fix(e2e): replace networkidle with domcontentloaded to fix flaky timeouts#823
Open
vdimarco wants to merge 1 commit into
Open
fix(e2e): replace networkidle with domcontentloaded to fix flaky timeouts#823vdimarco wants to merge 1 commit into
vdimarco wants to merge 1 commit into
Conversation
…outs
The E2E tests in chat-critical.spec.ts were failing intermittently due to
page.waitForLoadState('networkidle') timing out in CI environments. This
is a known Playwright issue where networkidle can hang if there are
background requests that never settle.
Changes:
- Replaced all waitForLoadState('networkidle') calls with 'domcontentloaded'
- Added 1000ms waitForTimeout after page load to allow dynamic content to render
- Added comments explaining the fix for future maintainers
This follows the same pattern already used in other tests (e.g.,
'chat page loads within reasonable time') that were previously fixed.
🤖 Generated with [Claude Code](https://claude.com/claude-code)
Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
|
The latest updates on your projects. Learn more about Vercel for GitHub.
|
|
You have reached your Codex usage limits for code reviews. You can see your limits in the Codex usage dashboard. |
3 tasks
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Fixes flaky E2E test timeouts in
chat-critical.spec.tsthat were causing CI failures.Problem
The E2E tests in
chat-critical.spec.tswere failing intermittently with errors like:This was happening because
page.waitForLoadState('networkidle')can hang indefinitely if there are background requests that never settle (analytics, websockets, long-polling, etc.). This is a known issue with Playwright'snetworkidlestate.Changes
waitForLoadState('networkidle')with'domcontentloaded'in chat-critical.spec.tswaitForTimeoutafter page load to allow dynamic content to renderWhy domcontentloaded?
domcontentloadedfires when the initial HTML document has been completely loaded and parsedTesting
🤖 Generated with Claude Code
Greptile Summary
Replaced all 15 instances of
waitForLoadState('networkidle')with'domcontentloaded'+ 1000ms timeout inchat-critical.spec.tsto fix flaky E2E test timeouts.Key changes:
networkidlecan hang indefinitely on background requests (analytics, websockets, long-polling)domcontentloadedevent which fires when the HTML document is parsedConfidence Score: 5/5
Important Files Changed
waitForLoadState('networkidle')with'domcontentloaded'+ 1000ms timeout to fix flaky test timeouts. Change is consistent with existing test patterns and addresses known Playwright issue.Sequence Diagram
sequenceDiagram participant Test as E2E Test participant Browser as Playwright Browser participant Page as Chat Page participant API as Backend APIs Test->>Browser: Navigate to /chat Browser->>Page: Load HTML document Page-->>Browser: HTML parsed (domcontentloaded) Note over Browser,Page: OLD: Wait for networkidle<br/>(can hang on background requests) Note over Browser,Page: NEW: Use domcontentloaded<br/>(fires when HTML parsed) Browser->>Test: domcontentloaded event fired Test->>Test: waitForTimeout(1000ms) Note over Test: Allow time for dynamic content<br/>to render (React hydration, etc.) par Background requests (may never settle) Page->>API: Analytics requests Page->>API: WebSocket connections Page->>API: Long-polling end Test->>Page: Continue with test assertions Page-->>Test: Test assertions pass Note over Test: Tests no longer hang<br/>waiting for network idle