From 3ddedbe28b5535e9970a305db13d6b3b3afe2039 Mon Sep 17 00:00:00 2001 From: Edwards Presume Date: Mon, 8 Jan 2024 17:31:45 -0500 Subject: [PATCH] Update home page test and remove basic test --- tests/e2e/homePage.test.ts | 24 +++++++++++++++--------- tests/unit/basic.test.ts | 7 ------- 2 files changed, 15 insertions(+), 16 deletions(-) delete mode 100644 tests/unit/basic.test.ts diff --git a/tests/e2e/homePage.test.ts b/tests/e2e/homePage.test.ts index 4b55eb8..a156a3b 100644 --- a/tests/e2e/homePage.test.ts +++ b/tests/e2e/homePage.test.ts @@ -1,19 +1,25 @@ import { expect, test } from '@playwright/test'; test.describe('Basic home page tests', () => { - test('verify page heading and toast message', async ({ page }) => { + test('Verify page headings and navigation', async ({ page }) => { // Navigate to the home page await page.goto('/'); - // Check if the heading 'Home page' is visible - const heading = page.getByRole('heading', { name: 'Home page' }); - await expect(heading).toBeVisible(); + // Check if the heading is visible + const homePageHeading = page.getByRole('heading', { + name: 'CaptionThat - Unleash Your Creativity' + }); + await expect(homePageHeading).toBeVisible(); - // Click the button that shows the toast - const showToastButton = page.getByRole('button', { name: 'Show toast' }); - await showToastButton.click(); + // Click the link that navigates to "/app" + const link = page.getByRole('link', { name: 'Try it out for free' }); + await link.first().click(); - // Verify the toast message 'Hello world' is displayed - await expect(page.locator('text=Hello world!')).toBeVisible(); + await page.waitForURL('/app'); + + const appPageHeading = page.getByRole('heading', { + name: 'Image Caption Creator' + }); + await expect(appPageHeading).toBeVisible(); }); }); diff --git a/tests/unit/basic.test.ts b/tests/unit/basic.test.ts deleted file mode 100644 index 4d84828..0000000 --- a/tests/unit/basic.test.ts +++ /dev/null @@ -1,7 +0,0 @@ -import { describe, expect, it } from 'vitest'; - -describe('tests', () => { - it('should works', () => { - expect(1 + 1).toEqual(2); - }); -});