Repository navigation
Synchronize browser test request assertions - #789
Conversation
cb78c16 to
0f7a224
Compare
0f7a224 to
7f39f22
Compare
7f39f22 to
f006947
Compare
Disesfgewu
left a comment
There was a problem hiding this comment.
Checked out f006947 on macOS 26.6 arm64 with Node v24.21.0 and Playwright Chromium:
node --test tests/browser/task-workspace.test.js: 119 pass, 0 fail, 0 skippednode --test --test-name-pattern="cached .* interview preserves" tests/browser/strict-selection.test.js: 2 pass, 0 fail
The poll fix works for me. With the if (st.attempt === "done") return; guard after the fetch removed from pollReview, the test fails on /invalid/, so the late-answer half is covered. The two inline comments are about the end of the test: a held check that cannot fail, and a wait that is now redundant.
f006947 to
e6c5031
Compare
There was a problem hiding this comment.
All reported issues were addressed across 1 file (changes from recent commits).
Reply with feedback, questions, or to request a fix.
View guided diff | Re-trigger cubic
matthiola0
left a comment
There was a problem hiding this comment.
All three tests passed at e6c5031a and with the suggested edits. Windows 11, Node.js v22.23.1, Playwright 1.64.1 (Chromium).
node --test --test-name-pattern="a result poll still on its way|a cached (strict|practice) interview preserves" tests/browser/task-workspace.test.js tests/browser/strict-selection.test.js
alanhc
left a comment
There was a problem hiding this comment.
LGTM. I read e6c5031 against 7f39f22, and both browser files pass at this head, 194/194.
- With
runFor(5000), the closingheldcheck now catches a repeated poll. I removedstopAttemptTimers();fromrenderReviewandst.attempt === "done" ||frompollReview, as Disesfgewu did, and the test failed with2 !== 1in 3 of 3 runs. It passed 3 of 3 with the code unchanged. - That also answers the open cubic thread: the repeated request reaches the route before
heldis read, since the twotextContentreads come first. The check still depends on that ordering, so it is worth keeping in mind if the assertions move. - Dropping
answeredis fine.reviewPollingturns false only afterapi()returns, so thewaitForFunctioncovers the same point.
matthiola0's two suggestions would make failures clearer but do not change what is covered.
|
Some review comments on this pull request are not settled yet. Please refine the change per the review comments listed below, reply on each thread with what you changed or why you did not, and mark each thread resolved yourself once it is settled (Resolve conversation, at the bottom of the thread). The pull request stays blocked while review threads are open. Not addressed at the current head:
Checked at e6c5031. |
Fake time can advance before a review request reaches its route handler. An enabled Practice editor also precedes the asynchronous room join, so both regressions can check their counts before setup settles. Wait for the intercepted poll and first join before asserting counts. Bound the poll wait separately and check pending state after a full interval, keeping repeated-request checks independent of interception delivery. Retain result, editor, unload-warning and exact join counts. Change-Id: I69ad3f4fa4276c4fa950342ac97439208b2d8ff9
e6c5031 to
96d33f6
Compare
|
Thank @MorganHo001 for contributing! |
The result-poll regression can check its held-request count before Playwright dispatches the request to the route handler, as seen in this browser 3/3 run. The cached Practice test can also check its join count after the editor is enabled but before the room connection completes.
Wait for the intercepted poll and the existing room-join observable before checking pending results and cache restoration. Keep the count, result, editor and unload-warning assertions. The first intercepted poll has a separate five-second deadline. A 60-second outer test budget leaves room for Playwright's 30-second waits to report their own errors and run cleanup first. Production code is unchanged.
Validation
0 !== 1; the fixed test passes.96d33f60, both changed browser files pass all 194 tests locally. Browser shard 3/3 passes 1,229 tests with no failures or skips in an Ubuntu ARM64 VM.fetch-gate-note-tests,run-budget-tests,review-memory-tests,interactive-review-hook-testsandgit-hooks. The failures include temporary-path differences, empty RSS samples, missingghand a missing formatter. Optional ruff, shellcheck and actionlint are unavailable. Rust was not rerun for this test-only change.Summary by cubic
Fixes flaky browser tests that could assert request and join counts before async setup completed.
The result-poll test checked the held-request count before Playwright dispatched the request to the route handler, and the cached Practice test checked the join count before the room connection finished. Both tests now wait for the intercepted poll and the room-join observable before asserting; the poll wait has its own bound plus the 60-second test timeout and verifies pending state after a full interval while keeping repeated-request checks independent of interception delivery. Production code is unchanged.
Written for commit 96d33f6. Summary will update on new commits.