37 lines
2.5 KiB
Markdown
37 lines
2.5 KiB
Markdown
|
|
# E2E — Playwright
|
|||
|
|
|
|||
|
|
Track Q (`docs/PRODUCT-PLAN-v3.1-DELIVERY-PLAN.md`, Q1). None of this existed before 2026-08-18.
|
|||
|
|
|
|||
|
|
## Run
|
|||
|
|
|
|||
|
|
```bash
|
|||
|
|
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):
|
|||
|
|
|
|||
|
|
```bash
|
|||
|
|
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 no `data-testid` attributes 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.
|