Skip to content

test: de-flake medication-page ui-smoke against transient Suspense duplicate - #184

Merged
BigSimmo merged 1 commit into
mainfrom
claude/harden-ui-smoke-medication-mount
Jul 2, 2026
Merged

test: de-flake medication-page ui-smoke against transient Suspense duplicate#184
BigSimmo merged 1 commit into
mainfrom
claude/harden-ui-smoke-medication-mount

Conversation

@BigSimmo

Copy link
Copy Markdown
Owner

Summary

The required ui-smoke gate intermittently fails the "prescribing workflow uses in-app medication routes" spec with a Playwright strict-mode violation — getByTestId('acamprosate-medication-page') resolves to 2 elements. This flake blocked #176 (an unrelated eval PR) until a manual re-run.

Root cause

The medication route renders inside GlobalMockupSearchShell, whose <Suspense> fallback renders props.childrenand whose resolved client subtree also renders children. During the mockup→redirect hard navigation, both <main data-testid="acamprosate-medication-page"> copies briefly coexist in the DOM. Rendering children in the fallback is an intentional SSR pattern (content visible while useSearchParams suspends), so the app renders correctly in every browser — this is purely a too-strict test locator catching a transient overlap.

Fix

Wait for the testid to settle to exactly one instance before asserting visibility (expectSingleMedicationPage helper). toHaveCount(1) retries through the transition but still fails on a genuine permanent double-render, so it does not mask a real regression. Follows the same philosophy as #178.

Verification

  • prettier --check, eslint, tsc --noEmit all clean on the changed file.
  • Test-only change; CI ui-smoke is the cross-environment validator.

Follow-up (not in this PR)

Hoisting children out of the Suspense boundary so it renders exactly once would remove the duplicate at the source, but that is a broader shell refactor with SSR implications for every GlobalSearchShell route.

🤖 Generated with Claude Code

…plicate
The "prescribing workflow uses in-app medication routes" spec intermittently
failed the Chromium ui-smoke gate with a strict-mode violation:
getByTestId('acamprosate-medication-page') resolved to 2 elements.
Root cause: the medication route renders inside GlobalMockupSearchShell, whose
Suspense fallback renders `props.children` and whose resolved client subtree
also renders `children`. During a navigation/hydration overlap (the mockup->
redirect hard navigation) both <main data-testid="acamprosate-medication-page">
copies briefly coexist. Rendering children in the fallback is an intentional
SSR pattern (content visible while useSearchParams suspends), so the app is
correct in every browser — this is purely a too-strict test locator catching a
transient DOM overlap.
Fix: wait for the testid to settle to exactly one instance before asserting
visibility (new expectSingleMedicationPage helper). toHaveCount(1) retries
through the transition yet still fails on a genuine permanent double-render, so
it does not mask a real regression.
Follow-up (not done here): hoisting `children` out of the Suspense boundary so
it renders exactly once would remove the duplicate at the source, but that is a
broader shell refactor with SSR implications.
Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
@BigSimmo
BigSimmo merged commit 5aab09a into mainJul 2, 2026
4 checks passed
@BigSimmo
BigSimmo deleted the claude/harden-ui-smoke-medication-mount branch July 2, 2026 16:31
BigSimmo added a commit that referenced this pull request Jul 31, 2026
Regenerate drift-manifest after hosted db-query-perf migration confirmation; keep #183 open pending SENTRY_AUTH_TOKEN for metric alert create.
Co-authored-by: Cursor <cursoragent@cursor.com>
Sign up for freeto join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant

@BigSimmo