@keber/qa-framework 1.3.0-0 → 1.4.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.
@@ -0,0 +1,93 @@
1
+ ---
2
+ name: qa-spec-generation
3
+ description: >
4
+ Stage 2 of the QA pipeline. Generates or updates the 6-file specification set
5
+ (00-inventory, 01-business-rules, 02-workflows, 03-roles-permissions, 04-test-data,
6
+ 05-test-scenarios) for a module submodule. Use when asked to write specs, generate
7
+ test scenarios, document business rules, create a test case table, or produce the
8
+ QA specification for a feature. Requires completed module analysis (Stage 1).
9
+ ---
10
+
11
+ # QA Skill: Specification Generation (Stage 2 of 6)
12
+
13
+ **Stage**: 2 — Specification Generation
14
+ **Prerequisite**: `00-inventory.md` must exist (Stage 1 complete)
15
+ **Output**: Complete 6-file spec set under `qa/01-specifications/module-{name}/submodule-{name}/`
16
+ **Next stage**: Stage 3 — Test Plan (`qa-test-plan`)
17
+
18
+ > **Pipeline rule**: Do not generate specs for features marked `PENDING-CODE` in the inventory.
19
+ > Do not create TCs without having observed or been given the behavior being tested.
20
+
21
+ ---
22
+
23
+ ## Inputs Required
24
+
25
+ 1. Module exploration notes or existing `00-inventory.md`
26
+ 2. Module code from `qa/00-standards/naming-conventions.md`
27
+ 3. Submodule name and kebab-case directory name
28
+ 4. QA environment observations (what was actually seen in the UI)
29
+
30
+ ---
31
+
32
+ ## File Generation Rules
33
+
34
+ Generate or update each file following the formats in `references/spec-file-formats.md`.
35
+
36
+ ### `00-inventory.md`
37
+ - Header block: module/submodule codes, primary URL, status, last updated date
38
+ - UI element table: name, type, required, notes (validation rule)
39
+ - API endpoint table: method, path, purpose
40
+ - **Never include**: credentials, personal data, real user IDs
41
+
42
+ ### `01-business-rules.md`
43
+ - Format: `RN-{MODULE}-{NNN}` with type, trigger, behavior, error message (exact UI text)
44
+ - **Rule sources**: every required field → 1 RN; every unique constraint → 1 RN; every state transition → 1 RN; every role restriction → 1 RN
45
+ - Minimum 5 rules per submodule; typical 8–15
46
+
47
+ ### `02-workflows.md`
48
+ - Format: `FL-{MODULE}-{NNN}` with actor, trigger, precondition, ASCII/Mermaid flow diagram, postcondition
49
+ - Must cover: primary happy path + rejection/cancellation + error path
50
+
51
+ ### `03-roles-permissions.md`
52
+ - Role × feature access matrix: ✅ / ❌ / ⚠️ (limited)
53
+ - Test user reference table: role name + env var names only (never actual credentials)
54
+
55
+ ### `04-test-data.md`
56
+ - Prerequisites table (data that must exist before tests run)
57
+ - Data shapes per key scenario (reference env vars for credentials)
58
+ - EXEC_IDX pattern for unique dynamic values
59
+ - Data isolation rules (each test operates on its own data)
60
+
61
+ ### `05-test-scenarios.md`
62
+ - Summary table at top (total TCs by priority and type)
63
+ - TC format: `TC-{MODULE}-{SUBMODULE}-{NNN}` with priority, type, origin, automation feasibility, preconditions, steps, expected result
64
+ - **Target**: 50–85 TCs per submodule
65
+ - **Mandatory coverage categories** (≥1 TC each where applicable):
66
+ - Access: unauthenticated user; role without permission
67
+ - Happy path: primary workflow end-to-end
68
+ - Negative: required field missing; duplicate; invalid format
69
+ - State transitions
70
+ - Export/download (if feature exists)
71
+ - Pagination/search (if feature exists)
72
+
73
+ Full format templates: `references/spec-file-formats.md`
74
+
75
+ ---
76
+
77
+ ## Anti-Patterns to Avoid
78
+
79
+ | Anti-pattern | Correct approach |
80
+ |---|---|
81
+ | TC for a feature not in QA env | Mark as `PENDING-CODE`; do not write test steps |
82
+ | Real credentials in any TC step | Use env var references only |
83
+ | "Verify system works correctly" as expected result | Write observable, measurable expected result |
84
+ | 100+ TCs by copy-pasting near-identical variations | Merge cases; use parameterization |
85
+ | TC written without observing the actual behavior | Mark as `PENDING-CODE` until verified |
86
+
87
+ ---
88
+
89
+ ## Outputs
90
+
91
+ - 6 spec files per submodule in `qa/01-specifications/module-{name}/submodule-{name}/`
92
+ - Module `README.md` updated with submodule TC count
93
+ - `qa/README.md` module status updated
@@ -0,0 +1,89 @@
1
+ ---
2
+ name: qa-test-cases
3
+ description: >
4
+ Stage 4 of the QA pipeline. Generates individual test case documents from
5
+ approved specifications and the test plan. Produces TC-{ID}.md files with
6
+ preconditions, steps, and expected results.
7
+ Use when asked to write test cases, create TCs, expand scenarios into steps,
8
+ document test procedures, or generate TC-{ID} files.
9
+ Requires existing specs (Stage 2) and, ideally, a test plan (Stage 3).
10
+ ---
11
+
12
+ # QA Skill: Test Case Generation (Stage 4 of 6)
13
+
14
+ **Stage**: 4 — Test Cases
15
+ **Prerequisite**: Submodule specs exist (Stage 2). Test plan is optional but strongly recommended.
16
+ **Output**: `qa/03-test-cases/automated/TC-{ID}.md` (one file per TC)
17
+ **Next stage**: Stage 5 — Automation (`qa-automation`)
18
+
19
+ > **Pipeline rule**: TC IDs must be unique across the module. Never reuse a TC ID.
20
+
21
+ ---
22
+
23
+ ## Inputs Required
24
+
25
+ 1. `qa/01-specifications/{module}/05-test-scenarios.md` — source scenarios to expand
26
+ 2. Test plan (if available) — defines priority and which scenarios are in scope
27
+ 3. Module TC-ID range prefix (e.g., `PROV` → `TC-PROV-001`)
28
+
29
+ ---
30
+
31
+ ## Process
32
+
33
+ ### Step 1 — Audit existing TCs
34
+
35
+ Check `qa/03-test-cases/automated/` for existing TC files in this module. Note:
36
+ - Highest existing TC number (to continue sequence from next number)
37
+ - Any `PENDING-CODE` TCs (skip automation loop; flag for manual follow-up)
38
+ - Any TCs for scenarios already documented (do not duplicate)
39
+
40
+ ### Step 2 — Map scenarios to TC IDs
41
+
42
+ For each scenario in `05-test-scenarios.md`:
43
+ - Assign sequential TC ID: `TC-{PREFIX}-{NNN}` (zero-padded to 3 digits)
44
+ - Annotate with priority and automation feasibility from test plan (if available)
45
+ - Skip scenarios marked with `BLOCKED-PERMISSIONS` or `NOT-AUTOMATABLE` — generate TC shells only
46
+
47
+ ### Step 3 — Write TC documents
48
+
49
+ Full template: `references/test-case-template.md`
50
+
51
+ Each TC file must include:
52
+ - **ID** and **Title**
53
+ - **Priority** (P0/P1/P2/P3)
54
+ - **Automation feasibility** (fully / partially / not)
55
+ - **Preconditions** (setup state + test data reference)
56
+ - **Steps** (numbered, action + input + expected result per step)
57
+ - **Postconditions** (cleanup or state left after TC)
58
+ - **Tags** (e.g., `smoke`, `regression`, `happy-path`)
59
+
60
+ ### Step 4 — Quality gates
61
+
62
+ Before saving each TC:
63
+ - Every step has an expected result — no steps with "verify it works"
64
+ - Test data references a named fixture or `qa/01-specifications/{module}/04-test-data.md`
65
+ - For CRUD TCs: steps cover create → verify → update → verify → delete → verify
66
+ - Preconditions do not duplicate setup that belongs in a shared fixture
67
+
68
+ ### Step 5 — Update index
69
+
70
+ Create or update `qa/03-test-cases/automated/{module}-index.md`:
71
+ - Table: TC ID | Title | Priority | Feasibility | Spec reference
72
+
73
+ ---
74
+
75
+ ## Key Rules
76
+
77
+ | Rule | Correct | Wrong |
78
+ |---|---|---|
79
+ | TC isolation | Each TC is independent | TCs depend on prior TC's data |
80
+ | Step granularity | One action + one assertion per step | Multi-action steps |
81
+ | Data hygiene | Named fixtures or spec data | Hardcoded values in steps |
82
+ | ID stability | Never re-number existing IDs | Renaming breaks ADO links |
83
+
84
+ ---
85
+
86
+ ## Outputs
87
+
88
+ - `qa/03-test-cases/automated/TC-{ID}.md` (one per scenario)
89
+ - `qa/03-test-cases/automated/{module}-index.md`
@@ -0,0 +1,142 @@
1
+ # Reference: Test Case Template
2
+
3
+ > Loaded by `skills/qa-test-cases/` when generating TC documents.
4
+
5
+ ---
6
+
7
+ ## Full TC Document Template
8
+
9
+ ```markdown
10
+ # TC-{MODULE}-{SUBMODULE}-{NNN}: {TC Title}
11
+
12
+ | Field | Value |
13
+ |-------|-------|
14
+ | TC ID | TC-{MODULE}-{SUBMODULE}-{NNN} |
15
+ | Module | {Module display name} |
16
+ | Submodule | {Submodule display name} |
17
+ | Priority | P0 / P1 / P2 / P3 |
18
+ | Type | Functional / Negative / Regression / Security / Integration |
19
+ | Origin | UI-OBSERVED / PENDING-CODE / BLOCKED-PERMISSIONS |
20
+ | Observation date | YYYY-MM-DD |
21
+ | Automatable | Yes / Partial / No |
22
+ | Playwright file | (fill when automation is written) |
23
+ | Status | Draft / Approved / Automated / Deprecated |
24
+
25
+ ---
26
+
27
+ ## Objective
28
+
29
+ {1-2 sentences: what this TC verifies and why it matters}
30
+
31
+ ---
32
+
33
+ ## Preconditions
34
+
35
+ 1. User is logged in as **{role}**
36
+ 2. The following data exists in the QA environment:
37
+ - {item 1}: {description}
38
+ 3. {any other system state requirement}
39
+
40
+ ---
41
+
42
+ ## Test Data
43
+
44
+ | Field | Value |
45
+ |-------|-------|
46
+ | {field name} | {value or generation rule} |
47
+ | {field name} | Use `EXEC_IDX`-generated value for uniqueness |
48
+ | User | Credentials from `QA_USER_{ROLE}_EMAIL` env var |
49
+
50
+ ---
51
+
52
+ ## Steps
53
+
54
+ | Step | Action | Expected result |
55
+ |------|--------|----------------|
56
+ | 1 | Navigate to {URL} | Page loads, {element} visible |
57
+ | 2 | Click {element description} | {modal opens / form appears} |
58
+ | 3 | Fill {field} with {value} | Field accepts input |
59
+ | 4 | Click {submit button} | {success message / state change} |
60
+ | 5 | Verify {observable outcome} | {specific text or element state} |
61
+
62
+ ---
63
+
64
+ ## Expected Results
65
+
66
+ **Final state**: {what the system should look like after all steps complete}
67
+
68
+ **Verification points**:
69
+ - [ ] {element} should {state}
70
+ - [ ] {element} should contain {text}
71
+ - [ ] Page/modal should transition to {expected state}
72
+
73
+ ---
74
+
75
+ ## Known Issues / Related Defects
76
+
77
+ | Issue | DEF-ID / ADO WI | Status | Impact on this TC |
78
+ |-------|----------------|--------|------------------|
79
+ | {description} | DEF-NNN | Open | TC skipped until resolved |
80
+
81
+ ---
82
+
83
+ ## Automation Notes
84
+
85
+ ```typescript
86
+ // Key Playwright selector
87
+ // page.locator('{selector}')
88
+
89
+ // Key assertion
90
+ // await expect(page.locator('{selector}')).toHaveText('{expected}');
91
+ ```
92
+
93
+ ---
94
+
95
+ ## Changelog
96
+
97
+ | Version | Date | Author | Description |
98
+ |---------|------|--------|-------------|
99
+ | 1.0 | YYYY-MM-DD | {author} | Initial creation |
100
+ ```
101
+
102
+ ---
103
+
104
+ ## Module Index Template
105
+
106
+ Create at: `qa/03-test-cases/automated/{module}-index.md`
107
+
108
+ ```markdown
109
+ # TC Index — {Module Display Name}
110
+
111
+ | TC ID | Title | Priority | Feasibility | Spec reference |
112
+ |-------|-------|----------|-------------|---------------|
113
+ | TC-{M}-{S}-001 | {title} | P0 | Yes | 05-test-scenarios.md#{anchor} |
114
+ ```
115
+
116
+ ---
117
+
118
+ ## Content Quality Rules
119
+
120
+ ### Measurable expected results
121
+
122
+ ❌ `The system should work correctly`
123
+ ✅ `A toast message 'Record saved' appears and the datatable row count increases by 1`
124
+
125
+ ❌ `The form validates the input`
126
+ ✅ `A red validation message 'This field is required' appears below the Name field`
127
+
128
+ ### Observable steps
129
+
130
+ ❌ `Add a new record with valid data`
131
+ ✅ `Click 'New'. Fill 'Name' with 'Test-{EXEC_IDX}'. Click 'Save'.`
132
+
133
+ ### Defect links
134
+
135
+ When skipping a step due to a bug:
136
+ ✅ `Step 4 — SKIPPED: DEF-001 (ADO #21944). Switch defaults to OFF. Re-enable after fix.`
137
+
138
+ ### TC isolation
139
+
140
+ - Each TC is fully independent — no TC depends on state from a prior TC
141
+ - All required data is provisioned in preconditions or `beforeAll`
142
+ - CRUD TCs cover: create → verify → update → verify → delete → verify
@@ -0,0 +1,81 @@
1
+ ---
2
+ name: qa-test-plan
3
+ description: >
4
+ Stage 3 of the QA pipeline. Generates a test plan document from completed
5
+ submodule specifications. Defines scope, priority distribution, automation
6
+ feasibility, ADO mapping, and TC selection for a sprint or release.
7
+ Use when asked to create a test plan, define test scope, plan a sprint,
8
+ prioritize test cases, or decide what to automate vs test manually.
9
+ Requires completed specs (Stage 2).
10
+ ---
11
+
12
+ # QA Skill: Test Plan Generation (Stage 3 of 6)
13
+
14
+ **Stage**: 3 — Test Plan
15
+ **Prerequisite**: `05-test-scenarios.md` must exist for all in-scope submodules (Stage 2 complete)
16
+ **Output**: `qa/02-test-plans/automated/{module}-test-plan.md`
17
+ **Next stage**: Stage 4 — Test Cases (`qa-test-cases`) or Stage 5 — Automation (`qa-automation`)
18
+
19
+ > **Pipeline rule**: Do not automate TCs that are not in an approved or active test plan.
20
+
21
+ ---
22
+
23
+ ## Inputs Required
24
+
25
+ 1. `qa/01-specifications/module-{name}/` — all submodule specs
26
+ 2. Scope definition — which submodules are in this test plan (ask the user if not given)
27
+ 3. Priority guidance (from team or implied by sprint scope)
28
+
29
+ ---
30
+
31
+ ## Process
32
+
33
+ ### Step 1 — Collect TC inventory
34
+
35
+ For each in-scope submodule, read `05-test-scenarios.md` and aggregate:
36
+ - Total TC count by priority (P0/P1/P2/P3)
37
+ - TC count by automation feasibility (fully / partially / not automatable)
38
+ - Any TCs marked `BLOCKED-PERMISSIONS` or `PENDING-CODE` (these go in the exclusion list)
39
+
40
+ ### Step 2 — Apply priority rules
41
+
42
+ Use the priority decision tree (see `references/priority-and-feasibility.md`) to assign or validate priorities. Key rules:
43
+
44
+ - **P0**: primary happy path; show-stopper risk; critical data corruption
45
+ - **P1**: common negative scenarios; cross-module dependencies; state machine transitions
46
+ - **P2**: secondary features (export, pagination, search)
47
+ - **P3**: edge cases, cosmetic, rare scenarios
48
+
49
+ ### Step 3 — Apply automation feasibility rules
50
+
51
+ - **Fully automatable**: deterministic, observable via browser, no external system dependency
52
+ - **Partially automatable**: some result requires human inspection OR external system can be mocked
53
+ - **Not automatable**: physical access required; inherently non-deterministic; irreversible QA side effects; BLOCKED-PERMISSIONS
54
+
55
+ ### Step 4 — Write the test plan document
56
+
57
+ Full document template: `references/test-plan-template.md`
58
+
59
+ Required sections:
60
+ 1. Objective
61
+ 2. Scope (in/out)
62
+ 3. Automation feasibility analysis table (per submodule)
63
+ 4. Priority distribution table
64
+ 5. TC selection suites (P0 suite, P1 suite)
65
+ 6. Azure DevOps mapping (if ADO enabled)
66
+ 7. Test environment
67
+ 8. Risks and assumptions
68
+ 9. Excluded TCs (with reason)
69
+ 10. Execution schedule
70
+
71
+ ### Step 5 — Update status
72
+
73
+ - Update `qa/README.md` module row (plan status → ✅)
74
+ - If ADO enabled: stub the ADO Plan ID field for Step 6 (ADO integration)
75
+
76
+ ---
77
+
78
+ ## Outputs
79
+
80
+ - `qa/02-test-plans/automated/{module}-test-plan.md`
81
+ - `qa/README.md` plan status updated
@@ -0,0 +1,159 @@
1
+ # Reference: Test Plan Template
2
+
3
+ > Loaded by `skills/qa-test-plan/` when generating a test plan document.
4
+
5
+ ---
6
+
7
+ ## Complete Test Plan Template
8
+
9
+ Create at: `qa/02-test-plans/automated/{module}-test-plan.md`
10
+
11
+ ```markdown
12
+ # Test Plan: {Module Display Name}
13
+
14
+ | Field | Value |
15
+ |-------|-------|
16
+ | Version | 1.0 |
17
+ | Date | YYYY-MM-DD |
18
+ | Module | {module-code} |
19
+ | Test plan type | Automated / Manual / Combined |
20
+ | Author | {agent or human name} |
21
+ | Status | Draft / Approved / Active |
22
+
23
+ ---
24
+
25
+ ## 1. Objective
26
+
27
+ {1-2 sentences: what this test plan covers and why}
28
+
29
+ ---
30
+
31
+ ## 2. Scope
32
+
33
+ ### In scope
34
+ - {submodule 1}: {what is being tested}
35
+
36
+ ### Out of scope
37
+ - {what is explicitly excluded and why}
38
+
39
+ ---
40
+
41
+ ## 3. Automation Feasibility Analysis
42
+
43
+ | Submodule | Total TCs | Fully automatable | Partially | Not automatable | Reason for exclusions |
44
+ |-----------|-----------|------------------|-----------|-----------------|----------------------|
45
+ | {name} | {N} | {N} ({%}) | {N} ({%}) | {N} ({%}) | {brief reason} |
46
+
47
+ ---
48
+
49
+ ## 4. Priority Distribution
50
+
51
+ | Priority | TCs selected | Automated | Manual |
52
+ |----------|-------------|-----------|--------|
53
+ | P0 (Critical — every build) | {N} | {N} | {N} |
54
+ | P1 (High — every release) | {N} | {N} | {N} |
55
+ | P2 (Medium — periodic regression) | {N} | {N} | {N} |
56
+ | P3 (Low — manual only) | {N} | 0 | {N} |
57
+
58
+ ---
59
+
60
+ ## 5. TC Selection and Automation Plan
61
+
62
+ ### P0 Suite
63
+
64
+ | TC ID | Title | Type | Automation status |
65
+ |-------|-------|------|------------------|
66
+ | TC-{M}-{S}-001 | {title} | Functional | Queued |
67
+
68
+ ### P1 Suite
69
+
70
+ | TC ID | Title | Type | Automation status |
71
+ |-------|-------|------|------------------|
72
+ | TC-{M}-{S}-010 | {title} | Functional | Queued |
73
+
74
+ ---
75
+
76
+ ## 6. Azure DevOps Test Plan (if enabled)
77
+
78
+ | Item | Value |
79
+ |------|-------|
80
+ | ADO Plan ID | (populate after creation) |
81
+ | ADO Suite IDs | (populate after creation) |
82
+ | Reporter | @alex_neo/playwright-azure-reporter |
83
+
84
+ ---
85
+
86
+ ## 7. Test Environment
87
+
88
+ | Item | Value |
89
+ |------|-------|
90
+ | QA URL | {{QA_BASE_URL}} |
91
+ | Browser | Chromium (Playwright) |
92
+ | Workers (local) | {N} |
93
+ | Workers (CI) | {N} |
94
+
95
+ ---
96
+
97
+ ## 8. Risks and Assumptions
98
+
99
+ | Risk | Likelihood | Impact | Mitigation |
100
+ |------|-----------|--------|------------|
101
+ | Unstable QA data | Medium | High | Use EXEC_IDX-generated data |
102
+ | External service unavailable | High | Medium | Use intercept / mock strategy |
103
+
104
+ ---
105
+
106
+ ## 9. Excluded TCs
107
+
108
+ | TC ID | Reason for exclusion |
109
+ |-------|---------------------|
110
+ | TC-{M}-{S}-NNN | `BLOCKED-PERMISSIONS` |
111
+ | TC-{M}-{S}-NNN | `PENDING-CODE` |
112
+
113
+ ---
114
+
115
+ ## 10. Execution Schedule
116
+
117
+ | Suite | Trigger | Frequency |
118
+ |-------|---------|-----------|
119
+ | P0 smoke | Every CI build | On push to main / PR |
120
+ | P1 regression | Scheduled | Nightly |
121
+ | P2 full regression | Manual trigger | Before each release |
122
+
123
+ ---
124
+
125
+ ## Changelog
126
+
127
+ | Version | Date | Description |
128
+ |---------|------|-------------|
129
+ | 1.0 | YYYY-MM-DD | Initial creation |
130
+ ```
131
+
132
+ ---
133
+
134
+ ## Priority Decision Tree
135
+
136
+ ```
137
+ Primary happy path of the feature?
138
+ YES → P0
139
+ Critical data corruption or show-stopper risk?
140
+ YES → P0
141
+ Common negative scenario (empty required field, duplicate)?
142
+ YES → P1
143
+ Cross-module dependency or state machine transition?
144
+ YES → P1
145
+ Secondary feature (export, pagination, search)?
146
+ YES → P2
147
+ Edge case, cosmetic, or low-frequency scenario?
148
+ YES → P3
149
+ ```
150
+
151
+ ---
152
+
153
+ ## Automation Feasibility Criteria
154
+
155
+ | Feasibility | Criteria |
156
+ |---|---|
157
+ | Fully automatable | Deterministic, observable via browser, no external system dependency |
158
+ | Partially automatable | External system can be mocked, or some step requires human inspection |
159
+ | Not automatable | Physical access required; irreversible side effects; non-deterministic; BLOCKED-PERMISSIONS |
@@ -0,0 +1,123 @@
1
+ ---
2
+ name: qa-test-stabilization
3
+ description: >
4
+ Stage 5b of the QA pipeline. Diagnoses and fixes failing or flaky Playwright
5
+ tests. Classifies root causes, applies targeted fixes, and produces a
6
+ stabilization report.
7
+ Use when asked to fix failing tests, stabilize flaky tests, diagnose test
8
+ failures, debug e2e tests, reduce test flakiness, or improve test reliability.
9
+ Can be used any time after Stage 5 (Automation).
10
+ ---
11
+
12
+ # QA Skill: Test Stabilization (Stage 5b)
13
+
14
+ **Stage**: 5b — Stabilization (parallel to / after Stage 5)
15
+ **Prerequisite**: Failing or flaky tests exist in `qa/07-automation/e2e/`
16
+ **Output**: Stable passing tests + `STABILIZATION-REPORT.md`
17
+ **Next stage**: Return to Stage 5 to continue automation, or Stage 6 if all tests pass
18
+
19
+ > **Scope boundary**: Only fix tests inside `qa/07-automation/`. Do not modify application source code. Never introduce `waitForTimeout` as a stabilization fix.
20
+
21
+ ---
22
+
23
+ ## Inputs Required
24
+
25
+ 1. Failure output — CI log, local run output, or list of failing test names
26
+ 2. `qa/07-automation/e2e/{file}.spec.ts` — failing spec files
27
+ 3. `qa/01-specifications/{module}/` — ground truth for expected behavior
28
+ 4. `qa/07-automation/playwright.config.ts` — current runner config
29
+
30
+ ---
31
+
32
+ ## Process
33
+
34
+ ### Step 1 — Reproduce locally
35
+
36
+ Run failing tests in isolation:
37
+ ```
38
+ npx playwright test {file}.spec.ts --project={project} --reporter=list
39
+ ```
40
+ Do not trust CI-only failures until reproduced, or classify immediately as Category H (CI environment).
41
+
42
+ ### Step 2 — Classify each failure
43
+
44
+ Use the classification protocol: `references/classification-protocol.md`
45
+
46
+ Category summary:
47
+ - **A — Selector broken**: locator no longer matches; fix selector
48
+ - **B — Timing/flaky**: async operation not awaited correctly; replace with proper wait
49
+ - **C — Data conflict**: parallel test data collision; apply `EXEC_IDX`
50
+ - **D — Auth/session**: session expired or role mismatch; repair fixture
51
+ - **E — Spec mismatch**: behavior changed; update spec first, then test
52
+ - **F — Network dependency**: external call not mocked; add mock or skip
53
+ - **G — Environment**: missing env var or wrong base URL; fix config
54
+ - **H — CI environment**: OS/browser difference; add retry or tag as `@ci-skip`
55
+ - **I — Logic error**: test assertion is wrong; fix assertion to match spec
56
+
57
+ ### Step 3 — Apply fixes in priority order
58
+
59
+ Fix category priorities: A → C → D → B → I → E → F → G → H
60
+
61
+ For each fix:
62
+ 1. Apply minimal change — do not refactor surrounding code
63
+ 2. Re-run the specific TC to verify fix
64
+ 3. Re-run the full describe block to verify no regression
65
+ 4. Note confidence score (0-100) for each fix
66
+
67
+ ### Step 4 — Confidence scoring
68
+
69
+ Calculate composite confidence:
70
+ - Consistent pass ×3 locally: +40
71
+ - Root cause identified and understood: +30
72
+ - No `waitForTimeout` introduced: +20
73
+ - Spec confirms expected behavior: +10
74
+
75
+ Target: ≥ 90 before marking TC as stable.
76
+
77
+ ### Step 5 — Handle unresolvable failures
78
+
79
+ If a failure cannot be fixed without application code change:
80
+ - Add `test.skip(true, 'PENDING-CODE: {ADO item or description}')` annotation
81
+ - Update `qa/01-specifications/{module}/05-test-scenarios.md` with `PENDING-CODE` note
82
+
83
+ ### Step 6 — Update spec if behavior changed (Category E)
84
+
85
+ Follow `qa-maintenance` skill for mid-sprint spec updates. Do not change spec to match wrong behavior.
86
+
87
+ ### Step 7 — Re-run full suite
88
+
89
+ After all fixes applied, run the full module suite:
90
+ ```
91
+ npx playwright test --project={module} --reporter=list
92
+ ```
93
+ All previously failing TCs should pass or be explicitly skipped.
94
+
95
+ ### Step 8 — Produce stabilization report
96
+
97
+ Template: `references/classification-protocol.md` (STABILIZATION-REPORT section)
98
+
99
+ Required sections:
100
+ - Run date + environment
101
+ - TC table: ID | Category | Root cause | Fix applied | Confidence | Status
102
+ - Summary: pass/fail/skip counts, blockers needing application fix
103
+ - Recommendations (if any systemic issues found)
104
+
105
+ ---
106
+
107
+ ## Key Rules
108
+
109
+ | Rule | Required |
110
+ |---|---|
111
+ | No `waitForTimeout` | Use `waitForSelector` or `waitForResponse` |
112
+ | No app code changes | Fix tests only, not application |
113
+ | Spec is ground truth | Never change spec to match wrong behavior |
114
+ | Unresolvable → skip | With PENDING-CODE annotation |
115
+ | Report required | Every stabilization session produces a report |
116
+
117
+ ---
118
+
119
+ ## Outputs
120
+
121
+ - Fixed spec files in `qa/07-automation/e2e/`
122
+ - `qa/07-automation/STABILIZATION-REPORT-{date}.md`
123
+ - Updated `qa/01-specifications/` (if Category E found)