Skip to content

test(e2e): add Paddle E2E helpers, config guard, and error-path test (WST-712)#918

Closed
rogersole wants to merge 6 commits into
roger/wst-711-paddle-e2e-env-plumbingfrom
roger/wst-712-paddle-e2e-helpers
Closed

test(e2e): add Paddle E2E helpers, config guard, and error-path test (WST-712)#918
rogersole wants to merge 6 commits into
roger/wst-711-paddle-e2e-env-plumbingfrom
roger/wst-712-paddle-e2e-helpers

Conversation

@rogersole

@rogersole rogersole commented Jun 10, 2026

Copy link
Copy Markdown
Contributor

Summary

Stacked on #917. Form-fill knowledge ported from #820 (credit @nicfix) and from rc-billing-checkout's proven Paddle E2E suite, then corrected against live sandbox runs.

  • src/tests/paddle/test-helpers.ts
    • forcePaddleCheckoutMode(page, "inline" | "overlay"): rewrites paddle_billing_params.inline_checkout_enabled in the real /checkout/start response, so one E2E project deterministically covers both presentation modes regardless of the backend per-project flag (WST-700). Asserts paddle_billing_params is present so backend shape drift fails loudly.
    • Frame locators verified against the sandbox: inline scoped to [data-testid='paddle-inline-checkout-container'] iframe; overlay iframe.paddle-frame, iframe[name='paddle_frame'].
    • completePaddleCheckoutForm(frame, ...) parameterized by FrameLocator so it serves both modes. Uses Paddle's own test ids (cardNumberInput, authenticationEmailInput), Andorra to skip the postcode field, and a submit re-click loop — Paddle authenticates the filled email asynchronously and silently swallows submits that land mid-authentication.
    • Offering identifier: paddle_e2e_test (real identifier from the Paddle E2E project).
  • config-guard.test.ts: fails loudly on CI if VITE_RC_PADDLE_E2E_API_KEY is missing, instead of the suite silently skipping.
  • purchase-flow.test.ts: error path — checkout/start returning paddle_billing_params: null → error screen ('Something went wrong' + 'An unknown error occurred', the Paddle flow's copy).

Part of WST-564 (subtask WST-712).

Test plan

  • tsc --noEmit, eslint, prettier clean
  • Verified locally against the real Paddle E2E project: error path green on 3 consecutive full-suite runs
  • CI green — config guard passing with E2E_RC_PADDLE_E2E_API_KEY configured in CircleCI (WST-708 done)

🤖 Generated with Claude Code


Note

Low Risk
Test-only additions in the demo example; no production billing or auth logic changes.

Overview
Adds Paddle Playwright E2E scaffolding under examples/webbilling-demo/src/tests/paddle/, reusing shared integration helpers and the paddle_e2e_test offering.

test-helpers.ts introduces Paddle-specific navigation (navigateToPaddleLandingUrl), timeouts, sandbox card/country constants, inline vs overlay iframe locators, forcePaddleCheckoutMode (rewrites inline_checkout_enabled on real /checkout/start responses with an assertion if paddle_billing_params is missing), completePaddleCheckoutForm (shared frame-based fill/submit with email-auth re-click), and visibility helpers for inline checkout, processing, and sandbox banner.

config-guard.test.ts fails on CI when VITE_RC_PADDLE_E2E_API_KEY is unset so the suite cannot skip silently while CI stays green.

purchase-flow.test.ts adds a Paddle flow describe (Chromium-only on CI, rate-limit sleep between tests) with one test that stubs paddle_billing_params: null on checkout/start and asserts "Something went wrong" and "An unknown error occurred" (Paddle-specific copy vs Stripe).

Reviewed by Cursor Bugbot for commit be9518d. Bugbot is set up for automated code reviews on this repo. Configure here.

@rogersole rogersole force-pushed the roger/wst-712-paddle-e2e-helpers branch from 30bc6de to 8dd502a Compare June 10, 2026 14:28
@rogersole rogersole marked this pull request as ready for review June 10, 2026 16:09
@rogersole

Copy link
Copy Markdown
Contributor Author

Verified locally against the real Paddle E2E project (paddle_e2e_test offering, sandbox): error-path test and config guard green on 3 consecutive full-suite runs. Selector updates from the live run: this checkout variant has no logoutLinkTextCTA, renders submit as Subscribe now, surfaces missing-params as 'An unknown error occurred', and silently swallows submits that land while the email is being authenticated — the helper now blurs the email and re-clicks until the form transitions. CI will stay red until E2E_RC_PADDLE_E2E_API_KEY is confirmed in the CircleCI context (WST-708) — that's the config guard doing its job.

@rogersole rogersole force-pushed the roger/wst-711-paddle-e2e-env-plumbing branch from ee270ee to 04f1e89 Compare June 11, 2026 06:04
@rogersole rogersole force-pushed the roger/wst-712-paddle-e2e-helpers branch from 6ea3f7f to 5043030 Compare June 11, 2026 06:04
rogersole and others added 6 commits June 12, 2026 15:01
…(WST-712)

- navigateToPaddleLandingUrl + forcePaddleCheckoutMode: forces inline or
  overlay presentation by rewriting inline_checkout_enabled in the real
  /checkout/start response, so one E2E project covers both modes
  deterministically regardless of the backend per-project flag.
- Mode-aware frame locators (inline container scoped; overlay via
  paddle.com iframe src) and completePaddleCheckoutForm parameterized by
  FrameLocator so it serves both modes (field locators from #820,
  credit: @nicfix).
- config-guard test: fails loudly on CI if VITE_RC_PADDLE_E2E_API_KEY is
  missing instead of letting the suite silently skip.
- First test: error screen when checkout/start returns missing paddle
  billing params (mode-agnostic, CI-safe).

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
…T-712)

Replaces the role-based field guesses with Paddle's own test ids
(cardNumberInput, authenticationEmailInput, cardPaymentFormSubmitButton)
and the fill order proven in rc-billing-checkout/src/e2e (country first,
Andorra to avoid the postcode field; wait for logoutLinkTextCTA before
submitting). Pins the overlay frame selector to
iframe.paddle-frame/iframe[name='paddle_frame'].

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
…n (WST-712)

Verified against the real Paddle E2E project: this checkout has no
logoutLinkTextCTA and renders the submit as 'Subscribe now', and the
error screen shows 'An unknown error occurred' rather than the Stripe
flow's 'Purchase not started' copy.

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
Paddle authenticates the filled email asynchronously and silently
swallows submit clicks that land mid-authentication (observed against
the sandbox). Blur the email field and re-click submit until the form
transitions away.

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
@rogersole

Copy link
Copy Markdown
Contributor Author

Superseded by #925, which now targets main and contains the full WST-564 stack (this PR's commits included) — all CI checks green there. Closing to keep a single merge point.

@rogersole rogersole closed this Jun 12, 2026
@rogersole rogersole deleted the roger/wst-712-paddle-e2e-helpers branch June 12, 2026 13:23
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant