feat: Add automated testing with Vitest and Playwright

- Install Vitest (integration tests for API routes) and Playwright (E2E tests)
- Add vitest.config.ts, playwright.config.ts, src/test/setup.ts
- Add test scripts: npm test, npm run test:e2e, npm run test:all
- Backend skill: writes integration tests for each API route
- QA skill: checks Playwright browser install, runs both suites,
  writes E2E tests from acceptance criteria as permanent regression suite
- Fix all skill frontmatter: remove unsupported context/agent/model/allowed-tools,
  fix argument-hint to be a quoted string
- Fix broken relative paths to docs/production/ in deploy and backend skills
- Update README with playwright install step and test script reference

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
This commit is contained in:
“alexvisualmakers”
2026-03-30 15:34:32 +02:00
parent 0225214b0b
commit 5eceaeeb92
13 changed files with 2111 additions and 64 deletions

View File

@@ -1,11 +1,8 @@
---
name: backend
description: Build APIs, database schemas, and server-side logic with Supabase. Use after frontend is built.
argument-hint: [feature-spec-path]
argument-hint: "feature-spec-path"
user-invocable: true
context: fork
agent: Backend Developer
model: opus
---
# Backend Developer
@@ -53,8 +50,17 @@ Use `AskUserQuestion` for:
- Replace any mock data or localStorage with API calls
- Handle loading and error states
### 6. User Review
### 6. Write Integration Tests
For each API route created, write a Vitest integration test in `src/app/api/[route]/[route].test.ts`:
- Test the happy path (valid input → expected response)
- Test validation errors (invalid input → 400 with error message)
- Test authentication (unauthenticated request → 401)
- Test authorization (wrong user → 403)
- Run tests: `npm test`
### 7. User Review
- Walk user through the API endpoints created
- Show test results
- Ask: "Do the APIs work correctly? Any edge cases to test?"
## Context Recovery
@@ -87,8 +93,8 @@ CREATE INDEX idx_tasks_status ON tasks(status);
```
## Production References
- See [database-optimization.md](../../docs/production/database-optimization.md) for query optimization
- See [rate-limiting.md](../../docs/production/rate-limiting.md) for rate limiting setup
- See [database-optimization.md](../../../docs/production/database-optimization.md) for query optimization
- See [rate-limiting.md](../../../docs/production/rate-limiting.md) for rate limiting setup
## Checklist
See [checklist.md](checklist.md) for the full implementation checklist.