Skip to main content
The Starter Kit includes comprehensive testing infrastructure using Vitest for integration tests and Playwright for end-to-end testing.

Test types

Integration tests (Vitest):
  • Test utilities and helper functions
  • Validate configuration logic
  • Check data transformations
  • Run fast without external dependencies
E2E tests (Playwright):
  • Test complete user workflows
  • Verify authentication flows
  • Check page navigation
  • Test form submissions

Running tests

All tests

Run both integration and E2E tests:

Integration tests only

Watch mode for development:

E2E tests only

Run with UI mode:

Writing integration tests

Create tests in tests/integration/ or colocate with your code:
__tests__/utils.test.ts

Testing Server Actions

Test server-side logic:
__tests__/actions.test.ts

Writing E2E tests

Create tests in tests/e2e/:
tests/e2e/auth.spec.ts

Testing protected pages

tests/e2e/protected.spec.ts

Test configuration

Vitest config

vitest.config.ts includes:
  • TypeScript support
  • Path aliases (@/ imports)
  • Coverage reporting
  • Fast watch mode

Playwright config

playwright.config.ts includes:
  • Multiple browsers (Chromium, Firefox, WebKit)
  • Mobile viewport testing
  • Screenshot on failure
  • Video recording for CI

CI/CD integration

Run tests in your CI pipeline:
.github/workflows/test.yml

Best practices

  • Test one thing per test case
  • Use descriptive test names
  • Group related tests with describe()
Don’t just test happy paths:
  • Invalid inputs
  • Network failures
  • Permission errors
  • Edge cases
Create reusable test data:

Troubleshooting

Common issues:
  • Port conflicts: Ensure dev server isn’t running during E2E tests
  • Flaky tests: Add proper wait conditions with Playwright
  • Environment variables: Set test-specific values in test setup

Next steps

Deployment

Deploy with confidence after testing

Best Practices

Learn testing strategies