forked from TanStack/router
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathreload-document.test.ts
More file actions
42 lines (35 loc) · 1.46 KB
/
reload-document.test.ts
File metadata and controls
42 lines (35 loc) · 1.46 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
import { expect, test } from '@playwright/test'
test('navigate() respects basepath for when reloadDocument=true', async ({
page,
}) => {
await page.goto(`/app/`)
await expect(page.getByTestId(`home-component`)).toBeInViewport()
const aboutBtn = page.getByTestId(`to-about-btn`)
await aboutBtn.click()
await page.waitForURL('/app/about')
await expect(page.getByTestId(`about-component`)).toBeInViewport()
const homeBtn = page.getByTestId(`to-home-btn`)
await homeBtn.click()
await page.waitForURL('/app/')
await expect(page.getByTestId(`home-component`)).toBeInViewport()
})
test('navigate() with href containing basepath', async ({ page }) => {
await page.goto(`/app/`)
await expect(page.getByTestId(`home-component`)).toBeInViewport()
const aboutBtn = page.getByTestId(`to-about-href-with-basepath-btn`)
await aboutBtn.click()
// Should navigate to /app/about, NOT /app/app/about
await page.waitForURL('/app/about')
await expect(page.getByTestId(`about-component`)).toBeInViewport()
})
test('navigate() with href containing basepath and reloadDocument=true', async ({
page,
}) => {
await page.goto(`/app/`)
await expect(page.getByTestId(`home-component`)).toBeInViewport()
const aboutBtn = page.getByTestId(`to-about-href-with-basepath-reload-btn`)
await aboutBtn.click()
// Should navigate to /app/about, NOT stay on current page
await page.waitForURL('/app/about')
await expect(page.getByTestId(`about-component`)).toBeInViewport()
})