test(e2e): Gate hydrogen-react-router-7 client clicks on hydration#22061
Merged
Conversation
The hydrogen-react-router-7 E2E client tests that click an element right after `page.goto()` are flaky: Playwright's `click()` waits for actionability but not React hydration, so the click can land before the element's onClick handler is attached. The exception/ErrorBoundary clicks then capture nothing, and the `<Link>` click falls back to a full page navigation (a pageload instead of a client-side navigation). Await the pageload transaction — which only completes once the client SDK and router have hydrated — before clicking, in the exception, ErrorBoundary and navigation tests. This mirrors the mitigation already used by the remix-hydrogen navigation test. Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
chargome
approved these changes
Jul 9, 2026
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.
Companion to #22051 (remix-hydrogen): the sibling hydrogen-react-router-7 app has the same click-before-hydration flakiness in its client tests.
Root cause
Three client tests click an element immediately after
page.goto(). Playwright'sclick()waits for actionability but not React hydration, so the click can land before the element'sonClickhandler is attached:<Link>behaves like a plain anchor, producing a full-pagepageloadinstead of the expected client-sidenavigationtransaction.Fix
Await the pageload transaction — which only completes once the client SDK and router have hydrated — before clicking, in the exception, ErrorBoundary and navigation tests. This is the exact mitigation the remix-hydrogen navigation test already uses. This app already omits Replay/
debug, so no SDK-config change is needed.The two remaining tests in the group (
pageload,meta tags) are load-only with no click; they were swept into the same flaky-run batch and have no per-test hydration race to fix here. These E2E tests require the packed SDK tarballs + Shopify Hydrogen toolchain to run, so they're validated in CI rather than locally.Fixes #21737
Fixes #21736
Fixes #21710
Fixes #21735
Fixes #21734
🤖 Generated with Claude Code