Skip to content

Flaky tests: fix router navigate latest HTML - #80178

Merged
priethor merged 1 commit into
trunkfrom
fix/flaky-router-navigate-latest-html
Jul 30, 2026
Merged

Flaky tests: fix router navigate latest HTML#80178
priethor merged 1 commit into
trunkfrom
fix/flaky-router-navigate-latest-html

Conversation

@priethor

Copy link
Copy Markdown
Contributor

What

Fixes #78835.

This fixes a race in the router navigation E2E test. The test could call resolveLink2() before Playwright entered the second route handler, leaving the resolver undefined and failing with resolveLink2 is not a function.

How

The test now waits for both intercepted requests to reach their route handlers before releasing either response. It can then complete the second request first and the earlier request last, while checking that the earlier response does not replace the latest navigation's HTML.

Locally, the test failed 25 times in 40 runs without this change. With the change applied, all 40 runs passed.

Testing Instructions

  1. Repeat the target test:
    npm run test:e2e -- test/e2e/specs/interactivity/router-navigate.spec.ts -g "should update the HTML only for the latest navigation" --repeat-each=40
  2. Run the full spec:
    npm run test:e2e -- test/e2e/specs/interactivity/router-navigate.spec.ts

I used Codex to help implement these changes. I guided the work, then tested and reviewed the result.

@priethor priethor added [Type] Automated Testing Testing infrastructure changes impacting the execution of end-to-end (E2E) and/or unit tests. [Feature] Interactivity API API to add frontend interactivity to blocks. [Package] Interactivity Router /packages/interactivity-router labels Jul 13, 2026
@github-actions github-actions Bot removed the [Package] Interactivity Router /packages/interactivity-router label Jul 13, 2026
@github-actions

Copy link
Copy Markdown

Size Change: 0 B

Total Size: 7.71 MB

compressed-size-action

@priethor
priethor requested a review from DAreRodz July 15, 2026 13:25
CoderAbhinav added a commit to CoderAbhinav/gutenberg that referenced this pull request Jul 22, 2026
The test "should update the URL from the last navigation if only varies
in the URL fragment" could release a navigation's response before both
requests had reached the route handler.

Both navigations target the same page path (they only differ in the URL
fragment, which is stripped when building the cache key), so both fetches
go through a single route handler and their resolvers are collected in a
shared array. Asserting the pending navigations counter is `2` only
guarantees both navigate actions have started; the actual fetches happen
later (after a dynamic import). As a result, `resolvers.pop()` could
release the first navigation's request instead of the last one's. That
earlier navigation bails out because its destination is no longer the
current one, so the title stays "Main" and the assertion for "Link 1"
times out.

Wait for both requests to reach the route handler before releasing any of
them, mirroring the fix applied to the sibling test in WordPress#80178.

Reported issues:
- Fixes WordPress#80447
@github-actions

Copy link
Copy Markdown

The following accounts have interacted with this PR and/or linked issues. I will continue to update these lists as activity occurs. You can also manually ask me to refresh this list by adding the props-bot label.

If you're merging code through a pull request on GitHub, copy and paste the following into the bottom of the merge commit message.

Co-authored-by: priethor <priethor@git.wordpress.org>
Co-authored-by: ntsekouras <ntsekouras@git.wordpress.org>

To understand the WordPress project's expectations around crediting contributors, please review the Contributor Attribution page in the Core Handbook.

@priethor
priethor merged commit e693c18 into trunk Jul 30, 2026
66 checks passed
@priethor
priethor deleted the fix/flaky-router-navigate-latest-html branch July 30, 2026 14:14
@github-actions github-actions Bot added this to the Gutenberg 23.8 milestone Jul 30, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

[Feature] Interactivity API API to add frontend interactivity to blocks. [Type] Automated Testing Testing infrastructure changes impacting the execution of end-to-end (E2E) and/or unit tests.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[Flaky Test] should update the HTML only for the latest navigation

2 participants

Sponsor
SponsoredKunjungi sekarang
Promo