Test Orchestrator
Master coordinator for all testing workflows. Understands the project test architecture, routes tasks to the correct specialized test subagent, and tracks overall test coverage.
Commands
| Command |
Description |
/creo test unit |
Write or run unit/integration tests |
/creo test e2e |
Write or run end-to-end Playwright tests |
/creo test plan |
Create a structured test plan for a feature |
/creo test coverage |
Analyze test coverage and identify gaps |
Subagents
| Subagent |
Purpose |
When to Route |
| creo-unit-test |
Unit and integration tests (Vitest/Jest + Testing Library) |
Component, store, hook, service, utility tests |
| creo-e2e-test |
End-to-end tests (Playwright) |
Full user flow, cross-page navigation, auth flows, responsive testing |
Core Instructions
Configuration
- Check for project-specific config at
.claude/project-config.md
- Read
project_id, test_frameworks, dev_server_url, coverage targets
- Load project extension if it exists at
.claude/skills/creo-test/creo-test-{project_id}.md. This file contains project-specific test frameworks, mock strategies, fixtures, page objects, and testing conventions. {project_id} comes from project-config.md. Always load it before doing work.
- If no config exists, use defaults or ask user
Routing Rules
Route to creo-unit-test when:
- "Write tests for this component"
- "Test this hook/store/utility"
- "Unit test the validation logic"
- "Integration test with providers"
- "Mock the API and test the component"
Route to creo-e2e-test when:
- "Test this user flow end to end"
- "E2E test for the wizard"
- "Test login and navigation"
- "Test responsive layout"
- "Automated browser test"
Handle yourself when:
- "Run all tests" -- Execute test commands
- "What is the test coverage?" -- Analyze existing tests
- "Create a test plan" -- Analyze source, create structured plan
- "What needs testing?" -- Read source, identify gaps
Creating Test Plans
When asked to test a feature:
- Read source code to understand what needs testing
- Identify which test types are needed (unit, integration, E2E)
- Create structured plan:
## Test Plan: [Feature Name]
### Unit / Integration Tests (creo-unit-test)
| File | Tests | Priority |
|------|-------|----------|
| `__tests__/component.test.tsx` | Rendering, interaction, state | P0 |
| `__tests__/hook.test.ts` | Hook logic, edge cases | P1 |
### E2E Tests (creo-e2e-test)
| File | Tests | Priority |
|------|-------|----------|
| `e2e/feature/happy-path.spec.ts` | Complete user flow | P0 |
| `e2e/feature/edge-cases.spec.ts` | Error handling | P1 |
| `e2e/feature/responsive.spec.ts` | Mobile/tablet | P2 |
### Mock Requirements
| Module | Mock Strategy |
|--------|---------------|
| API hooks | vi.mock() with factory functions |
| Navigation | Mock useRouter, usePathname |
- Ask for priority confirmation if the plan is large
- Delegate to specialized subagents
Unit Test Principles (creo-unit-test)
- Test behavior, not implementation -- test what the user sees
- One assertion per behavior -- each
it() tests one thing
- Arrange-Act-Assert pattern
- Factory functions for test data (no inline literals)
- Mock at the right level -- mock API layer, test component logic
- Frameworks: Vitest, Jest, Testing Library
E2E Test Principles (creo-e2e-test)
- Semantic locators --
getByRole(), getByText(), getByLabel() (accessibility-first)
- Test user flows, not implementation -- interact as a real user
- Explicit assertions -- no
waitForTimeout(), use proper waits
- Isolate tests -- each test is independent
- Auth state reuse --
storageState for authenticated tests
- Page Object Model for complex flows
- Responsive testing --
test.use({ viewport: { width, height } })
Running Tests
Typical patterns (check project config for specifics):
# Unit/Integration
pnpm test # Run all
pnpm test -- --reporter=verbose # Detailed output
pnpm test -- --coverage # With coverage
# E2E
npx playwright test # Run all E2E
npx playwright test --ui # Interactive mode
npx playwright test --debug # Debug mode
Tracking Coverage
- List existing test files
- List source files that lack tests
- Calculate rough coverage by file count
- Prioritize gaps: critical paths > happy paths > edge cases > error handling
Coordinating Cross-Agent Work
When a feature needs both unit and E2E tests:
- Start with unit tests (faster feedback loop)
- Then E2E tests (validates integration)
- Verify no regressions across the stack
Reference Files
Load these on demand for extended guidance:
| File |
Purpose |
references/test-patterns.md |
Common testing patterns and examples |
references/mock-strategies.md |
Mocking guide for different frameworks |
Quality Gates
Unit Tests
- All tests pass
- No TypeScript errors
- Tests are independent (no shared mutable state)
- Factory functions used for test data
- Mocks reset in
beforeEach
- Descriptive test names
- Edge cases covered (empty, null, error states)
E2E Tests
- All tests pass locally
- Tests are independent (no order dependency)
- Semantic locators used
- No
waitForTimeout() calls
- Auth state reused
- Responsive tests for mobile-critical features
- Screenshots on failure configured
1---2name: creo-test3description: Testing orchestration that routes to unit test and E2E test subagents. Manages test plans, coverage tracking, and coordinates test execution across the full stack. Supports Vitest/Jest for unit tests and Playwright for E2E tests. Trigger keywords: test, unit test, e2e test, end to end, test plan, test coverage, playwright, vitest.4---56# Test Orchestrator78Master coordinator for all testing workflows. Understands the project test architecture, routes tasks to the correct specialized test subagent, and tracks overall test coverage.910## Commands1112| Command | Description |13|---------|-------------|14| `/creo test unit` | Write or run unit/integration tests |15| `/creo test e2e` | Write or run end-to-end Playwright tests |16| `/creo test plan` | Create a structured test plan for a feature |17| `/creo test coverage` | Analyze test coverage and identify gaps |1819## Subagents2021| Subagent | Purpose | When to Route |22|----------|---------|---------------|23| creo-unit-test | Unit and integration tests (Vitest/Jest + Testing Library) | Component, store, hook, service, utility tests |24| creo-e2e-test | End-to-end tests (Playwright) | Full user flow, cross-page navigation, auth flows, responsive testing |2526## Core Instructions2728### Configuration29301. Check for project-specific config at `.claude/project-config.md`312. Read `project_id`, `test_frameworks`, `dev_server_url`, coverage targets323. Load project extension if it exists at `.claude/skills/creo-test/creo-test-{project_id}.md`. This file contains project-specific test frameworks, mock strategies, fixtures, page objects, and testing conventions. `{project_id}` comes from `project-config.md`. Always load it before doing work.334. If no config exists, use defaults or ask user3435### Routing Rules3637Route to **creo-unit-test** when:38- "Write tests for this component"39- "Test this hook/store/utility"40- "Unit test the validation logic"41- "Integration test with providers"42- "Mock the API and test the component"4344Route to **creo-e2e-test** when:45- "Test this user flow end to end"46- "E2E test for the wizard"47- "Test login and navigation"48- "Test responsive layout"49- "Automated browser test"5051Handle yourself when:52- "Run all tests" -- Execute test commands53- "What is the test coverage?" -- Analyze existing tests54- "Create a test plan" -- Analyze source, create structured plan55- "What needs testing?" -- Read source, identify gaps5657### Creating Test Plans5859When asked to test a feature:60611. Read source code to understand what needs testing622. Identify which test types are needed (unit, integration, E2E)633. Create structured plan:6465```markdown66## Test Plan: [Feature Name]6768### Unit / Integration Tests (creo-unit-test)6970| File | Tests | Priority |71|------|-------|----------|72| `__tests__/component.test.tsx` | Rendering, interaction, state | P0 |73| `__tests__/hook.test.ts` | Hook logic, edge cases | P1 |7475### E2E Tests (creo-e2e-test)7677| File | Tests | Priority |78|------|-------|----------|79| `e2e/feature/happy-path.spec.ts` | Complete user flow | P0 |80| `e2e/feature/edge-cases.spec.ts` | Error handling | P1 |81| `e2e/feature/responsive.spec.ts` | Mobile/tablet | P2 |8283### Mock Requirements8485| Module | Mock Strategy |86|--------|---------------|87| API hooks | vi.mock() with factory functions |88| Navigation | Mock useRouter, usePathname |89```90914. Ask for priority confirmation if the plan is large925. Delegate to specialized subagents9394### Unit Test Principles (creo-unit-test)9596- **Test behavior, not implementation** -- test what the user sees97- **One assertion per behavior** -- each `it()` tests one thing98- **Arrange-Act-Assert** pattern99- **Factory functions** for test data (no inline literals)100- **Mock at the right level** -- mock API layer, test component logic101- **Frameworks**: Vitest, Jest, Testing Library102103### E2E Test Principles (creo-e2e-test)104105- **Semantic locators** -- `getByRole()`, `getByText()`, `getByLabel()` (accessibility-first)106- **Test user flows, not implementation** -- interact as a real user107- **Explicit assertions** -- no `waitForTimeout()`, use proper waits108- **Isolate tests** -- each test is independent109- **Auth state reuse** -- `storageState` for authenticated tests110- **Page Object Model** for complex flows111- **Responsive testing** -- `test.use({ viewport: { width, height } })`112113### Running Tests114115Typical patterns (check project config for specifics):116117```bash118# Unit/Integration119pnpm test # Run all120pnpm test -- --reporter=verbose # Detailed output121pnpm test -- --coverage # With coverage122123# E2E124npx playwright test # Run all E2E125npx playwright test --ui # Interactive mode126npx playwright test --debug # Debug mode127```128129### Tracking Coverage1301311. List existing test files1322. List source files that lack tests1333. Calculate rough coverage by file count1344. Prioritize gaps: critical paths > happy paths > edge cases > error handling135136### Coordinating Cross-Agent Work137138When a feature needs both unit and E2E tests:1391. Start with unit tests (faster feedback loop)1402. Then E2E tests (validates integration)1413. Verify no regressions across the stack142143## Reference Files144145Load these on demand for extended guidance:146147| File | Purpose |148|------|---------|149| `references/test-patterns.md` | Common testing patterns and examples |150| `references/mock-strategies.md` | Mocking guide for different frameworks |151152## Quality Gates153154### Unit Tests155- All tests pass156- No TypeScript errors157- Tests are independent (no shared mutable state)158- Factory functions used for test data159- Mocks reset in `beforeEach`160- Descriptive test names161- Edge cases covered (empty, null, error states)162163### E2E Tests164- All tests pass locally165- Tests are independent (no order dependency)166- Semantic locators used167- No `waitForTimeout()` calls168- Auth state reused169- Responsive tests for mobile-critical features170- Screenshots on failure configured