fix(tests): enhance reliability of homepage navigation test#278
fix(tests): enhance reliability of homepage navigation test#278
Conversation
Updated the homepage to quickstart navigation test to wait for the "Set sail" button to be visible instead of relying on the "networkidle" state. Added a timeout for the navigation verification to improve test reliability.
|
|
The latest updates on your projects. Learn more about Vercel for GitHub.
|
WalkthroughThe test file Changes
Estimated code review effort🎯 2 (Simple) | ⏱️ ~5 minutes
Suggested labels
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. Comment |
There was a problem hiding this comment.
Actionable comments posted: 0
🧹 Nitpick comments (2)
tooling/playwright-www/tests/docs-navigation.test.ts (2)
69-69: Consider removing redundant URL assertion.After
waitForURLsuccessfully resolves on Line 68, this assertion will always pass. While being explicit isn't harmful, you could streamline the test by removing this line since the URL match is already verified.Apply this diff if you prefer a more concise test:
// Wait for navigation to complete with timeout await page.waitForURL("**/docs/quickstart", { timeout: 30000 }); - await expect(page).toHaveURL("/docs/quickstart"); await expect(page.locator("body")).toBeVisible();
58-71: Consider applying this pattern to other navigation tests.Since
networkidleproved unreliable for this test (especially on webkit), you might want to audit other tests in this file that still usewaitForLoadState("networkidle")(lines 15, 33, 48, 78, 89, 95, 107, 130, 140) to see if they could benefit from similar explicit visibility/navigation checks.
📜 Review details
Configuration used: CodeRabbit UI
Review profile: CHILL
Plan: Pro
📒 Files selected for processing (1)
tooling/playwright-www/tests/docs-navigation.test.ts(1 hunks)
🧰 Additional context used
📓 Path-based instructions (1)
**/*.test.ts
📄 CodeRabbit inference engine (.github/copilot-instructions.md)
**/*.test.ts: Place tests alongside source files and use the .test.ts suffix (e.g., create-env.test.ts, types.test.ts, errors.test.ts, utils.test.ts)
Use Vitest's describe/it structure in tests
Test both success and failure cases for environment validation and utilities
Mock process.env to cover different environment scenarios in tests
In tests, save and restore process.env in setup/teardown (beforeEach/afterEach) to avoid leakage between cases
Verify both runtime behavior and TypeScript types in tests
Files:
tooling/playwright-www/tests/docs-navigation.test.ts
🧠 Learnings (1)
📓 Common learnings
Learnt from: CR
Repo: yamcodes/arkenv PR: 0
File: .github/copilot-instructions.md:0-0
Timestamp: 2025-09-12T06:23:45.463Z
Learning: Applies to **/*.test.ts : Verify both runtime behavior and TypeScript types in tests
⏰ 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). (2)
- GitHub Check: test-e2e (e2e)
- GitHub Check: test-e2e (a11y)
🔇 Additional comments (1)
tooling/playwright-www/tests/docs-navigation.test.ts (1)
60-68: LGTM! Good improvement to test reliability.Replacing the
networkidlewait with an explicit visibility check for the button and addingwaitForURLfor navigation verification is a solid approach. This makes the test more deterministic and browser-agnostic, particularly for webkit as noted in the comment.
Updated the homepage to quickstart navigation test to wait for the "Set sail" button to be visible instead of relying on the "networkidle" state. Added a timeout for the navigation verification to improve test reliability.
Summary by CodeRabbit