@qazuor/claude-code-config 0.1.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/LICENSE +21 -0
- package/README.md +1248 -0
- package/dist/bin.cjs +11886 -0
- package/dist/bin.cjs.map +1 -0
- package/dist/bin.d.cts +1 -0
- package/dist/bin.d.ts +1 -0
- package/dist/bin.js +11869 -0
- package/dist/bin.js.map +1 -0
- package/dist/index.cjs +3887 -0
- package/dist/index.cjs.map +1 -0
- package/dist/index.d.cts +1325 -0
- package/dist/index.d.ts +1325 -0
- package/dist/index.js +3835 -0
- package/dist/index.js.map +1 -0
- package/package.json +86 -0
- package/templates/.log/notifications.log +1775 -0
- package/templates/agents/README.md +164 -0
- package/templates/agents/_registry.json +443 -0
- package/templates/agents/design/content-writer.md +353 -0
- package/templates/agents/design/ux-ui-designer.md +382 -0
- package/templates/agents/engineering/astro-engineer.md +293 -0
- package/templates/agents/engineering/db-drizzle-engineer.md +360 -0
- package/templates/agents/engineering/express-engineer.md +316 -0
- package/templates/agents/engineering/fastify-engineer.md +399 -0
- package/templates/agents/engineering/hono-engineer.md +263 -0
- package/templates/agents/engineering/mongoose-engineer.md +473 -0
- package/templates/agents/engineering/nestjs-engineer.md +429 -0
- package/templates/agents/engineering/nextjs-engineer.md +451 -0
- package/templates/agents/engineering/node-typescript-engineer.md +347 -0
- package/templates/agents/engineering/prisma-engineer.md +432 -0
- package/templates/agents/engineering/react-senior-dev.md +394 -0
- package/templates/agents/engineering/tanstack-start-engineer.md +447 -0
- package/templates/agents/engineering/tech-lead.md +269 -0
- package/templates/agents/product/product-functional.md +329 -0
- package/templates/agents/product/product-technical.md +578 -0
- package/templates/agents/quality/debugger.md +514 -0
- package/templates/agents/quality/qa-engineer.md +390 -0
- package/templates/agents/specialized/enrichment-agent.md +277 -0
- package/templates/agents/specialized/i18n-specialist.md +322 -0
- package/templates/agents/specialized/seo-ai-specialist.md +387 -0
- package/templates/agents/specialized/tech-writer.md +300 -0
- package/templates/code-style/.editorconfig +27 -0
- package/templates/code-style/.prettierignore +25 -0
- package/templates/code-style/.prettierrc +12 -0
- package/templates/code-style/biome.json +78 -0
- package/templates/code-style/commitlint.config.js +44 -0
- package/templates/commands/README.md +175 -0
- package/templates/commands/_registry.json +420 -0
- package/templates/commands/add-new-entity.md +211 -0
- package/templates/commands/audit/accessibility-audit.md +360 -0
- package/templates/commands/audit/performance-audit.md +290 -0
- package/templates/commands/audit/security-audit.md +231 -0
- package/templates/commands/code-check.md +127 -0
- package/templates/commands/five-why.md +225 -0
- package/templates/commands/formatting/format-markdown.md +197 -0
- package/templates/commands/git/commit.md +247 -0
- package/templates/commands/meta/create-agent.md +257 -0
- package/templates/commands/meta/create-command.md +312 -0
- package/templates/commands/meta/create-skill.md +321 -0
- package/templates/commands/meta/help.md +318 -0
- package/templates/commands/planning/check-completed-tasks.md +224 -0
- package/templates/commands/planning/cleanup-issues.md +248 -0
- package/templates/commands/planning/planning-cleanup.md +251 -0
- package/templates/commands/planning/sync-planning-github.md +133 -0
- package/templates/commands/planning/sync-todos-github.md +203 -0
- package/templates/commands/quality-check.md +211 -0
- package/templates/commands/run-tests.md +159 -0
- package/templates/commands/start-feature-plan.md +232 -0
- package/templates/commands/start-refactor-plan.md +244 -0
- package/templates/commands/sync-planning.md +176 -0
- package/templates/commands/update-docs.md +242 -0
- package/templates/docs/CHECKPOINT-SYSTEM.md +504 -0
- package/templates/docs/INDEX.md +677 -0
- package/templates/docs/RECOMMENDED-HOOKS.md +415 -0
- package/templates/docs/_registry.json +329 -0
- package/templates/docs/diagrams/README.md +220 -0
- package/templates/docs/diagrams/agent-hierarchy.mmd +55 -0
- package/templates/docs/diagrams/documentation-map.mmd +61 -0
- package/templates/docs/diagrams/tools-relationship.mmd +55 -0
- package/templates/docs/diagrams/workflow-decision-tree.mmd +38 -0
- package/templates/docs/doc-sync.md +533 -0
- package/templates/docs/examples/end-to-end-workflow.md +1505 -0
- package/templates/docs/glossary.md +495 -0
- package/templates/docs/guides/mockup-prompt-engineering.md +644 -0
- package/templates/docs/guides/mockup-setup.md +737 -0
- package/templates/docs/learnings/README.md +250 -0
- package/templates/docs/learnings/common-architectural-patterns.md +123 -0
- package/templates/docs/learnings/common-mistakes-to-avoid.md +149 -0
- package/templates/docs/learnings/markdown-formatting-standards.md +104 -0
- package/templates/docs/learnings/monorepo-command-execution.md +64 -0
- package/templates/docs/learnings/optimization-tips.md +146 -0
- package/templates/docs/learnings/planning-linear-sync-workflow.md +70 -0
- package/templates/docs/learnings/shell-compatibility-fish.md +46 -0
- package/templates/docs/learnings/test-organization-structure.md +68 -0
- package/templates/docs/mcp-installation.md +613 -0
- package/templates/docs/mcp-servers.md +989 -0
- package/templates/docs/notification-installation.md +570 -0
- package/templates/docs/quick-start.md +354 -0
- package/templates/docs/standards/architecture-patterns.md +1064 -0
- package/templates/docs/standards/atomic-commits.md +513 -0
- package/templates/docs/standards/code-standards.md +993 -0
- package/templates/docs/standards/design-standards.md +656 -0
- package/templates/docs/standards/documentation-standards.md +1160 -0
- package/templates/docs/standards/testing-standards.md +969 -0
- package/templates/docs/system-maintenance.md +604 -0
- package/templates/docs/templates/PDR-template.md +561 -0
- package/templates/docs/templates/TODOs-template.md +534 -0
- package/templates/docs/templates/tech-analysis-template.md +800 -0
- package/templates/docs/workflows/README.md +519 -0
- package/templates/docs/workflows/atomic-task-protocol.md +955 -0
- package/templates/docs/workflows/decision-tree.md +482 -0
- package/templates/docs/workflows/edge-cases.md +856 -0
- package/templates/docs/workflows/phase-1-planning.md +957 -0
- package/templates/docs/workflows/phase-2-implementation.md +896 -0
- package/templates/docs/workflows/phase-3-validation.md +792 -0
- package/templates/docs/workflows/phase-4-finalization.md +927 -0
- package/templates/docs/workflows/quick-fix-protocol.md +505 -0
- package/templates/docs/workflows/task-atomization.md +537 -0
- package/templates/docs/workflows/task-completion-protocol.md +448 -0
- package/templates/hooks/on-notification.sh +28 -0
- package/templates/schemas/checkpoint.schema.json +97 -0
- package/templates/schemas/code-registry.schema.json +84 -0
- package/templates/schemas/pdr.schema.json +314 -0
- package/templates/schemas/problems.schema.json +55 -0
- package/templates/schemas/tech-analysis.schema.json +404 -0
- package/templates/schemas/telemetry.schema.json +298 -0
- package/templates/schemas/todos.schema.json +234 -0
- package/templates/schemas/workflows.schema.json +69 -0
- package/templates/scripts/add-changelogs.sh +105 -0
- package/templates/scripts/generate-code-registry.ts +270 -0
- package/templates/scripts/health-check.sh +343 -0
- package/templates/scripts/sync-registry.sh +40 -0
- package/templates/scripts/telemetry-report.ts +36 -0
- package/templates/scripts/validate-docs.sh +224 -0
- package/templates/scripts/validate-registry.sh +225 -0
- package/templates/scripts/validate-schemas.ts +283 -0
- package/templates/scripts/validate-structure.sh +165 -0
- package/templates/scripts/worktree-cleanup.sh +81 -0
- package/templates/scripts/worktree-create.sh +63 -0
- package/templates/sessions/planning/.gitkeep +0 -0
- package/templates/sessions/planning/archived/.gitkeep +0 -0
- package/templates/settings.json +202 -0
- package/templates/settings.local.json +138 -0
- package/templates/skills/README.md +197 -0
- package/templates/skills/_registry.json +473 -0
- package/templates/skills/audit/accessibility-audit.md +309 -0
- package/templates/skills/audit/performance-audit.md +257 -0
- package/templates/skills/audit/security-audit.md +217 -0
- package/templates/skills/auth/nextauth-patterns.md +308 -0
- package/templates/skills/brand-guidelines.md +240 -0
- package/templates/skills/documentation/markdown-formatter.md +302 -0
- package/templates/skills/git/git-commit-helper.md +321 -0
- package/templates/skills/i18n/i18n-patterns.md +251 -0
- package/templates/skills/patterns/error-handling-patterns.md +242 -0
- package/templates/skills/patterns/tdd-methodology.md +342 -0
- package/templates/skills/qa/qa-criteria-validator.md +383 -0
- package/templates/skills/qa/web-app-testing.md +398 -0
- package/templates/skills/react/react-hook-form-patterns.md +359 -0
- package/templates/skills/state/redux-toolkit-patterns.md +272 -0
- package/templates/skills/state/tanstack-query-patterns.md +299 -0
- package/templates/skills/state/zustand-patterns.md +301 -0
- package/templates/skills/tech/mermaid-diagram-specialist.md +195 -0
- package/templates/skills/tech/shadcn-specialist.md +252 -0
- package/templates/skills/tech/vercel-specialist.md +297 -0
- package/templates/skills/testing/api-app-testing.md +254 -0
- package/templates/skills/testing/performance-testing.md +275 -0
- package/templates/skills/testing/security-testing.md +348 -0
- package/templates/skills/utils/add-memory.md +295 -0
- package/templates/skills/utils/json-data-auditor.md +283 -0
- package/templates/skills/utils/pdf-creator-editor.md +342 -0
- package/templates/tools/format-markdown.sh +185 -0
|
@@ -0,0 +1,398 @@
|
|
|
1
|
+
---
|
|
2
|
+
name: web-app-testing
|
|
3
|
+
category: qa
|
|
4
|
+
description: Comprehensive web testing strategy using unit, integration, and E2E tests
|
|
5
|
+
usage: Use when implementing web features to ensure quality and coverage
|
|
6
|
+
input: Feature requirements, components, test framework configuration
|
|
7
|
+
output: Test suite with 90%+ coverage, E2E tests, accessibility validation
|
|
8
|
+
config_required:
|
|
9
|
+
- TEST_FRAMEWORK: "Unit test framework (e.g., Vitest, Jest)"
|
|
10
|
+
- UI_FRAMEWORK: "UI library (e.g., React, Vue, Svelte)"
|
|
11
|
+
- E2E_FRAMEWORK: "E2E test framework (e.g., Playwright, Cypress)"
|
|
12
|
+
- COVERAGE_TARGET: "Minimum coverage percentage (e.g., 90%)"
|
|
13
|
+
---
|
|
14
|
+
|
|
15
|
+
# Web App Testing
|
|
16
|
+
|
|
17
|
+
## ⚙️ Configuration
|
|
18
|
+
|
|
19
|
+
| Setting | Description | Example |
|
|
20
|
+
|---------|-------------|---------|
|
|
21
|
+
| TEST_FRAMEWORK | Unit/integration test framework | `Vitest`, `Jest` |
|
|
22
|
+
| UI_FRAMEWORK | UI library/framework | `React`, `Vue`, `Svelte` |
|
|
23
|
+
| E2E_FRAMEWORK | End-to-end test framework | `Playwright`, `Cypress` |
|
|
24
|
+
| COVERAGE_TARGET | Minimum coverage required | `90%` |
|
|
25
|
+
| A11Y_TOOL | Accessibility testing tool | `axe-core`, `pa11y` |
|
|
26
|
+
| TEST_LIBRARY | Component testing library | `Testing Library`, `Vue Test Utils` |
|
|
27
|
+
|
|
28
|
+
## Purpose
|
|
29
|
+
|
|
30
|
+
Comprehensive testing strategy ensuring quality, accessibility, and coverage across web applications.
|
|
31
|
+
|
|
32
|
+
## Capabilities
|
|
33
|
+
|
|
34
|
+
- Design test suites (unit, integration, E2E)
|
|
35
|
+
- Test components and user interactions
|
|
36
|
+
- Validate accessibility (WCAG AA)
|
|
37
|
+
- Measure test coverage
|
|
38
|
+
- Test responsive design
|
|
39
|
+
- Validate performance
|
|
40
|
+
|
|
41
|
+
## Test Pyramid
|
|
42
|
+
|
|
43
|
+
```text
|
|
44
|
+
/\
|
|
45
|
+
/E2E\ 5-10% - Critical user journeys
|
|
46
|
+
/------\
|
|
47
|
+
/ Int \ 15-20% - Component interactions
|
|
48
|
+
/----------\
|
|
49
|
+
/ Unit \ 70-80% - Business logic
|
|
50
|
+
/--------------\
|
|
51
|
+
```
|
|
52
|
+
|
|
53
|
+
**Distribution:**
|
|
54
|
+
- Unit Tests: 70-80% - Fast, isolated
|
|
55
|
+
- Integration Tests: 15-20% - Component interactions
|
|
56
|
+
- E2E Tests: 5-10% - Critical flows
|
|
57
|
+
|
|
58
|
+
## Test Structure: AAA Pattern
|
|
59
|
+
|
|
60
|
+
Every test follows **Arrange-Act-Assert**:
|
|
61
|
+
|
|
62
|
+
```typescript
|
|
63
|
+
describe('Feature', () => {
|
|
64
|
+
it('should do something specific', () => {
|
|
65
|
+
// Arrange: Set up test data
|
|
66
|
+
const input = { value: 42 };
|
|
67
|
+
|
|
68
|
+
// Act: Execute behavior
|
|
69
|
+
const result = myFunction(input.value);
|
|
70
|
+
|
|
71
|
+
// Assert: Verify outcome
|
|
72
|
+
expect(result).toBe(84);
|
|
73
|
+
});
|
|
74
|
+
});
|
|
75
|
+
```
|
|
76
|
+
|
|
77
|
+
## Unit Testing
|
|
78
|
+
|
|
79
|
+
### Testing Pure Functions
|
|
80
|
+
|
|
81
|
+
```typescript
|
|
82
|
+
// utils/calculator.ts
|
|
83
|
+
export function calculateTotal(input: {
|
|
84
|
+
basePrice: number;
|
|
85
|
+
quantity: number;
|
|
86
|
+
discount: number;
|
|
87
|
+
}): number {
|
|
88
|
+
const subtotal = input.basePrice * input.quantity;
|
|
89
|
+
return subtotal * (1 - input.discount / 100);
|
|
90
|
+
}
|
|
91
|
+
|
|
92
|
+
// utils/calculator.test.ts
|
|
93
|
+
import { describe, it, expect } from '{{TEST_FRAMEWORK}}';
|
|
94
|
+
import { calculateTotal } from './calculator';
|
|
95
|
+
|
|
96
|
+
describe('calculateTotal', () => {
|
|
97
|
+
it('should calculate total with discount', () => {
|
|
98
|
+
const input = {
|
|
99
|
+
basePrice: 100,
|
|
100
|
+
quantity: 3,
|
|
101
|
+
discount: 10
|
|
102
|
+
};
|
|
103
|
+
|
|
104
|
+
const result = calculateTotal(input);
|
|
105
|
+
|
|
106
|
+
expect(result).toBe(270);
|
|
107
|
+
});
|
|
108
|
+
|
|
109
|
+
it('should handle zero discount', () => {
|
|
110
|
+
const input = {
|
|
111
|
+
basePrice: 100,
|
|
112
|
+
quantity: 2,
|
|
113
|
+
discount: 0
|
|
114
|
+
};
|
|
115
|
+
|
|
116
|
+
expect(calculateTotal(input)).toBe(200);
|
|
117
|
+
});
|
|
118
|
+
});
|
|
119
|
+
```
|
|
120
|
+
|
|
121
|
+
### Testing Components
|
|
122
|
+
|
|
123
|
+
```typescript
|
|
124
|
+
// components/Card.test.tsx
|
|
125
|
+
import { render, screen } from '@testing-library/react';
|
|
126
|
+
import { describe, it, expect } from '{{TEST_FRAMEWORK}}';
|
|
127
|
+
import { Card } from './Card';
|
|
128
|
+
|
|
129
|
+
describe('Card', () => {
|
|
130
|
+
const mockItem = {
|
|
131
|
+
id: '1',
|
|
132
|
+
title: 'Test Item',
|
|
133
|
+
description: 'Test description',
|
|
134
|
+
price: 150
|
|
135
|
+
};
|
|
136
|
+
|
|
137
|
+
it('should render item details', () => {
|
|
138
|
+
render(<Card item={mockItem} />);
|
|
139
|
+
|
|
140
|
+
expect(screen.getByText('Test Item')).toBeInTheDocument();
|
|
141
|
+
expect(screen.getByText('$150')).toBeInTheDocument();
|
|
142
|
+
});
|
|
143
|
+
|
|
144
|
+
it('should render image with alt text', () => {
|
|
145
|
+
render(<Card item={mockItem} />);
|
|
146
|
+
|
|
147
|
+
const image = screen.getByAltText('Test Item');
|
|
148
|
+
expect(image).toBeInTheDocument();
|
|
149
|
+
});
|
|
150
|
+
|
|
151
|
+
it('should have accessible link', () => {
|
|
152
|
+
render(<Card item={mockItem} />);
|
|
153
|
+
|
|
154
|
+
const link = screen.getByRole('link');
|
|
155
|
+
expect(link).toHaveAttribute('href', '/items/1');
|
|
156
|
+
});
|
|
157
|
+
});
|
|
158
|
+
```
|
|
159
|
+
|
|
160
|
+
## Integration Testing
|
|
161
|
+
|
|
162
|
+
### Testing API Integration
|
|
163
|
+
|
|
164
|
+
```typescript
|
|
165
|
+
// routes/items.test.ts
|
|
166
|
+
import { describe, it, expect, beforeAll, afterAll } from '{{TEST_FRAMEWORK}}';
|
|
167
|
+
import { testClient } from 'test-client';
|
|
168
|
+
import { app } from '../src/index';
|
|
169
|
+
import { db } from '@/db';
|
|
170
|
+
|
|
171
|
+
describe('Item API Routes', () => {
|
|
172
|
+
beforeAll(async () => {
|
|
173
|
+
await db.execute('BEGIN');
|
|
174
|
+
});
|
|
175
|
+
|
|
176
|
+
afterAll(async () => {
|
|
177
|
+
await db.execute('ROLLBACK');
|
|
178
|
+
});
|
|
179
|
+
|
|
180
|
+
describe('GET /api/items', () => {
|
|
181
|
+
it('should return list of items', async () => {
|
|
182
|
+
const res = await testClient(app).items.$get();
|
|
183
|
+
|
|
184
|
+
expect(res.status).toBe(200);
|
|
185
|
+
const data = await res.json();
|
|
186
|
+
expect(data).toHaveProperty('items');
|
|
187
|
+
expect(data.items).toBeInstanceOf(Array);
|
|
188
|
+
});
|
|
189
|
+
|
|
190
|
+
it('should filter by category', async () => {
|
|
191
|
+
const res = await testClient(app).items.$get({
|
|
192
|
+
query: { category: 'electronics' }
|
|
193
|
+
});
|
|
194
|
+
|
|
195
|
+
expect(res.status).toBe(200);
|
|
196
|
+
const data = await res.json();
|
|
197
|
+
expect(data.items.every(i => i.category === 'electronics')).toBe(true);
|
|
198
|
+
});
|
|
199
|
+
});
|
|
200
|
+
|
|
201
|
+
describe('POST /api/items', () => {
|
|
202
|
+
it('should create item when authenticated', async () => {
|
|
203
|
+
const newItem = {
|
|
204
|
+
title: 'New Item',
|
|
205
|
+
description: 'Description',
|
|
206
|
+
price: 200
|
|
207
|
+
};
|
|
208
|
+
|
|
209
|
+
const res = await testClient(app).items.$post({
|
|
210
|
+
json: newItem,
|
|
211
|
+
headers: { Authorization: 'Bearer valid-token' }
|
|
212
|
+
});
|
|
213
|
+
|
|
214
|
+
expect(res.status).toBe(201);
|
|
215
|
+
const data = await res.json();
|
|
216
|
+
expect(data.title).toBe('New Item');
|
|
217
|
+
});
|
|
218
|
+
|
|
219
|
+
it('should return 401 when not authenticated', async () => {
|
|
220
|
+
const res = await testClient(app).items.$post({
|
|
221
|
+
json: { title: 'Item' }
|
|
222
|
+
});
|
|
223
|
+
|
|
224
|
+
expect(res.status).toBe(401);
|
|
225
|
+
});
|
|
226
|
+
});
|
|
227
|
+
});
|
|
228
|
+
```
|
|
229
|
+
|
|
230
|
+
## E2E Testing
|
|
231
|
+
|
|
232
|
+
### Critical User Journeys
|
|
233
|
+
|
|
234
|
+
```typescript
|
|
235
|
+
// tests/e2e/checkout-flow.test.ts
|
|
236
|
+
import { test, expect } from '@playwright/test';
|
|
237
|
+
|
|
238
|
+
test.describe('Checkout Flow', () => {
|
|
239
|
+
test('user can complete purchase', async ({ page }) => {
|
|
240
|
+
// Navigate to homepage
|
|
241
|
+
await page.goto('/');
|
|
242
|
+
|
|
243
|
+
// Search for items
|
|
244
|
+
await page.fill('[aria-label="Search"]', 'laptop');
|
|
245
|
+
await page.click('button:has-text("Search")');
|
|
246
|
+
|
|
247
|
+
// Verify results
|
|
248
|
+
await expect(page.locator('h2')).toContainText('Results');
|
|
249
|
+
await expect(page.locator('[data-testid="item-card"]').first()).toBeVisible();
|
|
250
|
+
|
|
251
|
+
// Select item
|
|
252
|
+
await page.locator('[data-testid="item-card"]').first().click();
|
|
253
|
+
|
|
254
|
+
// Verify details page
|
|
255
|
+
await expect(page).toHaveURL(/\/items\//);
|
|
256
|
+
await expect(page.locator('h1')).toBeVisible();
|
|
257
|
+
|
|
258
|
+
// Add to cart
|
|
259
|
+
await page.click('button:has-text("Add to Cart")');
|
|
260
|
+
|
|
261
|
+
// Verify cart updated
|
|
262
|
+
await expect(page.locator('[data-testid="cart-count"]')).toContainText('1');
|
|
263
|
+
|
|
264
|
+
// Proceed to checkout
|
|
265
|
+
await page.click('[data-testid="cart-button"]');
|
|
266
|
+
await page.click('button:has-text("Checkout")');
|
|
267
|
+
|
|
268
|
+
// Complete purchase
|
|
269
|
+
await page.fill('[name="card-number"]', '4242424242424242');
|
|
270
|
+
await page.fill('[name="expiry"]', '12/25');
|
|
271
|
+
await page.fill('[name="cvc"]', '123');
|
|
272
|
+
await page.click('button[type="submit"]');
|
|
273
|
+
|
|
274
|
+
// Verify success
|
|
275
|
+
await expect(page.locator('h1')).toContainText('Order Confirmed');
|
|
276
|
+
});
|
|
277
|
+
|
|
278
|
+
test('should handle invalid payment', async ({ page }) => {
|
|
279
|
+
// Setup: Add item to cart
|
|
280
|
+
await page.goto('/items/1');
|
|
281
|
+
await page.click('button:has-text("Add to Cart")');
|
|
282
|
+
await page.click('button:has-text("Checkout")');
|
|
283
|
+
|
|
284
|
+
// Enter invalid card
|
|
285
|
+
await page.fill('[name="card-number"]', '0000000000000000');
|
|
286
|
+
await page.click('button[type="submit"]');
|
|
287
|
+
|
|
288
|
+
// Verify error
|
|
289
|
+
await expect(page.locator('[role="alert"]')).toContainText('Invalid card');
|
|
290
|
+
});
|
|
291
|
+
});
|
|
292
|
+
```
|
|
293
|
+
|
|
294
|
+
### Accessibility Testing
|
|
295
|
+
|
|
296
|
+
```typescript
|
|
297
|
+
// tests/e2e/accessibility.test.ts
|
|
298
|
+
import { test, expect } from '@playwright/test';
|
|
299
|
+
import { injectAxe, checkA11y } from 'axe-playwright';
|
|
300
|
+
|
|
301
|
+
test.describe('Accessibility', () => {
|
|
302
|
+
test('homepage is accessible', async ({ page }) => {
|
|
303
|
+
await page.goto('/');
|
|
304
|
+
await injectAxe(page);
|
|
305
|
+
|
|
306
|
+
await checkA11y(page, undefined, {
|
|
307
|
+
detailedReport: true
|
|
308
|
+
});
|
|
309
|
+
});
|
|
310
|
+
|
|
311
|
+
test('keyboard navigation works', async ({ page }) => {
|
|
312
|
+
await page.goto('/');
|
|
313
|
+
|
|
314
|
+
// Tab through elements
|
|
315
|
+
await page.keyboard.press('Tab');
|
|
316
|
+
await page.keyboard.press('Tab');
|
|
317
|
+
|
|
318
|
+
// Verify focus visible
|
|
319
|
+
const focused = await page.evaluate(() =>
|
|
320
|
+
document.activeElement?.tagName
|
|
321
|
+
);
|
|
322
|
+
expect(focused).toBeTruthy();
|
|
323
|
+
});
|
|
324
|
+
});
|
|
325
|
+
```
|
|
326
|
+
|
|
327
|
+
## Coverage Requirements
|
|
328
|
+
|
|
329
|
+
### Target: {{COVERAGE_TARGET}}
|
|
330
|
+
|
|
331
|
+
```bash
|
|
332
|
+
# Run tests with coverage
|
|
333
|
+
{{TEST_COMMAND}} --coverage
|
|
334
|
+
|
|
335
|
+
# View report
|
|
336
|
+
open coverage/index.html
|
|
337
|
+
```
|
|
338
|
+
|
|
339
|
+
**Configuration:**
|
|
340
|
+
|
|
341
|
+
```typescript
|
|
342
|
+
// test.config.ts
|
|
343
|
+
export default {
|
|
344
|
+
test: {
|
|
345
|
+
coverage: {
|
|
346
|
+
provider: 'v8',
|
|
347
|
+
thresholds: {
|
|
348
|
+
lines: 90,
|
|
349
|
+
functions: 90,
|
|
350
|
+
branches: 90,
|
|
351
|
+
statements: 90
|
|
352
|
+
}
|
|
353
|
+
}
|
|
354
|
+
}
|
|
355
|
+
}
|
|
356
|
+
```
|
|
357
|
+
|
|
358
|
+
## Best Practices
|
|
359
|
+
|
|
360
|
+
**DO:**
|
|
361
|
+
- Write tests before code (TDD)
|
|
362
|
+
- Use descriptive test names
|
|
363
|
+
- Follow AAA pattern
|
|
364
|
+
- Test edge cases
|
|
365
|
+
- Mock external dependencies
|
|
366
|
+
- Keep tests isolated
|
|
367
|
+
- Test user behavior, not implementation
|
|
368
|
+
|
|
369
|
+
**DON'T:**
|
|
370
|
+
- Test implementation details
|
|
371
|
+
- Share state between tests
|
|
372
|
+
- Write flaky tests
|
|
373
|
+
- Skip error cases
|
|
374
|
+
- Over-mock
|
|
375
|
+
- Depend on test order
|
|
376
|
+
- Ignore accessibility
|
|
377
|
+
|
|
378
|
+
## Output
|
|
379
|
+
|
|
380
|
+
**Produces:**
|
|
381
|
+
1. Test suite with {{COVERAGE_TARGET}}+ coverage
|
|
382
|
+
2. Test fixtures for reusable data
|
|
383
|
+
3. Test helpers for common operations
|
|
384
|
+
4. E2E tests for critical journeys
|
|
385
|
+
5. Accessibility tests
|
|
386
|
+
6. Coverage report
|
|
387
|
+
|
|
388
|
+
**Success Criteria:**
|
|
389
|
+
- All tests passing
|
|
390
|
+
- Coverage >= {{COVERAGE_TARGET}}
|
|
391
|
+
- No accessibility violations
|
|
392
|
+
- E2E tests cover critical paths
|
|
393
|
+
|
|
394
|
+
## Related Skills
|
|
395
|
+
|
|
396
|
+
- `tdd-methodology` - Test-Driven Development
|
|
397
|
+
- `api-app-testing` - API testing
|
|
398
|
+
- `qa-criteria-validator` - Acceptance criteria validation
|