Skip to main content

Testing

In one line: Royal Glow follows a testing diamond — most tests at the integration boundary — across 13 layers, all on free tiers at $0/month. CI gates get stricter from dev to prod, and Lighthouse requires performance ≥ 95 with accessibility/best-practices/SEO = 100.

Philosophy

Royal Glow uses a testing diamond (not the traditional pyramid) because the integration boundary is where most bugs live in a fullstack app:
Core principles:
  1. Tests are production code — same quality, same review rigor, same TypeScript strictness
  2. Test behaviour, not implementation — if you refactor and tests break, the tests were wrong
  3. Deterministic or nothing — flaky tests get quarantined immediately, fixed within 24h, or deleted
  4. Fast feedback loop — unit tests < 10s, integration < 60s, E2E < 5 min (local)

Testing Layers

Tool Decisions

Locked-In Stack

Tools Rejected

Slower than Playwright, no WebKit, worse Next.js App Router support.
Vitest is a drop-in replacement, 10x faster with Bun.
Requires Storybook — RGSS doesn’t use Storybook.
31/host/moBetterStack+Sentrycoversallneedsat31/host/mo — BetterStack + Sentry covers all needs at 0.
Trivy + Socket.dev covers the same ground for free.

Unit Testing (Vitest)

What to unit test:

Integration Testing

Integration tests run against the Neon test branch — a real database with seeded fixtures. The test branch is wiped and reseeded before each CI run.

E2E Testing (Playwright)

Critical paths covered:
  1. Homepage loads → Book Now opens dialog → 4-step booking flow → submission
  2. Sign in with Google → onboarding → profile complete
  3. Admin dashboard → approve booking → mark complete → invoice generated
  4. Customer views booking history → cancels upcoming booking
  5. Admin creates membership → customer views membership page

Accessibility Testing

  • axe-core integrated into Playwright E2E tests — runs on every page
  • Lighthouse CI — Accessibility score = 100 required to merge
  • Keyboard navigation — booking flow completable via keyboard only
  • Screen reader — manual testing with VoiceOver (macOS) before each release

Performance Testing

Lighthouse CI

k6 Load Testing

Target: 50 concurrent users on pprd. Runs on every PR to pprd.

Security Testing

CI Pipeline Integration

Gates are cumulative — each stage adds checks on top of the previous one.
  • Lint + Format (Biome)
  • Type check (tsc —noEmit)
  • Unit tests (Vitest)

Coverage Requirements

Commands

Meticulous AI — Visual Regression

Meticulous records real user sessions on pprd, then replays them as visual regression tests on every PR. Zero test code required — it learns from real usage. What Meticulous catches that Playwright doesn’t:
  • Subtle font rendering changes
  • 1px layout shifts after CSS changes
  • Colour/spacing regressions in components you didn’t touch
  • Responsive breakpoint issues on real device viewports
Last modified on August 29, 2026