test(solid-router): enhance transition test suite #5753
main fromrefs/pull/5753/head·merged by birkskyum(GitHub profile, opens in a new tab) Summary by CodeRabbit#
- Tests
- Enhanced end-to-end tests with step-by-step assertions covering 1, 2, and 3 interaction sequences to validate intermediate and final state updates.
- Extended timing and polling validations to better capture transient states and added a final cleanup of polling.
- Added descriptive comments to clarify test sections and intent.
- 1
View your CI Pipeline Execution ↗ for commit ae98aded743a9e55f3c7c3d48839035745d5829e
Command Status Duration Result nx affected --targets=test:eslint,test:unit,tes...✅ Succeeded 4m 9s View ↗ nx run-many --target=build --exclude=examples/*...✅ Succeeded 2s View ↗
☁️ Nx Cloud last updated this comment at
2025-11-04 15:15:11UTCMore templates
- tanstack-router-solid-example-basic
- tanstack-router-solid-example-basic-devtools-panel
- tanstack-router-solid-example-basic-file-based
- tanstack-router-solid-example-basic-non-nested-devtools
- tanstack-router-solid-example-basic-solid-query
- tanstack-router-solid-example-basic-solid-query-file-based
- tanstack-router-solid-example-basic-ssr-streaming-file-based
- tanstack-router-solid-example-kitchen-sink-file-based
- tanstack-router-solid-example-kitchen-sink-solid-query
- tanstack-router-solid-example-kitchen-sink-solid-query-file-based
- tanstack-router-solid-example-quickstart-file-based
- tanstack-solid-start-example-bare
- tanstack-solid-start-example-basic
- tanstack-solid-start-example-basic-auth
- tanstack-solid-start-example-basic-cloudflare
- tanstack-solid-start-example-basic-netlify
- tanstack-solid-start-example-basic-nitro
- tanstack-start-example-basic-solid-query
- tanstack-solid-start-example-basic-static
- tanstack-solid-start-example-basic-supabase
- tanstack-router-react-example-authenticated-routes
- tanstack-router-react-example-authenticated-routes-firebase
- tanstack-router-react-example-basic
- tanstack-router-react-example-basic-default-search-params
- tanstack-router-react-example-basic-devtools-panel
- tanstack-router-react-example-basic-file-based
- tanstack-router-react-example-basic-non-nested-devtools
- tanstack-router-react-example-react-query
- tanstack-router-react-example-basic-react-query-file-based
- tanstack-router-react-example-basic-ssr-file-based
- tanstack-router-react-example-basic-ssr-streaming-file-based
- tanstack-router-react-example-basic-virtual-file-based
- tanstack-router-react-example-basic-virtual-inside-file-based
- tanstack-router-react-example-deferred-data
- tanstack-router-i18n-paraglide
- tanstack-router-react-example-kitchen-sink
- tanstack-router-react-example-kitchen-sink-file-based
- tanstack-router-react-example-kitchen-sink-react-query
- tanstack-router-react-example-kitchen-sink-react-query-file-based
- tanstack-router-react-example-large-file-based
- tanstack-router-react-example-location-masking
- tanstack-router-react-example-navigation-blocking
- tanstack-router-react-example-quickstart
- tanstack-router-react-example-quickstart-esbuild-file-based
- tanstack-router-react-example-quickstart-file-based
- tanstack-router-react-example-quickstart-rspack-file-based
- tanstack-router-react-example-quickstart-webpack-file-based
- router-monorepo-react-query
- router-mono-simple
- router-mono-simple-lazy
- tanstack-router-react-example-scroll-restoration
- tanstack-search-validator-adapters
- tanstack-start-example-bare
- tanstack-start-example-basic
- tanstack-start-example-basic-auth
- tanstack-start-example-basic-cloudflare
- tanstack-start-example-basic-react-query
- tanstack-start-example-basic-static
- tanstack-start-bun-hosting
- tanstack-start-example-clerk-basic
- tanstack-start-example-convex-trellaux
- tanstack-start-example-counter
- tanstack-start-i18n-paraglide
- tanstack-start-example-large
- tanstack-start-example-material-ui
- tanstack-start-streaming-data-from-server-functions
- tanstack-start-example-supabase-basic
- tanstack-start-tailwind-v4
- tanstack-start-example-trellaux
- tanstack-start-example-workos
- tanstack-router-react-example-view-transitions
- tanstack-router-react-example-with-framer-motion
- tanstack-router-react-example-with-trpc
- tanstack-router-react-example-with-trpc-react-query
@tanstack/arktype-adapter
npm i https://pkg.pr.new/TanStack/router/@tanstack/arktype-adapter@5753@tanstack/directive-functions-plugin
npm i https://pkg.pr.new/TanStack/router/@tanstack/directive-functions-plugin@5753@tanstack/eslint-plugin-router
npm i https://pkg.pr.new/TanStack/router/@tanstack/eslint-plugin-router@5753@tanstack/history
npm i https://pkg.pr.new/TanStack/router/@tanstack/history@5753@tanstack/nitro-v2-vite-plugin
npm i https://pkg.pr.new/TanStack/router/@tanstack/nitro-v2-vite-plugin@5753@tanstack/react-router
npm i https://pkg.pr.new/TanStack/router/@tanstack/react-router@5753@tanstack/react-router-devtools
npm i https://pkg.pr.new/TanStack/router/@tanstack/react-router-devtools@5753@tanstack/react-router-ssr-query
npm i https://pkg.pr.new/TanStack/router/@tanstack/react-router-ssr-query@5753@tanstack/react-start
npm i https://pkg.pr.new/TanStack/router/@tanstack/react-start@5753@tanstack/react-start-client
npm i https://pkg.pr.new/TanStack/router/@tanstack/react-start-client@5753@tanstack/react-start-server
npm i https://pkg.pr.new/TanStack/router/@tanstack/react-start-server@5753@tanstack/router-cli
npm i https://pkg.pr.new/TanStack/router/@tanstack/router-cli@5753@tanstack/router-core
npm i https://pkg.pr.new/TanStack/router/@tanstack/router-core@5753@tanstack/router-devtools
npm i https://pkg.pr.new/TanStack/router/@tanstack/router-devtools@5753@tanstack/router-devtools-core
npm i https://pkg.pr.new/TanStack/router/@tanstack/router-devtools-core@5753@tanstack/router-generator
npm i https://pkg.pr.new/TanStack/router/@tanstack/router-generator@5753@tanstack/router-plugin
npm i https://pkg.pr.new/TanStack/router/@tanstack/router-plugin@5753@tanstack/router-ssr-query-core
npm i https://pkg.pr.new/TanStack/router/@tanstack/router-ssr-query-core@5753@tanstack/router-utils
npm i https://pkg.pr.new/TanStack/router/@tanstack/router-utils@5753@tanstack/router-vite-plugin
npm i https://pkg.pr.new/TanStack/router/@tanstack/router-vite-plugin@5753@tanstack/server-functions-plugin
npm i https://pkg.pr.new/TanStack/router/@tanstack/server-functions-plugin@5753@tanstack/solid-router
npm i https://pkg.pr.new/TanStack/router/@tanstack/solid-router@5753@tanstack/solid-router-devtools
npm i https://pkg.pr.new/TanStack/router/@tanstack/solid-router-devtools@5753@tanstack/solid-router-ssr-query
npm i https://pkg.pr.new/TanStack/router/@tanstack/solid-router-ssr-query@5753@tanstack/solid-start
npm i https://pkg.pr.new/TanStack/router/@tanstack/solid-start@5753@tanstack/solid-start-client
npm i https://pkg.pr.new/TanStack/router/@tanstack/solid-start-client@5753@tanstack/solid-start-server
npm i https://pkg.pr.new/TanStack/router/@tanstack/solid-start-server@5753@tanstack/start-client-core
npm i https://pkg.pr.new/TanStack/router/@tanstack/start-client-core@5753@tanstack/start-plugin-core
npm i https://pkg.pr.new/TanStack/router/@tanstack/start-plugin-core@5753@tanstack/start-server-core
npm i https://pkg.pr.new/TanStack/router/@tanstack/start-server-core@5753@tanstack/start-static-server-functions
npm i https://pkg.pr.new/TanStack/router/@tanstack/start-static-server-functions@5753@tanstack/start-storage-context
npm i https://pkg.pr.new/TanStack/router/@tanstack/start-storage-context@5753@tanstack/valibot-adapter
npm i https://pkg.pr.new/TanStack/router/@tanstack/valibot-adapter@5753@tanstack/virtual-file-routes
npm i https://pkg.pr.new/TanStack/router/@tanstack/virtual-file-routes@5753@tanstack/zod-adapter
npm i https://pkg.pr.new/TanStack/router/@tanstack/zod-adapter@5753commit:
ae98adeActionable comments posted: 1
🧹 Nitpick comments (1)
e2e/solid-router/basic-file-based/tests/transition.spec.ts (1)
26-26: Optional: Use consistent timeout format.Lines 26 and 29 use
2_000for the timeout, while other assertions in the file use2000. Consider using a consistent format throughout for readability.Also applies to: 29-29
📜 Review details
Configuration used: CodeRabbit UI
Review profile: CHILL
Plan: Pro
📥 Commits
Reviewing files that changed from the base of the PR and between 811df9c97c82bf8b35e2d426ee22aea6bd154f04 and f6da91d5fb6ae2177cb6bb1f7170cc871ae648c4.
📒 Files selected for processing (1)
e2e/solid-router/basic-file-based/tests/transition.spec.ts(2 hunks)
🧰 Additional context used
📓 Path-based instructions (2)
**/*.{ts,tsx}
📄 CodeRabbit inference engine (AGENTS.md)
Use TypeScript in strict mode with extensive type safety across the codebase
Files:
e2e/solid-router/basic-file-based/tests/transition.spec.ts
e2e/**
📄 CodeRabbit inference engine (AGENTS.md)
Store end-to-end tests under the e2e/ directory
Files:
e2e/solid-router/basic-file-based/tests/transition.spec.ts
🧠 Learnings (2)
📓 Common learnings
Learnt from: nlynzaad Repo: TanStack/router PR: 5402 File: packages/router-generator/tests/generator/no-formatted-route-tree/routeTree.nonnested.snapshot.ts:19-21 Timestamp: 2025-10-08T08:11:47.088Z Learning: Test snapshot files in the router-generator tests directory (e.g., files matching the pattern `packages/router-generator/tests/generator/**/routeTree*.snapshot.ts` or `routeTree*.snapshot.js`) should not be modified or have issues flagged, as they are fixtures used to verify the generator's output and are intentionally preserved as-is.Learnt from: FatahChan Repo: TanStack/router PR: 5475 File: e2e/react-start/basic-prerendering/src/routes/redirect/$target/via-beforeLoad.tsx:8-0 Timestamp: 2025-10-14T18:59:33.990Z Learning: In TanStack Router e2e test files, when a route parameter is validated at the route level (e.g., using zod in validateSearch or param validation), switch statements on that parameter do not require a default case, as the validation ensures only expected values will reach the switch.📚 Learning: 2025-10-08T08:11:47.088Z
Learnt from: nlynzaad Repo: TanStack/router PR: 5402 File: packages/router-generator/tests/generator/no-formatted-route-tree/routeTree.nonnested.snapshot.ts:19-21 Timestamp: 2025-10-08T08:11:47.088Z Learning: Test snapshot files in the router-generator tests directory (e.g., files matching the pattern `packages/router-generator/tests/generator/**/routeTree*.snapshot.ts` or `routeTree*.snapshot.js`) should not be modified or have issues flagged, as they are fixtures used to verify the generator's output and are intentionally preserved as-is.Applied to files:
e2e/solid-router/basic-file-based/tests/transition.spec.ts
⏰ Context from checks skipped due to timeout of 90000ms. You can increase the timeout in your CodeRabbit configuration to a maximum of 15 minutes (900000ms). (1)
- GitHub Check: Test
e2e/solid-router/basic-file-based/tests/transition.spec.ts line 34OutdatedResolvedby coderabbitai[bot](GitHub profile, opens in a new tab)@@ -18,8 +18,17 @@1818 if (text) bodyTexts.push(text)1919 }, 50)202021+ // 1 click22+2123 await page.getByTestId('increase-button').click()222425+ 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)24332534 clearInterval(pollInterval)⚠️ Potential issue | 🔴 Critical
Critical: Multiple
clearIntervalcalls break the test's monitoring logic.The
pollIntervalis set up once (line 13) but cleared three times (lines 34, 57, 81). After the firstclearIntervalat line 34, the interval stops capturing body text. The subsequentclearIntervalcalls are no-ops, and thebodyTextsarray stops being populated. This means the final check at line 91 only verifies the first click sequence—the 2-click and 3-click sequences are not monitored for "Loading..." text, undermining the test's purpose.Apply this diff to fix the monitoring logic:
await page.waitForTimeout(200) - clearInterval(pollInterval) - await expect(page.getByTestId('n-value')).toContainText('n: 2', { timeout: 2000, })await page.waitForTimeout(200) - clearInterval(pollInterval) - await expect(page.getByTestId('n-value')).toContainText('n: 4', { timeout: 2000, })await page.waitForTimeout(200) - clearInterval(pollInterval) - 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...'))Also applies to: 57-57, 81-81
🤖 Prompt for AI Agents
In e2e/solid-router/basic-file-based/tests/transition.spec.ts around lines 34, 57 and 81, the test currently calls clearInterval(pollInterval) three times which stops the single monitoring interval after the first call and prevents bodyTexts from being populated for the 2-click and 3-click sequences; remove the extra clearInterval calls at lines 57 and 81 (keep a single clearInterval for pollInterval) and move or ensure the remaining clearInterval is executed only once after all click sequences are complete (e.g., after the final assertions near line 91) so the polling runs for the entire test duration and bodyTexts captures every sequence.✅ Addressed in commit 3461780
Actionable comments posted: 0
🧹 Nitpick comments (1)
e2e/solid-router/basic-file-based/tests/transition.spec.ts (1)
26-81: Standardize timeout format for consistency.The timeout values use inconsistent numeric formatting:
2_000(lines 26, 29) vs2000(lines 35, 38, 47, 50, 56, 59, 69, 72, 78, 81). While functionally equivalent, standardizing on one format improves readability.Apply this diff to use consistent formatting:
- 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 expect(page.getByTestId('n-value')).toContainText('n: 1', { + timeout: 2000, + }) + await expect(page.getByTestId('double-value')).toContainText('double: 2', { + timeout: 2000, + })📜 Review details
Configuration used: CodeRabbit UI
Review profile: CHILL
Plan: Pro
📥 Commits
Reviewing files that changed from the base of the PR and between f6da91d5fb6ae2177cb6bb1f7170cc871ae648c4 and ae98aded743a9e55f3c7c3d48839035745d5829e.
📒 Files selected for processing (1)
e2e/solid-router/basic-file-based/tests/transition.spec.ts(2 hunks)
🧰 Additional context used
📓 Path-based instructions (2)
**/*.{ts,tsx}
📄 CodeRabbit inference engine (AGENTS.md)
Use TypeScript in strict mode with extensive type safety across the codebase
Files:
e2e/solid-router/basic-file-based/tests/transition.spec.ts
e2e/**
📄 CodeRabbit inference engine (AGENTS.md)
Store end-to-end tests under the e2e/ directory
Files:
e2e/solid-router/basic-file-based/tests/transition.spec.ts
🧠 Learnings (1)
📓 Common learnings
Learnt from: nlynzaad Repo: TanStack/router PR: 5402 File: packages/router-generator/tests/generator/no-formatted-route-tree/routeTree.nonnested.snapshot.ts:19-21 Timestamp: 2025-10-08T08:11:47.088Z Learning: Test snapshot files in the router-generator tests directory (e.g., files matching the pattern `packages/router-generator/tests/generator/**/routeTree*.snapshot.ts` or `routeTree*.snapshot.js`) should not be modified or have issues flagged, as they are fixtures used to verify the generator's output and are intentionally preserved as-is.⏰ Context from checks skipped due to timeout of 90000ms. You can increase the timeout in your CodeRabbit configuration to a maximum of 15 minutes (900000ms). (1)
- GitHub Check: Test
🔇 Additional comments (1)
e2e/solid-router/basic-file-based/tests/transition.spec.ts (1)
21-82: Excellent test enhancement with stepwise validation.The expanded test now thoroughly validates transition behavior across multiple click sequences. The pattern of asserting old values → waiting → asserting new values for each section (1, 2, and 3 clicks) provides comprehensive coverage of the transition mechanism. The single
clearIntervalat line 84 correctly allows polling throughout the entire test duration.birkskyum(GitHub profile, opens in a new tab) closed this
Sign in to join this conversation.
Walkthrough#
This PR expands the existing e2e transition test to add stepwise assertions after each increment, verifying intermediate n and double values across multiple click groups while preserving final assertions and loading-transition checks.
Changes#
e2e/solid-router/basic-file-based/tests/transition.spec.tsclearInterval(pollInterval)to extend polling coverage, inserts additional short waits and 2s timeouts for async checks, and retains final loading-transition validations.Sequence Diagram(s)#
(Skipped — changes are test assertions and do not introduce new runtime control-flow between components.)
Estimated code review effort#
🎯 2 (Simple) | ⏱️ ~10 minutes
clearInterval(pollInterval)still guarantees cleanup and doesn't leak timers.Possibly related PRs#
Suggested labels#
package: solid-routerSuggested reviewers#
Poem#
Pre-merge checks and finishing touches#
✅ Passed checks (2 passed)
✨ Finishing touches
🧪 Generate unit tests (beta)
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.
❤️ Share