Skip to content
Source
Sign inSign up
TanStack/router
Open History to see the last commit

app.spec.ts

33 lines972 Bytes

1import { expect, test } from '@playwright/test'
2​
3const routeTestId = 'selected-route-label'
4​
5test('resolves to the latest version on load of a project like "/router"', async ({
6 page,
7}) => {
8 await page.goto('/router')
9​
10 await expect(page.getByTestId(routeTestId)).toContainText('/router/latest')
11})
12​
13test('resolves to the overview docs page', async ({ page }) => {
14 await page.goto('/router/latest/docs')
15​
16 await expect(page.getByTestId(routeTestId)).toContainText(
17 '/router/latest/docs/framework/react/overview',
18 )
19})
20​
21test('clicking on Documentation link navigates to the overview docs page', async ({
22 page,
23}) => {
24 await page.goto('/router')
25 await page.waitForLoadState('networkidle')
26​
27 const documentationLink = page.getByLabel('Documentation')
28 await documentationLink.click()
29 await page.waitForLoadState('networkidle')
30​
31 const pathname = new URL(page.url()).pathname
32 expect(pathname).toBe('/router/latest/docs/framework/react/overview')
33})