Repository navigation
test(web): keep request interception on while hero clips load - #5085
tale-code-bot wants to merge 1 commit into
Conversation
The real product hero playback test failed two release-candidate validations (#4996). gotoClientPage removes its catch-all route just as hydration requests the in-view clip, and removing a page's last route switches Playwright's request interception off. playwright-core 1.58.2 marks interception off (crNetworkManager.ts:151) before Chromium receives Fetch.disable (:165). A clip request that starts in between either stays paused with nothing to continue it, so the video stays at readyState 0 until the 20 s playback poll times out, or loses its request event, so the test sees no clip request. A route on clip requests for the whole real-playback describe keeps interception on, so gotoClientPage never removes the page's last route while a clip loads. Routes a test adds later still run first. expectPlaying now waits in the page for the playing or timeupdate event with a 30 s deadline, and a clip that never starts fails with its media state instead of a bare poll timeout. Test-only change: nothing user-visible, so no docs or translations.
tale-review-bot
left a comment
There was a problem hiding this comment.
Approved at 89d571cc281f4c6449f11ae6de934f6423c1e5f7.
What I checked
- Diff, read in full (
services/web/tests/e2e/specs/product-motion.spec.ts, test-only):- Fallback route. A
beforeEachregisterspage.route(mediaRequest, route => route.fallback())for the real-playback describe. Request interception stays on, sogotoClientPagenever removes the page's last route while a clip loads. - Safe for other routes. Routes a test adds later still run first. The clip requests the test asserts on come from
page.on('request'), so the route hides none of them. - Playback wait.
expectPlayingnow waits in the page forplaying/timeupdate, captured on the figure because media events don't bubble. It checks once immediately and has a 30 s deadline that rejects with the media state. The@tale/e2etest timeout is 180 s, so that deadline can fire and report. - Test strength. It keeps all its assertions: a single
<video>, actual playback,currentTimeadvancing, and the asserted requests.
- Fallback route. A
- Repeat runs: I staged and read the Coder's logs.
contrast-main-r20-w2.clean.log(spec as onmain, 20 repeats × 4 cases): 67 passed, 13 failed, exit 1.fix-r20-w2.clean.log(this head): 80 passed, exit 0.
- Contract:
test(web)commit, commitlint-shaped title,Closes #4996, no user-visible change. - CI on this head: all seven
CI readychecks pass. Runs: Checks 40919302213, SAST 40919302364, Commitlint 40919302211, Security 40919302311, E2E 40919302844, Build 40919302589, CLI 40919302624.
Not run by me: the spec itself. This sandbox has no Chromium, and on PRs Playwright (web) is skipped; it runs only in the merge queue, which gates this merge.
Note: the root-cause trace is for playwright-core 1.58.2. #5076, the 1.62.1 bump, is queued too. The fallback route is harmless under either version.
|
Not landing yet. The green
|
|
Reopened so the checks run again. The 20:13–20:15 UTC reopen started its runs from a test merge into |
|
Landed on |
Summary
This fixes the flaky E2E test real product hero playback ›
<locale>uses only its responsive product clips at<width>px(services/web/tests/e2e/specs/product-motion.spec.ts), which failed two release-candidate validations.expectPlayingwaits on a media event with a 30 s deadline, and its failure message carries the media state.Closes #4996. Board task: TALE-206 (Development).
Diagnosis
CI traces had expired. Runs 38585257407 and 38700307158 keep only their receipt artifacts; the
playwright-report-web-attempt-Nreports are past their 14-day retention. I read the job logs instead (jobs 115925522218 and 116308271941). Line numbers are those of9be5cadac:expectPlaying(:71via:336), aftertoHaveCount(1)had passed.de … at 1440pxin 38700307158 failed after 2.7 s at:346, with 0 requests.Local reproduction. On unmodified
main9be5cadac, with--repeat-each=5and 2 workers, 3 of 30 runs failed, all at the:71poll.Instrumented run. It logged CDP
Network.*events, pagerequestevents and the media element's state on failure. In both stalls:gotoClientPagereturned;paused:false, readyState:0, networkState:2, error:null.Cause
gotoClientPage(tests/e2e/helpers/client-page.ts) routes**/*for the document. It removes that route after the client commit, just as hydration requests the in-view clip. Removing a page's last route switches request interception off.In playwright-core 1.58.2 (
server/chromium/crNetworkManager.ts,_updateProtocolRequestInterception), the flag goes false (:151) before Chromium receivesFetch.disable(:165). A request that starts in between is lost in one of two ways:requestWillBeSent(:274). That event arrives after the flag has flipped, so it is handled as not intercepted (:205-206). Nothing ever continues the paused request, and the video stays atreadyState0 until the poll times out.requestWillBeSentarrives first and is parked to wait for a pause (:203) that never comes. Norequestevent fires even though the clip plays, sorequests.lengthis 0.Change (one file:
product-motion.spec.ts)A route for the whole describe.
test.describe('real product hero playback')gets abeforeEachthat routes clip requests (mediaRequest) toroute.fallback()::149-150return early).:159), so no clip can come from cache.expectPlayingwaits on events. AftertoHaveCount(1), it listens on the figure forplayingandtimeupdatein the capture phase. It resolves once the same condition as before holds:!paused,readyState >= 2andvideoWidth > 0.currentSrc,paused,readyState,networkStateand the media error code.data-product-motion-state="playing"check after it are unchanged.Every assertion stays. Each locale's hero plays only its own responsive WebM, without controls, inside its figure, at 320 and 1440 px. Nothing is skipped, quarantined or loosened.
Open for the reviewer
gotoClientPagehas the same window for any request that starts at client commit, and 12 specs use it. Only this describe loads an in-view clip with motion on through it. A fix in the helper would change interception and caching for all 12 specs, so it is left out of this PR. It could be a follow-up issue.gotoClientPage: motion preference, visibility and viewport. It keeps the HTTP cache off for every test in the describe.Checklist
Tick each box or mark N/A with a short reason. Empty boxes block review.
bun run checkpasses (format, lint, typecheck, all tests). Not run in full.89d571cc2, all with exit 0:bunx oxfmt --check;bun run lint:conflicts;bun run --filter @tale/web lint;bun run --filter @tale/web typecheck;bun run --filter @tale/web test(47 files, 1913 tests).bun run lint:linkspassed (exit 0) on the content before thevideo→cliprename described under Test plan.uvx ruff format --check: it would install a tool from outside the lock files;bun run lint:sastpasses (Opengrep). Not run: this worker has no Opengrep. The SAST check in this PR's CI runs it.README.md/README.de.md/README.fr.md: N/A. Test-only change.Test plan
Setup.
services/web, against the prebuilt client:E2E_USE_BUILD=1, vite preview on :3001.PLAYWRIGHT_BROWSERS_PATH.Command A, run before and after the change:
Results.
main9be5cadac:71via:336): de 1440 ×4, de 320 ×2, fr 1440 ×4, fr 320 ×3.--workers=2(29 tests)main's copy of the spec, fail with the same errors.-g "real product hero playback"89d571cc2Why the 13 tests fail here. They need what this worker lacks:
DEMUXER_ERROR_NO_SUPPORTED_STREAMS;<video>.What ran on what. The two Command A runs and the whole-spec run used the change before two later edits:
no-shadowrule asked to rename the in-pagevideotoclip;The PR head differs from the tested content only by those two edits. The describe run and the gates ran on the head.
Not run:
Playwright (web)job;The merge queue's E2E runs this spec on Chromium 145. Note that a green
Playwright (web)job can still hold a failure that passed on retry: look for a Playwright diagnostics notice that names this test.