test(e2e): mocked-contract Playwright gate for the ClaimPage conversion journey#213
Merged
Conversation
…on journey
Adds e2e/claim-conversion.spec.ts — a browser-level Playwright spec that drives
the REAL ClaimPage route (/claim?t=) + REAL src/api client with the network
mocked at the page.route() boundary, so it runs on every web PR (mocked config,
VITE_NO_PROXY=1) without minting real resources.
Fills the gap between the three existing claim layers without duplicating any:
- ClaimPage.test.tsx (vitest) stubs the `../api` MODULE — never exercises the
SPA→fetch wiring (URL/method/body, response→error mapping in call()).
- live-claim-deploy.spec.ts drives the api-direct (request fixture), never
renders ClaimPage, runs only on the scheduled/on-demand live suite.
- auth-roundtrip.spec.ts covers the cookie-exchange seam, not claim UI.
Coverage (10 tests): preview rendered from the upgrade token; malformed-token
dead-end; empty-email client guard; email → POST /claim {jwt,email} → payment
funnel; live HH:MM:SS countdown from the resource TTL; Hobby/Pro checkout CTA
plan wiring + short_url redirect; inline checkout-failure (no redirect); and the
claim error states (409 already_claimed, account_exists → error, no funnel).
All 10 pass in mock mode (chromium). npm run gate green (tsc + build + 1147
vitest). No live-claim-deploy duplication; no real resources minted.
Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
size-limit report 📦
|
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
Adds
e2e/claim-conversion.spec.ts— a browser-level Playwright spec for the ClaimPage conversion journey (anonymous → claimed → checkout money path), driven through the real/claim?t=SPA route + realsrc/apiclient, with the network mocked at thepage.route()boundary.Runs under the default mocked config (
playwright.config.ts,VITE_NO_PROXY=1), so it executes on every web PR viae2e-pr-smoke's mocked path without minting real resources.Why (the gap it fills)
Three layers already touch the claim flow; this spec fills the one gap between them and is scoped not to duplicate any:
src/pages/ClaimPage.test.tsx(vitest)../apimodule — the SPA→fetch wiring (URL/method/request body, response→error mapping incall()) is never exercised. A/claimrename or checkout-body rename would not red it.e2e/live-claim-deploy.spec.ts(live cohort)requestfixture (api-direct)e2e/auth-roundtrip.spec.tsThis spec is the missing middle: real browser + real
src/apiclient + mocked network, redding a PR if the SPA→api claim/checkout wiring breaks.Coverage (10 tests)
?t=decoded client-side)POST /claimfired)POST /claim {jwt,email}→ payment funnel (asserts the request body contract)HH:MM:SScountdown derived from the resource TTLplanwiring +short_urlredirectalready_claimedandaccount_exists→ inline error, funnel does not mountGate
npm run gategreen —tsc --noEmit+vite build(incl.scripts/prerender.mjs) +vitest run(1147 passed / 3 skipped).No
live-claim-deployduplication. No real resources minted. No prod calls.🤖 Generated with Claude Code