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