Repository navigation
Interactivity Router: Fix the flaky URL fragment navigate e2e test - #85473
Open
luisherranz wants to merge 1 commit into
Open
luisherranz wants to merge 1 commit into
luisherranz wants to merge 1 commit into
Conversation
The test holds the router's page requests with page.route() and then releases the one of the latest navigation with resolvers.pop(). The fixture loads the router when a link is first clicked, so the request of the latest navigation can arrive after the test's checks pass. The test then released the stale request instead, the latest one was never released, and the title stayed "Main". Wait until both requests are held before releasing them, as #80178 does for the latest HTML test.
🤖 PR meta 🤖🎉 PropsIf you're merging code through a pull request on GitHub, copy and paste the following into the bottom of the merge commit message. To understand the WordPress project's expectations around crediting contributors, please review the Contributor Attribution page in the Core Handbook. Updated as activity occurs, without notifying anyone named here. Add the 📦 Bundle sizeSize Change: 0 B Total Size: 9.06 MB
🏁 Flaky testsSome tests passed with failed attempts. The failures may not be related to this commit but are still reported for visibility. See the documentation for more information. Regression: updating a specific option will only change its value and will not corrupt others in
|
This branch has not been deployed
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
What?
Fixes the flaky e2e test
router-navigate.spec.ts› "should update the URL from the last navigation if only varies in the URL fragment".Why?
It fails most of the time locally. The test holds the router's page requests with
page.route()and then callsresolvers.pop()to release the request of the latest navigation. But the fixture only loads the router when a link is first clicked, so the requests start a few milliseconds after the clicks return. The checks before the release (navigations,statusandtitle) pass right away, because they change on click.So when the test calls
resolvers.pop(), often only the first request is held. The test releases that one instead, which belongs to the stale navigation and which the router correctly ignores. The latest request arrives just after, is held, and is never released, so the title stays "Main" and the test times out.It's the same race #80178 fixed for "should update the HTML only for the latest navigation".
How?
Before releasing anything, wait until both requests are held:
No check is removed or loosened: the test still releases the latest request first, and checks that only the latest navigation updates the title and the URL.
Testing Instructions
All runs pass. Without this change, the URL fragment test fails in most runs.
Use of AI Tools
Claude Code (Claude Opus): finding the cause from the Playwright traces, writing the change, running the tests, and drafting this description.