Skip to main content

10 — Frontend Testing Strategy

Scope: What the FE pyramid looks like across web, mobile, desktop, and kiosk; what must be green to ship; how journeys map to e2e gates. This doc inherits from the platform-wide ../../11-testing-strategy-qa.md and elaborates the FE slice.

Companions: 09-non-functional-requirements.md · ../../standards/FRONTEND_DEFINITION_OF_DONE.md


1. Pyramid

LayerWebMobileDesktopKiosk
UnitVitestJestVitest (renderer) + Node test runner (main / sync worker)shared with desktop
ComponentTesting Library (@testing-library/react)React Native Testing LibraryTesting Libraryshared
Visual regressionChromatic per Storybook story (per primary locale + RTL)Loki / RN Storybook + Chromatic web stories for shared primitivesChromatic per renderer storyshared
End-to-endPlaywright (Chromium + WebKit + Firefox; mobile emulation Pixel 5 + iPhone 13)Detox (iOS Sim + Android Emulator; one Pixel 4a profile gates main)Playwright Electron driver against packaged buildPlaywright Electron driver in kiosk-shell mode
Accessibilityaxe-core in Storybook + Playwright @axe-core/playwrightDetox + manual VoiceOver / TalkBack scriptsaxe + manual NVDAtap-target + screen-reader audits
PerformanceLighthouse-CI (3 runs median)Reassure on hot screenssynthetic perf test for HK board / reservation listmanual idle-loop test (24h)
ContractGenerated OpenAPI clients typecheck-validated; mock BFF via mswmsw for native (works in Expo)msw in renderer; nock in main / sync workershared
i18n / pseudo-localeen-XA rendered for every PR; truncation + RTL flips checkedsamesamesame
Integration (sync)n/an/afull sync round-trip against test BFF; conflict-resolution fixtureshared

Coverage floors:

  • Unit: 80% lines on packages/feature-* and packages/ui-melmastoon
  • Component: every primitive story has at least one interaction test
  • E2E: every gated journey (see §3) has at least one scenario per platform it ships on

2. What must be green to merge a PR

PR-merge gate (CI):

  1. Typecheck passes (tsc --noEmit) across the workspace
  2. ESLint passes (incl. eslint-plugin-boundaries, no-raw-color, no-physical-properties, i18n key checks)
  3. Unit + component tests green; coverage above floor
  4. Visual regression: zero unreviewed Chromatic diffs (or explicit accept)
  5. Bundle / size budgets within thresholds (@next/bundle-analyzer / EAS Build report / electron-builder size)
  6. Lighthouse-CI (web changes only): perf >= 90, a11y >= 95, best-practices >= 95, SEO >= 95
  7. axe: zero serious / critical issues on every changed Storybook story
  8. New telemetry events declared in ../catalogs/C1-telemetry-event-dictionary.md (P1 doc)

PR-review gate (human):

  1. Design review checklist signed off (../../standards/DESIGN_REVIEW_CHECKLIST.md)
  2. Frontend DoD signed off (../../standards/FRONTEND_DEFINITION_OF_DONE.md)
  3. Security review for any change touching auth, payment, lock/key, AI orchestration, multi-tenant boundary

3. Critical journey e2e gates

These journeys MUST have a passing e2e on every release branch. Failure blocks release.

Gate IDSurfaceJourneyE2E test name
G-WEB-1Web meta + tenant bookingSearch -> filter -> map toggle -> property detail -> handoff -> bootstrap -> quote -> hold -> guest details -> cash-on-arrival -> confirmationweb/e2e/full-meta-to-cash-confirmation.spec.ts
G-WEB-2Tenant bookingDirect entry to <tenant>.melmastoon.app/book -> bootstrap -> quote -> hold -> card payment via Adyen test mode -> return -> confirmationweb/e2e/tenant-booking-card.spec.ts
G-WEB-3Tenant bookingHold-expiry mid-funnel -> re-quote -> resumeweb/e2e/hold-expiry-resume.spec.ts
G-MOB-1MobileDiscover (search) -> property detail -> Book -> bootstrap tenant -> quote -> hold -> MFS payment -> return -> confirmationmobile/e2e/discover-to-mfs.spec.ts
G-MOB-2MobileTrips tab opened offline -> cached upcoming reservation visible -> "Get directions" works -> "Modify dates" cleanly disabled with bannermobile/e2e/trips-offline.spec.ts
G-MOB-3MobilePush notification arrival -> deep-link into ConfirmationScreen from cold startmobile/e2e/push-deeplink-cold.spec.ts
G-DSK-1DesktopFront-desk arrival flow: walk-in -> create reservation -> assign room -> issue key (encoder) -> print registration carddesktop/e2e/walkin-to-key.spec.ts
G-DSK-2DesktopSync recovery: go offline for 30 min, make 5 status changes -> reconnect -> outbox replays without conflictdesktop/e2e/sync-recovery.spec.ts
G-DSK-3DesktopHK board: drag room from dirty to cleaning -> assign housekeeper -> mark inspected -> verify event publicationdesktop/e2e/hk-board-flow.spec.ts
G-KIO-1Kiosk (R2)Self-checkin: pre-arrived guest -> passport scan -> e-signature -> payment -> key issuance -> idle-reset workskiosk/e2e/self-checkin-happy.spec.ts

Adding a journey to this list requires PR review by QA + the surface owner.


4. Test data and fixtures

  • Test tenants: kabul-grand-hotel (PS/DR primary), karachi-gateway-suites (UR/EN primary), dubai-pearl-residency (AR/EN primary), paris-petit-palais (FR/EN, Phase 2)
  • Test properties: at least one property per tenant with full media, rooms, rate plans, policies seeded
  • Test guests: guest.alpha@example.test (returning loyalty), guest.beta@example.test (first-time), guest.gamma@example.test (RTL primary, Pashto)
  • Test cards: Adyen test cards per https://docs.adyen.com/development-resources/testing/test-card-numbers
  • Test MFS accounts: documented in tooling/test-fixtures/mfs.json of impl monorepo
  • Test locks: stub encoder in tooling/test-fixtures/lock-stubs.ts; physical lock simulator for E2E ring (R2)

5. Localisation testing

  • Pseudo-locale en-XA rendered every PR — checks for hardcoded strings + truncation + bidi flips
  • Real-locale review per release: native speaker review for PS / DR / UR / AR / FR (Phase 2)
  • Numerals invariant: financial confirmations always Latin numerals — automated assertion in confirmation snapshot tests

6. Performance testing

See 09-non-functional-requirements.md §1. Per-PR perf budgets are gated; per-release synthetic perf runs cover:

  • Web: Lighthouse-CI on top 5 routes per app
  • Mobile: Reassure on SearchScreen, PropertyDetailScreen, BookingFlow, TripsTab
  • Desktop: synthetic HK board with 200 rooms, reservation list with 50 rows
  • Local AI: cold first-token + warm first-token + 50-token completion latency

7. Security testing

  • Static: eslint-plugin-security, npm audit in CI
  • Dependency: Dependabot weekly; alert-on-critical immediate
  • Dynamic: BFF security tested separately (see service SECURITY_MODEL.md); FE security tested for CSP, cookie flags, XSS escaping, CSRF token presence
  • Penetration: external pen-test before R1 GA, then quarterly

8. Open questions

  • Should we adopt Playwright Component Testing for @ghasi/ui-melmastoon to replace some Vitest+Testing-Library tests? Trade-off: real browser vs jsdom speed.
  • Mobile visual regression on real devices vs simulators only — coverage vs cost.
  • Desktop e2e test ring: do we run on all 3 OS in CI, or rotate (Mac matrix Mon, Windows Tue, Linux Wed)?

References