@keber/qa-framework 1.6.1 → 1.7.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +56 -5
- package/README.md +29 -20
- package/docs/folder-structure-guide.md +53 -0
- package/docs/installation.md +2 -2
- package/package.json +1 -1
- package/scripts/init.js +9 -4
- package/scripts/upgrade.js +83 -5
- package/templates/automation-scaffold/playwright.config.ts +2 -0
package/CHANGELOG.md
CHANGED
|
@@ -33,6 +33,58 @@ has been removed or parameterized. See `docs/comparison-matrix.md` and `docs/gen
|
|
|
33
33
|
|
|
34
34
|
---
|
|
35
35
|
|
|
36
|
+
## [1.7.0] - 2026-05-06
|
|
37
|
+
|
|
38
|
+
### Changed
|
|
39
|
+
|
|
40
|
+
- **Agent instructions moved to `.github/instructions/qa-framework.instructions.md`** — the
|
|
41
|
+
framework no longer writes to `.github/copilot-instructions.md`. The new file is a VS Code
|
|
42
|
+
`*.instructions.md` file with `applyTo: '**'` frontmatter, which Copilot loads automatically.
|
|
43
|
+
This eliminates the conflict between framework-owned rules and project-owned custom instructions:
|
|
44
|
+
both files coexist independently and the framework file is freely upgradeable.
|
|
45
|
+
|
|
46
|
+
### Added
|
|
47
|
+
|
|
48
|
+
- **`upgrade` step 2b — automatic migration of old `copilot-instructions.md`**:
|
|
49
|
+
- If the file contains only QA Framework content (any previous version) → the file is deleted.
|
|
50
|
+
- If the file contains custom instructions and a QA Framework section → the QA section is stripped and the custom content is preserved.
|
|
51
|
+
- If the file contains no QA Framework content → the file is left untouched.
|
|
52
|
+
The detection marker is the heading `# QA Framework Instructions`, consistent across all versions.
|
|
53
|
+
|
|
54
|
+
### Migration
|
|
55
|
+
|
|
56
|
+
Run `npx qa-framework upgrade`. No manual steps required.
|
|
57
|
+
See `MIGRATION-NOTES.md` — section "Upgrading from a version that used `.github/copilot-instructions.md`".
|
|
58
|
+
|
|
59
|
+
---
|
|
60
|
+
|
|
61
|
+
## [1.6.2] - 2026-05-05
|
|
62
|
+
|
|
63
|
+
### Added
|
|
64
|
+
|
|
65
|
+
- **`tests/helpers/debug/`** — diagnostic scripts directory created by `init` and `upgrade` inside
|
|
66
|
+
`07-automation/e2e/tests/`. Scripts here are excluded from test runs via `testIgnore`.
|
|
67
|
+
- **`tests/seeds/`** — data seeding specs directory created by `init` and `upgrade` inside
|
|
68
|
+
`07-automation/e2e/tests/`. Excluded from test runs via `testIgnore`.
|
|
69
|
+
- **`testIgnore`** in `playwright.config.ts` template — excludes `**/helpers/debug/**` and
|
|
70
|
+
`**/seeds/**` from Playwright test discovery.
|
|
71
|
+
- **`upgrade` step 5e** — patches existing `playwright.config.ts` in `e2e/`: replaces
|
|
72
|
+
`testDir: '.'` with `'./tests'`, injects `testIgnore` if missing, creates `helpers/debug/`
|
|
73
|
+
and `seeds/` if absent.
|
|
74
|
+
- **Dual-Track Pipeline** section in `docs/folder-structure-guide.md` and `qa/QA-STRUCTURE-GUIDE.md`
|
|
75
|
+
— documents the automation track and manual track as parallel paths sharing `01-specifications/`
|
|
76
|
+
as source of truth. Includes entry point table (3 scenarios) and track selection guidance.
|
|
77
|
+
Clarifies that `03-test-cases/` is the manual track artifact and `04-test-data/` is optional.
|
|
78
|
+
|
|
79
|
+
### Fixed
|
|
80
|
+
|
|
81
|
+
- `qa/QA-STRUCTURE-GUIDE.md` — removed stale reference to deleted `docs/generalization-decisions.md`
|
|
82
|
+
from the `06-defects/` section.
|
|
83
|
+
- `README.md` — pipeline table updated with Track column; `03-test-cases/` and `04-test-data/`
|
|
84
|
+
annotated as manual-track / optional in the directory tree.
|
|
85
|
+
|
|
86
|
+
---
|
|
87
|
+
|
|
36
88
|
## [1.6.0] - 2026-04-29
|
|
37
89
|
|
|
38
90
|
### Changed (breaking - automated by `upgrade`)
|
|
@@ -69,11 +121,10 @@ has been removed or parameterized. See `docs/comparison-matrix.md` and `docs/gen
|
|
|
69
121
|
- `07-automation/load/` — placeholder for load and performance tests; created on `init` and `upgrade`.
|
|
70
122
|
- **`scripts/upgrade.js` migration section 5** — detects old v1.5.x structure and relocates all
|
|
71
123
|
affected files non-destructively (moves only when destination does not exist; warns on conflict).
|
|
72
|
-
- **Stage
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
upstream artifact update rules.
|
|
124
|
+
- **Stage 5b - Test Stabilization** (`skills/qa-test-stabilization/`) — skill for exhaustively
|
|
125
|
+
reviewing and stabilizing generated Playwright tests before ADO integration. Covers baseline
|
|
126
|
+
collection, failure classification (9 categories), false-positive validation, confidence scoring
|
|
127
|
+
(>=90% exit threshold), `STABILIZATION-REPORT.md` schema, and upstream artifact update rules.
|
|
77
128
|
|
|
78
129
|
### Planned
|
|
79
130
|
|
package/README.md
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
# qa-framework
|
|
2
2
|
|
|
3
3
|
> Reusable, installable, agent-oriented QA framework for spec-driven automated testing.
|
|
4
|
-
> Current version: **v1.
|
|
4
|
+
> Current version: **v1.7.0**
|
|
5
5
|
|
|
6
6
|
---
|
|
7
7
|
|
|
@@ -61,7 +61,7 @@ npm install @keber/qa-framework
|
|
|
61
61
|
1. Create the `qa/` directory tree in your project root
|
|
62
62
|
2. Copy all base templates into place
|
|
63
63
|
3. Create `qa/qa-framework.config.json` for project-specific settings
|
|
64
|
-
4. Generate `.github/
|
|
64
|
+
4. Generate `.github/instructions/qa-framework.instructions.md` with QA agent behavior rules (11 rules + ADO detection)
|
|
65
65
|
5. Copy the `skills/` set to `.github/skills/` so the agent can load them on demand
|
|
66
66
|
6. Create `qa/AGENT-NEXT-STEPS.md` with follow-up steps
|
|
67
67
|
|
|
@@ -73,9 +73,13 @@ After `npm update @keber/qa-framework`, run:
|
|
|
73
73
|
npx qa-framework upgrade
|
|
74
74
|
```
|
|
75
75
|
|
|
76
|
-
This overwrites **only** framework-owned files (skills, `
|
|
76
|
+
This overwrites **only** framework-owned files (skills, `qa-framework.instructions.md`,
|
|
77
77
|
`QA-STRUCTURE-GUIDE.md`) and never touches your specs, test plans, automation code, or memory.
|
|
78
78
|
|
|
79
|
+
If upgrading from a version that wrote to `.github/copilot-instructions.md`, `upgrade`
|
|
80
|
+
automatically removes the QA section from that file (or deletes it if it contained only
|
|
81
|
+
framework content), and creates `.github/instructions/qa-framework.instructions.md` instead.
|
|
82
|
+
|
|
79
83
|
---
|
|
80
84
|
|
|
81
85
|
## Repository Structure (this package)
|
|
@@ -148,7 +152,7 @@ qa-framework/
|
|
|
148
152
|
│
|
|
149
153
|
└── scripts/ <- CLI commands
|
|
150
154
|
├── cli.js <- Entry point (qa-framework <command>)
|
|
151
|
-
├── init.js <- Scaffold qa/ tree + skills +
|
|
155
|
+
├── init.js <- Scaffold qa/ tree + skills + qa-framework.instructions.md
|
|
152
156
|
├── upgrade.js <- Refresh framework-owned files after npm update
|
|
153
157
|
├── generate.js <- Generate individual artifact from template
|
|
154
158
|
└── validate.js <- Check structure compliance
|
|
@@ -170,8 +174,8 @@ qa/
|
|
|
170
174
|
├── 01-specifications/ <- Functional specs (used by generate command)
|
|
171
175
|
├── {module}/{submodule}/ <- 6-file spec sets created per module/submodule in config
|
|
172
176
|
├── 02-test-plans/ <- Test plans (automated + manual)
|
|
173
|
-
├── 03-test-cases/ <-
|
|
174
|
-
├── 04-test-data/ <-
|
|
177
|
+
├── 03-test-cases/ <- TC-*.md step-by-step docs (manual track; optional if fully automated)
|
|
178
|
+
├── 04-test-data/ <- Shared test data factories/seeders (optional — per-module data lives in 01-specs)
|
|
175
179
|
├── 05-test-execution/ <- Execution reports and results
|
|
176
180
|
├── 06-defects/open|resolved/ <- Defect tracking
|
|
177
181
|
├── 07-automation/ <- Playwright automation code and config
|
|
@@ -194,10 +198,15 @@ Additionally, `init` writes to the project root:
|
|
|
194
198
|
|
|
195
199
|
```
|
|
196
200
|
.github/
|
|
197
|
-
├──
|
|
198
|
-
└──
|
|
201
|
+
├── instructions/
|
|
202
|
+
│ └── qa-framework.instructions.md <- QA agent rules (framework-owned, applyTo: '**')
|
|
203
|
+
└── skills/ <- Copied from package skills/ (one folder per pipeline stage)
|
|
199
204
|
```
|
|
200
205
|
|
|
206
|
+
> `qa-framework.instructions.md` is a VS Code `*.instructions.md` file, separate from any
|
|
207
|
+
> custom `.github/copilot-instructions.md` the project may already have. The two files
|
|
208
|
+
> coexist without conflict and are independently upgradeable.
|
|
209
|
+
|
|
201
210
|
See [docs/folder-structure-guide.md](docs/folder-structure-guide.md) for a full explanation of every folder.
|
|
202
211
|
|
|
203
212
|
---
|
|
@@ -218,18 +227,18 @@ them via `read_file` without touching `node_modules`.
|
|
|
218
227
|
|
|
219
228
|
### QA Pipeline
|
|
220
229
|
|
|
221
|
-
Skills map to the pipeline stages enforced by `.github/
|
|
230
|
+
Skills map to the pipeline stages enforced by `.github/instructions/qa-framework.instructions.md`:
|
|
222
231
|
|
|
223
|
-
| Stage | Skill | Task | Prerequisite |
|
|
224
|
-
|
|
225
|
-
| 1 | `qa-module-analysis` | Analyze module, produce 6-file spec set | None |
|
|
226
|
-
| 2 | `qa-spec-generation` | Generate/update 6-file spec set | `00-inventory.md` exists |
|
|
227
|
-
| 3 | `qa-test-plan` | Generate test plan | `05-test-scenarios.md` exists |
|
|
228
|
-
| 4 | `qa-test-cases` | Generate TC-{ID}.md files | Test plan exists |
|
|
229
|
-
| 5 | `qa-automation` | Implement Playwright tests | Specs approved, no PENDING-CODE |
|
|
230
|
-
| 5b | `qa-test-stabilization` | Stabilize failing tests | Failing tests exist |
|
|
231
|
-
| 6 | `qa-maintenance` | Update artifacts after app changes | Delivered change |
|
|
232
|
-
| - | `qa-ado-integration` | Sync with Azure DevOps Test Plans | ADO enabled in config |
|
|
232
|
+
| Stage | Skill | Task | Track | Prerequisite |
|
|
233
|
+
|---|---|---|---|---|
|
|
234
|
+
| 1 | `qa-module-analysis` | Analyze module, produce 6-file spec set | Both | None |
|
|
235
|
+
| 2 | `qa-spec-generation` | Generate/update 6-file spec set | Both | `00-inventory.md` exists |
|
|
236
|
+
| 3 | `qa-test-plan` | Generate test plan | Both | `05-test-scenarios.md` exists |
|
|
237
|
+
| 4 | `qa-test-cases` | Generate TC-{ID}.md files | Manual | Test plan exists |
|
|
238
|
+
| 5 | `qa-automation` | Implement Playwright tests | Automation | Specs approved, no PENDING-CODE |
|
|
239
|
+
| 5b | `qa-test-stabilization` | Stabilize failing tests | Automation | Failing tests exist |
|
|
240
|
+
| 6 | `qa-maintenance` | Update artifacts after app changes | Both | Delivered change |
|
|
241
|
+
| - | `qa-ado-integration` | Sync with Azure DevOps Test Plans | Both | ADO enabled in config |
|
|
233
242
|
|
|
234
243
|
See [docs/skills-architecture.md](docs/skills-architecture.md) for the full design rationale.
|
|
235
244
|
|
|
@@ -254,7 +263,7 @@ Options:
|
|
|
254
263
|
--version, -v Show version
|
|
255
264
|
```
|
|
256
265
|
|
|
257
|
-
**upgrade** overwrites only framework-owned files (skills, `
|
|
266
|
+
**upgrade** overwrites only framework-owned files (skills, `qa-framework.instructions.md`,
|
|
258
267
|
`QA-STRUCTURE-GUIDE.md`) and never touches project-owned files. Run `--dry-run` to preview
|
|
259
268
|
without writing.
|
|
260
269
|
|
|
@@ -31,6 +31,59 @@ Agent skills live in `.github/skills/` (not inside `qa/`). See the `.github/skil
|
|
|
31
31
|
|
|
32
32
|
---
|
|
33
33
|
|
|
34
|
+
## Dual-Track Pipeline
|
|
35
|
+
|
|
36
|
+
All pipeline paths share the same input: `01-specifications/`. From there, work splits into
|
|
37
|
+
two tracks that can run in parallel or independently depending on team maturity.
|
|
38
|
+
|
|
39
|
+
```
|
|
40
|
+
01-specifications/ (source of truth — what the app does and what must be tested)
|
|
41
|
+
│
|
|
42
|
+
├─── Automation track ──────────────────────────────────────────────────
|
|
43
|
+
│ │
|
|
44
|
+
│ ▼
|
|
45
|
+
│ 02-test-plans/automated/ ← scope + priority decisions
|
|
46
|
+
│ │
|
|
47
|
+
│ ▼
|
|
48
|
+
│ 07-automation/e2e/tests/ ← Playwright .spec.ts files
|
|
49
|
+
│ │
|
|
50
|
+
│ ▼
|
|
51
|
+
│ 05-test-execution/automated/ ← execution reports
|
|
52
|
+
│ │
|
|
53
|
+
│ ▼
|
|
54
|
+
│ 08-azure-integration/ ← ADO sync via playwright-azure-reporter
|
|
55
|
+
│
|
|
56
|
+
└─── Manual track ──────────────────────────────────────────────────────
|
|
57
|
+
│
|
|
58
|
+
▼
|
|
59
|
+
02-test-plans/manual/ ← scope + manual test approach
|
|
60
|
+
│
|
|
61
|
+
▼
|
|
62
|
+
03-test-cases/manual/ ← TC-*.md with steps (for human testers)
|
|
63
|
+
│
|
|
64
|
+
▼
|
|
65
|
+
05-test-execution/manual/ ← manual run evidence
|
|
66
|
+
│
|
|
67
|
+
▼
|
|
68
|
+
08-azure-integration/ ← ADO sync via ado-integration skill
|
|
69
|
+
```
|
|
70
|
+
|
|
71
|
+
**Entry points:**
|
|
72
|
+
|
|
73
|
+
| Scenario | Entry point | Tracks active |
|
|
74
|
+
|---|---|---|
|
|
75
|
+
| New system, no prior QA | Module analysis → spec generation | Automation (primary), Manual (as needed) |
|
|
76
|
+
| Sprint with ADO stories | Stories → spec generation → test plan | Both, driven by sprint scope |
|
|
77
|
+
| Maintenance/continuous improvement | Changed module → maintenance skill | Automation (update existing tests) |
|
|
78
|
+
|
|
79
|
+
**Track selection guidance:**
|
|
80
|
+
- Use **automation track** when the goal is regression coverage and CI integration.
|
|
81
|
+
- Use **manual track** when: (a) team has manual testers who need step-by-step documents; (b) auditability or traceability to external standards is required; (c) features are not yet automatable.
|
|
82
|
+
- Both tracks use the same TC-IDs from `01-specifications/*/05-test-scenarios.md` — traceability is preserved regardless of which track executes a given TC.
|
|
83
|
+
- `04-test-data/` is optional in both tracks. Use it when test data factories or seeders are shared across multiple modules. Per-submodule data belongs in `01-specifications/*/04-test-data.md`.
|
|
84
|
+
|
|
85
|
+
---
|
|
86
|
+
|
|
34
87
|
## .github/skills/
|
|
35
88
|
|
|
36
89
|
**Purpose**: 3-layer QA pipeline skills installed by the framework. Loaded by the agent on demand — only the relevant skill for the current task is loaded, not all skills at once.
|
package/docs/installation.md
CHANGED
|
@@ -51,7 +51,7 @@ qa/
|
|
|
51
51
|
└── 08-azure-integration/README.md
|
|
52
52
|
└── memory/INDEX.md
|
|
53
53
|
|
|
54
|
-
.github/
|
|
54
|
+
.github/instructions/qa-framework.instructions.md <- QA agent rules (framework-owned)
|
|
55
55
|
.github/skills/ <- 8 agent skill sets (SKILL.md + references/)
|
|
56
56
|
```
|
|
57
57
|
|
|
@@ -93,7 +93,7 @@ After `npm update @keber/qa-framework`:
|
|
|
93
93
|
npx qa-framework upgrade
|
|
94
94
|
```
|
|
95
95
|
|
|
96
|
-
This overwrites only framework-owned files (`.github/skills/`,
|
|
96
|
+
This overwrites only framework-owned files (`.github/skills/`, `.github/instructions/qa-framework.instructions.md`,
|
|
97
97
|
`QA-STRUCTURE-GUIDE.md`) and migrates the `07-automation/` structure if upgrading from
|
|
98
98
|
v1.5.x. Your specs, tests, and memory are never touched.
|
|
99
99
|
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@keber/qa-framework",
|
|
3
|
-
"version": "1.
|
|
3
|
+
"version": "1.7.0",
|
|
4
4
|
"description": "Reusable spec-driven QA framework for IDE-agent-assisted automated testing. Installable as an npm package. Provides structure, templates, agent instructions, and optional integrations for Playwright and Azure DevOps.",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"qa",
|
package/scripts/init.js
CHANGED
|
@@ -86,6 +86,8 @@ const topLevelFolders = [
|
|
|
86
86
|
'06-defects/open',
|
|
87
87
|
'06-defects/resolved',
|
|
88
88
|
'07-automation/e2e/tests',
|
|
89
|
+
'07-automation/e2e/tests/helpers/debug',
|
|
90
|
+
'07-automation/e2e/tests/seeds',
|
|
89
91
|
'08-azure-integration',
|
|
90
92
|
'memory',
|
|
91
93
|
];
|
|
@@ -251,9 +253,9 @@ if (fs.existsSync(structureGuideSrc)) {
|
|
|
251
253
|
writeIfMissing(structureGuideDest, fs.readFileSync(structureGuideSrc, 'utf8'));
|
|
252
254
|
}
|
|
253
255
|
|
|
254
|
-
// --- .github/
|
|
256
|
+
// --- .github/instructions/qa-framework.instructions.md ---
|
|
255
257
|
const githubDir = path.join(cwd, '.github');
|
|
256
|
-
const copilotInstrPath = path.join(githubDir, '
|
|
258
|
+
const copilotInstrPath = path.join(githubDir, 'instructions', 'qa-framework.instructions.md');
|
|
257
259
|
|
|
258
260
|
// Detect whether the ado-qa skill is available (installed or already copied)
|
|
259
261
|
const adoQaInstalled = fs.existsSync(path.join(cwd, 'node_modules', '@keber', 'ado-qa'))
|
|
@@ -282,7 +284,10 @@ Refer to \`qa/00-guides/AGENT-INSTRUCTIONS-ADO-INTEGRATION.md\` for the full ADO
|
|
|
282
284
|
> This will automatically copy the ADO skills to \`.github/skills/\` via postinstall.
|
|
283
285
|
`;
|
|
284
286
|
|
|
285
|
-
const copilotInstrContent =
|
|
287
|
+
const copilotInstrContent = `---
|
|
288
|
+
applyTo: '**'
|
|
289
|
+
---
|
|
290
|
+
# QA Framework Instructions
|
|
286
291
|
|
|
287
292
|
This project uses \`@keber/qa-framework\` v${config.frameworkVersion ?? '1.0.0'} for spec-driven automated testing.
|
|
288
293
|
|
|
@@ -335,7 +340,7 @@ const nextStepsContent = `# ✅ @keber/qa-framework installed successfully
|
|
|
335
340
|
## What was scaffolded
|
|
336
341
|
|
|
337
342
|
- \`qa/\` folder structure with spec templates and agent instructions
|
|
338
|
-
- \`.github/
|
|
343
|
+
- \`.github/instructions/qa-framework.instructions.md\` with QA agent behavior rules (framework-owned, safe to upgrade)
|
|
339
344
|
|
|
340
345
|
## Required next steps
|
|
341
346
|
|
package/scripts/upgrade.js
CHANGED
|
@@ -19,8 +19,8 @@
|
|
|
19
19
|
* - qa/07-automation/.env.example -> qa/07-automation/e2e/
|
|
20
20
|
* - qa/07-automation/fixtures/ -> qa/07-automation/e2e/fixtures/
|
|
21
21
|
* - qa/07-automation/e2e/{module}/ -> qa/07-automation/e2e/tests/{module}/
|
|
22
|
-
* - Creates integration/ and load/ placeholders
|
|
23
|
-
*
|
|
22
|
+
* - Creates integration/ and load/ placeholders * - Patches playwright.config.ts: testDir '.' -> './tests', adds testIgnore
|
|
23
|
+
* - Creates tests/helpers/debug/ and tests/seeds/ if absent *
|
|
24
24
|
* NEVER touches (project-owned):
|
|
25
25
|
* - qa/01-specifications/ <- Your specs
|
|
26
26
|
* - qa/02-test-plans/ <- Your test plans
|
|
@@ -81,12 +81,48 @@ if (!fs.existsSync(skillsSrc)) {
|
|
|
81
81
|
}
|
|
82
82
|
|
|
83
83
|
// ---------------------------------------------------------------------------
|
|
84
|
-
// 2. .github/
|
|
84
|
+
// 2. .github/instructions/qa-framework.instructions.md — overwrite (framework-owned)
|
|
85
85
|
// ---------------------------------------------------------------------------
|
|
86
|
-
const copilotInstrPath = path.join(githubDir, '
|
|
86
|
+
const copilotInstrPath = path.join(githubDir, 'instructions', 'qa-framework.instructions.md');
|
|
87
87
|
const copilotContent = buildCopilotInstructions(config);
|
|
88
88
|
forceWrite(copilotInstrPath, copilotContent);
|
|
89
89
|
|
|
90
|
+
// ---------------------------------------------------------------------------
|
|
91
|
+
// 2b. Migration: strip QA Framework section from old copilot-instructions.md
|
|
92
|
+
//
|
|
93
|
+
// Handles all cases:
|
|
94
|
+
// A. File has custom instructions + QA section → keep custom, strip QA section
|
|
95
|
+
// B. File has ONLY QA section (any version) → delete the file
|
|
96
|
+
// C. File does not mention QA Framework → leave untouched
|
|
97
|
+
//
|
|
98
|
+
// The QA section always starts with "# QA Framework Instructions" across all
|
|
99
|
+
// previous versions, so that heading is the reliable split point.
|
|
100
|
+
// ---------------------------------------------------------------------------
|
|
101
|
+
const oldCopilotPath = path.join(githubDir, 'copilot-instructions.md');
|
|
102
|
+
if (fs.existsSync(oldCopilotPath)) {
|
|
103
|
+
const oldContent = fs.readFileSync(oldCopilotPath, 'utf8');
|
|
104
|
+
const qaMarker = '# QA Framework Instructions';
|
|
105
|
+
const qaIdx = oldContent.indexOf(qaMarker);
|
|
106
|
+
|
|
107
|
+
if (qaIdx !== -1) {
|
|
108
|
+
// Extract anything before the QA section, removing any trailing separator
|
|
109
|
+
const before = oldContent.slice(0, qaIdx).replace(/\s*\n---\s*$/, '').trim();
|
|
110
|
+
|
|
111
|
+
if (before.length === 0) {
|
|
112
|
+
// Case B: file contained only QA Framework content → delete it
|
|
113
|
+
if (!dryRun) fs.unlinkSync(oldCopilotPath);
|
|
114
|
+
updated.push(oldCopilotPath);
|
|
115
|
+
console.log(` [deleted] .github/copilot-instructions.md (contained only QA Framework rules — now in .github/instructions/qa-framework.instructions.md)`);
|
|
116
|
+
} else {
|
|
117
|
+
// Case A: file had custom content too → write back only the custom part
|
|
118
|
+
if (!dryRun) fs.writeFileSync(oldCopilotPath, before + '\n', 'utf8');
|
|
119
|
+
updated.push(oldCopilotPath);
|
|
120
|
+
console.log(` [cleaned] .github/copilot-instructions.md — removed QA Framework section, kept custom instructions`);
|
|
121
|
+
}
|
|
122
|
+
}
|
|
123
|
+
// Case C: no QA marker found → leave untouched (no log noise)
|
|
124
|
+
}
|
|
125
|
+
|
|
90
126
|
// ---------------------------------------------------------------------------
|
|
91
127
|
// 3. qa/QA-STRUCTURE-GUIDE.md — overwrite (framework doc)
|
|
92
128
|
// ---------------------------------------------------------------------------
|
|
@@ -187,6 +223,45 @@ if (!fs.existsSync(loadReadme)) {
|
|
|
187
223
|
console.log(` [created] ${path.relative(cwd, loadReadme)}`);
|
|
188
224
|
}
|
|
189
225
|
|
|
226
|
+
// 5e. Patch playwright.config.ts in e2e/:
|
|
227
|
+
const playwrightConfigPath = path.join(e2eDir, 'playwright.config.ts');
|
|
228
|
+
if (fs.existsSync(playwrightConfigPath)) {
|
|
229
|
+
let cfg = fs.readFileSync(playwrightConfigPath, 'utf8');
|
|
230
|
+
let cfgChanged = false;
|
|
231
|
+
|
|
232
|
+
// Fix testDir: '.' -> './tests'
|
|
233
|
+
if (/testDir\s*:\s*['"]\.['"]/.test(cfg)) {
|
|
234
|
+
cfg = cfg.replace(/testDir\s*:\s*['"]\.['"]/g, "testDir: './tests'");
|
|
235
|
+
cfgChanged = true;
|
|
236
|
+
console.log(` [patched] e2e/playwright.config.ts — testDir: '.' -> './tests'`);
|
|
237
|
+
}
|
|
238
|
+
|
|
239
|
+
// Inject testIgnore after testDir line if not present
|
|
240
|
+
if (!cfg.includes('testIgnore')) {
|
|
241
|
+
cfg = cfg.replace(
|
|
242
|
+
/(testDir\s*:.*\n)/,
|
|
243
|
+
"$1 testIgnore: ['**/helpers/debug/**', '**/seeds/**'],\n"
|
|
244
|
+
);
|
|
245
|
+
cfgChanged = true;
|
|
246
|
+
console.log(` [patched] e2e/playwright.config.ts — added testIgnore`);
|
|
247
|
+
}
|
|
248
|
+
|
|
249
|
+
if (cfgChanged) {
|
|
250
|
+
if (!dryRun) fs.writeFileSync(playwrightConfigPath, cfg, 'utf8');
|
|
251
|
+
updated.push(playwrightConfigPath);
|
|
252
|
+
}
|
|
253
|
+
}
|
|
254
|
+
|
|
255
|
+
// Create tests/helpers/debug and tests/seeds if missing
|
|
256
|
+
for (const subdir of ['tests/helpers/debug', 'tests/seeds']) {
|
|
257
|
+
const subdirPath = path.join(e2eDir, subdir);
|
|
258
|
+
if (!fs.existsSync(subdirPath)) {
|
|
259
|
+
if (!dryRun) fs.mkdirSync(subdirPath, { recursive: true });
|
|
260
|
+
updated.push(subdirPath);
|
|
261
|
+
console.log(` [created] ${path.relative(cwd, subdirPath)}/`);
|
|
262
|
+
}
|
|
263
|
+
}
|
|
264
|
+
|
|
190
265
|
// ---------------------------------------------------------------------------
|
|
191
266
|
// Summary
|
|
192
267
|
// ---------------------------------------------------------------------------
|
|
@@ -239,7 +314,10 @@ function copyDirForce(srcDir, destDir) {
|
|
|
239
314
|
|
|
240
315
|
function buildCopilotInstructions(cfg) {
|
|
241
316
|
const version = cfg.frameworkVersion ?? '1.0.0';
|
|
242
|
-
return
|
|
317
|
+
return `---
|
|
318
|
+
applyTo: '**'
|
|
319
|
+
---
|
|
320
|
+
# QA Framework Instructions
|
|
243
321
|
|
|
244
322
|
This project uses \`@keber/qa-framework\` v${version} for spec-driven automated testing.
|
|
245
323
|
|
|
@@ -39,6 +39,8 @@ for (const key of required) {
|
|
|
39
39
|
export default defineConfig({
|
|
40
40
|
// ------ Test discovery ------
|
|
41
41
|
testDir: './tests',
|
|
42
|
+
// Exclude non-suite directories from test runs
|
|
43
|
+
testIgnore: ['**/helpers/debug/**', '**/seeds/**'],
|
|
42
44
|
// Use any subdir pattern your project standardizes on, e.g.:
|
|
43
45
|
// testMatch: ['**/*.spec.ts'],
|
|
44
46
|
|