Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
54 changes: 53 additions & 1 deletion e2e/solid-router/basic-file-based/tests/transition.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -18,11 +18,30 @@ test('transitions should keep old values visible during navigation', async ({
if (text) bodyTexts.push(text)
}, 50)

// 1 click

await page.getByTestId('increase-button').click()

await expect(page.getByTestId('n-value')).toContainText('n: 1', {
timeout: 2_000,
})
await expect(page.getByTestId('double-value')).toContainText('double: 2', {
timeout: 2_000,
})

await page.waitForTimeout(200)

clearInterval(pollInterval)
await expect(page.getByTestId('n-value')).toContainText('n: 2', {
timeout: 2000,
})
await expect(page.getByTestId('double-value')).toContainText('double: 4', {
timeout: 2000,
})

// 2 clicks

await page.getByTestId('increase-button').click()
await page.getByTestId('increase-button').click()

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

await page.waitForTimeout(200)

await expect(page.getByTestId('n-value')).toContainText('n: 4', {
timeout: 2000,
})
await expect(page.getByTestId('double-value')).toContainText('double: 8', {
timeout: 2000,
})

// 3 clicks

await page.getByTestId('increase-button').click()
await page.getByTestId('increase-button').click()
await page.getByTestId('increase-button').click()

await expect(page.getByTestId('n-value')).toContainText('n: 4', {
timeout: 2000,
})
await expect(page.getByTestId('double-value')).toContainText('double: 8', {
timeout: 2000,
})

await page.waitForTimeout(200)

await expect(page.getByTestId('n-value')).toContainText('n: 7', {
timeout: 2000,
})
await expect(page.getByTestId('double-value')).toContainText('double: 14', {
timeout: 2000,
})

clearInterval(pollInterval)

// With proper transitions, old values should remain visible until new ones arrive
const hasLoadingText = bodyTexts.some((text) => text.includes('Loading...'))

Expand Down
Loading