Synchronize browser test request assertions

MO
2m ago
+51-37

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. A 30-second test timeout bounds the poll wait. Production code is unchanged.

Validation

  • With a controlled interception delay, the original poll test fails with 0 !== 1; the fixed test passes.
  • Temporarily removing the delivered-result guard still makes the fixed test fail.
  • The task-workspace file passes all 119 tests; both cached-interview cases pass.
  • Browser shard 3/3 passes 1,226 tests with no failures or skips locally.
  • The portable lane has five local failures: fetch-gate-note-tests, run-budget-tests, review-memory-tests, interactive-review-hook-tests and git-hooks. The failures include temporary-path differences, empty RSS samples, missing gh and 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 check request and join counts before async setup finished.

Both tests could assert on counts before the underlying async work 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. The tests now wait for the intercepted poll and the room-join observable before asserting, and the poll wait is bounded by a 30-second test timeout. Production code is unchanged.