- Next.js 14+ with App Router and TypeScript - Tailwind CSS and ShadCN UI styling - Zustand state management - Dexie.js for IndexedDB (local-first data) - Auth.js v5 for authentication - BMAD framework integration Co-Authored-By: Claude <noreply@anthropic.com>
1.3 KiB
1.3 KiB
Test Suite Documentation
This project uses Playwright for End-to-End (E2E) testing.
Setup
-
Install dependencies: ```bash npm install ```
-
Setup environment: ```bash cp .env.example .env
Update .env with local configuration if needed
```
-
Install Playwright browsers: ```bash npx playwright install ```
Running Tests
-
Run all E2E tests: ```bash npm run test:e2e ```
-
Run in UI mode (interactive): ```bash npx playwright test --ui ```
-
Run specific test file: ```bash npx playwright test tests/e2e/example.spec.ts ```
Architecture
We follow a structured pattern for maintainable tests:
tests/e2e/: Contains the actual test files.tests/support/fixtures/: Playwright fixtures. Usetestfrom here, not@playwright/test.tests/support/fixtures/factories/: Data factories for generating test data.
Best Practices
- Use
data-testid: Preferpage.getByTestId('submit-btn')over CSS/XPath selectors. - Atomic Tests: Each test should be independent and run in isolation.
- Use Factories: Don't hardcode data. Use
userFactory.createUser()to get fresh data. - Network First: When testing external APIs, use network interception to avoid flakiness.