Testing¶
Fruit Plug ships a thin Playwright smoke layer against the dev PWA. The aim is don't ship a regression to the buying path — not full coverage. Anything more granular belongs in unit tests next to the code.
Where tests live¶
apps/web/
├── playwright.config.ts
├── tests/
│ └── smoke/
│ ├── atlas.spec.ts
│ ├── cart.spec.ts
│ ├── home.spec.ts
│ ├── legal.spec.ts
│ ├── login.spec.ts
│ ├── mobile-nav.spec.ts
│ └── pdp.spec.ts
Each spec mirrors a primary surface from features/. A new top-level route should land with a sibling smoke spec covering at least the happy path render + one interaction.
Running¶
From apps/web/:
# Headless run, all specs (uses the URL in playwright.config.ts)
pnpm exec playwright test
# Single spec
pnpm exec playwright test tests/smoke/cart.spec.ts
# Headed (debug) mode
pnpm exec playwright test --headed
# Open the HTML report after a run
pnpm exec playwright show-report
The dev container exposes the same scripts.
What the smoke layer covers¶
| Spec | Asserts |
|---|---|
home.spec.ts |
Hero renders, BoxesShowcase mounts, footer has the social links from lib/social.ts. |
atlas.spec.ts |
/atlas index renders the Curated Collections band + 16 family cards; clicking a family lands on /atlas/{slug} with the 21:9 hero. |
pdp.spec.ts |
A canonical PDP slug renders title, price, gallery, related rail, and the Preparation guide cross-link card. |
cart.spec.ts |
Add-to-cart from a PDP increments the header <CartCount /> and shows a row in /cart. |
login.spec.ts |
/login form rejects an empty submit, surfaces the inline error, and routes to /account after a stubbed valid login. |
mobile-nav.spec.ts |
Tab bar renders at small viewports; tapping the cart tab opens the slide-up <MiniCart>. |
legal.spec.ts |
/privacy, /terms-and-conditions, /refund-policy all render the cream paper-panel layout via LegalPage. |
What it deliberately doesn't cover¶
- Stripe checkout — the inline Elements path is env-gated and varies by tenant.
- Loyalty / Streaks / Passport — UI runs on mocked data; once real WP endpoints land, add specs against fixture responses.
- The WP plugin — Playwright is browser-side only. Plugin behaviour is asserted by the existing smoke endpoints (e.g.
/wp-json/fruitplug/v1/health) and ad-hoc wp-cli scripts.
CI¶
Specs do not yet run in CI — that lands once the GitHub repo URL + gh auth blockers in Roadmap 1.15 clear. Run them locally before any merge that touches a route.