Open History to see the last commit
1import { expect, test } from '@playwright/test'
2β
3test('solid-query transitions keep previous data during navigation', async ({
4 page,
5}) => {
6 await page.goto('/transition/count/query')
7β
8 await expect(page.getByTestId('n-value')).toContainText('n: 1')
9 await expect(page.getByTestId('double-value')).toContainText('double: 2')
10β
11 const bodySnapshots: Array<string> = []
12β
13 const interval = setInterval(async () => {
14 const text = await page
15 .locator('body')
16 .textContent()
17 .catch(() => '')
18 if (text) bodySnapshots.push(text)
19 }, 50)
20β
21 await page.getByTestId('increase-button').click()
22β
23 await page.waitForTimeout(200)
24β
25 clearInterval(interval)
26β
27 await expect(page.getByTestId('n-value')).toContainText('n: 2', {
28 timeout: 2_000,
29 })
30 await expect(page.getByTestId('double-value')).toContainText('double: 4', {
31 timeout: 2_000,
32 })
33β
34 const sawLoading = bodySnapshots.some((text) => text.includes('Loading...'))
35β
36 expect(sawLoading).toBeFalsy()
37})