next.js
2fbeebba - Wait for back-before-hydration recoveries in the browser (#97321)

Commit
26 days ago
Wait for back-before-hydration recoveries in the browser (#97321) The `back-before-hydration` assertions read the heading with `browser.elementByCss`, which waits for the load event before it returns. Here the load event cannot fire until the stalled scripts are released and finish running, and that is the whole window the test is about. So the first attempt inside `retry` blocks for almost the entire 3s budget, looks at the DOM once, and then `retry` refuses a second look because `waited + interval > duration`. This waits in the browser instead, with the load event out of the picture. Every page already has its own heading id, except the two search pages, which shared one; they get a per-page id too. Then a single `waitForSelector` resolves the moment that page commits, and the URL assertion follows the wait rather than racing alongside it. The assertions that check content *stayed* put keep polling with `retry`, since a change there is the failure. Holding the flight response for 1800ms and throttling the renderer 8x reproduces the CI failure exactly on canary — same `Failed to retry within 3000ms`, same expected "Home" / received "Post" — and passes with this change; the suite is still 16/16 with the response held for 6s. Test-only. Co-authored-by: Claude Fable 5 <noreply@anthropic.com>
Author
Parents
Loading