# Test Suite Documentation This project uses **Playwright** for End-to-End (E2E) testing. ## Setup 1. Install dependencies: \`\`\`bash npm install \`\`\` 2. Setup environment: \`\`\`bash cp .env.example .env # Update .env with local configuration if needed \`\`\` 3. 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. Use `test` from here, not `@playwright/test`. - **`tests/support/fixtures/factories/`**: Data factories for generating test data. ### Best Practices 1. **Use `data-testid`**: Prefer `page.getByTestId('submit-btn')` over CSS/XPath selectors. 2. **Atomic Tests**: Each test should be independent and run in isolation. 3. **Use Factories**: Don't hardcode data. Use `userFactory.createUser()` to get fresh data. 4. **Network First**: When testing external APIs, use network interception to avoid flakiness.