Skip to content

test(e2e): Gate hydrogen-react-router-7 client clicks on hydration#22061

Merged
mydea merged 1 commit into
developfrom
test/fix-flaky-hydrogen-rr7-e2e
Jul 9, 2026
Merged

test(e2e): Gate hydrogen-react-router-7 client clicks on hydration#22061
mydea merged 1 commit into
developfrom
test/fix-flaky-hydrogen-rr7-e2e

Conversation

@mydea

@mydea mydea commented Jul 8, 2026

Copy link
Copy Markdown
Member

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'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 buttons then capture no error, and
  • the <Link> behaves like a plain anchor, producing a full-page pageload instead of the expected client-side navigation transaction.

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

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>
@mydea mydea requested review from a team, chargome, nicohrubec and s1gr1d and removed request for a team July 9, 2026 08:43
@mydea mydea merged commit 5342cc0 into develop Jul 9, 2026
48 checks passed
@mydea mydea deleted the test/fix-flaky-hydrogen-rr7-e2e branch July 9, 2026 09:03
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment