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', exact: true }).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 pathless layouts', async ({ page }) => {
14 await page.getByRole('link', { name: 'Pathless Layout', exact: true }).click()
15β
16 await expect(page.locator('#app')).toContainText("I'm a pathless layout")
17 await expect(page.locator('#app')).toContainText(
18 "I'm a nested pathless layout",
19 )
20β
21 await page.getByRole('link', { name: 'Go to route A' }).click()
22 await expect(page.locator('#app')).toContainText("I'm layout A!")
23β
24 await page.getByRole('link', { name: 'Go to route B' }).click()
25 await expect(page.locator('#app')).toContainText("I'm layout B!")
26})
27β
28test('Navigating to a not-found route', async ({ page }) => {
29 await page.getByRole('link', { name: 'This Route Does Not Exist' }).click()
30 await expect(page.getByRole('paragraph')).toContainText(
31 'This is the notFoundComponent configured on root route',
32 )
33 await page.getByRole('link', { name: 'Start Over' }).click()
34 await expect(page.getByRole('heading')).toContainText('Welcome Home!')
35})