Files
brachnha-insight/tests/README.md
Max 3fbbb1a93b Initial commit: Brachnha Insight project setup
- 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>
2026-01-26 12:28:43 +07:00

54 lines
1.3 KiB
Markdown

# 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.