Test Types
Unit Tests
Test individual functions and components in isolation
Integration Tests
Test how multiple components work together
E2E Tests
Test complete user workflows in a real browser
Running Tests
All Tests
Run the entire test suite:Unit Tests
Run unit tests with Vitest:Backend Tests
Run backend tests with Ava:E2E Tests
Run end-to-end tests with Playwright:Writing Unit Tests
Frontend Unit Tests
Frontend tests use Vitest and React Testing Library:Button.spec.tsx
Backend Unit Tests
Backend tests use Ava:auth.spec.ts
Writing E2E Tests
E2E tests use Playwright:workspace.spec.ts
Page Object Pattern
Use page objects for reusable test code:WorkspacePage.ts
Testing Best Practices
Unit Tests
Test behavior, not implementation
Test behavior, not implementation
Focus on what the component does, not how it does it:
Use meaningful test descriptions
Use meaningful test descriptions
Keep tests independent
Keep tests independent
Each test should be able to run in isolation:
E2E Tests
Use data attributes for selectors
Use data attributes for selectors
Wait for elements properly
Wait for elements properly
Test user workflows, not API calls
Test user workflows, not API calls
Mocking
Mocking Functions
Mocking Modules
Coverage
Generate test coverage reports:- Statements: >80%
- Branches: >75%
- Functions: >80%
- Lines: >80%
Continuous Integration
Tests run automatically on:- Every pull request
- Every commit to main
- Nightly builds
- Lint code
- Type check
- Run unit tests
- Run integration tests
- Run E2E tests
- Generate coverage
- Upload artifacts
Debugging Tests
Debug Unit Tests
Debug E2E Tests
Playwright Inspector
Test Utilities
Custom Matchers
Test Fixtures
fixtures.ts