F14-F16 of the frontend backlog. Contract: PHASE-1-MONEY-FX-PAYMENTS-CONTRACT.md §5.2. The highest-priority change in Phase 1: `POST /cart` sent `amount` computed client-side (this.convertTotal(this.totalWithDelivery())) and the backend was asked to trust it. Replaced with two calls: 1. POST /api/v2/storefront/checkout - offer ids + qty only. Returns checkoutSessionId and the server-computed total. 2. POST /api/v2/storefront/payments/intents - references checkoutSessionId only. Same response shape as before (qrId/qrUrl/bankUrl/qrTTL via the existing resolvePaymentQrId/resolvePaymentLink/resolveBankPaymentUrl helpers) - this replaces how the charged amount is determined, not the QR/card provider polling flow, which Phase 1 does not redesign. merchantReference (PARTNER-PROVISIONING-API-CONTRACT.md's RoutingContext field) is sent on the payment intent, generated the same way the old orderId was - our own correlation id, now with a name that matches what it is. api.service.ts: CheckoutSessionRequest/Response and PaymentIntentRequest types added, old CartPaymentRequest/createCartPayment left in place (Phase 7 reconciliation and any other caller may still reference the shape) but no longer called from checkout. offerId uses item.itemID: this codebase has no distinct Offer entity yet (Phase 3, Product/Offer split, not shipped in this model) - itemID is the same catalog identifier every other endpoint already keys off. Flagged in a code comment for whoever ships Phase 3 to revisit. Dead code removed as a consequence, not a separate pass: buildPaymentItems, getPaymentUserId, getPaymentDescription (no other caller once the old payload was gone), the ConfigService/TenantResolverService injects that existed only for getPaymentDescription, and the now-orphaned cart.paymentDescriptionFallback i18n key in all three locales. Verification: cart.component.ts has no unit spec (no src/app/pages/cart/ *.spec.ts exists) - this session's E2E suite is the only coverage the checkout request shape has. Added checkout-request-shape.spec.ts, scoped narrowly to the request/response contract rather than a full add-to-cart UI journey: seeds cart state directly into localStorage, fakes the customer session via cookie + intercepted session-check, intercepts both new endpoints and asserts on the captured request bodies. Confirms concretely: no `amount` or `price` field ever leaves the client, offers carry the right offerId/qty, and the payment intent correctly threads checkoutSessionId through. Verified: 5/5 E2E green, 115/115 unit tests green, arch:check clean, production build succeeds. Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
E2E — Playwright
Track Q (docs/PRODUCT-PLAN-v3.1-DELIVERY-PLAN.md, Q1). None of this existed before 2026-08-18.
Run
npm run e2e # headless, boots the dev server automatically
npm run e2e:ui # interactive runner
npm run e2e:report # last HTML report
Against a different server (staging, a locally-started backend):
BASE_URL=https://staging.example.com npm run e2e
What this suite currently covers, and what it doesn't
environment.ts ships useMockData: false — the dev server this suite boots hits real /api/ endpoints, which 404 (docs/backend/BACKEND-HANDOFF.md — no backend is running anywhere this session can reach). The product catalog itself renders from a separate mocked bootstrap/catalog path (useMockBootstrapOnLocal: true), so real prices and real currency conversion ARE exercised — smoke.spec.ts explicitly ignores the expected 404 console noise rather than pretending it isn't there.
This is not the same guarantee as running against a live backend. Checkout, payment, and anything behind a real endpoint are not covered until BASE_URL points at a live environment. Confirmed once, concretely: on the first run, this suite caught a real bug (@marketplaces/auth shipping without Angular Ivy metadata, breaking app bootstrap) and a real test defect (a duplicate hidden dropdown made the first currency-switch attempt click a no-op element) — both fixed as part of standing this suite up. See the commit history in src/main.ts and this directory for what each was.
Files
| File | Covers |
|---|---|
currency-switch.spec.ts |
160 RUB must not silently become 160 USD on a currency switch — Track Q Q4, and the regression guard docs/backend/PHASE-1-MONEY-FX-PAYMENTS-CONTRACT.md §5 exists to close. Written before the checkout money-truth rewrite (F10–F16 in the frontend backlog), specifically so that rewrite has a net under it. |
smoke.spec.ts |
App boots, storefront renders, no console errors on first paint. |
Adding a test
- Prefer existing CSS classes / ARIA roles already in the templates (
.currency-button,role="option", etc.) over inventing new selectors — there are nodata-testidattributes in this codebase yet, and adding them project-wide is out of scope for this suite. - One behavior per test. Name the file after the behavior, not the page.
- If a test needs backend state that mock data can't produce, mark it
test.skip(!process.env.BASE_URL, 'needs a live backend')rather than deleting it — it documents the gap.