Test Types
- Unit Tests — Vitest for component and utility testing
- E2E Tests — Playwright for browser automation
- API Contract Tests — Validate Next.js/Rust API parity
- Schema Validation — Ensure OpenAPI compliance
Unit Testing with Vitest
Running Tests
Test Configuration
Vitest is configured with:- React Testing Library — Component testing
- jsdom — Browser environment simulation
- Coverage reporting — Istanbul integration
Writing Unit Tests
E2E Testing with Playwright
Configuration
Playwright is configured in playwright.config.ts:1-25:Running E2E Tests
Testing Desktop (Tauri)
Test the Rust backend with Playwright:Example E2E Test
From e2e/tauri-backend-check.spec.ts:1-118:Screenshot Testing
Playwright automatically captures screenshots on failure. For manual screenshots:API Contract Testing
Checking API Parity
Ensure Next.js and Rust backends implement identical APIs:Running Contract Tests
Schema Validation
Validate OpenAPI schema compliance:Full API Validation
Testing Workflow
Pre-commit Checklist
Pull Request Testing
From AGENTS.md:20:When plan to create a PR, should attach screenshot with Playwright in GitHub PR bodyInclude Playwright screenshots in PR descriptions to demonstrate UI changes.
Testing Both Backends
Continuous Integration
GitHub Actions
Typical CI workflow:Testing Best Practices
From AGENTS.md
Key testing guidelines from AGENTS.md:12-16:- Use Playwright MCP tool to test the web UI when possible
- Test both Next.js and Rust to ensure API parity
- Capture screenshots for visual verification
- Run E2E tests before pushing changes
Test Organization
Writing Good Tests
- Descriptive names — Clearly state what is being tested
- Independent tests — Each test should run in isolation
- Wait strategies — Use proper waits, not arbitrary timeouts
- Cleanup — Reset state between tests
- Screenshots — Capture visual state for debugging
Debugging Tests
Playwright Debug Mode
Headed Mode
Test Results
Playwright saves artifacts intest-results/:
- Screenshots — Captured on failure
- Traces — Full execution traces
- Videos — Recording of test execution (if enabled)
Related Resources
- Dual Backend Architecture — Understanding both backends
- Database Configuration — Database testing setup
- Contributing Guide — Code quality standards
- Playwright Docs — Official Playwright documentation
- Vitest Docs — Official Vitest documentation