qaa-agent 1.6.2 → 1.6.3
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/.claude/commands/create-test.md +164 -164
- package/.claude/commands/qa-audit.md +37 -37
- package/.claude/commands/qa-blueprint.md +54 -54
- package/.claude/commands/qa-fix.md +36 -36
- package/.claude/commands/qa-from-ticket.md +24 -24
- package/.claude/commands/qa-gap.md +20 -20
- package/.claude/commands/qa-map.md +47 -47
- package/.claude/commands/qa-pom.md +36 -36
- package/.claude/commands/qa-pr.md +23 -23
- package/.claude/commands/qa-pyramid.md +37 -37
- package/.claude/commands/qa-report.md +38 -38
- package/.claude/commands/qa-research.md +33 -33
- package/.claude/commands/qa-start.md +22 -22
- package/.claude/commands/qa-testid.md +19 -19
- package/.claude/commands/qa-validate.md +42 -42
- package/.claude/commands/update-test.md +58 -58
- package/.claude/settings.json +20 -20
- package/.claude/skills/qa-bug-detective/SKILL.md +122 -122
- package/.claude/skills/qa-learner/SKILL.md +150 -150
- package/.claude/skills/qa-repo-analyzer/SKILL.md +88 -88
- package/.claude/skills/qa-self-validator/SKILL.md +109 -109
- package/.claude/skills/qa-template-engine/SKILL.md +113 -113
- package/.claude/skills/qa-testid-injector/SKILL.md +93 -93
- package/.claude/skills/qa-workflow-documenter/SKILL.md +87 -87
- package/.mcp.json +8 -8
- package/CHANGELOG.md +71 -71
- package/CLAUDE.md +553 -553
- package/agents/qa-pipeline-orchestrator.md +1378 -1378
- package/agents/qaa-analyzer.md +524 -524
- package/agents/qaa-bug-detective.md +446 -446
- package/agents/qaa-codebase-mapper.md +935 -935
- package/agents/qaa-e2e-runner.md +415 -415
- package/agents/qaa-executor.md +651 -651
- package/agents/qaa-planner.md +390 -390
- package/agents/qaa-project-researcher.md +319 -319
- package/agents/qaa-scanner.md +424 -424
- package/agents/qaa-testid-injector.md +585 -585
- package/agents/qaa-validator.md +452 -452
- package/bin/install.cjs +198 -198
- package/bin/lib/commands.cjs +709 -709
- package/bin/lib/config.cjs +307 -307
- package/bin/lib/core.cjs +497 -497
- package/bin/lib/frontmatter.cjs +299 -299
- package/bin/lib/init.cjs +989 -989
- package/bin/lib/milestone.cjs +241 -241
- package/bin/lib/model-profiles.cjs +60 -60
- package/bin/lib/phase.cjs +911 -911
- package/bin/lib/roadmap.cjs +306 -306
- package/bin/lib/state.cjs +748 -748
- package/bin/lib/template.cjs +222 -222
- package/bin/lib/verify.cjs +842 -842
- package/bin/qaa-tools.cjs +607 -607
- package/docs/COMMANDS.md +341 -341
- package/docs/DEMO.md +182 -182
- package/docs/TESTING.md +156 -156
- package/package.json +41 -41
- package/templates/failure-classification.md +391 -391
- package/templates/gap-analysis.md +409 -409
- package/templates/pr-template.md +48 -48
- package/templates/qa-analysis.md +381 -381
- package/templates/qa-audit-report.md +465 -465
- package/templates/qa-repo-blueprint.md +636 -636
- package/templates/scan-manifest.md +312 -312
- package/templates/test-inventory.md +582 -582
- package/templates/testid-audit-report.md +354 -354
- package/templates/validation-report.md +243 -243
- package/workflows/qa-analyze.md +296 -296
- package/workflows/qa-from-ticket.md +536 -536
- package/workflows/qa-gap.md +303 -303
- package/workflows/qa-pr.md +389 -389
- package/workflows/qa-start.md +1168 -1168
- package/workflows/qa-testid.md +356 -356
- package/workflows/qa-validate.md +295 -295
|
@@ -1,109 +1,109 @@
|
|
|
1
|
-
---
|
|
2
|
-
name: qa-self-validator
|
|
3
|
-
description: QA Self Validator. Closed-loop agent that validates generated test code across 4 layers (syntax, structure, dependencies, logic) and auto-fixes issues. Use when user wants to validate tests, check test quality, verify test code compiles, ensure tests follow standards, run quality checks on test suite, or verify generated tests before delivery. Triggers on "validate tests", "check test quality", "verify tests", "test validation", "quality check", "does it compile", "are tests valid", "check my tests".
|
|
4
|
-
---
|
|
5
|
-
|
|
6
|
-
# QA Self Validator
|
|
7
|
-
|
|
8
|
-
## Purpose
|
|
9
|
-
|
|
10
|
-
Closed-loop validation agent: Generate -> Validate -> Fix -> Deliver. Never deliver test code without at least one validation pass.
|
|
11
|
-
|
|
12
|
-
## Core Rule
|
|
13
|
-
|
|
14
|
-
**NEVER deliver generated QA code without running at least one validation pass. Max 3 fix loops before escalating.**
|
|
15
|
-
|
|
16
|
-
## Validation Layers
|
|
17
|
-
|
|
18
|
-
### Layer 1: Syntax
|
|
19
|
-
Run the appropriate checker based on language:
|
|
20
|
-
- TypeScript: `tsc --noEmit`
|
|
21
|
-
- JavaScript: `node --check [file]`
|
|
22
|
-
- Python: `python -m py_compile [file]`
|
|
23
|
-
- C#: `dotnet build --no-restore`
|
|
24
|
-
- Also run project linter if configured (eslint, flake8, etc.)
|
|
25
|
-
|
|
26
|
-
**Pass criteria**: Zero syntax errors.
|
|
27
|
-
|
|
28
|
-
### Layer 2: Structure
|
|
29
|
-
Check each test file for:
|
|
30
|
-
- Correct directory placement (e2e in e2e/, unit in unit/, etc.)
|
|
31
|
-
- Naming convention compliance (CLAUDE.md patterns)
|
|
32
|
-
- Has actual test functions (not empty describe blocks)
|
|
33
|
-
- Imports reference real modules in the codebase
|
|
34
|
-
- No hardcoded secrets/credentials/tokens
|
|
35
|
-
- Page objects in pages/ directory, tests in tests/
|
|
36
|
-
|
|
37
|
-
**Pass criteria**: All structural checks pass.
|
|
38
|
-
|
|
39
|
-
### Layer 3: Dependencies
|
|
40
|
-
Verify:
|
|
41
|
-
- All imports resolvable (modules exist at the referenced paths)
|
|
42
|
-
- Packages listed in package.json/requirements.txt
|
|
43
|
-
- No missing dependencies
|
|
44
|
-
- No circular dependencies in test helpers
|
|
45
|
-
- Test fixtures reference existing fixture files
|
|
46
|
-
|
|
47
|
-
**Pass criteria**: All imports resolve, all packages available.
|
|
48
|
-
|
|
49
|
-
### Layer 4: Logic Quality
|
|
50
|
-
Check test logic:
|
|
51
|
-
- Happy path tests have positive assertions (toBe, toEqual, toHaveText)
|
|
52
|
-
- Error/negative tests have negative assertions (not.toBe, toThrow, status >= 400)
|
|
53
|
-
- Setup and teardown are symmetric (what's created is cleaned up)
|
|
54
|
-
- No duplicate test IDs across the suite
|
|
55
|
-
- Assertions are concrete — reject: toBeTruthy(), toBeDefined(), .should('exist')
|
|
56
|
-
- Each test has at least one assertion
|
|
57
|
-
|
|
58
|
-
**Pass criteria**: All logic checks pass.
|
|
59
|
-
|
|
60
|
-
## Fix Loop Protocol
|
|
61
|
-
|
|
62
|
-
```
|
|
63
|
-
Loop 1: Generate tests
|
|
64
|
-
-> Run all 4 validation layers
|
|
65
|
-
-> If PASS: Deliver
|
|
66
|
-
-> If FAIL: Identify issues, fix, continue
|
|
67
|
-
|
|
68
|
-
Loop 2: Re-validate after fixes
|
|
69
|
-
-> If PASS: Deliver
|
|
70
|
-
-> If FAIL: Identify remaining issues, fix
|
|
71
|
-
|
|
72
|
-
Loop 3: Final validation
|
|
73
|
-
-> If PASS: Deliver
|
|
74
|
-
-> If FAIL: Deliver with VALIDATION_REPORT noting unresolved issues
|
|
75
|
-
```
|
|
76
|
-
|
|
77
|
-
## Output: VALIDATION_REPORT.md
|
|
78
|
-
|
|
79
|
-
```markdown
|
|
80
|
-
# Validation Report
|
|
81
|
-
|
|
82
|
-
## Summary
|
|
83
|
-
| Layer | Status | Issues Found | Issues Fixed |
|
|
84
|
-
|-------|--------|-------------|-------------|
|
|
85
|
-
| Syntax | PASS/FAIL | N | N |
|
|
86
|
-
| Structure | PASS/FAIL | N | N |
|
|
87
|
-
| Dependencies | PASS/FAIL | N | N |
|
|
88
|
-
| Logic | PASS/FAIL | N | N |
|
|
89
|
-
|
|
90
|
-
## File Details
|
|
91
|
-
### [filename]
|
|
92
|
-
| Layer | Status | Details |
|
|
93
|
-
|-------|--------|---------|
|
|
94
|
-
| ... | ... | ... |
|
|
95
|
-
|
|
96
|
-
## Unresolved Issues
|
|
97
|
-
[Any issues that couldn't be auto-fixed after 3 loops]
|
|
98
|
-
|
|
99
|
-
## Confidence Level
|
|
100
|
-
[HIGH/MEDIUM/LOW with reasoning]
|
|
101
|
-
```
|
|
102
|
-
|
|
103
|
-
## Quality Gate
|
|
104
|
-
|
|
105
|
-
- [ ] All 4 layers checked for every file
|
|
106
|
-
- [ ] Fix loop executed (max 3 iterations)
|
|
107
|
-
- [ ] VALIDATION_REPORT.md produced
|
|
108
|
-
- [ ] No test delivered with syntax errors
|
|
109
|
-
- [ ] Unresolved issues clearly documented
|
|
1
|
+
---
|
|
2
|
+
name: qa-self-validator
|
|
3
|
+
description: QA Self Validator. Closed-loop agent that validates generated test code across 4 layers (syntax, structure, dependencies, logic) and auto-fixes issues. Use when user wants to validate tests, check test quality, verify test code compiles, ensure tests follow standards, run quality checks on test suite, or verify generated tests before delivery. Triggers on "validate tests", "check test quality", "verify tests", "test validation", "quality check", "does it compile", "are tests valid", "check my tests".
|
|
4
|
+
---
|
|
5
|
+
|
|
6
|
+
# QA Self Validator
|
|
7
|
+
|
|
8
|
+
## Purpose
|
|
9
|
+
|
|
10
|
+
Closed-loop validation agent: Generate -> Validate -> Fix -> Deliver. Never deliver test code without at least one validation pass.
|
|
11
|
+
|
|
12
|
+
## Core Rule
|
|
13
|
+
|
|
14
|
+
**NEVER deliver generated QA code without running at least one validation pass. Max 3 fix loops before escalating.**
|
|
15
|
+
|
|
16
|
+
## Validation Layers
|
|
17
|
+
|
|
18
|
+
### Layer 1: Syntax
|
|
19
|
+
Run the appropriate checker based on language:
|
|
20
|
+
- TypeScript: `tsc --noEmit`
|
|
21
|
+
- JavaScript: `node --check [file]`
|
|
22
|
+
- Python: `python -m py_compile [file]`
|
|
23
|
+
- C#: `dotnet build --no-restore`
|
|
24
|
+
- Also run project linter if configured (eslint, flake8, etc.)
|
|
25
|
+
|
|
26
|
+
**Pass criteria**: Zero syntax errors.
|
|
27
|
+
|
|
28
|
+
### Layer 2: Structure
|
|
29
|
+
Check each test file for:
|
|
30
|
+
- Correct directory placement (e2e in e2e/, unit in unit/, etc.)
|
|
31
|
+
- Naming convention compliance (CLAUDE.md patterns)
|
|
32
|
+
- Has actual test functions (not empty describe blocks)
|
|
33
|
+
- Imports reference real modules in the codebase
|
|
34
|
+
- No hardcoded secrets/credentials/tokens
|
|
35
|
+
- Page objects in pages/ directory, tests in tests/
|
|
36
|
+
|
|
37
|
+
**Pass criteria**: All structural checks pass.
|
|
38
|
+
|
|
39
|
+
### Layer 3: Dependencies
|
|
40
|
+
Verify:
|
|
41
|
+
- All imports resolvable (modules exist at the referenced paths)
|
|
42
|
+
- Packages listed in package.json/requirements.txt
|
|
43
|
+
- No missing dependencies
|
|
44
|
+
- No circular dependencies in test helpers
|
|
45
|
+
- Test fixtures reference existing fixture files
|
|
46
|
+
|
|
47
|
+
**Pass criteria**: All imports resolve, all packages available.
|
|
48
|
+
|
|
49
|
+
### Layer 4: Logic Quality
|
|
50
|
+
Check test logic:
|
|
51
|
+
- Happy path tests have positive assertions (toBe, toEqual, toHaveText)
|
|
52
|
+
- Error/negative tests have negative assertions (not.toBe, toThrow, status >= 400)
|
|
53
|
+
- Setup and teardown are symmetric (what's created is cleaned up)
|
|
54
|
+
- No duplicate test IDs across the suite
|
|
55
|
+
- Assertions are concrete — reject: toBeTruthy(), toBeDefined(), .should('exist')
|
|
56
|
+
- Each test has at least one assertion
|
|
57
|
+
|
|
58
|
+
**Pass criteria**: All logic checks pass.
|
|
59
|
+
|
|
60
|
+
## Fix Loop Protocol
|
|
61
|
+
|
|
62
|
+
```
|
|
63
|
+
Loop 1: Generate tests
|
|
64
|
+
-> Run all 4 validation layers
|
|
65
|
+
-> If PASS: Deliver
|
|
66
|
+
-> If FAIL: Identify issues, fix, continue
|
|
67
|
+
|
|
68
|
+
Loop 2: Re-validate after fixes
|
|
69
|
+
-> If PASS: Deliver
|
|
70
|
+
-> If FAIL: Identify remaining issues, fix
|
|
71
|
+
|
|
72
|
+
Loop 3: Final validation
|
|
73
|
+
-> If PASS: Deliver
|
|
74
|
+
-> If FAIL: Deliver with VALIDATION_REPORT noting unresolved issues
|
|
75
|
+
```
|
|
76
|
+
|
|
77
|
+
## Output: VALIDATION_REPORT.md
|
|
78
|
+
|
|
79
|
+
```markdown
|
|
80
|
+
# Validation Report
|
|
81
|
+
|
|
82
|
+
## Summary
|
|
83
|
+
| Layer | Status | Issues Found | Issues Fixed |
|
|
84
|
+
|-------|--------|-------------|-------------|
|
|
85
|
+
| Syntax | PASS/FAIL | N | N |
|
|
86
|
+
| Structure | PASS/FAIL | N | N |
|
|
87
|
+
| Dependencies | PASS/FAIL | N | N |
|
|
88
|
+
| Logic | PASS/FAIL | N | N |
|
|
89
|
+
|
|
90
|
+
## File Details
|
|
91
|
+
### [filename]
|
|
92
|
+
| Layer | Status | Details |
|
|
93
|
+
|-------|--------|---------|
|
|
94
|
+
| ... | ... | ... |
|
|
95
|
+
|
|
96
|
+
## Unresolved Issues
|
|
97
|
+
[Any issues that couldn't be auto-fixed after 3 loops]
|
|
98
|
+
|
|
99
|
+
## Confidence Level
|
|
100
|
+
[HIGH/MEDIUM/LOW with reasoning]
|
|
101
|
+
```
|
|
102
|
+
|
|
103
|
+
## Quality Gate
|
|
104
|
+
|
|
105
|
+
- [ ] All 4 layers checked for every file
|
|
106
|
+
- [ ] Fix loop executed (max 3 iterations)
|
|
107
|
+
- [ ] VALIDATION_REPORT.md produced
|
|
108
|
+
- [ ] No test delivered with syntax errors
|
|
109
|
+
- [ ] Unresolved issues clearly documented
|
|
@@ -1,113 +1,113 @@
|
|
|
1
|
-
---
|
|
2
|
-
name: qa-template-engine
|
|
3
|
-
description: QA Template Engine. Creates production-ready test files with POM pattern, explicit assertions, and proper structure. Use when user wants to generate test files, create test templates, write test code, scaffold test suites, produce executable tests, or create test specs from an inventory. Triggers on "generate tests", "create test files", "write tests", "scaffold tests", "test templates", "produce test code", "executable tests", "create test spec".
|
|
4
|
-
---
|
|
5
|
-
|
|
6
|
-
# QA Template Engine
|
|
7
|
-
|
|
8
|
-
## Purpose
|
|
9
|
-
|
|
10
|
-
Create definitive, production-ready test files with explicit expected outcomes, proper POM architecture, and framework-specific best practices.
|
|
11
|
-
|
|
12
|
-
## Core Rule
|
|
13
|
-
|
|
14
|
-
**NO test case is complete without an expected outcome that a junior QA engineer could verify without asking questions.**
|
|
15
|
-
|
|
16
|
-
## Framework Detection
|
|
17
|
-
|
|
18
|
-
Before generating ANY code:
|
|
19
|
-
1. Check for existing config: playwright.config.ts, cypress.config.ts, jest.config.ts, vitest.config.ts, pytest.ini
|
|
20
|
-
2. Check package.json/requirements.txt for test dependencies
|
|
21
|
-
3. Check existing test files for patterns and conventions
|
|
22
|
-
4. **Always match the project's existing framework**
|
|
23
|
-
|
|
24
|
-
If no framework exists, ask the user.
|
|
25
|
-
|
|
26
|
-
## Test Template Categories
|
|
27
|
-
|
|
28
|
-
### Unit Test Template
|
|
29
|
-
```
|
|
30
|
-
Test ID: UT-[MODULE]-[NNN]
|
|
31
|
-
Target: [file]:[function]
|
|
32
|
-
Priority: P[0-2]
|
|
33
|
-
|
|
34
|
-
// Arrange
|
|
35
|
-
const input = [concrete value];
|
|
36
|
-
const expected = [concrete value];
|
|
37
|
-
|
|
38
|
-
// Act
|
|
39
|
-
const result = functionUnderTest(input);
|
|
40
|
-
|
|
41
|
-
// Assert
|
|
42
|
-
expect(result).toBe(expected); // NEVER toBeTruthy/toBeDefined
|
|
43
|
-
```
|
|
44
|
-
|
|
45
|
-
### API Test Template
|
|
46
|
-
```
|
|
47
|
-
Test ID: API-[RESOURCE]-[NNN]
|
|
48
|
-
Target: [METHOD] [endpoint]
|
|
49
|
-
Priority: P[0-2]
|
|
50
|
-
|
|
51
|
-
// Arrange
|
|
52
|
-
const payload = { [concrete data] };
|
|
53
|
-
|
|
54
|
-
// Act
|
|
55
|
-
const response = await api.[method]('[endpoint]', payload);
|
|
56
|
-
|
|
57
|
-
// Assert
|
|
58
|
-
expect(response.status).toBe([exact code]);
|
|
59
|
-
expect(response.body.[field]).toBe('[exact value]');
|
|
60
|
-
```
|
|
61
|
-
|
|
62
|
-
### E2E Test Template (Playwright)
|
|
63
|
-
```
|
|
64
|
-
Test ID: E2E-[FLOW]-[NNN]
|
|
65
|
-
Target: [user flow description]
|
|
66
|
-
Priority: P[0-2]
|
|
67
|
-
|
|
68
|
-
// Arrange
|
|
69
|
-
await loginPage.navigate();
|
|
70
|
-
|
|
71
|
-
// Act
|
|
72
|
-
await loginPage.login('[email]', '[password]');
|
|
73
|
-
|
|
74
|
-
// Assert
|
|
75
|
-
await expect(dashboardPage.welcomeMessage).toHaveText('Welcome, Test User');
|
|
76
|
-
```
|
|
77
|
-
|
|
78
|
-
## POM Generation Rules
|
|
79
|
-
|
|
80
|
-
Following CLAUDE.md strictly:
|
|
81
|
-
1. One class per page — no god objects
|
|
82
|
-
2. No assertions in page objects — assertions in test specs ONLY
|
|
83
|
-
3. Locators as readonly properties — Tier 1 preferred (data-testid, ARIA roles)
|
|
84
|
-
4. Actions return void or next page
|
|
85
|
-
5. State queries return data
|
|
86
|
-
6. Every POM extends BasePage
|
|
87
|
-
|
|
88
|
-
## Locator Priority
|
|
89
|
-
|
|
90
|
-
Always use this order:
|
|
91
|
-
1. data-testid: `page.getByTestId('login-submit-btn')`
|
|
92
|
-
2. ARIA role: `page.getByRole('button', { name: 'Log in' })`
|
|
93
|
-
3. Label/placeholder: `page.getByLabel('Email')`
|
|
94
|
-
4. CSS selector: `page.locator('.btn')` + `// TODO: Request test ID`
|
|
95
|
-
|
|
96
|
-
## Expected Outcome Rules
|
|
97
|
-
|
|
98
|
-
- **Be specific**: Exact values, status codes, text content
|
|
99
|
-
- **Be measurable**: Timing thresholds, counts, lengths
|
|
100
|
-
- **Be negative too**: What should NOT happen
|
|
101
|
-
- **Include state transitions**: Before/after states
|
|
102
|
-
- **Reference test data**: Use fixture values, not magic strings
|
|
103
|
-
|
|
104
|
-
## Quality Gate
|
|
105
|
-
|
|
106
|
-
- [ ] Every test has explicit expected outcome with concrete value
|
|
107
|
-
- [ ] No vague words: "correct", "proper", "appropriate", "works"
|
|
108
|
-
- [ ] All locators follow tier hierarchy
|
|
109
|
-
- [ ] No assertions inside page objects
|
|
110
|
-
- [ ] No hardcoded credentials
|
|
111
|
-
- [ ] File naming follows project conventions
|
|
112
|
-
- [ ] Test IDs are unique and follow convention
|
|
113
|
-
- [ ] Priority (P0/P1/P2) assigned to every test
|
|
1
|
+
---
|
|
2
|
+
name: qa-template-engine
|
|
3
|
+
description: QA Template Engine. Creates production-ready test files with POM pattern, explicit assertions, and proper structure. Use when user wants to generate test files, create test templates, write test code, scaffold test suites, produce executable tests, or create test specs from an inventory. Triggers on "generate tests", "create test files", "write tests", "scaffold tests", "test templates", "produce test code", "executable tests", "create test spec".
|
|
4
|
+
---
|
|
5
|
+
|
|
6
|
+
# QA Template Engine
|
|
7
|
+
|
|
8
|
+
## Purpose
|
|
9
|
+
|
|
10
|
+
Create definitive, production-ready test files with explicit expected outcomes, proper POM architecture, and framework-specific best practices.
|
|
11
|
+
|
|
12
|
+
## Core Rule
|
|
13
|
+
|
|
14
|
+
**NO test case is complete without an expected outcome that a junior QA engineer could verify without asking questions.**
|
|
15
|
+
|
|
16
|
+
## Framework Detection
|
|
17
|
+
|
|
18
|
+
Before generating ANY code:
|
|
19
|
+
1. Check for existing config: playwright.config.ts, cypress.config.ts, jest.config.ts, vitest.config.ts, pytest.ini
|
|
20
|
+
2. Check package.json/requirements.txt for test dependencies
|
|
21
|
+
3. Check existing test files for patterns and conventions
|
|
22
|
+
4. **Always match the project's existing framework**
|
|
23
|
+
|
|
24
|
+
If no framework exists, ask the user.
|
|
25
|
+
|
|
26
|
+
## Test Template Categories
|
|
27
|
+
|
|
28
|
+
### Unit Test Template
|
|
29
|
+
```
|
|
30
|
+
Test ID: UT-[MODULE]-[NNN]
|
|
31
|
+
Target: [file]:[function]
|
|
32
|
+
Priority: P[0-2]
|
|
33
|
+
|
|
34
|
+
// Arrange
|
|
35
|
+
const input = [concrete value];
|
|
36
|
+
const expected = [concrete value];
|
|
37
|
+
|
|
38
|
+
// Act
|
|
39
|
+
const result = functionUnderTest(input);
|
|
40
|
+
|
|
41
|
+
// Assert
|
|
42
|
+
expect(result).toBe(expected); // NEVER toBeTruthy/toBeDefined
|
|
43
|
+
```
|
|
44
|
+
|
|
45
|
+
### API Test Template
|
|
46
|
+
```
|
|
47
|
+
Test ID: API-[RESOURCE]-[NNN]
|
|
48
|
+
Target: [METHOD] [endpoint]
|
|
49
|
+
Priority: P[0-2]
|
|
50
|
+
|
|
51
|
+
// Arrange
|
|
52
|
+
const payload = { [concrete data] };
|
|
53
|
+
|
|
54
|
+
// Act
|
|
55
|
+
const response = await api.[method]('[endpoint]', payload);
|
|
56
|
+
|
|
57
|
+
// Assert
|
|
58
|
+
expect(response.status).toBe([exact code]);
|
|
59
|
+
expect(response.body.[field]).toBe('[exact value]');
|
|
60
|
+
```
|
|
61
|
+
|
|
62
|
+
### E2E Test Template (Playwright)
|
|
63
|
+
```
|
|
64
|
+
Test ID: E2E-[FLOW]-[NNN]
|
|
65
|
+
Target: [user flow description]
|
|
66
|
+
Priority: P[0-2]
|
|
67
|
+
|
|
68
|
+
// Arrange
|
|
69
|
+
await loginPage.navigate();
|
|
70
|
+
|
|
71
|
+
// Act
|
|
72
|
+
await loginPage.login('[email]', '[password]');
|
|
73
|
+
|
|
74
|
+
// Assert
|
|
75
|
+
await expect(dashboardPage.welcomeMessage).toHaveText('Welcome, Test User');
|
|
76
|
+
```
|
|
77
|
+
|
|
78
|
+
## POM Generation Rules
|
|
79
|
+
|
|
80
|
+
Following CLAUDE.md strictly:
|
|
81
|
+
1. One class per page — no god objects
|
|
82
|
+
2. No assertions in page objects — assertions in test specs ONLY
|
|
83
|
+
3. Locators as readonly properties — Tier 1 preferred (data-testid, ARIA roles)
|
|
84
|
+
4. Actions return void or next page
|
|
85
|
+
5. State queries return data
|
|
86
|
+
6. Every POM extends BasePage
|
|
87
|
+
|
|
88
|
+
## Locator Priority
|
|
89
|
+
|
|
90
|
+
Always use this order:
|
|
91
|
+
1. data-testid: `page.getByTestId('login-submit-btn')`
|
|
92
|
+
2. ARIA role: `page.getByRole('button', { name: 'Log in' })`
|
|
93
|
+
3. Label/placeholder: `page.getByLabel('Email')`
|
|
94
|
+
4. CSS selector: `page.locator('.btn')` + `// TODO: Request test ID`
|
|
95
|
+
|
|
96
|
+
## Expected Outcome Rules
|
|
97
|
+
|
|
98
|
+
- **Be specific**: Exact values, status codes, text content
|
|
99
|
+
- **Be measurable**: Timing thresholds, counts, lengths
|
|
100
|
+
- **Be negative too**: What should NOT happen
|
|
101
|
+
- **Include state transitions**: Before/after states
|
|
102
|
+
- **Reference test data**: Use fixture values, not magic strings
|
|
103
|
+
|
|
104
|
+
## Quality Gate
|
|
105
|
+
|
|
106
|
+
- [ ] Every test has explicit expected outcome with concrete value
|
|
107
|
+
- [ ] No vague words: "correct", "proper", "appropriate", "works"
|
|
108
|
+
- [ ] All locators follow tier hierarchy
|
|
109
|
+
- [ ] No assertions inside page objects
|
|
110
|
+
- [ ] No hardcoded credentials
|
|
111
|
+
- [ ] File naming follows project conventions
|
|
112
|
+
- [ ] Test IDs are unique and follow convention
|
|
113
|
+
- [ ] Priority (P0/P1/P2) assigned to every test
|
|
@@ -1,93 +1,93 @@
|
|
|
1
|
-
---
|
|
2
|
-
name: qa-testid-injector
|
|
3
|
-
description: QA Test ID Injector. Scans source code to find interactive UI elements missing data-testid attributes and injects them following naming convention. Use when user wants to add test IDs, improve testability, audit missing test hooks, prepare for E2E automation, or add data-testid attributes before writing Playwright/Cypress tests. Triggers on "add test IDs", "add data-testid", "test hooks", "missing testid", "testability audit", "prepare for automation", "inject test attributes", "make components testable".
|
|
4
|
-
---
|
|
5
|
-
|
|
6
|
-
# QA Test ID Injector
|
|
7
|
-
|
|
8
|
-
## Purpose
|
|
9
|
-
|
|
10
|
-
Scan application source code, identify interactive UI elements lacking stable test selectors, and inject `data-testid` attributes following a consistent naming convention. Runs as **Step 0** — before any test generation.
|
|
11
|
-
|
|
12
|
-
## Core Rule
|
|
13
|
-
|
|
14
|
-
**Every interactive element MUST have a stable, unique `data-testid` before E2E tests are generated against it.**
|
|
15
|
-
|
|
16
|
-
## Naming Convention
|
|
17
|
-
|
|
18
|
-
Pattern: `{context}-{description}-{element-type}` in kebab-case.
|
|
19
|
-
|
|
20
|
-
### Element Type Suffixes
|
|
21
|
-
|
|
22
|
-
| Element | Suffix | Example |
|
|
23
|
-
|---------|--------|---------|
|
|
24
|
-
| button | -btn | login-submit-btn |
|
|
25
|
-
| input | -input | login-email-input |
|
|
26
|
-
| select | -select | settings-language-select |
|
|
27
|
-
| textarea | -textarea | feedback-comment-textarea |
|
|
28
|
-
| link | -link | navbar-profile-link |
|
|
29
|
-
| form | -form | checkout-payment-form |
|
|
30
|
-
| img | -img | product-hero-img |
|
|
31
|
-
| table | -table | users-list-table |
|
|
32
|
-
| row | -row | users-item-row |
|
|
33
|
-
| modal | -modal | confirm-delete-modal |
|
|
34
|
-
| container | -container | dashboard-stats-container |
|
|
35
|
-
| list | -list | notifications-list |
|
|
36
|
-
| item | -item | notifications-item |
|
|
37
|
-
| dropdown | -dropdown | navbar-user-dropdown |
|
|
38
|
-
| tab | -tab | settings-security-tab |
|
|
39
|
-
| checkbox | -checkbox | terms-accept-checkbox |
|
|
40
|
-
| radio | -radio | shipping-express-radio |
|
|
41
|
-
| toggle | -toggle | notifications-enabled-toggle |
|
|
42
|
-
| badge | -badge | cart-count-badge |
|
|
43
|
-
| alert | -alert | error-validation-alert |
|
|
44
|
-
|
|
45
|
-
### Context Derivation
|
|
46
|
-
|
|
47
|
-
1. **Page-level**: From component filename or route (LoginPage.tsx -> login)
|
|
48
|
-
2. **Component-level**: From component name (<NavBar> -> navbar)
|
|
49
|
-
3. **Nested**: Parent -> child hierarchy, max 3 levels deep
|
|
50
|
-
4. **Dynamic lists**: Use template literals with unique keys
|
|
51
|
-
|
|
52
|
-
## Execution Phases
|
|
53
|
-
|
|
54
|
-
### Phase 1: SCAN
|
|
55
|
-
- Detect framework (React/Vue/Angular/HTML) from package.json and file extensions
|
|
56
|
-
- List all component files (exclude test/spec/stories)
|
|
57
|
-
- Prioritize by interaction density (forms > pages > layouts)
|
|
58
|
-
- Output: SCAN_MANIFEST.md
|
|
59
|
-
|
|
60
|
-
### Phase 2: AUDIT
|
|
61
|
-
- For each file, identify interactive elements
|
|
62
|
-
- Classify: P0 (must have), P1 (should have), P2 (nice to have)
|
|
63
|
-
- Record existing data-testid as EXISTING (don't modify)
|
|
64
|
-
- Record missing as MISSING with proposed value
|
|
65
|
-
- Output: TESTID_AUDIT_REPORT.md
|
|
66
|
-
|
|
67
|
-
### Phase 3: INJECT
|
|
68
|
-
- Add data-testid as LAST attribute before closing >
|
|
69
|
-
- Preserve all existing formatting
|
|
70
|
-
- Only add the attribute — change nothing else
|
|
71
|
-
- Framework-specific handling (JSX, Vue, Angular, HTML)
|
|
72
|
-
- Output: INJECTION_CHANGELOG.md + modified source files
|
|
73
|
-
|
|
74
|
-
### Phase 4: VALIDATE
|
|
75
|
-
- Syntax check all modified files
|
|
76
|
-
- Uniqueness check (no duplicate testids per page)
|
|
77
|
-
- Convention compliance check
|
|
78
|
-
- Output: INJECTION_VALIDATION.md
|
|
79
|
-
|
|
80
|
-
## Third-Party Components
|
|
81
|
-
|
|
82
|
-
1. Props passthrough (if library supports it) — direct data-testid
|
|
83
|
-
2. Wrapper div (if no passthrough) — wrap with data-testid div
|
|
84
|
-
3. inputProps/slotProps (MUI-specific) — use component-specific prop APIs
|
|
85
|
-
|
|
86
|
-
## Quality Gate
|
|
87
|
-
|
|
88
|
-
- [ ] Every interactive element has a data-testid
|
|
89
|
-
- [ ] All values follow {context}-{description}-{element-type} convention
|
|
90
|
-
- [ ] No duplicate data-testid values in same page/route scope
|
|
91
|
-
- [ ] No existing code modified beyond adding the attribute
|
|
92
|
-
- [ ] Syntax validation passes on all modified files
|
|
93
|
-
- [ ] Dynamic list items use template literals with unique keys
|
|
1
|
+
---
|
|
2
|
+
name: qa-testid-injector
|
|
3
|
+
description: QA Test ID Injector. Scans source code to find interactive UI elements missing data-testid attributes and injects them following naming convention. Use when user wants to add test IDs, improve testability, audit missing test hooks, prepare for E2E automation, or add data-testid attributes before writing Playwright/Cypress tests. Triggers on "add test IDs", "add data-testid", "test hooks", "missing testid", "testability audit", "prepare for automation", "inject test attributes", "make components testable".
|
|
4
|
+
---
|
|
5
|
+
|
|
6
|
+
# QA Test ID Injector
|
|
7
|
+
|
|
8
|
+
## Purpose
|
|
9
|
+
|
|
10
|
+
Scan application source code, identify interactive UI elements lacking stable test selectors, and inject `data-testid` attributes following a consistent naming convention. Runs as **Step 0** — before any test generation.
|
|
11
|
+
|
|
12
|
+
## Core Rule
|
|
13
|
+
|
|
14
|
+
**Every interactive element MUST have a stable, unique `data-testid` before E2E tests are generated against it.**
|
|
15
|
+
|
|
16
|
+
## Naming Convention
|
|
17
|
+
|
|
18
|
+
Pattern: `{context}-{description}-{element-type}` in kebab-case.
|
|
19
|
+
|
|
20
|
+
### Element Type Suffixes
|
|
21
|
+
|
|
22
|
+
| Element | Suffix | Example |
|
|
23
|
+
|---------|--------|---------|
|
|
24
|
+
| button | -btn | login-submit-btn |
|
|
25
|
+
| input | -input | login-email-input |
|
|
26
|
+
| select | -select | settings-language-select |
|
|
27
|
+
| textarea | -textarea | feedback-comment-textarea |
|
|
28
|
+
| link | -link | navbar-profile-link |
|
|
29
|
+
| form | -form | checkout-payment-form |
|
|
30
|
+
| img | -img | product-hero-img |
|
|
31
|
+
| table | -table | users-list-table |
|
|
32
|
+
| row | -row | users-item-row |
|
|
33
|
+
| modal | -modal | confirm-delete-modal |
|
|
34
|
+
| container | -container | dashboard-stats-container |
|
|
35
|
+
| list | -list | notifications-list |
|
|
36
|
+
| item | -item | notifications-item |
|
|
37
|
+
| dropdown | -dropdown | navbar-user-dropdown |
|
|
38
|
+
| tab | -tab | settings-security-tab |
|
|
39
|
+
| checkbox | -checkbox | terms-accept-checkbox |
|
|
40
|
+
| radio | -radio | shipping-express-radio |
|
|
41
|
+
| toggle | -toggle | notifications-enabled-toggle |
|
|
42
|
+
| badge | -badge | cart-count-badge |
|
|
43
|
+
| alert | -alert | error-validation-alert |
|
|
44
|
+
|
|
45
|
+
### Context Derivation
|
|
46
|
+
|
|
47
|
+
1. **Page-level**: From component filename or route (LoginPage.tsx -> login)
|
|
48
|
+
2. **Component-level**: From component name (<NavBar> -> navbar)
|
|
49
|
+
3. **Nested**: Parent -> child hierarchy, max 3 levels deep
|
|
50
|
+
4. **Dynamic lists**: Use template literals with unique keys
|
|
51
|
+
|
|
52
|
+
## Execution Phases
|
|
53
|
+
|
|
54
|
+
### Phase 1: SCAN
|
|
55
|
+
- Detect framework (React/Vue/Angular/HTML) from package.json and file extensions
|
|
56
|
+
- List all component files (exclude test/spec/stories)
|
|
57
|
+
- Prioritize by interaction density (forms > pages > layouts)
|
|
58
|
+
- Output: SCAN_MANIFEST.md
|
|
59
|
+
|
|
60
|
+
### Phase 2: AUDIT
|
|
61
|
+
- For each file, identify interactive elements
|
|
62
|
+
- Classify: P0 (must have), P1 (should have), P2 (nice to have)
|
|
63
|
+
- Record existing data-testid as EXISTING (don't modify)
|
|
64
|
+
- Record missing as MISSING with proposed value
|
|
65
|
+
- Output: TESTID_AUDIT_REPORT.md
|
|
66
|
+
|
|
67
|
+
### Phase 3: INJECT
|
|
68
|
+
- Add data-testid as LAST attribute before closing >
|
|
69
|
+
- Preserve all existing formatting
|
|
70
|
+
- Only add the attribute — change nothing else
|
|
71
|
+
- Framework-specific handling (JSX, Vue, Angular, HTML)
|
|
72
|
+
- Output: INJECTION_CHANGELOG.md + modified source files
|
|
73
|
+
|
|
74
|
+
### Phase 4: VALIDATE
|
|
75
|
+
- Syntax check all modified files
|
|
76
|
+
- Uniqueness check (no duplicate testids per page)
|
|
77
|
+
- Convention compliance check
|
|
78
|
+
- Output: INJECTION_VALIDATION.md
|
|
79
|
+
|
|
80
|
+
## Third-Party Components
|
|
81
|
+
|
|
82
|
+
1. Props passthrough (if library supports it) — direct data-testid
|
|
83
|
+
2. Wrapper div (if no passthrough) — wrap with data-testid div
|
|
84
|
+
3. inputProps/slotProps (MUI-specific) — use component-specific prop APIs
|
|
85
|
+
|
|
86
|
+
## Quality Gate
|
|
87
|
+
|
|
88
|
+
- [ ] Every interactive element has a data-testid
|
|
89
|
+
- [ ] All values follow {context}-{description}-{element-type} convention
|
|
90
|
+
- [ ] No duplicate data-testid values in same page/route scope
|
|
91
|
+
- [ ] No existing code modified beyond adding the attribute
|
|
92
|
+
- [ ] Syntax validation passes on all modified files
|
|
93
|
+
- [ ] Dynamic list items use template literals with unique keys
|