Skip to content

Commit

Permalink
Update home page test and remove basic test
Browse files Browse the repository at this point in the history
  • Loading branch information
edwardspresume committed Jan 8, 2024
1 parent 47869d4 commit 3ddedbe
Show file tree
Hide file tree
Showing 2 changed files with 15 additions and 16 deletions.
24 changes: 15 additions & 9 deletions tests/e2e/homePage.test.ts
Original file line number Diff line number Diff line change
@@ -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();
});
});
7 changes: 0 additions & 7 deletions tests/unit/basic.test.ts

This file was deleted.

0 comments on commit 3ddedbe

Please sign in to comment.