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

mask.spec.ts

27 lines818 Bytes

1import { expect } from '@playwright/test'
2import { apiTest as test } from '@tanstack/router-e2e-utils'
3​
4test('route masks transform params and expose masked pathname in the browser (solid)', async ({
5 page,
6}) => {
7 await page.goto('/')
8​
9 await page.getByTestId('link-to-masks').click()
10 await expect(page.getByText('Route Masks')).toBeVisible()
11​
12 const link = page.getByTestId('link-to-admin-mask')
13 await link.click()
14​
15 await page.waitForURL('/masks/public/user-42')
16​
17 await expect(page.getByTestId('admin-user-component')).toBeInViewport()
18 await expect(page.getByTestId('admin-user-id')).toHaveText('42')
19​
20 await expect(page.getByTestId('router-pathname')).toHaveText(
21 '/masks/admin/42',
22 )
23​
24 await expect(page.getByTestId('router-masked-pathname')).toHaveText(
25 '/masks/public/user-42',
26 )
27})