qaa-agent 1.7.0 → 1.7.1

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/bin/install.cjs CHANGED
@@ -143,12 +143,22 @@ async function main() {
143
143
  copyFile(path.join(ROOT, 'CLAUDE.md'), path.join(qaaDir, 'CLAUDE.md'));
144
144
  ok('Installed QA standards (CLAUDE.md)');
145
145
 
146
- // Install .mcp.json (Playwright MCP server config)
146
+ // Install .mcp.json (Playwright MCP server config) -- both to qaaDir AND global baseDir
147
147
  const mcpSrc = path.join(ROOT, '.mcp.json');
148
148
  if (fs.existsSync(mcpSrc)) {
149
- const mcpDest = path.join(qaaDir, '.mcp.json');
150
- copyFile(mcpSrc, mcpDest);
151
- ok('Installed Playwright MCP server config (.mcp.json)');
149
+ // Copy to qaa dir for reference
150
+ copyFile(mcpSrc, path.join(qaaDir, '.mcp.json'));
151
+ // Merge into global ~/.claude/.mcp.json so Playwright MCP is available in ALL projects
152
+ const globalMcpPath = path.join(baseDir, '.mcp.json');
153
+ let globalMcp = { mcpServers: {} };
154
+ if (fs.existsSync(globalMcpPath)) {
155
+ try { globalMcp = JSON.parse(fs.readFileSync(globalMcpPath, 'utf8')); } catch {}
156
+ globalMcp.mcpServers = globalMcp.mcpServers || {};
157
+ }
158
+ const qaaMcp = JSON.parse(fs.readFileSync(mcpSrc, 'utf8'));
159
+ Object.assign(globalMcp.mcpServers, qaaMcp.mcpServers);
160
+ fs.writeFileSync(globalMcpPath, JSON.stringify(globalMcp, null, 2));
161
+ ok('Installed Playwright MCP server config (global — available in all projects)');
152
162
  }
153
163
 
154
164
  // Write version
@@ -5,12 +5,13 @@ Validate, diagnose, and fix test files — all in one command. Runs 4-layer stat
5
5
  ## Usage
6
6
 
7
7
  ```
8
- /qa-fix [<test-directory>] [options]
8
+ /qa-fix [<test-files-or-directory>] [options]
9
9
  ```
10
10
 
11
11
  ### Options
12
12
 
13
- - `<test-directory>` — path to test files (auto-detects if omitted)
13
+ - `<test-files-or-directory>` — one or more test file paths or a directory (auto-detects if omitted)
14
+ - `--check` — **final check mode**: full quality verification against company preferences, codebase conventions, and execution
14
15
  - `--validate-only` — run 4-layer static validation only, no test execution or classification
15
16
  - `--classify` — run tests and classify failures, but do NOT auto-fix
16
17
  - `--run --app-url <url>` — also execute E2E tests against live app after static validation
@@ -20,7 +21,9 @@ Validate, diagnose, and fix test files — all in one command. Runs 4-layer stat
20
21
  ### Mode Detection
21
22
 
22
23
  ```
23
- if --validate-only:
24
+ if --check:
25
+ MODE = "check" → full quality check + execution + QA_CHECK_REPORT.md
26
+ elif --validate-only:
24
27
  MODE = "validate" → 4-layer static validation + VALIDATION_REPORT.md
25
28
  elif --classify:
26
29
  MODE = "classify" → run tests + classify failures (no auto-fix)
@@ -32,6 +35,8 @@ else:
32
35
 
33
36
  | Mode | Artifacts |
34
37
  |------|-----------|
38
+ | check | QA_CHECK_REPORT.md (full quality verification with pass/fail per test file) |
39
+ | check --ticket | QA_CHECK_REPORT.md + UAT_VERIFICATION.md (step-by-step screenshots vs ticket acceptance criteria) |
35
40
  | validate | VALIDATION_REPORT.md (syntax, structure, dependencies, logic per file) |
36
41
  | classify | FAILURE_CLASSIFICATION_REPORT.md (per-failure evidence, no fixes) |
37
42
  | fix | FAILURE_CLASSIFICATION_REPORT.md + auto-fixed test files |
@@ -57,6 +62,249 @@ App URL: {url or "auto-detect"}
57
62
 
58
63
  ---
59
64
 
65
+ ### CHECK MODE (`--check`) — Final Quality Verification
66
+
67
+ Full quality check for specific test files. Reads ALL context sources, verifies every aspect of the tests, runs them, and produces a pass/fail report. Use this as a final gate before delivering tests.
68
+
69
+ **Accepts specific files:**
70
+ ```
71
+ /qa-fix --check tests/e2e/login.e2e.spec.ts tests/e2e/checkout.e2e.spec.ts
72
+ /qa-fix --check tests/unit/auth.unit.spec.ts
73
+ /qa-fix --check tests/e2e/ --app-url http://localhost:3000
74
+ ```
75
+
76
+ **Step 1: Read ALL context sources**
77
+
78
+ Read every available context source — this is not optional, all must be read:
79
+
80
+ 1. **CLAUDE.md** — QA standards, POM rules, locator tiers, assertion rules, naming conventions, quality gates
81
+ 2. **~/.claude/qaa/MY_PREFERENCES.md** — company/user preferences that OVERRIDE CLAUDE.md rules
82
+ 3. **Codebase map** (`.qa-output/codebase/`):
83
+ - `CODE_PATTERNS.md` — naming conventions, import style, file organization (are tests matching the project's style?)
84
+ - `API_CONTRACTS.md` — real API shapes (are API test payloads correct?)
85
+ - `TEST_SURFACE.md` — function signatures (are test targets real?)
86
+ - `TESTABILITY.md` — mock boundaries (are mocks set up correctly?)
87
+ 4. **Locator Registry** (`.qa-output/locators/`) — real locators from the app (are POM locators accurate?)
88
+ 5. **Existing test patterns** — read 2-3 existing test files in the same repo to understand current conventions (describe block style, import patterns, assertion patterns, fixture usage)
89
+
90
+ If codebase map is missing, STOP and tell the user to run `/qa-map` first.
91
+
92
+ **Step 2: Verify each test file across 7 dimensions**
93
+
94
+ For EACH selected test file, check:
95
+
96
+ | # | Dimension | What to check | Source |
97
+ |---|-----------|---------------|--------|
98
+ | 1 | **Naming** | File name, test IDs, describe/it names follow conventions | CLAUDE.md + CODE_PATTERNS.md + MY_PREFERENCES.md |
99
+ | 2 | **Structure** | Correct directory, imports resolve, follows repo patterns | CODE_PATTERNS.md + existing tests in repo |
100
+ | 3 | **Locators** | POM locators match registry, Tier 1 preferred, no stale selectors | LOCATOR_REGISTRY.md |
101
+ | 4 | **Assertions** | Concrete values (no toBeTruthy alone), match API contracts | CLAUDE.md + API_CONTRACTS.md |
102
+ | 5 | **POM compliance** | No assertions in POMs, locators as properties, extends BasePage | CLAUDE.md |
103
+ | 6 | **Code quality** | No redundant code, no dead code, no hardcoded credentials, no copy-paste | Code review |
104
+ | 7 | **Company conventions** | Matches all rules in MY_PREFERENCES.md | MY_PREFERENCES.md |
105
+
106
+ **Step 3: Run the tests**
107
+
108
+ Execute the selected test files:
109
+
110
+ ```bash
111
+ # Detect test runner from project config
112
+ npx playwright test {files} --reporter=json 2>&1 # if Playwright
113
+ npx cypress run --spec {files} 2>&1 # if Cypress
114
+ npx jest {files} --json 2>&1 # if Jest
115
+ npx vitest run {files} --reporter=json 2>&1 # if Vitest
116
+ ```
117
+
118
+ If E2E tests and app URL available, also verify with Playwright MCP:
119
+ - Navigate to each page referenced in the tests
120
+ - `browser_snapshot()` to verify elements exist in DOM
121
+ - Cross-reference locators against real page
122
+
123
+ **Step 4: Fix issues found**
124
+
125
+ For each issue found:
126
+ - **AUTO-FIX** (HIGH confidence): naming, imports, locator mismatches, missing await, Tier 4→Tier 1 upgrade when registry has the value
127
+ - **FLAG for review** (MEDIUM/LOW): logic changes, assertion value changes, structural refactors
128
+ - Re-run tests after fixes (max 5 loops)
129
+
130
+ **Step 5: Produce QA_CHECK_REPORT.md**
131
+
132
+ ```markdown
133
+ # QA Check Report
134
+
135
+ ## Summary
136
+
137
+ | Metric | Value |
138
+ |--------|-------|
139
+ | Files checked | {N} |
140
+ | Dimensions checked | 7 |
141
+ | Issues found | {N} |
142
+ | Auto-fixed | {N} |
143
+ | Flagged for review | {N} |
144
+ | Tests passed | {N}/{total} |
145
+ | Overall | PASS / PASS WITH WARNINGS / FAIL |
146
+
147
+ ## Per-File Results
148
+
149
+ ### {file_path}
150
+
151
+ | Dimension | Status | Details |
152
+ |-----------|--------|---------|
153
+ | Naming | PASS/FAIL | {specific details} |
154
+ | Structure | PASS/FAIL | {specific details} |
155
+ | Locators | PASS/FAIL | {specific details} |
156
+ | Assertions | PASS/FAIL | {specific details} |
157
+ | POM compliance | PASS/FAIL | {specific details} |
158
+ | Code quality | PASS/FAIL | {specific details} |
159
+ | Company conventions | PASS/FAIL | {specific details} |
160
+
161
+ **Test execution:** PASS / FAIL ({error if failed})
162
+ **Fixes applied:** {list of auto-fixes}
163
+ **Flagged for review:** {list of items needing human review}
164
+
165
+ [... repeat per file ...]
166
+
167
+ ## Flagged Items (Needs Human Review)
168
+
169
+ | File | Dimension | Issue | Suggested Fix |
170
+ |------|-----------|-------|---------------|
171
+ | ... | ... | ... | ... |
172
+ ```
173
+
174
+ Write to `.qa-output/QA_CHECK_REPORT.md`.
175
+
176
+ Present results to user with clear PASS/FAIL per file and overall status.
177
+
178
+ **Step 6 (optional): Ticket Verification (`--ticket <source>`)**
179
+
180
+ If `--ticket` flag is provided, perform UAT verification — walk through the test flow step-by-step in the browser, take screenshots at each step, and compare against the ticket's acceptance criteria.
181
+
182
+ **Usage:**
183
+ ```
184
+ /qa-fix --check --ticket #123 tests/e2e/login.e2e.spec.ts --app-url http://localhost:3000
185
+ /qa-fix --check --ticket https://company.atlassian.net/browse/PROJ-456 tests/e2e/checkout.e2e.spec.ts
186
+ /qa-fix --check --ticket "User logs in, sees dashboard with welcome message, clicks profile" tests/e2e/login.e2e.spec.ts
187
+ ```
188
+
189
+ **Requires:** `--app-url` or auto-detected running app. Cannot do ticket verification without a live app.
190
+
191
+ **Step 6a: Fetch and parse the ticket**
192
+
193
+ Same ticket parsing as `/qa-create-test` from-ticket mode:
194
+ - GitHub Issue: `gh issue view` → extract title, body, ACs
195
+ - Jira/Linear URL: `WebFetch` → extract content
196
+ - Plain text: use directly as acceptance criteria
197
+ - File path: read file content
198
+
199
+ Extract:
200
+ - Acceptance criteria (AC-1, AC-2, ...)
201
+ - Expected user flow (step-by-step)
202
+ - Expected outcomes per step
203
+
204
+ **Step 6b: Walk through the flow with Playwright MCP**
205
+
206
+ For each E2E test file being checked, replay the user journey manually in the browser step-by-step:
207
+
208
+ ```
209
+ For each step in the ticket's user flow:
210
+
211
+ 1. Execute the action described in the step:
212
+ - Navigate: mcp__playwright__browser_navigate({ url: "{page}" })
213
+ - Fill form: mcp__playwright__browser_fill_form({ ... })
214
+ - Click: mcp__playwright__browser_click({ element: "..." })
215
+ - Wait: mcp__playwright__browser_wait_for({ text: "..." })
216
+
217
+ 2. Take screenshot AFTER the action:
218
+ mcp__playwright__browser_take_screenshot()
219
+ → Save to .qa-output/uat-screenshots/{test-name}-step-{N}.png
220
+
221
+ 3. Take accessibility snapshot to read page state:
222
+ mcp__playwright__browser_snapshot()
223
+
224
+ 4. Record what the page shows:
225
+ - URL after action
226
+ - Visible text/headings
227
+ - Form state
228
+ - Error messages (if any)
229
+ - Elements visible/hidden
230
+ ```
231
+
232
+ **Step 6c: Compare actual vs ticket**
233
+
234
+ For each acceptance criterion from the ticket:
235
+
236
+ | AC | Expected (from ticket) | Actual (from browser) | Screenshot | Verdict |
237
+ |----|----------------------|---------------------|------------|---------|
238
+ | AC-1 | User sees login form | Login form visible with email/password fields | step-1.png | MATCH |
239
+ | AC-2 | After login, redirect to dashboard | Redirected to /dashboard, "Welcome" visible | step-3.png | MATCH |
240
+ | AC-3 | Error message for wrong password | "Invalid credentials" alert shown | step-5.png | MATCH |
241
+ | AC-4 | Remember me keeps session | Session persists after browser close | step-7.png | MISMATCH — session expired |
242
+
243
+ Verdicts:
244
+ - **MATCH** — actual behavior matches what the ticket describes
245
+ - **MISMATCH** — actual behavior differs from ticket (could be app bug OR test not covering this AC)
246
+ - **NOT TESTED** — ticket has an AC but no test step covers it
247
+ - **EXTRA** — test covers something not in the ticket (informational, not a failure)
248
+
249
+ **Step 6d: Produce UAT_VERIFICATION.md**
250
+
251
+ ```markdown
252
+ # UAT Verification Report
253
+
254
+ ## Ticket Info
255
+
256
+ | Field | Value |
257
+ |-------|-------|
258
+ | Source | {ticket URL or text} |
259
+ | Title | {ticket title} |
260
+ | ACs extracted | {count} |
261
+ | Test files verified | {count} |
262
+
263
+ ## Step-by-Step Walkthrough
264
+
265
+ ### Step 1: {action description}
266
+ - **Action:** Navigate to /login
267
+ - **Screenshot:** [step-1.png](.qa-output/uat-screenshots/{test}-step-1.png)
268
+ - **Page state:** Login form visible, email and password fields empty, "Log in" button enabled
269
+ - **Matches AC:** AC-1 ✓
270
+
271
+ ### Step 2: {action description}
272
+ - **Action:** Fill email "test@example.com", password "SecureP@ss123!"
273
+ - **Screenshot:** [step-2.png]
274
+ - **Page state:** Fields filled, button still enabled
275
+ - **Matches AC:** (intermediate step, no AC)
276
+
277
+ [... repeat per step ...]
278
+
279
+ ## AC Coverage Matrix
280
+
281
+ | AC | Description | Tested | Verdict | Evidence |
282
+ |----|-------------|--------|---------|----------|
283
+ | AC-1 | Login form visible | Yes | MATCH | step-1.png |
284
+ | AC-2 | Redirect to dashboard | Yes | MATCH | step-3.png |
285
+ | AC-3 | Error on wrong password | Yes | MATCH | step-5.png |
286
+ | AC-4 | Remember me session | No | NOT TESTED | — |
287
+
288
+ ## Summary
289
+
290
+ | Metric | Value |
291
+ |--------|-------|
292
+ | ACs from ticket | {N} |
293
+ | ACs matched | {N} |
294
+ | ACs mismatched | {N} |
295
+ | ACs not tested | {N} |
296
+ | Screenshots captured | {N} |
297
+ | Overall | PASS / PARTIAL / FAIL |
298
+ ```
299
+
300
+ Write to `.qa-output/UAT_VERIFICATION.md`.
301
+
302
+ If any AC is MISMATCH or NOT TESTED, present to user with recommendation:
303
+ - MISMATCH → "AC-4 says X but the app does Y — either the app has a bug or the test needs updating"
304
+ - NOT TESTED → "AC-4 is not covered by any test step — consider adding a test case"
305
+
306
+ ---
307
+
60
308
  ### VALIDATE MODE (`--validate-only`)
61
309
 
62
310
  1. Read `CLAUDE.md` — quality gates, locator tiers, assertion rules.
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "qaa-agent",
3
- "version": "1.7.0",
3
+ "version": "1.7.1",
4
4
  "description": "QA Automation Agent for Claude Code — multi-agent pipeline that analyzes repos, generates tests, validates, and creates PRs",
5
5
  "bin": {
6
6
  "qaa-agent": "./bin/install.cjs"