@qa-gentic/agents 1.1.2

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (52) hide show
  1. package/README.md +203 -0
  2. package/bin/postinstall.js +75 -0
  3. package/bin/qa-stlc.js +76 -0
  4. package/package.json +48 -0
  5. package/skills/qa-stlc/AGENT-BEHAVIOR.md +373 -0
  6. package/skills/qa-stlc/deduplication-protocol.md +303 -0
  7. package/skills/qa-stlc/generate-gherkin.md +550 -0
  8. package/skills/qa-stlc/generate-playwright-code.md +439 -0
  9. package/skills/qa-stlc/generate-test-cases.md +176 -0
  10. package/skills/qa-stlc/write-helix-files.md +349 -0
  11. package/src/cmd-init.js +84 -0
  12. package/src/cmd-mcp-config.js +177 -0
  13. package/src/cmd-skills.js +124 -0
  14. package/src/cmd-verify.js +129 -0
  15. package/src/qa_stlc_agents/__init__.py +0 -0
  16. package/src/qa_stlc_agents/__pycache__/__init__.cpython-310.pyc +0 -0
  17. package/src/qa_stlc_agents/agent_gherkin_generator/__init__.py +0 -0
  18. package/src/qa_stlc_agents/agent_gherkin_generator/__pycache__/__init__.cpython-310.pyc +0 -0
  19. package/src/qa_stlc_agents/agent_gherkin_generator/__pycache__/server.cpython-310.pyc +0 -0
  20. package/src/qa_stlc_agents/agent_gherkin_generator/server.py +502 -0
  21. package/src/qa_stlc_agents/agent_gherkin_generator/tools/__init__.py +0 -0
  22. package/src/qa_stlc_agents/agent_gherkin_generator/tools/__pycache__/__init__.cpython-310.pyc +0 -0
  23. package/src/qa_stlc_agents/agent_gherkin_generator/tools/__pycache__/ado_gherkin.cpython-310.pyc +0 -0
  24. package/src/qa_stlc_agents/agent_gherkin_generator/tools/ado_gherkin.py +854 -0
  25. package/src/qa_stlc_agents/agent_helix_writer/__init__.py +0 -0
  26. package/src/qa_stlc_agents/agent_helix_writer/__pycache__/__init__.cpython-310.pyc +0 -0
  27. package/src/qa_stlc_agents/agent_helix_writer/__pycache__/server.cpython-310.pyc +0 -0
  28. package/src/qa_stlc_agents/agent_helix_writer/server.py +529 -0
  29. package/src/qa_stlc_agents/agent_helix_writer/tools/__init__.py +0 -0
  30. package/src/qa_stlc_agents/agent_helix_writer/tools/__pycache__/__init__.cpython-310.pyc +0 -0
  31. package/src/qa_stlc_agents/agent_helix_writer/tools/__pycache__/helix_write.cpython-310.pyc +0 -0
  32. package/src/qa_stlc_agents/agent_helix_writer/tools/helix_write.py +622 -0
  33. package/src/qa_stlc_agents/agent_playwright_generator/__init__.py +0 -0
  34. package/src/qa_stlc_agents/agent_playwright_generator/__pycache__/__init__.cpython-310.pyc +0 -0
  35. package/src/qa_stlc_agents/agent_playwright_generator/__pycache__/server.cpython-310.pyc +0 -0
  36. package/src/qa_stlc_agents/agent_playwright_generator/server.py +2771 -0
  37. package/src/qa_stlc_agents/agent_playwright_generator/tools/__init__.py +0 -0
  38. package/src/qa_stlc_agents/agent_playwright_generator/tools/__pycache__/__init__.cpython-310.pyc +0 -0
  39. package/src/qa_stlc_agents/agent_playwright_generator/tools/__pycache__/ado_attach.cpython-310.pyc +0 -0
  40. package/src/qa_stlc_agents/agent_playwright_generator/tools/ado_attach.py +62 -0
  41. package/src/qa_stlc_agents/agent_test_case_manager/__init__.py +0 -0
  42. package/src/qa_stlc_agents/agent_test_case_manager/__pycache__/__init__.cpython-310.pyc +0 -0
  43. package/src/qa_stlc_agents/agent_test_case_manager/__pycache__/server.cpython-310.pyc +0 -0
  44. package/src/qa_stlc_agents/agent_test_case_manager/server.py +483 -0
  45. package/src/qa_stlc_agents/agent_test_case_manager/tools/__init__.py +0 -0
  46. package/src/qa_stlc_agents/agent_test_case_manager/tools/__pycache__/__init__.cpython-310.pyc +0 -0
  47. package/src/qa_stlc_agents/agent_test_case_manager/tools/__pycache__/ado_workitem.cpython-310.pyc +0 -0
  48. package/src/qa_stlc_agents/agent_test_case_manager/tools/ado_workitem.py +302 -0
  49. package/src/qa_stlc_agents/shared/__init__.py +0 -0
  50. package/src/qa_stlc_agents/shared/__pycache__/__init__.cpython-310.pyc +0 -0
  51. package/src/qa_stlc_agents/shared/__pycache__/auth.cpython-310.pyc +0 -0
  52. package/src/qa_stlc_agents/shared/auth.py +119 -0
@@ -0,0 +1,550 @@
1
+ ---
2
+ name: generate-gherkin
3
+ description: >
4
+ Use this skill whenever the user asks to generate, write, or create Gherkin feature files,
5
+ BDD scenarios, or test cases from Azure DevOps work items. Also triggers when the user wants
6
+ to automate acceptance criteria into Playwright tests, create regression suites from PBIs,
7
+ Bugs, or Features, or produce .feature files for any web application. This skill enforces
8
+ navigation steps in every Gherkin scenario and links generated artefacts back to ADO work items.
9
+ Always use this skill when the user mentions "feature file", "Gherkin", "BDD", "scenarios",
10
+ "acceptance criteria automation", or asks to test a specific page/feature of a web app.
11
+ Works with any ADO work item type: PBI, Bug, or Feature ID.
12
+ compatibility:
13
+ tools:
14
+ - qa-gherkin-generator:fetch_feature_hierarchy
15
+ - qa-gherkin-generator:fetch_work_item_for_gherkin
16
+ - qa-gherkin-generator:attach_gherkin_to_feature
17
+ - qa-gherkin-generator:attach_gherkin_to_work_item
18
+ - qa-gherkin-generator:validate_gherkin_content
19
+ - qa-playwright-generator:validate_gherkin_steps
20
+ - qa-playwright-generator:generate_playwright_code
21
+ - qa-playwright-generator:attach_code_to_work_item
22
+ - qa-test-case-manager:fetch_work_item
23
+ - qa-test-case-manager:get_linked_test_cases
24
+ ---
25
+
26
+ # Generate Gherkin Skill
27
+
28
+ > **Read `AGENT-BEHAVIOR.md` before this skill.** The behavior rules there override any
29
+ > inference. This skill provides the step-by-step workflow only.
30
+
31
+ Generate production-quality Gherkin regression suites from ADO work items (PBI, Bug, or Feature),
32
+ with full navigation context in every scenario, then optionally produce Playwright automation.
33
+
34
+ ---
35
+
36
+ ## 🚨 HARD STOP RULES — Read Before Anything Else
37
+
38
+ These rules override every other instruction in this skill.
39
+
40
+ **HARD STOP 1 — Never write Gherkin for a screen you have not navigated to live.**
41
+ If a scenario requires a state-dependent screen (one that only appears after an upload,
42
+ form submit, error trigger, or multi-step flow), you MUST reach that screen in the live app
43
+ before writing the scenario. If you cannot reach it with the information you currently have,
44
+ ask the user and wait. Do not proceed.
45
+
46
+ **HARD STOP 2 — Never invent test data.**
47
+ Email addresses, file contents, record IDs, duplicate rows — every piece of test data used
48
+ in a `Given` step must come from the user or be confirmed in a live snapshot.
49
+ Do not hardcode emails or file names you made up.
50
+
51
+ **HARD STOP 3 — Never proceed past the Gap Check (Step 2) with open gaps.**
52
+ If even one gap is found, output the questions and stop. Do not write Gherkin, do not
53
+ navigate, do not infer. Wait for the user's answers.
54
+
55
+ **HARD STOP 4 — Never read only the target work item.**
56
+ Always fetch the parent Feature hierarchy and all sibling PBIs/Bugs first. A single PBI or
57
+ Bug is one slice of a flow defined across multiple work items. Writing Gherkin from one item
58
+ alone produces orphaned scenarios with invented preconditions.
59
+
60
+ ---
61
+
62
+ ## Tool Routing — Read This First
63
+
64
+ The correct tool sequence depends on what the user gives you. **Never substitute one path
65
+ for the other — they produce different scopes, different file names, and attach to different
66
+ work items in ADO.**
67
+
68
+ | ID type given by user | Goal | Fetch tool | Attach tool | Scope |
69
+ |---|---|---|---|---|
70
+ | **Epic ID** | Full regression suite across ALL child Features and their PBIs/Bugs | `fetch_epic_hierarchy` | `attach_gherkin_to_feature` (once per child Feature) | 5–10 scenarios per Feature |
71
+ | **Feature ID** | Full regression suite across all child PBIs | `fetch_feature_hierarchy` | `attach_gherkin_to_feature` | 5–10 scenarios |
72
+ | **PBI or Bug ID** | Scoped file for that single story in the current sprint | `fetch_work_item_for_gherkin` | `attach_gherkin_to_work_item` | 3–9 scenarios |
73
+
74
+ **Decision rule (apply exactly):**
75
+
76
+ ```
77
+ if user_input contains an Epic ID:
78
+ → ALWAYS use fetch_epic_hierarchy (never fall through to fetch_feature_hierarchy)
79
+ → fetch_epic_hierarchy returns ALL child Features, their PBIs/Bugs, and all linked TCs
80
+ → analyse every Feature and every child PBI/Bug before generating any Gherkin
81
+ → generate one .feature file per child Feature (5–10 scenarios each)
82
+ → attach each via attach_gherkin_to_feature on the respective Feature ID
83
+ → DO NOT create manual test cases (create_and_link_test_cases) for the Epic itself
84
+ → inform the user: "Test cases cannot be created for an Epic. They can only be
85
+ created for PBIs, Bugs, or Features. Would you like me to create test cases for
86
+ the individual child Features or PBIs instead?"
87
+
88
+ if user_input contains a Feature ID:
89
+ → use fetch_feature_hierarchy + attach_gherkin_to_feature
90
+ → before calling create_and_link_test_cases, ALWAYS ask the user to confirm:
91
+ "I'm about to create {N} manual test cases linked to Feature #{id} — {title}.
92
+ Please confirm (yes/no) before I proceed."
93
+ → do not upload until the user replies affirmatively
94
+
95
+ if user_input contains a PBI ID or Bug ID:
96
+ → use fetch_work_item_for_gherkin + attach_gherkin_to_work_item
97
+
98
+ if ambiguous (no ID, just a title or description):
99
+ → ask the user: "Is this an Epic, Feature, PBI, or Bug? Please share the work item ID."
100
+ → do not guess or default to either path
101
+ ```
102
+
103
+ When using the **Epic path**, `fetch_epic_hierarchy` returns a `features` list where each
104
+ entry contains the Feature's metadata plus its `child_work_items` (PBIs/Bugs) and
105
+ `existing_test_cases`. **Read every Feature and every child PBI/Bug in this list** before
106
+ writing a single scenario — the full cross-Feature flow is the only correct input for an
107
+ Epic-scope suite.
108
+
109
+ When using the **PBI/Bug path**, `fetch_work_item_for_gherkin` returns `parent_feature`
110
+ metadata. Use it for context when writing scenarios — but the generated file covers **only
111
+ the PBI/Bug's own acceptance criteria**, not the full Feature. The file is attached to the
112
+ PBI/Bug, not the Feature.
113
+
114
+ ---
115
+
116
+ ## Core Rule: Navigation Steps in Every Scenario
117
+
118
+ Every scenario MUST include an explicit navigation step — in `Background` (when all scenarios
119
+ share the same starting screen) or as a `Given` step in each individual scenario.
120
+
121
+ ```gherkin
122
+ Background:
123
+ Given I am logged in to Amplify as "<email>"
124
+ And I navigate to the "Users > Add Multiple" screen
125
+ ```
126
+
127
+ ```gherkin
128
+ Scenario: Export failed users after partial mass add
129
+ Given I am logged in to Amplify as "<email>"
130
+ And I navigate to the "Users > Add Multiple" screen
131
+ ...
132
+ ```
133
+
134
+ Navigation path derivation priority:
135
+ 1. Figma link in work item → use the frame/page name from the URL node-id
136
+ 2. Screen name in acceptance criteria → use verbatim
137
+ 3. Work item title → infer path
138
+ 4. Playwright MCP live inspection → read real URL and breadcrumb text
139
+ 5. Unknown → placeholder: `And I navigate to the "<!-- TODO: confirm screen name -->" page`
140
+
141
+ ---
142
+
143
+ ## ⛔ Mandatory Pre-Flight: Deduplication Protocol
144
+
145
+ Before executing any step below, run the deduplication protocol:
146
+ `skills/deduplication-protocol.md`
147
+
148
+ The protocol is **work-item-scoped**: PHASE 1 runs once per `work_item_id` and its results
149
+ are cached. If this skill is invoked for the same `work_item_id` that another agent already
150
+ processed, skip PHASE 1 and read from `CACHE[work_item_id]` directly.
151
+ A different `work_item_id` always triggers a fresh PHASE 1.
152
+
153
+ ---
154
+
155
+ ## Steps
156
+
157
+ ### Step 1 — Build the full picture (always, no exceptions)
158
+
159
+ A single work item never tells the whole story.
160
+
161
+ **1A — Route to the correct fetch tool (see Tool Routing above):**
162
+
163
+ *Epic path (ALWAYS use when an Epic ID is provided):*
164
+ ```
165
+ qa-gherkin-generator:fetch_epic_hierarchy(
166
+ epic_id : <Epic ID>
167
+ organization_url : ...
168
+ project_name : ...
169
+ )
170
+ ```
171
+ Extract: epic title/description, **all child Features**, each Feature's child PBIs/Bugs
172
+ with their ACs, and all existing test cases. Analyse the ENTIRE hierarchy — every Feature
173
+ and every PBI/Bug — before writing a single scenario. Generate one .feature file per
174
+ child Feature.
175
+
176
+ *Feature path:*
177
+ ```
178
+ qa-gherkin-generator:fetch_feature_hierarchy(
179
+ feature_id : <Feature ID>
180
+ organization_url : ...
181
+ project_name : ...
182
+ )
183
+ ```
184
+ Extract: feature title/description, **all child PBIs and Bugs** with their ACs, existing test
185
+ cases, existing `.feature` attachments.
186
+
187
+ *PBI/Bug path:*
188
+ ```
189
+ qa-gherkin-generator:fetch_work_item_for_gherkin(
190
+ work_item_id : <PBI or Bug ID>
191
+ organization_url : ...
192
+ project_name : ...
193
+ )
194
+ ```
195
+ Extract: work item title, acceptance_criteria, repro_steps (for Bugs), linked test cases
196
+ with full steps, parent_feature metadata, suggested_file_name.
197
+
198
+ **1B — get_linked_test_cases on the target work item (both paths):**
199
+ ```
200
+ qa-test-case-manager:get_linked_test_cases(organization_url, project_name, work_item_id)
201
+ ```
202
+
203
+ **1C — Build the full flow map:**
204
+
205
+ After fetching, assemble a flow map before writing anything:
206
+
207
+ ```
208
+ FEATURE: <feature title>
209
+ PBI/Bug A: <title> — <AC summary> ← prerequisite step?
210
+ PBI/Bug B: <title> — <AC summary> ← the work item you were given (PBI/Bug path)
211
+ PBI/Bug C: <title> — <AC summary> ← downstream step?
212
+
213
+ FLOW (inferred from ACs + titles + states):
214
+ Step 1: <what happens — which PBI owns it>
215
+ Step 2: <what happens — which PBI owns it>
216
+ Step 3: <target work item's step>
217
+ Step 4: <downstream step>
218
+
219
+ STATE-DEPENDENT SCREENS (screens only reachable after a prior action):
220
+ - <screen name> → requires: <what action / data to reach it>
221
+ ```
222
+
223
+ Scenarios for the target work item must reflect the **real prerequisites** shown in the flow
224
+ map, not invented ones. Note: only include **active** siblings (state ≠ Removed) when building
225
+ the flow; Removed PBIs are superseded and should not be relied on.
226
+
227
+ ---
228
+
229
+ ### Step 2 — GAP CHECK: identify unknowns and STOP to ask (mandatory, no exceptions)
230
+
231
+ After building the flow map, scan every step in the user journey for the following gap types.
232
+ **If even one gap is found, output the questions below and STOP. Do not write a single line of
233
+ Gherkin or locator code until all gaps are resolved. This is a hard stop — not a suggestion.**
234
+
235
+ #### Gap types that always trigger a user question
236
+
237
+ | # | Gap type | Example |
238
+ |---|---|---|
239
+ | G1 | **State-dependent screen** — only appears after a prior action | Failure summary only exists after a CSV upload with bad rows |
240
+ | G2 | **Required test data** — agent needs a real file, email, or record ID | "What CSV should I upload to trigger failures?" |
241
+ | G3 | **Ambiguous flow step** — AC says something happens but not what screen follows | "After clicking Next, does a loading screen appear?" |
242
+ | G4 | **Unverified screen name** — referenced in AC but not yet snapshotted | "What is the exact URL/route for the failure summary?" |
243
+ | G5 | **Unseen element** — AC references a button only visible after an action | "Export List only appears on the failure summary — I need to reach it first" |
244
+ | G6 | **Figma link present** — work item has a Figma URL not yet inspected | Fetch the Figma frame name; verify it matches a real screen |
245
+ | G7 | **Sibling PBI defines the prerequisite** — the agent must replay a step from another PBI to set up state | "Should I replay the upload step, or is there a shortcut?" |
246
+
247
+ #### Question format — use this exactly
248
+
249
+ ```
250
+ Before I generate Gherkin scenarios and locators for "<work item title>", I need answers
251
+ to the following — I cannot invent these without producing inaccurate, unrunnable tests:
252
+
253
+ **G1 / G2 — [gap type]: [screen or element name]**
254
+ [One sentence describing what I observed from the flow map]
255
+ → [Specific question asking for what I need]
256
+
257
+ **G3 — [gap type]: [ambiguous step]**
258
+ [One sentence describing the ambiguity]
259
+ → [Specific yes/no or multiple-choice question]
260
+
261
+ Please answer these and I will then navigate the live app through the full flow,
262
+ capture real locators from every screen, and generate accurate Gherkin + code.
263
+ I will not proceed until these are answered.
264
+ ```
265
+
266
+ #### Hard rules
267
+
268
+ - **NEVER invent test data.** A `buildCsv()` helper with a hardcoded email constant is
269
+ invented test data — it will fail unless the agent confirmed that email exists in the target org.
270
+ - **NEVER write a `Given` step that sets up state the agent has not actually observed.**
271
+ - **NEVER assign `stability: 0` silently.** Every `stability: 0` locator is a screen the agent
272
+ invented without seeing. Flag each one explicitly and get sign-off before attaching.
273
+ - **Do not proceed to Step 3 until every G1–G7 gap is answered OR the user explicitly
274
+ accepts the gaps and grants sign-off to proceed with known limitations.**
275
+
276
+ #### Pre-navigation checklist (run before Step 3)
277
+
278
+ ```
279
+ □ Parent Feature hierarchy fetched — all active sibling PBIs/Bugs read?
280
+ □ Full flow map built — which work item owns each step?
281
+ □ Every state-dependent screen identified?
282
+ □ For each state-dependent screen: real test data available to reach it?
283
+ □ If a file upload is required: has the user provided or described the file?
284
+ □ Every screen sequence after major actions (upload, submit, click) known?
285
+ □ Every email / record ID / test value confirmed from live snapshot or user input?
286
+ ```
287
+
288
+ If any box is unchecked: output gap questions and stop.
289
+
290
+ ---
291
+
292
+ ### Step 3 — Live navigation through the FULL flow using real test data
293
+
294
+ Once all gaps from Step 2 are resolved (or user has granted explicit sign-off), navigate
295
+ the live app through **every screen in the flow map** using the real test data provided.
296
+ Never skip a screen. Never snapshot only the landing page and infer the rest.
297
+
298
+ ```
299
+ playwright:browser_navigate(APP_BASE_URL)
300
+ playwright:browser_fill_form(...) ← login
301
+ playwright:browser_click(...) ← Log In
302
+ playwright:browser_snapshot() ← verify dashboard
303
+
304
+ ← Navigate prerequisite steps with real test data
305
+ playwright:browser_click(...) ← each step in the flow map
306
+ playwright:browser_snapshot() ← capture locators at each screen
307
+
308
+ ← For file-upload-gated screens:
309
+ playwright:browser_file_upload(
310
+ files: ["<real file path provided by user>"],
311
+ element: "file upload input",
312
+ ref: "<ref from snapshot>"
313
+ )
314
+ playwright:browser_snapshot() ← verify file accepted
315
+ playwright:browser_click(...) ← Next / Submit
316
+ playwright:browser_snapshot() ← capture processing screen (if any)
317
+ playwright:browser_snapshot() ← capture result / state-dependent screen
318
+ ← capture ALL elements on this screen
319
+ playwright:browser_click(...) ← any further actions (Export, Close, etc.)
320
+ playwright:browser_snapshot() ← capture post-action state
321
+ ```
322
+
323
+ **Every element captured in a live snapshot gets `stability ≥ 60`.**
324
+ **Every element NOT reached gets `stability: 0` and a `⚠ NOT VERIFIED — screen not reached` comment.**
325
+ A `stability: 0` locator for a reachable screen means you missed a step — go back to Step 2.
326
+
327
+ ---
328
+
329
+ ### Step 4 — Write net-new scenarios only
330
+
331
+ Map each acceptance criterion to one or more net-new scenarios (post-deduplication diff).
332
+ Scenarios must reflect the **real flow** from Step 1 — prerequisite steps come from the
333
+ flow map, not invented placeholders.
334
+
335
+ ```gherkin
336
+ @{feature_tag} @regression
337
+ Feature: {feature.title}
338
+ As a {persona}
339
+ I want {goal}
340
+ So that {benefit}
341
+
342
+ Background:
343
+ Given I am logged in to Amplify as "<email>"
344
+ And I navigate to the "<ScreenName>" page
345
+
346
+ @smoke
347
+ Scenario: {primary happy path — real flow, real test data}
348
+ Given {initial state — from flow map, not invented}
349
+ When {user action — verified in live snapshot}
350
+ Then {observable outcome — verified in live snapshot}
351
+
352
+ @regression
353
+ Scenario: {error / boundary / negative case}
354
+ Given {precondition from flow map}
355
+ When {action}
356
+ Then {expected outcome}
357
+
358
+ @regression
359
+ Scenario Outline: {data-driven boundary test}
360
+ When {action with "<param>"}
361
+ Then {expected outcome}
362
+ Examples:
363
+ | param |
364
+ | value |
365
+ ```
366
+
367
+ **Scenario count:**
368
+ - Feature-scoped file: **5–10 scenarios**
369
+ - Work-item-scoped file (single PBI or Bug): **3–9 scenarios**
370
+
371
+ **Coverage checklist:**
372
+
373
+ | Tag | When to include |
374
+ |---|---|
375
+ | `@smoke` | Always — exactly one primary happy path |
376
+ | `@regression` | Additional journeys, error cases, boundary conditions |
377
+ | `@regression` | Cancel/discard flows (when in ACs) |
378
+ | `@regression` | Persistence after refresh/re-login (when in ACs) |
379
+ | `@accessibility` | When ACs or coverage hints mention keyboard nav or ARIA |
380
+
381
+ **Style rules:**
382
+ - `Given` = state, `When` = user action, `Then` = observable outcome
383
+ - One assertion per `Then` where possible
384
+ - `Background` only when multiple scenarios share identical preconditions
385
+ - `Scenario Outline` + `Examples` for data-driven boundary tests
386
+
387
+ ---
388
+
389
+ ### Step 5 — Validate (two checks — both required)
390
+
391
+ **5A — Structural validation (tags, scenario count, When steps):**
392
+ ```
393
+ qa-gherkin-generator:validate_gherkin_content(
394
+ gherkin_content : <your .feature file content>,
395
+ scope : "feature" ← Feature path
396
+ | "work_item" ← PBI/Bug path
397
+ )
398
+ ```
399
+
400
+ If `valid` is `false`, **stop and fix all errors before proceeding**. Do not call the attach
401
+ tool with a file that failed validation — the attach tool will also block it and return the
402
+ same errors. Correct the content and re-validate until `valid` is `true`.
403
+
404
+ Review `warnings` even when valid — they are non-blocking but indicate style issues worth
405
+ addressing (e.g. multiple @smoke tags, missing Background block).
406
+
407
+ **5B — Step uniqueness check:**
408
+ ```
409
+ qa-playwright-generator:validate_gherkin_steps(gherkin_content)
410
+ ```
411
+
412
+ Check: zero duplicate step strings, every scenario has at least one `When`, navigation step
413
+ present in every scenario or Background.
414
+
415
+ ---
416
+
417
+ ### Step 6 — Delivery gate (mandatory before attaching to ADO)
418
+
419
+ Before calling any attach tool, present the following to the user and wait:
420
+
421
+ ```
422
+ I've generated a .feature file for {work_item_type} #{id} — "{title}".
423
+
424
+ {N} scenarios | validation: ✅ passed | scope: {feature | work_item}
425
+
426
+ **Do you want me to attach this file to ADO now? (yes / no)**
427
+
428
+ Note:
429
+ - Saying yes here only attaches the Gherkin file.
430
+ - It does NOT generate Playwright code or create manual test cases.
431
+ - If you want those as well, say so separately after this step.
432
+ ```
433
+
434
+ **Do not call any attach tool until the user replies "yes".**
435
+
436
+ **If user says "yes":**
437
+
438
+ Only attach if the deduplication diff confirms net-new scenarios exist.
439
+
440
+ *Feature path:*
441
+ ```
442
+ qa-gherkin-generator:attach_gherkin_to_feature(
443
+ organization_url, project_name,
444
+ feature_id, feature_title, gherkin_content
445
+ )
446
+ ```
447
+ File name produced: `{feature_id}_{feature_title}_regression.feature`
448
+ Attaches to: the Feature work item.
449
+
450
+ *PBI/Bug path:*
451
+ ```
452
+ qa-gherkin-generator:attach_gherkin_to_work_item(
453
+ organization_url, project_name,
454
+ work_item_id, work_item_title, gherkin_content
455
+ )
456
+ ```
457
+ File name produced: `{work_item_id}_{title_kebab}.feature`
458
+ Attaches to: the PBI or Bug work item directly.
459
+
460
+ Both attach tools run `validate_gherkin_content` internally. If the file still fails
461
+ validation at this point, the upload is blocked and errors are returned. Fix and retry.
462
+
463
+ **If user says "no":** Stop. Offer the content inline. Do not create a local file
464
+ unless the user explicitly says "save" or "download".
465
+
466
+ **After attach completes — STOP. Do not proceed to Playwright.**
467
+ Playwright code generation is a separate decision. Wait for the user to ask.
468
+
469
+ ---
470
+
471
+ ### Step 7 — Generate Playwright automation (only if user explicitly asks)
472
+
473
+ **Do not start this step unless the user has explicitly requested Playwright code.**
474
+ A "yes" at Step 6 (attach Gherkin) does not request Playwright generation.
475
+
476
+ If the user does ask for Playwright code, refer to `skills/generate-playwright-code.md`
477
+ for the full workflow. That skill has its own independent delivery gate at Step 7 of
478
+ that document — do not carry over the Gherkin attachment confirmation.
479
+
480
+ ---
481
+
482
+ ## Quality Gates — Do Not Attach Without These
483
+
484
+ - [ ] Work item type identified — **correct tool-routing path selected** (Epic vs Feature vs PBI/Bug)
485
+ - [ ] **Epic path**: `fetch_epic_hierarchy` called — NOT `fetch_feature_hierarchy` or `fetch_work_item_for_gherkin`
486
+ - [ ] **Epic path**: ALL child Features and ALL child PBIs/Bugs read and analysed before any Gherkin written
487
+ - [ ] **Epic path**: One .feature file generated per child Feature (not one file for the whole Epic)
488
+ - [ ] **Epic path**: `create_and_link_test_cases` NOT called on the Epic ID — user informed that test cases are scoped to Features/PBIs/Bugs only
489
+ - [ ] **Feature path**: `fetch_feature_hierarchy` called — all child PBIs/Bugs reviewed
490
+ - [ ] **Feature path**: User confirmation received before calling `create_and_link_test_cases`
491
+ - [ ] **PBI/Bug path**: `fetch_work_item_for_gherkin` called — parent Feature context reviewed
492
+ - [ ] Correct fetch tool called: `fetch_epic_hierarchy` for Epic, `fetch_feature_hierarchy` for Feature, `fetch_work_item_for_gherkin` for PBI/Bug
493
+ - [ ] Parent Feature hierarchy context reviewed — all active sibling PBIs/Bugs read and flow map built
494
+ - [ ] Gap check (Step 2) completed — every G1–G7 gap type checked
495
+ - [ ] **All gaps answered by user before any Gherkin was written** (or explicit sign-off obtained)
496
+ - [ ] **Real test data used** — no invented CSV content, emails, or record IDs
497
+ - [ ] Live Playwright MCP snapshots taken of **every screen in the full flow**
498
+ - [ ] **Zero `stability: 0` locators** for screens reachable with provided test data
499
+ - [ ] Every unverified locator has `⚠ NOT VERIFIED` comment with explicit user sign-off
500
+ - [ ] Deduplication report shown to user
501
+ - [ ] Every scenario has a navigation step (Background or inline `Given`)
502
+ - [ ] **`validate_gherkin_content` returned `valid: true`** (Step 5A — required before attach)
503
+ - [ ] `validate_gherkin_steps` returns zero duplicate steps (Step 5B)
504
+ - [ ] At least one `@smoke` scenario
505
+ - [ ] At least one `@regression` scenario
506
+ - [ ] Scenario count within range: 5–10 for Feature scope, 3–9 for PBI/Bug scope
507
+ - [ ] All `Then` assertions verified in a live snapshot
508
+ - [ ] Credentials sourced from `process.env` in any generated code, not hardcoded
509
+ - [ ] Correct attach tool called: `attach_gherkin_to_work_item` for PBI/Bug, `attach_gherkin_to_feature` for Feature (also used per Feature in Epic path)
510
+
511
+ ---
512
+
513
+ ## Navigation Step Wording Catalogue
514
+
515
+ Reuse these exact phrasings so a single step definition covers all scenarios:
516
+
517
+ ```gherkin
518
+ # Auth
519
+ Given I am logged in to Amplify as "<email>"
520
+ Given I am logged in as an admin user
521
+
522
+ # Navigation
523
+ And I navigate to the "Dashboard" page
524
+ And I navigate to the "Users" page
525
+ And I navigate to "Users > Add Multiple"
526
+ And I navigate to "Users > Add Multiple > Failure Summary"
527
+
528
+ # Direct route
529
+ And I navigate to "/manage/people"
530
+ And I navigate to "/manage/people/mass-add"
531
+
532
+ # Post-action state
533
+ And I am on the "Failure Summary" screen
534
+ And I am redirected to the "Dashboard"
535
+ ```
536
+ ---
537
+
538
+ ## Explicit Delivery Rules — No Inference
539
+
540
+ | Decision | Rule |
541
+ |---|---|
542
+ | Generate Gherkin | Always: show the file content first |
543
+ | Attach to ADO | Requires explicit "yes" at Step 6 gate |
544
+ | User says "no" at Step 6 | Present inline; offer local download only if user asks |
545
+ | Local file creation | Only if user says "save" or "download" |
546
+ | Playwright code generation | Must be a separate user request — not triggered by this skill completing |
547
+ | Manual test case creation | Must be a separate user request — not triggered by this skill completing |
548
+ | Next work item (Epic path) | Each child Feature's attachment requires its own separate "yes" |
549
+
550
+ **Each artifact delivery is independent. A yes/no for one does not answer any other.**