qaa-agent 1.0.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.
Files changed (56) hide show
  1. package/.claude/commands/create-test.md +40 -0
  2. package/.claude/commands/qa-analyze.md +60 -0
  3. package/.claude/commands/qa-audit.md +37 -0
  4. package/.claude/commands/qa-blueprint.md +54 -0
  5. package/.claude/commands/qa-fix.md +36 -0
  6. package/.claude/commands/qa-from-ticket.md +88 -0
  7. package/.claude/commands/qa-gap.md +54 -0
  8. package/.claude/commands/qa-pom.md +36 -0
  9. package/.claude/commands/qa-pyramid.md +37 -0
  10. package/.claude/commands/qa-report.md +38 -0
  11. package/.claude/commands/qa-start.md +33 -0
  12. package/.claude/commands/qa-testid.md +54 -0
  13. package/.claude/commands/qa-validate.md +54 -0
  14. package/.claude/commands/update-test.md +58 -0
  15. package/.claude/settings.json +19 -0
  16. package/.claude/skills/qa-bug-detective/SKILL.md +122 -0
  17. package/.claude/skills/qa-repo-analyzer/SKILL.md +88 -0
  18. package/.claude/skills/qa-self-validator/SKILL.md +109 -0
  19. package/.claude/skills/qa-template-engine/SKILL.md +113 -0
  20. package/.claude/skills/qa-testid-injector/SKILL.md +93 -0
  21. package/.claude/skills/qa-workflow-documenter/SKILL.md +87 -0
  22. package/CLAUDE.md +543 -0
  23. package/README.md +418 -0
  24. package/agents/qa-pipeline-orchestrator.md +1217 -0
  25. package/agents/qaa-analyzer.md +508 -0
  26. package/agents/qaa-bug-detective.md +444 -0
  27. package/agents/qaa-executor.md +618 -0
  28. package/agents/qaa-planner.md +374 -0
  29. package/agents/qaa-scanner.md +422 -0
  30. package/agents/qaa-testid-injector.md +583 -0
  31. package/agents/qaa-validator.md +450 -0
  32. package/bin/install.cjs +176 -0
  33. package/bin/lib/commands.cjs +709 -0
  34. package/bin/lib/config.cjs +307 -0
  35. package/bin/lib/core.cjs +497 -0
  36. package/bin/lib/frontmatter.cjs +299 -0
  37. package/bin/lib/init.cjs +989 -0
  38. package/bin/lib/milestone.cjs +241 -0
  39. package/bin/lib/model-profiles.cjs +60 -0
  40. package/bin/lib/phase.cjs +911 -0
  41. package/bin/lib/roadmap.cjs +306 -0
  42. package/bin/lib/state.cjs +748 -0
  43. package/bin/lib/template.cjs +222 -0
  44. package/bin/lib/verify.cjs +842 -0
  45. package/bin/qaa-tools.cjs +607 -0
  46. package/package.json +34 -0
  47. package/templates/failure-classification.md +391 -0
  48. package/templates/gap-analysis.md +409 -0
  49. package/templates/pr-template.md +48 -0
  50. package/templates/qa-analysis.md +381 -0
  51. package/templates/qa-audit-report.md +465 -0
  52. package/templates/qa-repo-blueprint.md +636 -0
  53. package/templates/scan-manifest.md +312 -0
  54. package/templates/test-inventory.md +582 -0
  55. package/templates/testid-audit-report.md +354 -0
  56. package/templates/validation-report.md +243 -0
@@ -0,0 +1,636 @@
1
+ ---
2
+ template_name: qa-repo-blueprint
3
+ version: "1.0"
4
+ artifact_type: blueprint
5
+ produces: QA_REPO_BLUEPRINT.md
6
+ producer_agent: qa-analyzer
7
+ consumer_agents:
8
+ - qa-planner
9
+ - qa-executor
10
+ required_sections:
11
+ - project-info
12
+ - folder-structure
13
+ - recommended-stack
14
+ - config-files
15
+ - execution-scripts
16
+ - ci-cd-strategy
17
+ - definition-of-done
18
+ example_domain: shopflow
19
+ ---
20
+
21
+ # QA_REPO_BLUEPRINT.md Template
22
+
23
+ **Purpose:** Defines the complete structure, tooling, configuration, and setup for a new QA test repository. This blueprint is the single source of truth for how the test project is organized, what tools it uses, and how tests are executed locally and in CI.
24
+
25
+ **Producer:** qa-analyzer (when no QA repo exists for the target dev repo)
26
+ **Consumers:** qa-planner (to plan test generation work), qa-executor (to scaffold the repo and write tests in the correct locations)
27
+
28
+ ---
29
+
30
+ ## Required Sections
31
+
32
+ ### Section 1: Project Info
33
+
34
+ **Description:** Identifies the QA project and its relationship to the development repository.
35
+
36
+ **Fields:**
37
+
38
+ | Field | Type | Required | Description |
39
+ |-------|------|----------|-------------|
40
+ | Suggested Repo Name | string | YES | Pattern: `{project}-qa-tests` |
41
+ | Relationship | enum | YES | `separate-repo` or `subdirectory` |
42
+ | Target Dev Repo | URL/path | YES | The repository being tested |
43
+ | Framework Rationale | text | YES | Why this test framework was chosen for this specific dev repo |
44
+
45
+ ---
46
+
47
+ ### Section 2: Folder Structure
48
+
49
+ **Description:** Complete directory tree for the QA repository with a one-line explanation per directory. Every directory that agents will write files into must appear here.
50
+
51
+ **Fields:**
52
+
53
+ | Field | Type | Required | Description |
54
+ |-------|------|----------|-------------|
55
+ | Directory Tree | code block | YES | Full tree output with all directories |
56
+ | Per-Directory Explanation | text per entry | YES | What goes in each directory |
57
+
58
+ Must include at minimum:
59
+ - `tests/e2e/smoke/` -- P0 critical path tests run on every PR
60
+ - `tests/e2e/regression/` -- Full E2E suite run nightly
61
+ - `tests/api/` -- API-level tests
62
+ - `tests/unit/` -- Unit tests for business logic
63
+ - `pages/base/` -- Base page object with shared methods
64
+ - `pages/{feature}/` -- Feature-specific page objects
65
+ - `pages/components/` -- Reusable UI component objects
66
+ - `fixtures/` -- Test data and factories
67
+ - `config/` -- Test configuration files (if separate from root)
68
+ - `reports/` -- Generated reports (gitignored)
69
+ - `.github/workflows/` -- CI/CD pipeline definitions
70
+
71
+ ---
72
+
73
+ ### Section 3: Recommended Stack
74
+
75
+ **Description:** Technology recommendations specific to the target dev repo's language and framework.
76
+
77
+ **Fields:**
78
+
79
+ | Field | Type | Required | Description |
80
+ |-------|------|----------|-------------|
81
+ | Component | string | YES | What role (test framework, runner, assertion, reporter, mocking, API testing, CI) |
82
+ | Recommended Tool | string | YES | Specific tool name |
83
+ | Version | string | YES | Pinned version |
84
+ | Why Chosen | text | YES | Rationale tied to the dev repo's stack |
85
+
86
+ ---
87
+
88
+ ### Section 4: Config Files
89
+
90
+ **Description:** Complete, ready-to-use configuration files for the QA project. Each file is shown as a full code block -- not a snippet, the entire file.
91
+
92
+ Must include:
93
+ - Test framework config (e.g., `playwright.config.ts`)
94
+ - TypeScript config for the test project (`tsconfig.json`)
95
+ - Environment template (`.env.example`) with all required variables
96
+ - Gitignore additions (`.gitignore`)
97
+ - Package scripts section (`package.json` scripts)
98
+
99
+ ---
100
+
101
+ ### Section 5: Execution Scripts
102
+
103
+ **Description:** npm scripts table defining how to run each test suite.
104
+
105
+ **Fields:**
106
+
107
+ | Field | Type | Required | Description |
108
+ |-------|------|----------|-------------|
109
+ | Script Name | string | YES | npm script name |
110
+ | Command | string | YES | Actual command executed |
111
+ | When to Run | string | YES | PR gate, nightly, manual, etc. |
112
+ | What It Does | text | YES | One-line description |
113
+
114
+ Must include at minimum:
115
+ - `test:smoke` -- PR gate, critical path only
116
+ - `test:regression` -- Nightly, full E2E suite
117
+ - `test:api` -- API tests only
118
+ - `test:unit` -- Unit tests only
119
+ - `test:report` -- Generate HTML report
120
+ - `test:ci` -- Full CI run (all suites + report)
121
+
122
+ ---
123
+
124
+ ### Section 6: CI/CD Strategy
125
+
126
+ **Description:** Complete GitHub Actions workflow YAML defining the CI/CD pipeline for the QA repo.
127
+
128
+ Must include:
129
+ - Smoke tests on pull request (triggers on PR to main)
130
+ - Regression tests on schedule (nightly)
131
+ - Report artifact upload
132
+ - Failure notification
133
+
134
+ ---
135
+
136
+ ### Section 7: Definition of Done
137
+
138
+ **Description:** Checklist of 10-12 conditions that must all be true before the QA repo is considered ready for use. Covers structure, test execution, CI integration, and baseline quality.
139
+
140
+ ---
141
+
142
+ ## Worked Example (ShopFlow E-Commerce API)
143
+
144
+ Below is a complete, filled QA_REPO_BLUEPRINT.md for the ShopFlow e-commerce platform.
145
+
146
+ ---
147
+
148
+ ### Project Info
149
+
150
+ | Property | Value |
151
+ |----------|-------|
152
+ | **Suggested Repo Name** | `shopflow-qa-tests` |
153
+ | **Relationship** | Separate repository |
154
+ | **Target Dev Repo** | `https://github.com/shopflow/shopflow-api` |
155
+ | **Dev Stack** | Node.js 20, TypeScript 5.3, Express 4.18, PostgreSQL 15 (Prisma 5.7), Stripe SDK |
156
+ | **Framework Rationale** | Playwright chosen because ShopFlow has both a REST API and a React frontend. Playwright handles browser E2E, API testing, and has built-in TypeScript support -- matching the dev repo's language. Single framework for all test tiers reduces context switching and dependency surface. |
157
+
158
+ ---
159
+
160
+ ### Folder Structure
161
+
162
+ ```
163
+ shopflow-qa-tests/
164
+ tests/
165
+ e2e/
166
+ smoke/ # P0 critical path tests -- run on every PR
167
+ login.e2e.spec.ts # Auth flow smoke test
168
+ checkout.e2e.spec.ts # Purchase flow smoke test
169
+ regression/ # Full E2E suite -- run nightly
170
+ product-browse.e2e.spec.ts
171
+ order-management.e2e.spec.ts
172
+ payment-flow.e2e.spec.ts
173
+ user-profile.e2e.spec.ts
174
+ inventory-alerts.e2e.spec.ts
175
+ api/ # API-level tests (no browser)
176
+ auth.api.spec.ts # Register, login, refresh, logout
177
+ products.api.spec.ts # CRUD + search + filtering
178
+ orders.api.spec.ts # Create, status transitions, history
179
+ payments.api.spec.ts # Charge, refund, webhook verification
180
+ inventory.api.spec.ts # Stock queries, reservation
181
+ unit/ # Unit tests for business logic
182
+ priceCalculator.unit.spec.ts
183
+ orderStateMachine.unit.spec.ts
184
+ validators.unit.spec.ts
185
+ authToken.unit.spec.ts
186
+ pages/
187
+ base/
188
+ BasePage.ts # Shared methods: navigation, screenshots, waits, common assertions setup
189
+ auth/
190
+ LoginPage.ts # Login page: email input, password input, submit, error display
191
+ RegisterPage.ts # Registration form page object
192
+ products/
193
+ ProductListPage.ts # Product listing with filters and search
194
+ ProductDetailPage.ts # Single product view with add-to-cart
195
+ checkout/
196
+ CartPage.ts # Shopping cart with item management
197
+ CheckoutPage.ts # Multi-step checkout (address, payment, confirm)
198
+ orders/
199
+ OrderHistoryPage.ts # Order list and status display
200
+ OrderDetailPage.ts # Single order with tracking
201
+ components/
202
+ NavigationBar.ts # Top nav: logo, search, cart icon, user menu
203
+ ProductCard.ts # Reusable product card (list and grid views)
204
+ Pagination.ts # Shared pagination controls
205
+ Toast.ts # Notification toast component
206
+ fixtures/
207
+ auth-data.ts # Test user credentials, tokens
208
+ product-data.ts # Sample product objects (with SKUs, prices, images)
209
+ order-data.ts # Order payloads at various states
210
+ payment-data.ts # Stripe test tokens, webhook payloads
211
+ config/
212
+ global-setup.ts # Database seeding, auth token acquisition
213
+ global-teardown.ts # Cleanup: remove test data, close connections
214
+ reports/ # Generated reports -- gitignored
215
+ html/
216
+ json/
217
+ screenshots/
218
+ .github/
219
+ workflows/
220
+ qa-smoke.yml # PR trigger: smoke tests only
221
+ qa-regression.yml # Nightly schedule: full regression
222
+ playwright.config.ts # Main test framework configuration
223
+ tsconfig.json # TypeScript config for test project
224
+ package.json # Dependencies and scripts
225
+ .env.example # Required environment variables
226
+ .gitignore # Ignore reports, node_modules, .env
227
+ ```
228
+
229
+ **Directory Purposes:**
230
+
231
+ | Directory | Purpose |
232
+ |-----------|---------|
233
+ | `tests/e2e/smoke/` | P0 critical path tests that gate every pull request. Max 5-8 tests, must complete in under 2 minutes. |
234
+ | `tests/e2e/regression/` | Comprehensive E2E tests covering all user flows. Runs nightly. No time constraint. |
235
+ | `tests/api/` | API-level tests hitting REST endpoints directly. No browser. Validates contracts, status codes, response shapes. |
236
+ | `tests/unit/` | Pure business logic tests. No network, no browser. Tests price calculations, state machines, validators. |
237
+ | `pages/base/` | BasePage class with shared methods inherited by all page objects (goto, screenshot, waitForLoad). |
238
+ | `pages/{feature}/` | One page object per page/view, grouped by feature area. |
239
+ | `pages/components/` | Reusable component objects shared across multiple pages (nav bar, product card, pagination). |
240
+ | `fixtures/` | Test data factories and static test payloads. One file per domain (auth, product, order, payment). |
241
+ | `config/` | Global setup/teardown scripts for test infrastructure (DB seeding, auth tokens). |
242
+ | `reports/` | Generated HTML/JSON reports and failure screenshots. Entirely gitignored. |
243
+ | `.github/workflows/` | CI/CD pipeline definitions for smoke (PR) and regression (nightly) runs. |
244
+
245
+ ---
246
+
247
+ ### Recommended Stack
248
+
249
+ | Component | Recommended Tool | Version | Why Chosen |
250
+ |-----------|-----------------|---------|------------|
251
+ | Test Framework | Playwright | 1.40.x | Supports browser E2E + API testing in one framework. Built-in TypeScript. Matches ShopFlow's TS stack. |
252
+ | Test Runner | @playwright/test | 1.40.x | Native Playwright runner with parallel execution, retries, and built-in assertions. |
253
+ | Assertion Library | @playwright/test (expect) | 1.40.x | Built-in web-first assertions (toBeVisible, toHaveText) + standard expect for API/unit. |
254
+ | HTML Reporter | @playwright/test html | 1.40.x | Zero-config HTML report with traces, screenshots, and video on failure. |
255
+ | CI Reporter | Allure | 2.25.x | Rich CI reporting with history trends, categories, and Slack integration. |
256
+ | API Mocking | MSW (Mock Service Worker) | 2.1.x | Intercepts HTTP at the network level. Useful for isolating frontend tests from real API. |
257
+ | Linting | ESLint + @typescript-eslint | 6.x | Catches no-floating-promises, unused variables, and enforces test code quality. |
258
+ | CI Platform | GitHub Actions | N/A | Matches ShopFlow's existing CI. Native artifact upload and caching support. |
259
+
260
+ ---
261
+
262
+ ### Config Files
263
+
264
+ **playwright.config.ts**
265
+
266
+ ```typescript
267
+ import { defineConfig, devices } from '@playwright/test';
268
+ import dotenv from 'dotenv';
269
+
270
+ dotenv.config();
271
+
272
+ export default defineConfig({
273
+ testDir: './tests',
274
+ fullyParallel: true,
275
+ forbidOnly: !!process.env.CI,
276
+ retries: process.env.CI ? 2 : 0,
277
+ workers: process.env.CI ? 2 : undefined,
278
+ reporter: [
279
+ ['html', { outputFolder: 'reports/html', open: 'never' }],
280
+ ['json', { outputFile: 'reports/json/results.json' }],
281
+ ...(process.env.CI ? [['allure-playwright' as const]] : []),
282
+ ],
283
+ use: {
284
+ baseURL: process.env.BASE_URL || 'http://localhost:3000',
285
+ trace: 'on-first-retry',
286
+ screenshot: 'only-on-failure',
287
+ video: 'retain-on-failure',
288
+ },
289
+ projects: [
290
+ {
291
+ name: 'smoke',
292
+ testDir: './tests/e2e/smoke',
293
+ use: { ...devices['Desktop Chrome'] },
294
+ },
295
+ {
296
+ name: 'regression-chromium',
297
+ testDir: './tests/e2e/regression',
298
+ use: { ...devices['Desktop Chrome'] },
299
+ },
300
+ {
301
+ name: 'regression-firefox',
302
+ testDir: './tests/e2e/regression',
303
+ use: { ...devices['Desktop Firefox'] },
304
+ },
305
+ {
306
+ name: 'api',
307
+ testDir: './tests/api',
308
+ use: {
309
+ baseURL: process.env.API_URL || 'http://localhost:3000/api/v1',
310
+ },
311
+ },
312
+ {
313
+ name: 'unit',
314
+ testDir: './tests/unit',
315
+ },
316
+ ],
317
+ globalSetup: './config/global-setup.ts',
318
+ globalTeardown: './config/global-teardown.ts',
319
+ });
320
+ ```
321
+
322
+ **tsconfig.json**
323
+
324
+ ```json
325
+ {
326
+ "compilerOptions": {
327
+ "target": "ES2022",
328
+ "module": "ESNext",
329
+ "moduleResolution": "bundler",
330
+ "strict": true,
331
+ "esModuleInterop": true,
332
+ "skipLibCheck": true,
333
+ "forceConsistentCasingInFileNames": true,
334
+ "resolveJsonModule": true,
335
+ "outDir": "./dist",
336
+ "rootDir": ".",
337
+ "baseUrl": ".",
338
+ "paths": {
339
+ "@pages/*": ["pages/*"],
340
+ "@fixtures/*": ["fixtures/*"],
341
+ "@config/*": ["config/*"]
342
+ }
343
+ },
344
+ "include": ["tests/**/*.ts", "pages/**/*.ts", "fixtures/**/*.ts", "config/**/*.ts"],
345
+ "exclude": ["node_modules", "reports", "dist"]
346
+ }
347
+ ```
348
+
349
+ **.env.example**
350
+
351
+ ```bash
352
+ # ShopFlow QA Test Configuration
353
+ # Copy to .env and fill in values
354
+
355
+ # Application URLs
356
+ BASE_URL=http://localhost:3000
357
+ API_URL=http://localhost:3000/api/v1
358
+
359
+ # Test User Credentials (use test/staging accounts only)
360
+ TEST_USER_EMAIL=test@shopflow.dev
361
+ TEST_USER_PASSWORD=TestP@ss123!
362
+
363
+ # Admin User Credentials (for admin-only test flows)
364
+ TEST_ADMIN_EMAIL=admin@shopflow.dev
365
+ TEST_ADMIN_PASSWORD=AdminP@ss456!
366
+
367
+ # Database (for direct DB setup/teardown)
368
+ DATABASE_URL=postgresql://test:test@localhost:5432/shopflow_test
369
+
370
+ # Stripe Test Keys (for payment flow tests)
371
+ STRIPE_TEST_SECRET_KEY=sk_test_...
372
+ STRIPE_TEST_WEBHOOK_SECRET=whsec_test_...
373
+
374
+ # CI Configuration
375
+ CI=false
376
+ HEADLESS=true
377
+ ```
378
+
379
+ **.gitignore additions**
380
+
381
+ ```
382
+ # Test reports
383
+ reports/
384
+ allure-results/
385
+ allure-report/
386
+
387
+ # Test artifacts
388
+ test-results/
389
+ playwright-report/
390
+ screenshots/
391
+
392
+ # Environment
393
+ .env
394
+ .env.local
395
+
396
+ # Dependencies
397
+ node_modules/
398
+
399
+ # Build
400
+ dist/
401
+
402
+ # OS
403
+ .DS_Store
404
+ Thumbs.db
405
+ ```
406
+
407
+ **package.json scripts**
408
+
409
+ ```json
410
+ {
411
+ "name": "shopflow-qa-tests",
412
+ "version": "1.0.0",
413
+ "description": "QA test suite for ShopFlow e-commerce API and frontend",
414
+ "scripts": {
415
+ "test:smoke": "playwright test --project=smoke",
416
+ "test:regression": "playwright test --project=regression-chromium --project=regression-firefox",
417
+ "test:api": "playwright test --project=api",
418
+ "test:unit": "playwright test --project=unit",
419
+ "test:report": "playwright show-report reports/html",
420
+ "test:ci": "playwright test --project=smoke --project=api --project=unit && playwright test --project=regression-chromium",
421
+ "lint": "eslint tests/ pages/ fixtures/ --ext .ts",
422
+ "lint:fix": "eslint tests/ pages/ fixtures/ --ext .ts --fix"
423
+ },
424
+ "devDependencies": {
425
+ "@playwright/test": "^1.40.0",
426
+ "allure-playwright": "^2.25.0",
427
+ "dotenv": "^16.3.1",
428
+ "eslint": "^8.56.0",
429
+ "@typescript-eslint/eslint-plugin": "^6.19.0",
430
+ "@typescript-eslint/parser": "^6.19.0",
431
+ "typescript": "^5.3.0"
432
+ }
433
+ }
434
+ ```
435
+
436
+ ---
437
+
438
+ ### Execution Scripts
439
+
440
+ | Script | Command | When to Run | What It Does |
441
+ |--------|---------|-------------|-------------|
442
+ | `test:smoke` | `playwright test --project=smoke` | Every PR (CI gate) | Runs P0 critical path E2E tests in Chrome only. Must pass before merge. Target: under 2 minutes. |
443
+ | `test:regression` | `playwright test --project=regression-chromium --project=regression-firefox` | Nightly (scheduled) | Full E2E regression across Chrome and Firefox. Catches cross-browser issues. |
444
+ | `test:api` | `playwright test --project=api` | Every PR + nightly | API contract tests. No browser. Validates endpoints, status codes, response shapes. |
445
+ | `test:unit` | `playwright test --project=unit` | Every PR + nightly | Pure business logic tests. Fastest suite. Validates calculations, state machines, validators. |
446
+ | `test:report` | `playwright show-report reports/html` | After any test run (local) | Opens the HTML report in the default browser for visual review of results. |
447
+ | `test:ci` | `playwright test --project=smoke --project=api --project=unit && playwright test --project=regression-chromium` | Full CI run | Runs all suites sequentially: smoke + API + unit first (fast feedback), then full regression. |
448
+
449
+ ---
450
+
451
+ ### CI/CD Strategy
452
+
453
+ **qa-smoke.yml** (PR gate)
454
+
455
+ ```yaml
456
+ name: QA Smoke Tests
457
+
458
+ on:
459
+ pull_request:
460
+ branches: [main]
461
+
462
+ jobs:
463
+ smoke-tests:
464
+ runs-on: ubuntu-latest
465
+ timeout-minutes: 10
466
+
467
+ steps:
468
+ - name: Checkout QA repo
469
+ uses: actions/checkout@v4
470
+
471
+ - name: Setup Node.js
472
+ uses: actions/setup-node@v4
473
+ with:
474
+ node-version: 20
475
+ cache: 'npm'
476
+
477
+ - name: Install dependencies
478
+ run: npm ci
479
+
480
+ - name: Install Playwright browsers
481
+ run: npx playwright install --with-deps chromium
482
+
483
+ - name: Run smoke tests
484
+ run: npm run test:smoke
485
+ env:
486
+ BASE_URL: ${{ secrets.STAGING_BASE_URL }}
487
+ API_URL: ${{ secrets.STAGING_API_URL }}
488
+ TEST_USER_EMAIL: ${{ secrets.TEST_USER_EMAIL }}
489
+ TEST_USER_PASSWORD: ${{ secrets.TEST_USER_PASSWORD }}
490
+ CI: true
491
+
492
+ - name: Run API tests
493
+ run: npm run test:api
494
+ env:
495
+ API_URL: ${{ secrets.STAGING_API_URL }}
496
+ TEST_USER_EMAIL: ${{ secrets.TEST_USER_EMAIL }}
497
+ TEST_USER_PASSWORD: ${{ secrets.TEST_USER_PASSWORD }}
498
+ CI: true
499
+
500
+ - name: Run unit tests
501
+ run: npm run test:unit
502
+ env:
503
+ CI: true
504
+
505
+ - name: Upload test report
506
+ if: always()
507
+ uses: actions/upload-artifact@v4
508
+ with:
509
+ name: smoke-report-${{ github.run_number }}
510
+ path: reports/
511
+ retention-days: 7
512
+ ```
513
+
514
+ **qa-regression.yml** (Nightly)
515
+
516
+ ```yaml
517
+ name: QA Regression Suite
518
+
519
+ on:
520
+ schedule:
521
+ - cron: '0 2 * * *' # Every night at 2:00 AM UTC
522
+ workflow_dispatch: # Allow manual trigger
523
+
524
+ jobs:
525
+ regression-tests:
526
+ runs-on: ubuntu-latest
527
+ timeout-minutes: 30
528
+
529
+ steps:
530
+ - name: Checkout QA repo
531
+ uses: actions/checkout@v4
532
+
533
+ - name: Setup Node.js
534
+ uses: actions/setup-node@v4
535
+ with:
536
+ node-version: 20
537
+ cache: 'npm'
538
+
539
+ - name: Install dependencies
540
+ run: npm ci
541
+
542
+ - name: Install Playwright browsers
543
+ run: npx playwright install --with-deps
544
+
545
+ - name: Run full regression
546
+ run: npm run test:ci
547
+ env:
548
+ BASE_URL: ${{ secrets.STAGING_BASE_URL }}
549
+ API_URL: ${{ secrets.STAGING_API_URL }}
550
+ TEST_USER_EMAIL: ${{ secrets.TEST_USER_EMAIL }}
551
+ TEST_USER_PASSWORD: ${{ secrets.TEST_USER_PASSWORD }}
552
+ STRIPE_TEST_SECRET_KEY: ${{ secrets.STRIPE_TEST_SECRET_KEY }}
553
+ CI: true
554
+
555
+ - name: Upload test report
556
+ if: always()
557
+ uses: actions/upload-artifact@v4
558
+ with:
559
+ name: regression-report-${{ github.run_number }}
560
+ path: reports/
561
+ retention-days: 30
562
+
563
+ - name: Upload Allure results
564
+ if: always()
565
+ uses: actions/upload-artifact@v4
566
+ with:
567
+ name: allure-results-${{ github.run_number }}
568
+ path: allure-results/
569
+ retention-days: 30
570
+
571
+ - name: Notify on failure
572
+ if: failure()
573
+ uses: slackapi/slack-github-action@v1.25.0
574
+ with:
575
+ payload: |
576
+ {
577
+ "text": "QA Regression FAILED: ${{ github.server_url }}/${{ github.repository }}/actions/runs/${{ github.run_id }}"
578
+ }
579
+ env:
580
+ SLACK_WEBHOOK_URL: ${{ secrets.SLACK_QA_WEBHOOK }}
581
+ ```
582
+
583
+ ---
584
+
585
+ ### Definition of Done
586
+
587
+ The QA repository is ready for use when ALL of the following are true:
588
+
589
+ - [ ] Repository created with the exact folder structure defined above
590
+ - [ ] All configuration files committed (`playwright.config.ts`, `tsconfig.json`, `.env.example`, `.gitignore`)
591
+ - [ ] `npm install` completes without errors
592
+ - [ ] `npx playwright install` completes and browsers are available
593
+ - [ ] BasePage class exists in `pages/base/BasePage.ts` with shared methods (goto, screenshot, waitForLoad)
594
+ - [ ] At least one smoke test exists and passes: `npm run test:smoke` exits 0
595
+ - [ ] At least one API test exists and passes: `npm run test:api` exits 0
596
+ - [ ] At least one unit test exists and passes: `npm run test:unit` exits 0
597
+ - [ ] Fixtures directory has at least one fixture file with test data
598
+ - [ ] `.env.example` documents ALL required environment variables
599
+ - [ ] CI smoke workflow (`qa-smoke.yml`) runs successfully on a test PR
600
+ - [ ] CI regression workflow (`qa-regression.yml`) runs successfully on manual trigger
601
+
602
+ ---
603
+
604
+ ## Guidelines
605
+
606
+ **DO:**
607
+ - Match the test framework to the dev repo's language (TypeScript dev repo = TypeScript tests)
608
+ - Include the smoke/regression split for CI efficiency -- smoke gates PRs fast, regression catches everything nightly
609
+ - Pin dependency versions in package.json to avoid surprise breaking changes
610
+ - Include path aliases in tsconfig.json (`@pages/*`, `@fixtures/*`) for clean imports
611
+ - Include both Chrome and Firefox in regression projects for cross-browser coverage
612
+ - Put global setup/teardown in `config/` to keep it separate from test files
613
+ - Always include `.env.example` -- tests need configuration and new team members need to know what to set up
614
+
615
+ **DON'T:**
616
+ - Recommend Cypress for pure API testing -- use Playwright or a dedicated API testing tool. Cypress is browser-first and adds unnecessary overhead for API-only tests.
617
+ - Skip the `.env.example` file -- without it, no one knows which environment variables are required
618
+ - Put assertions in page objects -- assertions belong ONLY in test spec files
619
+ - Use a single "tests/" directory without e2e/api/unit separation -- this makes selective CI execution impossible
620
+ - Hardcode base URLs or credentials in config files -- always use environment variables
621
+ - Recommend more than one test framework unless the project genuinely needs it (e.g., Playwright for E2E + Vitest for isolated unit tests of shared utilities)
622
+
623
+ ---
624
+
625
+ ## Quality Gate
626
+
627
+ Before delivering a QA_REPO_BLUEPRINT.md, verify:
628
+
629
+ - [ ] All 7 required sections are present and filled (Project Info, Folder Structure, Recommended Stack, Config Files, Execution Scripts, CI/CD Strategy, Definition of Done)
630
+ - [ ] Folder structure includes all mandatory directories (tests/e2e/smoke, tests/e2e/regression, tests/api, tests/unit, pages/base, fixtures, reports, .github/workflows)
631
+ - [ ] Recommended stack tools are specific to the target dev repo's language and framework (not generic recommendations)
632
+ - [ ] Config files are complete and ready to use (not snippets -- full files)
633
+ - [ ] Execution scripts include all 6 required scripts (test:smoke, test:regression, test:api, test:unit, test:report, test:ci)
634
+ - [ ] CI/CD strategy includes both PR gate (smoke) and nightly schedule (regression)
635
+ - [ ] Definition of Done has 10+ checklist items covering structure, tests pass, CI green, and baseline quality
636
+ - [ ] No hardcoded credentials anywhere in config files -- all use environment variables