-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #32 from fac28/tests
Tests
- Loading branch information
Showing
6 changed files
with
34 additions
and
27 deletions.
There are no files selected for viewing
This file was deleted.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,25 @@ | ||
import { test, expect } from '@playwright/test' | ||
|
||
test('should navigate to the listings page', async ({ page }) => { | ||
// Start from the index page (the baseURL is set via the webServer in the playwright.config.ts) | ||
await page.goto('http://localhost:3000/') | ||
// Find an element with the text 'About Page' and click on it | ||
await page.click('text=See the collection') | ||
// The new URL should be "/about" (baseURL is used there) | ||
await expect(page).toHaveURL('http://localhost:3000/listings') | ||
// The new page should contain an h1 with "Art Vandelay" | ||
await expect(page.locator('h1')).toContainText('Art Vandelay') | ||
}) | ||
|
||
test('should navigate to the first product page', async ({ page }) => { | ||
await page.goto('http://localhost:3000/listings') | ||
await page.click('img') | ||
await expect(page).toHaveURL('http://localhost:3000/listings/1') | ||
await expect(page.locator('h2')).toContainText('The Night Watch') | ||
}) | ||
|
||
test('header should navigate to the hoome page', async ({ page }) => { | ||
await page.goto('http://localhost:3000/listings/1') | ||
await page.click('h1') | ||
await expect(page).toHaveURL('http://localhost:3000') | ||
}) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Empty file.