-
-
Notifications
You must be signed in to change notification settings - Fork 1.8k
Expand file tree
/
Copy pathstreaming.spec.ts
More file actions
51 lines (41 loc) 路 1.67 KB
/
Copy pathstreaming.spec.ts
File metadata and controls
51 lines (41 loc) 路 1.67 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
43
44
45
46
47
48
49
50
51
import { expect } from '@playwright/test'
import { test } from '@tanstack/router-e2e-utils'
test('Navigating to deferred route', async ({ page }) => {
await page.goto('/')
await page.getByRole('link', { name: 'Deferred' }).click()
await expect(page.getByTestId('regular-person')).toContainText('John Doe')
await expect(page.getByTestId('deferred-person')).toContainText(
'Tanner Linsley',
)
await expect(page.getByTestId('deferred-stuff')).toContainText(
'Hello deferred!',
)
})
test('Directly visiting the deferred route', async ({ page }) => {
await page.goto('/deferred')
await expect(page.getByTestId('regular-person')).toContainText('John Doe')
await expect(page.getByTestId('deferred-person')).toContainText(
'Tanner Linsley',
)
await expect(page.getByTestId('deferred-stuff')).toContainText(
'Hello deferred!',
)
})
test('deferred route streams boundaries independently', async ({ page }) => {
await page.goto('/deferred', { waitUntil: 'commit' })
await expect(page.getByTestId('regular-person')).toContainText('John Doe')
await expect(page.getByText('Loading person...')).toBeVisible()
await expect(page.getByText('Loading stuff...')).toBeVisible()
await expect(page.getByTestId('deferred-person')).toContainText(
'Tanner Linsley',
)
await expect(page.getByText('Loading stuff...')).toBeVisible()
await expect(page.getByTestId('deferred-stuff')).toContainText(
'Hello deferred!',
)
})
test('streaming loader data', async ({ page }) => {
await page.goto('/stream')
await expect(page.getByTestId('promise-data')).toContainText('promise-data')
await expect(page.getByTestId('stream-data')).toContainText('stream-data')
})