Testing Strategy
Fully automated quality gates (notes: "fully automated e2e testing using cypress, playwright" + "do automated lightscore tests and improve"). Nothing merges that breaks the gates.
Test pyramid
| Level | Tooling | Covers |
|---|---|---|
| Static | TypeScript, ESLint, SAST, SCA, container scan | types, style, security |
| Unit | Jest (services), RN Testing Library, React Testing Library | domain logic, components |
| Integration | Jest + test DBs (PG/Mongo), supertest | APIs, repositories, event handlers |
| E2E | Playwright (web) + Cypress (flows) | user journeys across services |
| Performance | Lighthouse CI | storefront perf/SEO/a11y budgets |
| Load (v2) | k6 | checkout, dispatch under load |
E2E coverage (key journeys)
- Browse → configure solar kit → checkout (Hyperswitch sandbox) → order.
- Delivery → warranty registration → "My Products".
- Raise complaint → assign technician → close job (offline sync path).
- AMC purchase → scheduled visit → renewal reminder.
- Dealer order → ledger update → target progress.
- Cross-vendor external asset → paid visit.
- Testimonial 7-day auto-request flow (time-travel the delayed job).
Web journeys via Playwright; cross-app/business flows via Cypress. Choose one primary per journey to avoid duplication.
Lighthouse gate
- Budgets (storefront): Performance ≥ 90, Accessibility ≥ 95, SEO ≥ 95, Best-Practices ≥ 95 (tunable).
- Runs on PR preview builds; fails CI if below budget.
- Tracks localized routes (perf must hold across locales).
- Accessibility: axe checks in Playwright in addition to Lighthouse.
i18n testing
- Pseudo-localization run to catch hard-coded strings.
- Snapshot key locales (en-IN, hi-IN) on critical pages.
Test data & environments
- Ephemeral PG/Mongo/Redis per CI run (containers).
- Medusa seeded with a fixture catalog (a tenant-neutral "demo brand").
- External integrations (Hyperswitch/Shiprocket/marketplaces) use sandbox creds or contract mocks.
CI pipeline (per PR)
Contributor rules
- New module ships with unit + integration + at least one e2e journey.
- Event handlers must have idempotency tests (replay the same event).
- Scoped queries must have an authorization test (out-of-scope access denied).
- No lowering Lighthouse budgets without sign-off.