Frontend Testing

Establish a pragmatic test pyramid for frontend confidence and delivery speed.

  • Unit tests with Vitest for pure logic and component behavior.
  • Integration tests for routing, forms, and data states.
  • End-to-end smoke tests with Playwright for critical paths.

Alternatives and when to choose them

  • E2E-heavy strategy for teams with thin component abstraction.
  • Unit-heavy strategy for libraries and design systems.

Implementation checklist

  • Define critical journeys to cover in E2E.
  • Mock network predictably (for example with MSW).
  • Keep flaky test budgets and ownership explicit.

Common pitfalls

  • Too many snapshot-only tests with low signal.
  • No strategy for flaky test quarantine and recovery.

On this page