Skip to content

Commit 6baffeb

Browse files
authored
test(solid-router): enhance transition test suite (#5753)
1 parent 811df9c commit 6baffeb

File tree

1 file changed

+53
-1
lines changed

1 file changed

+53
-1
lines changed

e2e/solid-router/basic-file-based/tests/transition.spec.ts

Lines changed: 53 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -18,11 +18,30 @@ test('transitions should keep old values visible during navigation', async ({
1818
if (text) bodyTexts.push(text)
1919
}, 50)
2020

21+
// 1 click
22+
2123
await page.getByTestId('increase-button').click()
2224

25+
await expect(page.getByTestId('n-value')).toContainText('n: 1', {
26+
timeout: 2_000,
27+
})
28+
await expect(page.getByTestId('double-value')).toContainText('double: 2', {
29+
timeout: 2_000,
30+
})
31+
2332
await page.waitForTimeout(200)
2433

25-
clearInterval(pollInterval)
34+
await expect(page.getByTestId('n-value')).toContainText('n: 2', {
35+
timeout: 2000,
36+
})
37+
await expect(page.getByTestId('double-value')).toContainText('double: 4', {
38+
timeout: 2000,
39+
})
40+
41+
// 2 clicks
42+
43+
await page.getByTestId('increase-button').click()
44+
await page.getByTestId('increase-button').click()
2645

2746
await expect(page.getByTestId('n-value')).toContainText('n: 2', {
2847
timeout: 2000,
@@ -31,6 +50,39 @@ test('transitions should keep old values visible during navigation', async ({
3150
timeout: 2000,
3251
})
3352

53+
await page.waitForTimeout(200)
54+
55+
await expect(page.getByTestId('n-value')).toContainText('n: 4', {
56+
timeout: 2000,
57+
})
58+
await expect(page.getByTestId('double-value')).toContainText('double: 8', {
59+
timeout: 2000,
60+
})
61+
62+
// 3 clicks
63+
64+
await page.getByTestId('increase-button').click()
65+
await page.getByTestId('increase-button').click()
66+
await page.getByTestId('increase-button').click()
67+
68+
await expect(page.getByTestId('n-value')).toContainText('n: 4', {
69+
timeout: 2000,
70+
})
71+
await expect(page.getByTestId('double-value')).toContainText('double: 8', {
72+
timeout: 2000,
73+
})
74+
75+
await page.waitForTimeout(200)
76+
77+
await expect(page.getByTestId('n-value')).toContainText('n: 7', {
78+
timeout: 2000,
79+
})
80+
await expect(page.getByTestId('double-value')).toContainText('double: 14', {
81+
timeout: 2000,
82+
})
83+
84+
clearInterval(pollInterval)
85+
3486
// With proper transitions, old values should remain visible until new ones arrive
3587
const hasLoadingText = bodyTexts.some((text) => text.includes('Loading...'))
3688

0 commit comments

Comments
 (0)