Open History to see the last commit
1import { expect, test } from '@playwright/test'
2β
3test.beforeEach(async ({ page }) => {
4 await page.goto('/')
5})
6β
7test('Navigating to a post page', async ({ page }) => {
8 await page.getByRole('link', { name: 'Posts' }).click()
9 await page.getByRole('link', { name: 'sunt aut facere repe' }).click()
10 await expect(page.getByRole('heading')).toContainText('sunt aut facere')
11})
12β
13test('Navigating nested layouts', async ({ page }) => {
14 await page.getByRole('link', { name: 'Layout', exact: true }).click()
15β
16 await expect(page.locator('#app')).toContainText("I'm a layout")
17 await expect(page.locator('#app')).toContainText("I'm a nested layout")
18β
19 await page.getByRole('link', { name: 'Layout A' }).click()
20 await expect(page.locator('#app')).toContainText("I'm layout A!")
21β
22 await page.getByRole('link', { name: 'Layout B' }).click()
23 await expect(page.locator('#app')).toContainText("I'm layout B!")
24})
25β
26test('Navigating to a not-found route', async ({ page }) => {
27 await page.getByRole('link', { name: 'This Route Does Not Exist' }).click()
28 await expect(page.getByRole('paragraph')).toContainText(
29 'This is the notFoundComponent configured on root route',
30 )
31 await page.getByRole('link', { name: 'Start Over' }).click()
32 await expect(page.getByRole('heading')).toContainText('Welcome Home!')
33})