@sun-asterisk/sungen 3.2.33 → 3.2.34
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/dist/cli/commands/audit.d.ts +4 -0
- package/dist/cli/commands/audit.d.ts.map +1 -1
- package/dist/cli/commands/audit.js +16 -3
- package/dist/cli/commands/audit.js.map +1 -1
- package/dist/cli/commands/changed.d.ts.map +1 -1
- package/dist/cli/commands/changed.js +2 -3
- package/dist/cli/commands/changed.js.map +1 -1
- package/dist/cli/commands/dashboard.d.ts.map +1 -1
- package/dist/cli/commands/dashboard.js +2 -28
- package/dist/cli/commands/dashboard.js.map +1 -1
- package/dist/cli/commands/delivery.d.ts.map +1 -1
- package/dist/cli/commands/delivery.js +40 -35
- package/dist/cli/commands/delivery.js.map +1 -1
- package/dist/cli/commands/results-merge.d.ts +9 -0
- package/dist/cli/commands/results-merge.d.ts.map +1 -1
- package/dist/cli/commands/results-merge.js +7 -0
- package/dist/cli/commands/results-merge.js.map +1 -1
- package/dist/cli/commands/select.d.ts +12 -0
- package/dist/cli/commands/select.d.ts.map +1 -0
- package/dist/cli/commands/select.js +122 -0
- package/dist/cli/commands/select.js.map +1 -0
- package/dist/cli/commands/update.d.ts.map +1 -1
- package/dist/cli/commands/update.js +3 -0
- package/dist/cli/commands/update.js.map +1 -1
- package/dist/cli/index.js +7 -2
- package/dist/cli/index.js.map +1 -1
- package/dist/dashboard/templates/index.html +1 -1
- package/dist/dashboard/types.d.ts +1 -0
- package/dist/dashboard/types.d.ts.map +1 -1
- package/dist/exporters/csv-exporter.d.ts.map +1 -1
- package/dist/exporters/csv-exporter.js +11 -10
- package/dist/exporters/csv-exporter.js.map +1 -1
- package/dist/exporters/json-exporter.d.ts.map +1 -1
- package/dist/exporters/json-exporter.js +7 -0
- package/dist/exporters/json-exporter.js.map +1 -1
- package/dist/exporters/manual-hybrid-oracle.d.ts +54 -0
- package/dist/exporters/manual-hybrid-oracle.d.ts.map +1 -0
- package/dist/exporters/manual-hybrid-oracle.js +114 -0
- package/dist/exporters/manual-hybrid-oracle.js.map +1 -0
- package/dist/exporters/matrix/build.d.ts.map +1 -1
- package/dist/exporters/matrix/build.js +6 -2
- package/dist/exporters/matrix/build.js.map +1 -1
- package/dist/exporters/matrix/export.d.ts +3 -0
- package/dist/exporters/matrix/export.d.ts.map +1 -1
- package/dist/exporters/matrix/export.js +1 -0
- package/dist/exporters/matrix/export.js.map +1 -1
- package/dist/exporters/matrix/gates.js +6 -0
- package/dist/exporters/matrix/gates.js.map +1 -1
- package/dist/exporters/matrix/render-testcase-sheet.d.ts.map +1 -1
- package/dist/exporters/matrix/render-testcase-sheet.js +10 -4
- package/dist/exporters/matrix/render-testcase-sheet.js.map +1 -1
- package/dist/exporters/matrix/types.d.ts +8 -1
- package/dist/exporters/matrix/types.d.ts.map +1 -1
- package/dist/exporters/matrix/types.js.map +1 -1
- package/dist/exporters/matrix/wording.d.ts +1 -1
- package/dist/exporters/matrix/wording.d.ts.map +1 -1
- package/dist/exporters/matrix/wording.js +10 -1
- package/dist/exporters/matrix/wording.js.map +1 -1
- package/dist/exporters/run-environment.d.ts +32 -0
- package/dist/exporters/run-environment.d.ts.map +1 -0
- package/dist/exporters/run-environment.js +125 -0
- package/dist/exporters/run-environment.js.map +1 -0
- package/dist/exporters/scenario-merger.d.ts +18 -0
- package/dist/exporters/scenario-merger.d.ts.map +1 -1
- package/dist/exporters/scenario-merger.js +47 -3
- package/dist/exporters/scenario-merger.js.map +1 -1
- package/dist/exporters/test-data-resolver.d.ts +0 -4
- package/dist/exporters/test-data-resolver.d.ts.map +1 -1
- package/dist/exporters/test-data-resolver.js +0 -7
- package/dist/exporters/test-data-resolver.js.map +1 -1
- package/dist/generators/gherkin-parser/index.d.ts +11 -4
- package/dist/generators/gherkin-parser/index.d.ts.map +1 -1
- package/dist/generators/gherkin-parser/index.js +49 -19
- package/dist/generators/gherkin-parser/index.js.map +1 -1
- package/dist/generators/test-generator/adapters/adapter-interface.d.ts +4 -0
- package/dist/generators/test-generator/adapters/adapter-interface.d.ts.map +1 -1
- package/dist/generators/test-generator/adapters/playwright/templates/steps/actions/click-select-action.hbs +1 -1
- package/dist/generators/test-generator/adapters/playwright/templates/steps/actions/select-action.hbs +1 -1
- package/dist/generators/test-generator/adapters/playwright/templates/steps/partials/pick-option.hbs +13 -0
- package/dist/generators/test-generator/adapters/playwright/templates/test-file.hbs +16 -0
- package/dist/generators/test-generator/code-generator.d.ts.map +1 -1
- package/dist/generators/test-generator/code-generator.js +23 -2
- package/dist/generators/test-generator/code-generator.js.map +1 -1
- package/dist/generators/test-generator/diagnostics.d.ts +3 -1
- package/dist/generators/test-generator/diagnostics.d.ts.map +1 -1
- package/dist/generators/test-generator/diagnostics.js +3 -1
- package/dist/generators/test-generator/diagnostics.js.map +1 -1
- package/dist/harness/audit.d.ts +3 -0
- package/dist/harness/audit.d.ts.map +1 -1
- package/dist/harness/audit.js +17 -8
- package/dist/harness/audit.js.map +1 -1
- package/dist/harness/data-driven-lint.d.ts.map +1 -1
- package/dist/harness/data-driven-lint.js +69 -27
- package/dist/harness/data-driven-lint.js.map +1 -1
- package/dist/harness/next-step.d.ts.map +1 -1
- package/dist/harness/next-step.js +1 -0
- package/dist/harness/next-step.js.map +1 -1
- package/dist/harness/parse.d.ts +24 -0
- package/dist/harness/parse.d.ts.map +1 -1
- package/dist/harness/parse.js +117 -13
- package/dist/harness/parse.js.map +1 -1
- package/dist/harness/quality-gates.d.ts.map +1 -1
- package/dist/harness/quality-gates.js +6 -4
- package/dist/harness/quality-gates.js.map +1 -1
- package/dist/harness/read-text.d.ts +15 -0
- package/dist/harness/read-text.d.ts.map +1 -1
- package/dist/harness/read-text.js +25 -0
- package/dist/harness/read-text.js.map +1 -1
- package/dist/harness/select-by-ids.d.ts +31 -0
- package/dist/harness/select-by-ids.d.ts.map +1 -0
- package/dist/harness/select-by-ids.js +106 -0
- package/dist/harness/select-by-ids.js.map +1 -0
- package/dist/harness/sensors.d.ts +8 -1
- package/dist/harness/sensors.d.ts.map +1 -1
- package/dist/harness/sensors.js +61 -9
- package/dist/harness/sensors.js.map +1 -1
- package/dist/harness/spec-branches.js +1 -1
- package/dist/harness/spec-branches.js.map +1 -1
- package/dist/harness/ui-inventory.d.ts +40 -0
- package/dist/harness/ui-inventory.d.ts.map +1 -0
- package/dist/harness/ui-inventory.js +191 -0
- package/dist/harness/ui-inventory.js.map +1 -0
- package/dist/harness/viewpoint-ledger.d.ts.map +1 -1
- package/dist/harness/viewpoint-ledger.js +64 -9
- package/dist/harness/viewpoint-ledger.js.map +1 -1
- package/dist/orchestrator/screen-manager.d.ts.map +1 -1
- package/dist/orchestrator/screen-manager.js +3 -11
- package/dist/orchestrator/screen-manager.js.map +1 -1
- package/dist/orchestrator/templates/ai-src/agents/discovery.md +11 -3
- package/dist/orchestrator/templates/ai-src/agents/reviewer.md +8 -0
- package/dist/orchestrator/templates/ai-src/commands/create-test.md +2 -2
- package/dist/orchestrator/templates/ai-src/commands/review.md +2 -2
- package/dist/orchestrator/templates/ai-src/commands/run-test.md +70 -13
- package/dist/orchestrator/templates/ai-src/skills/sungen-capture/mode-local.md +2 -2
- package/dist/orchestrator/templates/ai-src/skills/sungen-error-mapping/SKILL.md +20 -0
- package/dist/orchestrator/templates/ai-src/skills/sungen-gherkin-syntax/SKILL.md +17 -8
- package/dist/orchestrator/templates/ai-src/skills/sungen-selector-fix/SKILL.md +58 -14
- package/dist/orchestrator/templates/ai-src/skills/sungen-tc-generation/SKILL.md +41 -1
- package/dist/orchestrator/templates/ai-src/skills/sungen-tc-review/SKILL.md +7 -0
- package/dist/orchestrator/templates/playwright.config.ts +4 -2
- package/dist/orchestrator/templates/specs-url-assert.d.ts.map +1 -1
- package/dist/orchestrator/templates/specs-url-assert.js +24 -2
- package/dist/orchestrator/templates/specs-url-assert.js.map +1 -1
- package/dist/orchestrator/templates/specs-url-assert.ts +23 -2
- package/dist/orchestrator/trace-mode-install.d.ts +14 -0
- package/dist/orchestrator/trace-mode-install.d.ts.map +1 -0
- package/dist/orchestrator/trace-mode-install.js +132 -0
- package/dist/orchestrator/trace-mode-install.js.map +1 -0
- package/dist/orchestrator/viewpoint-pattern-catalog.d.ts +20 -0
- package/dist/orchestrator/viewpoint-pattern-catalog.d.ts.map +1 -0
- package/dist/orchestrator/viewpoint-pattern-catalog.js +45 -0
- package/dist/orchestrator/viewpoint-pattern-catalog.js.map +1 -0
- package/package.json +3 -3
- package/src/cli/commands/audit.ts +14 -3
- package/src/cli/commands/changed.ts +2 -4
- package/src/cli/commands/dashboard.ts +1 -26
- package/src/cli/commands/delivery.ts +37 -32
- package/src/cli/commands/results-merge.ts +7 -1
- package/src/cli/commands/select.ts +88 -0
- package/src/cli/commands/update.ts +3 -0
- package/src/cli/index.ts +7 -2
- package/src/dashboard/templates/index.html +1 -1
- package/src/dashboard/types.ts +1 -0
- package/src/exporters/csv-exporter.ts +7 -10
- package/src/exporters/json-exporter.ts +6 -1
- package/src/exporters/manual-hybrid-oracle.ts +112 -0
- package/src/exporters/matrix/build.ts +6 -2
- package/src/exporters/matrix/export.ts +4 -0
- package/src/exporters/matrix/gates.ts +6 -0
- package/src/exporters/matrix/render-testcase-sheet.ts +10 -4
- package/src/exporters/matrix/types.ts +8 -1
- package/src/exporters/matrix/wording.ts +10 -1
- package/src/exporters/run-environment.ts +89 -0
- package/src/exporters/scenario-merger.ts +49 -4
- package/src/exporters/test-data-resolver.ts +0 -6
- package/src/generators/gherkin-parser/index.ts +50 -18
- package/src/generators/test-generator/adapters/adapter-interface.ts +4 -0
- package/src/generators/test-generator/adapters/playwright/templates/steps/actions/click-select-action.hbs +1 -1
- package/src/generators/test-generator/adapters/playwright/templates/steps/actions/select-action.hbs +1 -1
- package/src/generators/test-generator/adapters/playwright/templates/steps/partials/pick-option.hbs +13 -0
- package/src/generators/test-generator/adapters/playwright/templates/test-file.hbs +16 -0
- package/src/generators/test-generator/code-generator.ts +23 -2
- package/src/generators/test-generator/diagnostics.ts +3 -1
- package/src/harness/audit.ts +20 -9
- package/src/harness/data-driven-lint.ts +82 -24
- package/src/harness/next-step.ts +1 -0
- package/src/harness/parse.ts +123 -16
- package/src/harness/quality-gates.ts +6 -4
- package/src/harness/read-text.ts +25 -0
- package/src/harness/select-by-ids.ts +83 -0
- package/src/harness/sensors.ts +59 -9
- package/src/harness/spec-branches.ts +1 -1
- package/src/harness/ui-inventory.ts +164 -0
- package/src/harness/viewpoint-ledger.ts +57 -11
- package/src/orchestrator/screen-manager.ts +3 -11
- package/src/orchestrator/templates/ai-src/agents/discovery.md +11 -3
- package/src/orchestrator/templates/ai-src/agents/reviewer.md +8 -0
- package/src/orchestrator/templates/ai-src/commands/create-test.md +2 -2
- package/src/orchestrator/templates/ai-src/commands/review.md +2 -2
- package/src/orchestrator/templates/ai-src/commands/run-test.md +70 -13
- package/src/orchestrator/templates/ai-src/skills/sungen-capture/mode-local.md +2 -2
- package/src/orchestrator/templates/ai-src/skills/sungen-error-mapping/SKILL.md +20 -0
- package/src/orchestrator/templates/ai-src/skills/sungen-gherkin-syntax/SKILL.md +17 -8
- package/src/orchestrator/templates/ai-src/skills/sungen-selector-fix/SKILL.md +58 -14
- package/src/orchestrator/templates/ai-src/skills/sungen-tc-generation/SKILL.md +41 -1
- package/src/orchestrator/templates/ai-src/skills/sungen-tc-review/SKILL.md +7 -0
- package/src/orchestrator/templates/playwright.config.ts +4 -2
- package/src/orchestrator/templates/specs-url-assert.ts +23 -2
- package/src/orchestrator/trace-mode-install.ts +94 -0
- package/src/orchestrator/viewpoint-pattern-catalog.ts +58 -0
|
@@ -224,7 +224,7 @@ If the unit is **api-first** (`qa/api/<name>/` or `qa/api/flows/<name>/`), the d
|
|
|
224
224
|
|
|
225
225
|
**Auto-detect visual source** — do NOT ask the user to pick a source. Instead, check what already exists and use it:
|
|
226
226
|
1. If `spec_figma.md` exists → read it as Figma supplement (PAT flow already completed during `add-screen`). Do NOT call any `mcp__figma__*` tool.
|
|
227
|
-
2. If `ui/` has images (`.png`, `.jpg`, etc.) → read them
|
|
227
|
+
2. If `ui/` has images (`.png`, `.jpg`, etc.) or `ui/figma-meta.md` → read **all** of them; they feed the Design Inventory (below), not just visual context.
|
|
228
228
|
{{#cap parallel-subagents}}
|
|
229
229
|
3. If neither exists → use `AskUserQuestion` to ask: *"No visual source found. Pick one:"* — then invoke the **`sungen-capture`** skill with the matching **mode** (read only that mode's file):
|
|
230
230
|
- **Figma PAT** — ask for URL, run `sungen add --screen <screen> --figma '<url>'` via Bash, then `sungen-capture` **mode figma-pat**
|
|
@@ -242,7 +242,7 @@ If the unit is **api-first** (`qa/api/<name>/` or `qa/api/flows/<name>/`), the d
|
|
|
242
242
|
|
|
243
243
|
(When `spec_figma.md` exists, that is also `sungen-capture` **mode figma-pat**; when `ui/` images exist, that is **mode local**.)
|
|
244
244
|
|
|
245
|
-
**Cross-check**:
|
|
245
|
+
**Cross-check + Design Inventory**: when the unit holds any design source (`ui/` images, `ui/figma-meta.md`, `spec_figma.md`), follow `sungen-tc-generation` § **Design Inventory** (reading order, one `UI-NNN` row per item, `spec+design` / `design-only` / `conflict`) and **write `requirements/ui-inventory.md`** before generating — from the discovery report's UI INVENTORY block when a sub-agent read the sources. Every `design-only` / `conflict` item must then be covered (`@ui:UI-NNN`) or deferred with a reason (`# UI-DEFERRED: UI-NNN — <reason>`) in the `.feature`; `sungen audit` reports `UI-ITEM-UNCOVERED` otherwise. Show the user the conflicts and design-only items — they are decisions, not details.
|
|
246
246
|
|
|
247
247
|
Summarize what you found in requirements and present to the user.
|
|
248
248
|
|
|
@@ -51,7 +51,7 @@ You are an **independent QA Reviewer** — you did not author these tests. You d
|
|
|
51
51
|
1. **Enumerate feature files** — glob `<base>/<name>/features/*.feature` (main + any sub-features). If none → `/sungen:create-test` first.
|
|
52
52
|
2. **Run the harness (source of truth) — do NOT re-score with a separate rubric:**
|
|
53
53
|
- `sungen audit --screen <name>` (Bash) → gate status, business-weighted score, findings, gaps (coverage / assertion-depth / balance / duplicate / traceability).
|
|
54
|
-
- **`sungen-reviewer`** sub-agent (Task tool, `subagent_type: sungen-reviewer`) → semantic verdict the gate can't see (do steps prove the title, observable Then, @manual justified). Copilot/no-sub-agents: apply the `sungen-reviewer` criteria inline.
|
|
54
|
+
- **`sungen-reviewer`** sub-agent (Task tool, `subagent_type: sungen-reviewer`) → semantic verdict the gate can't see (do steps prove the title, observable Then, @manual justified) and, when the unit holds design sources (`requirements/ui/*`, `ui/figma-meta.md`, `spec_figma.md`), the **Design ↔ Feature diff** against `ui-inventory.md`. Copilot/no-sub-agents: apply the `sungen-reviewer` criteria inline.
|
|
55
55
|
- `sungen script-check --screen <name>` (Bash) → is the generated spec a 1:1 of the Gherkin (only if a spec exists; flags hand-edit / stale drift).
|
|
56
56
|
3. **Unified scorecard** — present ONE report per feature, anchored on the harness signals (the `sungen-tc-review` 7 dimensions are a *presentation layer* over these, not a competing score):
|
|
57
57
|
{{/cap}}
|
|
@@ -63,7 +63,7 @@ You are an **independent QA Reviewer** — you did not author these tests. You d
|
|
|
63
63
|
1. **Enumerate** `<base>/${input:name}/features/*.feature`. If none → `/sungen-create-test` first.
|
|
64
64
|
2. **Run the harness (source of truth) — no separate rubric:**
|
|
65
65
|
- `sungen audit --screen ${input:name}` → gate, business-weighted score, findings, gaps.
|
|
66
|
-
- Apply the **`sungen-reviewer` criteria inline** → semantic verdict (do steps prove the title? observable Then? business-critical depth? @manual justified?).
|
|
66
|
+
- Apply the **`sungen-reviewer` criteria inline** → semantic verdict (do steps prove the title? observable Then? business-critical depth? @manual justified?) and, when `requirements/ui/*` / `ui/figma-meta.md` / `spec_figma.md` exist, read them and diff the design against `ui-inventory.md` and the `.feature` (criterion 7).
|
|
67
67
|
- `sungen script-check --screen ${input:name}` → spec is 1:1 with the Gherkin (flags hand-edit / stale drift; only if a spec exists).
|
|
68
68
|
3. **Unified scorecard** per feature, anchored on harness signals (the `sungen-tc-review` 7 dimensions are a presentation layer, not a competing score):
|
|
69
69
|
{{/cap}}
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
---
|
|
2
2
|
name: run-test
|
|
3
3
|
description: "Generate selectors + auth state (Playwright MCP for web / Appium MCP for mobile), compile, and run tests — auto-fixes selectors on failure"
|
|
4
|
-
argument-hint: "[screen-name] [--env <locale>] [--ios|--android|--both]"
|
|
4
|
+
argument-hint: "[screen-name] [--ids <ID,…>] [--env <locale>] [--ios|--android|--both]"
|
|
5
5
|
order: 40
|
|
6
6
|
claude-tools: "Read, Grep, Bash, Glob, Edit, Write, AskUserQuestion, mcp__playwright__browser_navigate, mcp__playwright__browser_snapshot, mcp__playwright__browser_take_screenshot, mcp__playwright__browser_wait_for, mcp__playwright__browser_evaluate, mcp__playwright__browser_run_code, mcp__playwright__browser_storage_state, mcp__playwright__browser_set_storage_state, mcp__appium-mcp__select_device, mcp__appium-mcp__appium_session_management, mcp__appium-mcp__generate_locators, mcp__appium-mcp__appium_get_page_source, mcp__appium-mcp__appium_find_element, mcp__appium-mcp__appium_gesture, mcp__appium-mcp__appium_screenshot, mcp__appium-mcp__appium_set_value"
|
|
7
7
|
copilot-tools: "[read, execute, edit, vscode/askQuestions, playwright/*, appium/*]"
|
|
@@ -85,6 +85,13 @@ Stop here for mobile — do not continue to the web path.
|
|
|
85
85
|
> QA finding → report it, let it FAIL** (it may be a real bug). The live page is NOT the oracle;
|
|
86
86
|
> never hand-edit the generated `.spec.ts` either. See `sungen-error-mapping` § "HARD RULE".
|
|
87
87
|
> (A `password > 8` test that fails on 6 chars is a bug to report, not a `>= 6` edit.)
|
|
88
|
+
>
|
|
89
|
+
> **Blocked by missing seed data / capability** (the run cannot create the state the scenario
|
|
90
|
+
> needs)? Keep every Given/When/Then; add only a tag — `@requires:<cap>` when a driver exists,
|
|
91
|
+
> else `@manual:M1` with a `# MANUAL (<date>, run-test): <reason>` comment inside the scenario —
|
|
92
|
+
> and list each downgrade in the run summary for QA. Never replace the assertion with a presence
|
|
93
|
+
> placeholder and park the oracle in a comment (`SG-W008`). See `sungen-error-mapping` § "Fails
|
|
94
|
+
> because the environment lacks the DATA or CAPABILITY".
|
|
88
95
|
|
|
89
96
|
## Parameters
|
|
90
97
|
|
|
@@ -95,7 +102,9 @@ Parse from `$ARGUMENTS`:
|
|
|
95
102
|
the result over the previous run's file instead of replacing it. Passing it also **skips the scope gate**:
|
|
96
103
|
the flag IS the answer, so asking again would be noise. Without the flag the gate asks — but only when the
|
|
97
104
|
selection is narrower than the whole unit (see the table). Either way a subset run must follow the merge
|
|
98
|
-
|
|
105
|
+
flow below — web writes the subset to a temp report, mobile backs the fixed-name file up BEFORE the run.
|
|
106
|
+
- **`--ids <ID,…>`** — run exactly these test-case IDs (`VP-UI-001,VP-UI-002`) and merge the result
|
|
107
|
+
over the previous run's file — see the `--ids` section below. Skips the scope gate, like `--change-only`.
|
|
99
108
|
- **`--ios`**, **`--android`**, **`--both`** (mobile only) — optional. Sets `MOBILE_PLATFORM` for the test run. Default: `android` if not specified. Parsed into `MOBILE_PLATFORM=<value>` and used in WebdriverIO test runs.
|
|
100
109
|
|
|
101
110
|
If `--env` is passed but no value follows, ask the user which locale to use.
|
|
@@ -172,6 +181,7 @@ Read `summary.selected`, `summary.total`, `all`, and `reasons`, then follow this
|
|
|
172
181
|
| Situation | What to do |
|
|
173
182
|
|---|---|
|
|
174
183
|
| `--change-only` was passed | **Do NOT ask.** Run the changed set, print the list + reasons for the record, follow the merge flow below. |
|
|
184
|
+
| `--ids` was passed | **Do NOT ask, and do not run `sungen changed` at all.** The user named the cases — follow the `--ids` section below. |
|
|
175
185
|
| `all: true` | **Do NOT ask** — there is nothing to choose. Print the reason (`no previous run recorded`, `the Background changed`, `project config changed`, `git reports …`) and run the FULL suite. |
|
|
176
186
|
| `selected == 0` | **Do NOT ask.** Say plainly that nothing changed since the last recorded run, and use `AskUserQuestion` to offer: re-run the full suite anyway / stop here. |
|
|
177
187
|
| `0 < selected < total` | **ASK** — this is the only case with two honest answers. |
|
|
@@ -187,6 +197,10 @@ recorded` and runs everything again — the narrowing never starts. Record it af
|
|
|
187
197
|
results you accept (a full run, or a subset once merged), and NOT after a run you are about to
|
|
188
198
|
redo: leaving the baseline where it is keeps the same scenarios selected on the next attempt.
|
|
189
199
|
|
|
200
|
+
**Never record after an `--ids` run.** The user's IDs need not cover what an edit changed;
|
|
201
|
+
recording would mark every changed scenario as re-run, and the next `--change-only` would skip the
|
|
202
|
+
ones this run never touched.
|
|
203
|
+
|
|
190
204
|
When you ask, first PRINT the selection so the choice is informed — one line per scenario with its
|
|
191
205
|
reason, exactly as `sungen changed` renders it — then `AskUserQuestion` with two options:
|
|
192
206
|
|
|
@@ -257,7 +271,7 @@ question already.
|
|
|
257
271
|
6. **Phase 2 — Priority Wave**: Run all `@high` scenarios. Fix only failures from this wave. Max 2 attempts. Shared selectors fixed here cascade to later phases.
|
|
258
272
|
7. **Phase 3 — Full Run**: Run all tests. Fix only **new** failures (elements unique to `@normal`/`@low`). Max 1 attempt. Don't loop on low-priority failures.
|
|
259
273
|
8. **Phase 4 — Regression**: One final full run. Report results. No more fix loops.
|
|
260
|
-
9. **Phase 8 — Serial-cascade risk check** (#414): If any scenario has many steps, a skipped test may cause downstream steps to be incorrectly skipped due to the serial-cascade sensor detecting false "not reached" conditions. When you see "test skipped" messages during Phase 3–4 runs, check if the skipped scenario is a **blockers-exist** dependency in the test ledger (`sungen ledger query --screen <name>`). If the scenario had high step count and cascade fired, offer: *"Scenarios with deep steps can trigger serial-cascade skipping. Consider parallelizing this spec with `@concurrent` tags or breaking into smaller scenarios.
|
|
274
|
+
9. **Phase 8 — Serial-cascade risk check** (#414): If any scenario has many steps, a skipped test may cause downstream steps to be incorrectly skipped due to the serial-cascade sensor detecting false "not reached" conditions. When you see "test skipped" messages during Phase 3–4 runs, check if the skipped scenario is a **blockers-exist** dependency in the test ledger (`sungen ledger query --screen <name>`). If the scenario had high step count and cascade fired, offer: *"Scenarios with deep steps can trigger serial-cascade skipping. Consider parallelizing this spec with `@concurrent` tags or breaking into smaller scenarios."* Let the user decide whether to refactor (do not auto-apply parallelization).
|
|
261
275
|
{{#cap parallel-subagents}}
|
|
262
276
|
9. **Integrity check & trace (always run after the final run).**
|
|
263
277
|
- `sungen script-check --screen <name>` — verify the generated spec is a **1:1** of the Gherkin (every non-@manual scenario ↔ one `test()`, no drift). If it reports **DRIFT** (spec hand-edited or stale), re-run `sungen generate --screen <name>` so the spec matches the feature, then re-run — **never hand-edit the generated spec** (auto-fix must edit `selectors.yaml`, not the `.spec.ts`).
|
|
@@ -325,7 +339,7 @@ sungen results merge --screen <name> specs/generated/<name>/subset-tmp.json
|
|
|
325
339
|
rm specs/generated/<name>/subset-tmp.json
|
|
326
340
|
```
|
|
327
341
|
|
|
328
|
-
`--screen` takes the FEATURE basename — for a multi-feature screen (`home.spec.ts` + `home-modal.spec.ts`), each feature has its own result file: merge `home-modal`'s subset with `--screen home-modal`. If the previous run had zero failures, `--last-failed`
|
|
342
|
+
`--screen` takes the FEATURE basename — for a multi-feature screen (`home.spec.ts` + `home-modal.spec.ts`), each feature has its own result file: merge `home-modal`'s subset with `--screen home-modal`. If the previous run had zero failures, `--last-failed` finds no tests: Playwright prints "No tests found", exits 1, and still writes a zero-test report — don't merge it; use `-g "<scenario title>"` to pick the cases instead. `--last-failed` reads the failures of the *previous run only*, so any run in between replaces the list.
|
|
329
343
|
|
|
330
344
|
For a locale run (`SUNGEN_ENV=vi`), the config appends `.vi` before `.json` to WHATEVER `PLAYWRIGHT_JSON_OUTPUT_NAME` says — the temp report lands at `subset-tmp.vi.json`; merge that file into the matching `<name>-test-result.vi.json` explicitly: `sungen results merge specs/generated/<name>/<name>-test-result.vi.json specs/generated/<name>/subset-tmp.vi.json`. A scenario RENAMED by a spec edit leaves its old-title result in the file — the merge warns and keeps it (delivery builds rows from the feature, so it never renders).
|
|
331
345
|
|
|
@@ -360,29 +374,33 @@ If you want to filter scenarios, use `-g "<pattern>"` instead of a reporter over
|
|
|
360
374
|
|
|
361
375
|
## `--change-only` — re-run just what an edit obliges, without losing the rest
|
|
362
376
|
|
|
363
|
-
|
|
364
|
-
|
|
365
|
-
|
|
366
|
-
|
|
367
|
-
Two commands close that, and the order matters — the backup must exist BEFORE the run, because by
|
|
368
|
-
the time the run finishes the old file is already gone:
|
|
377
|
+
A per-target result file holds the whole unit, so a subset run must never replace it: re-running 3
|
|
378
|
+
cases of a 100-case screen used to throw away the 97 that still passed. The subset is MERGED in
|
|
379
|
+
instead — on web via a temp report, on mobile via a backup taken BEFORE the run (the WDIO reporter
|
|
380
|
+
always writes the fixed-name file, so by the time the run finishes the old one is gone):
|
|
369
381
|
|
|
370
382
|
```bash
|
|
371
383
|
# 1. what does the edit oblige? (empty output = nothing to run, do NOT fall through to a full run)
|
|
372
384
|
npx sungen changed --screen <name> # human-readable, with the reason per scenario
|
|
373
385
|
GREP=$(npx sungen changed --screen <name> --grep)
|
|
374
386
|
|
|
387
|
+
# MOBILE — the WDIO reporter always writes the canonical per-OS file, so back it up first:
|
|
375
388
|
# 2. keep the previous results BEFORE the runner overwrites them
|
|
376
389
|
cp specs/generated/<name>/<name>-test-result.<os>.json /tmp/<name>.prev.json
|
|
377
|
-
|
|
378
390
|
# 3. run only the selected scenarios
|
|
379
391
|
SUNGEN_SPECS='./specs/generated/<name>/<name>.spec.ts' npm run test:mobile -- --mochaOpts.grep "$GREP"
|
|
380
|
-
# web: npx playwright test specs/generated/<name>/<name>.spec.ts -g "$GREP"
|
|
381
|
-
|
|
382
392
|
# 4. merge the subset back over the kept results (same title → new wins, others kept)
|
|
383
393
|
npx sungen results merge /tmp/<name>.prev.json specs/generated/<name>/<name>-test-result.<os>.json \
|
|
384
394
|
-o specs/generated/<name>/<name>-test-result.<os>.json
|
|
385
395
|
|
|
396
|
+
# WEB — Playwright writes its report to PLAYWRIGHT_JSON_OUTPUT_NAME (else test-results/results.json),
|
|
397
|
+
# never to the per-target file by itself: write the subset to a temp report and merge THAT in (#837).
|
|
398
|
+
# With --env <x>: prefix BOTH commands with SUNGEN_ENV=<x>; the config then writes subset-tmp.<x>.json.
|
|
399
|
+
PLAYWRIGHT_JSON_OUTPUT_NAME=specs/generated/<name>/subset-tmp.json \
|
|
400
|
+
npx playwright test specs/generated/<name>/<name>.spec.ts -g "$GREP"
|
|
401
|
+
npx sungen results merge --screen <name> specs/generated/<name>/subset-tmp.json # --env x → subset-tmp.x.json
|
|
402
|
+
rm specs/generated/<name>/subset-tmp*.json
|
|
403
|
+
|
|
386
404
|
# 5. record the new baseline — ONLY after a run you accept
|
|
387
405
|
npx sungen changed --screen <name> --record
|
|
388
406
|
```
|
|
@@ -398,6 +416,45 @@ change that broke it.
|
|
|
398
416
|
**Without `--change-only`** the full run still writes the file wholesale, which is correct — a full
|
|
399
417
|
run IS the complete picture. Merging only matters for subsets.
|
|
400
418
|
|
|
419
|
+
## `--ids` — run a chosen list of test-case IDs
|
|
420
|
+
|
|
421
|
+
The user names the cases (`--ids VP-UI-001,VP-UI-002`). `sungen select` resolves them —
|
|
422
|
+
deterministic, exact ID match, grouped per feature — and refuses anything it cannot run:
|
|
423
|
+
|
|
424
|
+
```bash
|
|
425
|
+
npx sungen select --screen <name> --ids <ID,…> # human-readable
|
|
426
|
+
npx sungen select --screen <name> --ids <ID,…> --json # what you act on
|
|
427
|
+
```
|
|
428
|
+
|
|
429
|
+
**Exit 1 = do not run.** Report every entry of `unknown` (with its `didYouMean`), `notRunnable`
|
|
430
|
+
(manual / owned by a flow — with the reason) and `notCompiled` (→ `sungen generate` first), then
|
|
431
|
+
use `AskUserQuestion` to offer: run the valid IDs only / correct the list. Never fall back to a
|
|
432
|
+
full run, and never run with an empty grep.
|
|
433
|
+
|
|
434
|
+
Then, **for each entry of `features`** (a multi-feature screen has one spec and one result file per
|
|
435
|
+
feature), with `<spec>` = its `spec`, `<f>` = its `feature`, `<dir>` = the spec's directory and
|
|
436
|
+
`GREP` = its `grep`:
|
|
437
|
+
|
|
438
|
+
```bash
|
|
439
|
+
# WEB — write the subset to a temp report, then merge it into <f>'s per-target file.
|
|
440
|
+
# With --env <x>: prefix BOTH commands with SUNGEN_ENV=<x>; the config then writes subset-tmp.<x>.json.
|
|
441
|
+
PLAYWRIGHT_JSON_OUTPUT_NAME=<dir>/subset-tmp.json npx playwright test <spec> -g "$GREP"
|
|
442
|
+
npx sungen results merge --screen <f> <dir>/subset-tmp.json # --env x → <dir>/subset-tmp.x.json
|
|
443
|
+
rm <dir>/subset-tmp*.json
|
|
444
|
+
|
|
445
|
+
# MOBILE — the reporter always writes <dir>/<f>-test-result.<android|ios>[.<env>].json: back it up first
|
|
446
|
+
# (with --env <x> every <f>-test-result.<os>.json below is <f>-test-result.<os>.<x>.json)
|
|
447
|
+
cp <dir>/<f>-test-result.<os>.json /tmp/<f>.prev.json
|
|
448
|
+
SUNGEN_SPECS='./<spec>' npm run test:mobile -- --mochaOpts.grep "$GREP"
|
|
449
|
+
npx sungen results merge /tmp/<f>.prev.json <dir>/<f>-test-result.<os>.json -o <dir>/<f>-test-result.<os>.json
|
|
450
|
+
```
|
|
451
|
+
|
|
452
|
+
With no previous result file (first run of the unit, or of this `--env`) there is nothing to merge
|
|
453
|
+
into — `results merge --screen` says so and exits 1: on web run with
|
|
454
|
+
`PLAYWRIGHT_JSON_OUTPUT_NAME=<dir>/<f>-test-result.json`, on mobile skip the backup and the merge.
|
|
455
|
+
With `--both`, back up and merge each OS's file. **Do NOT run `sungen changed --record`** (see the
|
|
456
|
+
scope gate). Report the per-ID outcome, plus the IDs that were refused.
|
|
457
|
+
|
|
401
458
|
## Next steps
|
|
402
459
|
|
|
403
460
|
After showing results, use `AskUserQuestion` to offer next steps:
|
|
@@ -6,7 +6,7 @@ Use **pre-existing images** in `requirements/ui/` as visual context. No network,
|
|
|
6
6
|
|
|
7
7
|
### 1. List available images
|
|
8
8
|
|
|
9
|
-
Glob `requirements/ui/*.{png,jpg,jpeg,webp,gif}` and report count + filenames. Filter out metadata files (e.g. `figma-meta.md` written by mode figma-mcp) — those are read by `tc-generation` separately, not treated as images here.
|
|
9
|
+
Glob `requirements/ui/*.{png,jpg,jpeg,webp,gif}` and report count + filenames. Filter out metadata files (e.g. `figma-meta.md` written by mode figma-mcp) — those are read by `tc-generation` (§ Design Inventory) separately, not treated as images here.
|
|
10
10
|
|
|
11
11
|
### 2. Handle empty folder
|
|
12
12
|
|
|
@@ -21,7 +21,7 @@ If no images found:
|
|
|
21
21
|
|
|
22
22
|
### 3. Read images for context
|
|
23
23
|
|
|
24
|
-
Use the `Read` tool on each image — Claude Code reads PNG/JPG/WebP directly
|
|
24
|
+
Use the `Read` tool on **each** image — Claude Code reads PNG/JPG/WebP directly. For large sets (>10 images), ask which are primary and which are states/variants so they can be grouped — but still read them all: every image feeds the Design Inventory (`sungen-tc-generation` § Design Inventory), and the inventory records `images read: N/N`.
|
|
25
25
|
|
|
26
26
|
### 4. Summarize
|
|
27
27
|
|
|
@@ -39,6 +39,26 @@ weakening assertions, "fixing" an unknown step pattern, adding table-scope steps
|
|
|
39
39
|
needs any of these, it is a **finding for QA** — surface it in the run summary and let the test
|
|
40
40
|
**FAIL**. A failing test may be a **real bug**; do not edit the QA-approved Gherkin to make it pass.
|
|
41
41
|
|
|
42
|
+
### Fails because the environment lacks the DATA or CAPABILITY (not the app, not the locator)
|
|
43
|
+
|
|
44
|
+
Sometimes the scenario is right and the app may be right, but the run cannot set up the state —
|
|
45
|
+
the dev seed has no tie-break pair, no locked account, no second tenant. That is **neither** a
|
|
46
|
+
selector fix **nor** a reason to rewrite. The only allowed `.feature` edit is a **tag** (plus a
|
|
47
|
+
reason comment); the Given/When/Then stay **exactly** as QA approved them:
|
|
48
|
+
|
|
49
|
+
1. The capability exists as a driver (`db`, `api`, data-factory) → tag `@requires:<cap>` (e.g.
|
|
50
|
+
`@requires:db`) — it compiles to a skip stub (`AUTOMATION-READY-PENDING`) and runs, unchanged,
|
|
51
|
+
once `sungen capability add <cap>` is done.
|
|
52
|
+
2. Otherwise → tag `@manual:M1` and put the reason as a comment **inside** the scenario (below the
|
|
53
|
+
`Scenario:` line — a comment above the tags is attached to the previous scenario):
|
|
54
|
+
`# MANUAL (<date>, run-test): no seeded pair with equal plan + distinct last-updated`.
|
|
55
|
+
3. **Never** swap the real assertion (`table match data:`, `with {{v}}`, `count is …`) for a
|
|
56
|
+
presence placeholder (`see [X] table`) and move the oracle into a `# Tester verifies:` comment —
|
|
57
|
+
that hybrid exports an Expected cell that says nothing about what is checked, and `sungen
|
|
58
|
+
generate` flags it `SG-W008`.
|
|
59
|
+
4. List **every** downgrade of the run (scenario, tag added, reason) in the run summary so QA
|
|
60
|
+
reviews it — a downgrade is a coverage decision, not an auto-fix.
|
|
61
|
+
|
|
42
62
|
## ⛔ Source of truth — classify EVERY failure before you "fix" it
|
|
43
63
|
|
|
44
64
|
`.feature` + `test-data.yaml` + `spec.md` are the **oracle**. The **live page is NOT** — it may be the thing that's broken. A failing test is not automatically a test to "make pass". Classify first:
|
|
@@ -629,6 +629,7 @@ on mobile a dialog-scoped ref still resolves against the whole screen (`SG-W021`
|
|
|
629
629
|
| Tag | Effect |
|
|
630
630
|
|---|---|
|
|
631
631
|
| `@spec:<id>` | **Traceability**: this scenario proves requirement `<id>` from `requirements/spec.md` (`@spec:FR-003`). Repeatable — a scenario may prove several. Read by `sungen audit` (requirement coverage) and by delivery (the Coverage sheet's requirement table). Without it the link is only inferred from wording and cannot survive an edit. |
|
|
632
|
+
| `@ui:<UI-NNN>` | **Design traceability**: this scenario proves design item `UI-NNN` from `requirements/ui-inventory.md` (`@ui:UI-014`). Repeatable. Read by `sungen audit` (`UI-ITEM-UNCOVERED`). An item deliberately not tested is recorded as a comment instead: `# UI-DEFERRED: UI-002..013 — <reason>`. Rules: `sungen-tc-generation` § Design Inventory. |
|
|
632
633
|
| `@manual` | Skip in generation |
|
|
633
634
|
| `@known-defect` | The scenario is EXPECTED to be red — it asserts a live defect. It still runs and still reports as failed (never skipped, never "fixed"), and it stays a pass-through tag so `--grep @known-defect` selects it. **`[mobile]`** Its failure does NOT escalate the next scenario's `@reset:` tier: a red that was designed in is not evidence of leftover state |
|
|
634
635
|
| `@auth:role` | Use auth storage state for role |
|
|
@@ -640,7 +641,8 @@ on mobile a dialog-scoped ref still resolves against the whole screen (`SG-W021`
|
|
|
640
641
|
| `@cleanup:scroll` | Auto-cleanup: scroll to top after each test (cleanupPage) |
|
|
641
642
|
| `@cleanup:storage` | Auto-cleanup: clear sessionStorage after each test (cleanupPage) |
|
|
642
643
|
| `@screenshot:on-failure` | Auto-capture screenshot when test fails (base.ts fixture) |
|
|
643
|
-
| `@
|
|
644
|
+
| `@serial` | Opt-in: one shared page for an ordered, genuinely stateful sequence → `test.describe.serial()`. A failure skips the rest |
|
|
645
|
+
| `@parallel` | Names the default (fresh page per test) — changes nothing. Compiles on mobile too, but a single device/emulator gets no session-isolation benefit from it |
|
|
644
646
|
| `@beforeAll` | Hook: runs once before all tests → `test.beforeAll()` |
|
|
645
647
|
| `@afterEach` | Hook: runs after each test → `test.afterEach()` (custom cleanup) |
|
|
646
648
|
| `@afterAll` | Hook: runs once after all tests → `test.afterAll()` |
|
|
@@ -774,14 +776,14 @@ npx playwright test --grep "@smoke|@high" # smoke OR high
|
|
|
774
776
|
|
|
775
777
|
### Serial vs Parallel (test execution mode)
|
|
776
778
|
|
|
777
|
-
**Default:
|
|
779
|
+
**Default: isolated** — `test.describe()` with a fresh page per test. Background runs as `beforeEach`; a failing scenario does not skip the others. Write every scenario so it stands alone — no scenario may rely on state another one left behind. `@parallel` only names this default.
|
|
778
780
|
|
|
779
|
-
**`@
|
|
781
|
+
**`@serial` opt-in** — `test.describe.serial()` with one shared page. Background runs once in `beforeAll`; a failure skips the rest. Use it only for a genuinely stateful, ordered sequence.
|
|
780
782
|
|
|
781
783
|
| Mode | Generated | Page | Background | On fail |
|
|
782
784
|
|---|---|---|---|---|
|
|
783
|
-
|
|
|
784
|
-
| `@
|
|
785
|
+
| Isolated (default, `@parallel`) | `test.describe()` | Fresh per test | `beforeEach` (N goto) | Continue |
|
|
786
|
+
| `@serial` | `test.describe.serial()` | Shared | `beforeAll` (1 goto) | Skip remaining |
|
|
785
787
|
|
|
786
788
|
**Multiple auth groups need the default isolation.** A feature mixing `@auth:user` with `@no-auth` compiles as-is — features are parallel by default, and `@parallel` only names that default. What breaks it is `@serial`: one shared browser context cannot carry two different sessions, so the compiler errors and asks you to drop `@serial` or split the feature.
|
|
787
789
|
|
|
@@ -942,7 +944,13 @@ Feature: User Management
|
|
|
942
944
|
|
|
943
945
|
### Layer 2: `@afterEach` scenario (custom cleanup)
|
|
944
946
|
|
|
945
|
-
Only when `@cleanup:*` tags aren't enough — feature-specific logic.
|
|
947
|
+
Only when `@cleanup:*` tags aren't enough — feature-specific logic. `@afterEach` gets the per-test
|
|
948
|
+
`page`, so UI cleanup steps work in it.
|
|
949
|
+
|
|
950
|
+
It runs after every test it applies to — and it does NOT apply to the `@no-auth` group when the
|
|
951
|
+
feature mixes `@no-auth` with other scenarios: an anonymous test has an empty session, so a cleanup
|
|
952
|
+
that needs the signed-in page would fail it although its own steps passed. The hook is emitted inside
|
|
953
|
+
each other group instead. A feature whose scenarios are ALL `@no-auth` keeps the hook for them.
|
|
946
954
|
|
|
947
955
|
### Layer 3: `@beforeAll` / `@afterAll` (optional)
|
|
948
956
|
|
|
@@ -967,8 +975,9 @@ Scenario: drop the seeded data after the last scenario
|
|
|
967
975
|
recorded and the next step still runs; a failing action step (`Given`/`When`) stops the hook there.
|
|
968
976
|
The hook fails ONCE with the full list (`Hook preconditions not met`), not with the first failure.
|
|
969
977
|
- `@cases` and `@extend` are not supported on a hook — they are ignored with a compile warning.
|
|
970
|
-
-
|
|
971
|
-
`@query:` preconditions and `expect` assertions there.
|
|
978
|
+
- `@beforeAll` / `@afterAll` have no `page` fixture on an isolated (non-`@serial`) feature — keep
|
|
979
|
+
their steps to `@api:`/`@query:` preconditions and `expect` assertions there. `@afterEach` does get
|
|
980
|
+
the per-test `page`.
|
|
972
981
|
|
|
973
982
|
**Rendering order in `.spec.ts`:**
|
|
974
983
|
`test.describe` → `test.use(storageState)` → `test.use(autoCleanup)` → `test.beforeAll` → `test.beforeEach` → `test.afterEach` → `test.afterAll` → `test()` blocks.
|
|
@@ -225,12 +225,33 @@ Skip if `specs/.auth/<role>.json` already exists and a probe navigation reaches
|
|
|
225
225
|
|
|
226
226
|
---
|
|
227
227
|
|
|
228
|
+
## Where each wave writes its result
|
|
229
|
+
|
|
230
|
+
`sungen delivery` reads the per-target result file (`specs/generated/<name>/<name>-test-result.json`),
|
|
231
|
+
which the JSON reporter in `playwright.config.ts` writes. Keep it that way in every wave:
|
|
232
|
+
|
|
233
|
+
- **Never pass `--reporter`** — it replaces the config's reporters, the JSON reporter is switched off, and the run writes no result file.
|
|
234
|
+
- **Subset waves (Phase 1–2) write to `test-results/sungen-wave.json`** — never to the per-target file (a subset would overwrite the unit's full result) and never to the default `test-results/results.json` (delivery falls back to that file when a per-target one is missing, so a 5-scenario smoke would read as the unit's result). `test-results/` is Playwright's output dir, wiped on every run — nothing to clean up.
|
|
235
|
+
- **Full waves (Phase 3–4) write the per-target file** — the Phase 4 file is the result delivery shows.
|
|
236
|
+
- **Scope every run to the unit** — `specs/generated/<name>/` (flow: `specs/generated/flows/<name>/`). Without a path, `--grep` runs every unit in `specs/generated/`.
|
|
237
|
+
|
|
238
|
+
### Fix retries re-run only what the wave left red (Phase 2–3)
|
|
239
|
+
|
|
240
|
+
- **The first run of a phase is its full wave.** Each **fix retry** is the same command plus `--last-failed`, written to `test-results/sungen-wave.json` — never to the per-target file.
|
|
241
|
+
- **Retry immediately after the run whose failures you fixed.** `--last-failed` reads the failures of the *previous run only*: run any other test in between (a `-g` debug run) and the list now describes that run. If you did, re-run the full wave instead.
|
|
242
|
+
- **Nothing left red → no retry.** On an empty list Playwright prints "No tests found", exits 1 and still writes a zero-test report — that is not a failure of the unit, and it is why a retry never writes the per-target file.
|
|
243
|
+
- **A locale run (`SUNGEN_ENV=<env>`) writes `test-results/sungen-wave.<env>.json`** — the config inserts the env before `.json`; it is still a scratch file, nothing reads it.
|
|
244
|
+
- **A retry does not show whether your fix broke a test that was green.** Phase 3's full first run catches a Phase 2 fix that did; Phase 4 catches a Phase 3 one.
|
|
245
|
+
|
|
246
|
+
---
|
|
247
|
+
|
|
228
248
|
## Phase 1: Smoke Check (catch fundamentals)
|
|
229
249
|
|
|
230
250
|
Run **up to 5 scenarios** — pick the first `@high` scenarios in the feature file.
|
|
231
251
|
|
|
232
252
|
```bash
|
|
233
|
-
|
|
253
|
+
PLAYWRIGHT_JSON_OUTPUT_NAME=test-results/sungen-wave.json \
|
|
254
|
+
npx playwright test specs/generated/<name>/ --grep "VP-.*-001|VP-.*-002|VP-.*-003|VP-.*-004|VP-.*-005"
|
|
234
255
|
```
|
|
235
256
|
|
|
236
257
|
**Purpose:** Detect broken fundamentals before running 50+ tests:
|
|
@@ -248,7 +269,15 @@ npx playwright test --grep "VP-.*-001|VP-.*-002|VP-.*-003|VP-.*-004|VP-.*-005" -
|
|
|
248
269
|
Run all `@high` scenarios:
|
|
249
270
|
|
|
250
271
|
```bash
|
|
251
|
-
|
|
272
|
+
PLAYWRIGHT_JSON_OUTPUT_NAME=test-results/sungen-wave.json \
|
|
273
|
+
npx playwright test specs/generated/<name>/ --grep "@high"
|
|
274
|
+
```
|
|
275
|
+
|
|
276
|
+
Fix retry — only the scenarios this wave left red:
|
|
277
|
+
|
|
278
|
+
```bash
|
|
279
|
+
PLAYWRIGHT_JSON_OUTPUT_NAME=test-results/sungen-wave.json \
|
|
280
|
+
npx playwright test specs/generated/<name>/ --grep "@high" --last-failed
|
|
252
281
|
```
|
|
253
282
|
|
|
254
283
|
If your Playwright config doesn't support tag grep, use scenario name grep from the feature file — collect VP IDs of `@high` scenarios.
|
|
@@ -261,12 +290,24 @@ Max 2 fix attempts in this phase.
|
|
|
261
290
|
|
|
262
291
|
## Phase 3: Full Run (@normal + @low)
|
|
263
292
|
|
|
264
|
-
Run remaining scenarios:
|
|
293
|
+
Run remaining scenarios — the whole unit, into its per-target result file:
|
|
265
294
|
|
|
266
295
|
```bash
|
|
267
|
-
|
|
296
|
+
PLAYWRIGHT_JSON_OUTPUT_NAME=specs/generated/<name>/<name>-test-result.json \
|
|
297
|
+
npx playwright test specs/generated/<name>/<name>.spec.ts
|
|
268
298
|
```
|
|
269
299
|
|
|
300
|
+
A multi-feature screen (one result file per feature) or a locale run (`SUNGEN_ENV`): use the loop in `run-test` § "Playwright command guidelines".
|
|
301
|
+
|
|
302
|
+
Fix retry — the failures only, into the wave file (the per-target file keeps this phase's full run until Phase 4 rewrites it):
|
|
303
|
+
|
|
304
|
+
```bash
|
|
305
|
+
PLAYWRIGHT_JSON_OUTPUT_NAME=test-results/sungen-wave.json \
|
|
306
|
+
npx playwright test specs/generated/<name>/<name>.spec.ts --last-failed
|
|
307
|
+
```
|
|
308
|
+
|
|
309
|
+
**Multi-feature screen — no `--last-failed` here.** Phase 3 ran one Playwright run per feature spec, so the failure list holds only the LAST spec's failures; a retry would skip every earlier feature's red tests without a word. Re-run the per-spec loop instead.
|
|
310
|
+
|
|
270
311
|
Many selectors already fixed from Phase 2 (shared elements). Only diagnose **new** failures — selectors that only appear in lower-priority scenarios.
|
|
271
312
|
|
|
272
313
|
Max 1 fix attempt. If `@low` scenarios still fail after fix → **report and move on**, don't loop.
|
|
@@ -275,12 +316,15 @@ Max 1 fix attempt. If `@low` scenarios still fail after fix → **report and mov
|
|
|
275
316
|
|
|
276
317
|
## Phase 4: Regression
|
|
277
318
|
|
|
278
|
-
One final full run to confirm all phases together:
|
|
319
|
+
One final full run to confirm all phases together — this per-target file is the result `sungen delivery` reads:
|
|
279
320
|
|
|
280
321
|
```bash
|
|
281
|
-
|
|
322
|
+
PLAYWRIGHT_JSON_OUTPUT_NAME=specs/generated/<name>/<name>-test-result.json \
|
|
323
|
+
npx playwright test specs/generated/<name>/<name>.spec.ts
|
|
282
324
|
```
|
|
283
325
|
|
|
326
|
+
Same multi-feature / locale form as Phase 3.
|
|
327
|
+
|
|
284
328
|
Report results. Do NOT enter another fix loop here.
|
|
285
329
|
|
|
286
330
|
---
|
|
@@ -458,13 +502,13 @@ user detail:
|
|
|
458
502
|
|
|
459
503
|
## Attempt Budget Summary
|
|
460
504
|
|
|
461
|
-
| Phase | What runs | Max fix attempts | On failure after max |
|
|
462
|
-
|
|
463
|
-
| 0. Pre-gen | Playwright MCP snapshot → write selectors.yaml | 1 snapshot | Ask user — skip or retry navigation |
|
|
464
|
-
| 0.5. Auth | Manual login in MCP browser → `browser_storage_state` → `specs/.auth/<role>.json` | 1 login | Ask user — retry login or fall back to `sungen makeauth` |
|
|
465
|
-
| 1. Smoke | First 5 @high | 2 | Ask user — fundamentals broken |
|
|
466
|
-
| 2. Priority | All @high | 2 | Report failures, continue to Phase 3 |
|
|
467
|
-
| 3. Full | All tests | 1 | Report @low/@normal failures, continue |
|
|
468
|
-
| 4. Regression | All tests | 0 | Report final results |
|
|
505
|
+
| Phase | What runs | Fix retry runs | Max fix attempts | On failure after max |
|
|
506
|
+
|---|---|---|---|---|
|
|
507
|
+
| 0. Pre-gen | Playwright MCP snapshot → write selectors.yaml | — | 1 snapshot | Ask user — skip or retry navigation |
|
|
508
|
+
| 0.5. Auth | Manual login in MCP browser → `browser_storage_state` → `specs/.auth/<role>.json` | — | 1 login | Ask user — retry login or fall back to `sungen makeauth` |
|
|
509
|
+
| 1. Smoke | First 5 @high | the same 5 | 2 | Ask user — fundamentals broken |
|
|
510
|
+
| 2. Priority | All @high | `--last-failed` | 2 | Report failures, continue to Phase 3 |
|
|
511
|
+
| 3. Full | All tests | `--last-failed` (multi-feature screen: the per-spec loop again) | 1 | Report @low/@normal failures, continue |
|
|
512
|
+
| 4. Regression | All tests | — | 0 | Report final results |
|
|
469
513
|
|
|
470
514
|
**Total worst case: 5 fix attempts** (2+2+1), not unbounded loops. Phases 0 and 0.5 don't count toward fix budget.
|
|
@@ -154,7 +154,9 @@ For append: read highest `VP-<CAT>-<NNN>`, continue from next number. Never modi
|
|
|
154
154
|
Auto-detected by `create-test` before invoking this skill:
|
|
155
155
|
- `spec.md` — primary, always read if present
|
|
156
156
|
- `spec_figma.md` — Figma supplement (PAT flow already done — just read the file)
|
|
157
|
-
- `ui/*.png` — visual context
|
|
157
|
+
- `ui/*.{png,jpg,jpeg,webp,gif}` — design images. **Every one is read**, and turned into the Design Inventory below — not just "visual context".
|
|
158
|
+
- `ui/figma-meta.md` — Figma MCP capture (`sungen-capture` mode figma-mcp): `## Components` and `## Text Content` feed the Design Inventory; `## Text Content` also supplies exact labels for `test-data.yaml`.
|
|
159
|
+
- `ui-inventory.md` — the Design Inventory (written by create-test, see § Design Inventory). When it already exists, keep its ids and append new items; never renumber.
|
|
158
160
|
- `test-viewpoint.md` — test conditions checklist; scan entirely regardless of format.
|
|
159
161
|
Format varies across projects: hierarchical table (Level 1–4 columns), flat checklist,
|
|
160
162
|
prose, or mixed. Regardless of format:
|
|
@@ -181,6 +183,40 @@ This means: do not test other screens' UI layout or navigation. It does NOT mean
|
|
|
181
183
|
|
|
182
184
|
---
|
|
183
185
|
|
|
186
|
+
## Design Inventory (UI items)
|
|
187
|
+
|
|
188
|
+
**When:** the unit holds any design source — images in `requirements/ui/`, `ui/figma-meta.md`, or `spec_figma.md`. Without one, skip this section.
|
|
189
|
+
|
|
190
|
+
**Why:** a design read "for visual context" leaves no trace. An item that exists only on the design (a column `spec.md` never names) or contradicts the spec is then missed by the author AND the reviewer, and "deliberately deferred" looks exactly like "never seen". `sungen audit` checks this file (`UI-INVENTORY-MISSING`, `UI-INVENTORY-INCOMPLETE`, `UI-ITEM-UNCOVERED`).
|
|
191
|
+
|
|
192
|
+
**Reading order:** `spec.md` (authoritative) → `spec_figma.md` → `ui/figma-meta.md` (`## Components`, `## Text Content`) → **every** image in `ui/`. Many images: group them (primary screen vs states/variants) but read them all — an unread state screen is an un-inventoried one.
|
|
193
|
+
|
|
194
|
+
**Write `requirements/ui-inventory.md`** — one row per component, table column, button/link, field, state (empty/error/loading/disabled), and design annotation:
|
|
195
|
+
|
|
196
|
+
```markdown
|
|
197
|
+
# UI Inventory — <screen>
|
|
198
|
+
images read: 3/3 · figma-meta.md: read · spec_figma.md: absent
|
|
199
|
+
|
|
200
|
+
| ID | Item | Kind | Source | Seen in |
|
|
201
|
+
|---|---|---|---|---|
|
|
202
|
+
| UI-001 | Job List table | table | spec+design | ui/list.png |
|
|
203
|
+
| UI-002 | Contract plan | column | spec+design | ui/list.png |
|
|
204
|
+
| UI-014 | Salary range | column | design-only | ui/list.png |
|
|
205
|
+
| UI-015 | Status badge "Closed" | column | conflict — spec says "Expired" | ui/list.png |
|
|
206
|
+
```
|
|
207
|
+
|
|
208
|
+
- **Source:** `spec+design` (both name it) · `design-only` (only the design shows it) · `conflict` (they disagree — say how in the cell). `spec.md` stays authoritative; a conflict is reported, never silently resolved in either direction.
|
|
209
|
+
- **IDs** `UI-NNN` are append-only, like scenario ids: re-runs keep existing rows and continue numbering.
|
|
210
|
+
- `images read: N/N` counts the images you actually opened against the images in the folder.
|
|
211
|
+
|
|
212
|
+
**Account for every `design-only` / `conflict` item in the `.feature`** — either:
|
|
213
|
+
- **cover it**: tag the scenario that proves it `@ui:UI-014`, or
|
|
214
|
+
- **defer it with a reason** in a feature comment: `# UI-DEFERRED: UI-002..013 — per-column checks are owned by job-detail`. A deferral without a reason defers nothing.
|
|
215
|
+
|
|
216
|
+
`spec+design` items are covered through the spec (`@spec:`), and citing their ids is optional.
|
|
217
|
+
|
|
218
|
+
---
|
|
219
|
+
|
|
184
220
|
## Generation Workflow
|
|
185
221
|
|
|
186
222
|
### Step 1 — Orient: patterns + risk
|
|
@@ -219,6 +255,10 @@ Viewpoint items: [TV-01 – <exact wording from test-viewpoint row 1>]
|
|
|
219
255
|
[TV-02 – <exact wording from test-viewpoint row 2>]
|
|
220
256
|
→ one entry per row/bullet in test-viewpoint.md, regardless of format
|
|
221
257
|
→ leave empty if no test-viewpoint.md present
|
|
258
|
+
UI items: [UI-014 – Salary range column (design-only) → covered by VP-TAB-012]
|
|
259
|
+
[UI-002..013 – per-column checks → deferred: owned by job-detail]
|
|
260
|
+
→ one entry per Design Inventory row: covered / deferred-with-reason / uncovered
|
|
261
|
+
→ leave empty if the unit has no design source
|
|
222
262
|
Spec gaps: [G1 – behavior undocumented → verify with dev]
|
|
223
263
|
```
|
|
224
264
|
|
|
@@ -152,6 +152,7 @@ Build a mapping table: for each applicable group, does the feature have a matchi
|
|
|
152
152
|
| **Account Status** | Deleted / blocked / inactive account login | VP-LOGIC | corresponding account data → error message |
|
|
153
153
|
| **Security** | SQL Injection; XSS; Data Integrity (edit dropdown/remove `disabled` via DevTools → server rejects). SQL on LIKE/search fields → 2 TCs per the `sungen-viewpoint` SQL 2-layer rule. | VP-SEC | `with {{xss_*}}`/`{{sql_*}}`; data-integrity usually `@manual` |
|
|
154
154
|
| **Cross-surface outcomes** | Admin action → outcome on user-facing surface (portal, mobile, widget); spec defines display condition on another URL | VP-LOGIC-CS | `@high @manual` per surface per business rule — at minimum 1 per cross-surface rule; use `@auth:role` + `@extend` if surface reachable in same test run |
|
|
155
|
+
| **Design items** *(when `requirements/ui/*`, `ui/figma-meta.md` or `spec_figma.md` exist)* | Every component / column / button / state the design shows is in `ui-inventory.md`; each `design-only` / `conflict` item is covered or deferred with a reason. Read the images yourself — the inventory can be incomplete | UI-NNN | `@ui:UI-NNN` on the proving scenario, or `# UI-DEFERRED: UI-NNN — <reason>`; rules in `sungen-tc-generation` § Design Inventory |
|
|
155
156
|
|
|
156
157
|
**Mobile units add four categories** (`@platform:mobile/android/ios` only). Each maps to a theme the
|
|
157
158
|
`sungen audit` mobile catalog scores, so a gap here is a scored gap, not a stylistic note — the
|
|
@@ -374,6 +375,12 @@ If `selectors/<name>.yaml` exists, count lines matching `@needs-live-verify` (pr
|
|
|
374
375
|
| Behavior Handling / Account Status | ... | ... |
|
|
375
376
|
| Security (XSS/SQLi) | ... | ... |
|
|
376
377
|
| Cross-surface outcomes | ... | ... |
|
|
378
|
+
| Design items | n/a / ✓ / ✗ | ... |
|
|
379
|
+
|
|
380
|
+
### Design ↔ Feature (when the unit holds design sources)
|
|
381
|
+
- Images read: <n>/<n> · inventory items: <n> (covered <n> · deferred <n> · uncovered <n>)
|
|
382
|
+
- Not inventoried: <item> (<image>) …
|
|
383
|
+
- Mislabelled / unproven: UI-NNN …
|
|
377
384
|
|
|
378
385
|
### ✗ Must-fix
|
|
379
386
|
1. [DIMENSION] VP-XXX issue description
|
|
@@ -105,8 +105,10 @@ export default defineConfig({
|
|
|
105
105
|
/* Per-action timeout (click, fill, etc.) */
|
|
106
106
|
actionTimeout: 10_000,
|
|
107
107
|
|
|
108
|
-
/*
|
|
109
|
-
|
|
108
|
+
/* Trace for a failed test. CI: recorded on the first retry (CI retries). Local: no retries, so
|
|
109
|
+
'on-first-retry' would never record one — keep the trace of every failed test instead.
|
|
110
|
+
See https://playwright.dev/docs/trace-viewer */
|
|
111
|
+
trace: process.env.CI ? 'on-first-retry' : 'retain-on-failure',
|
|
110
112
|
|
|
111
113
|
/**
|
|
112
114
|
* Capture screenshot after each test failure.
|
|
@@ -205,6 +205,26 @@ interface SettleOpts { settleMs?: number; networkIdleMs?: number }
|
|
|
205
205
|
* 3000) bounds step 1. Both are runtime knobs, so a slow environment is a config change, not a
|
|
206
206
|
* regenerate.
|
|
207
207
|
*/
|
|
208
|
+
/**
|
|
209
|
+
* A millisecond budget from the environment. `Number()` alone turned `"1s"` / `"abc"` into NaN and
|
|
210
|
+
* `""` into 0 (`??` keeps an empty string): the hold loop then never ran, so a late redirect passed
|
|
211
|
+
* unseen, and a 0 / NaN networkidle timeout means "no timeout" to Playwright — the step waited out
|
|
212
|
+
* the whole test (#856). Unset or empty means the default; a malformed value falls back to it and
|
|
213
|
+
* says so, once per variable. `allowZero` for a knob where 0 is a real choice (no hold).
|
|
214
|
+
*/
|
|
215
|
+
const warnedEnv = new Set<string>();
|
|
216
|
+
function msEnv(name: string, fallback: number, allowZero = false): number {
|
|
217
|
+
const raw = process.env[name]?.trim();
|
|
218
|
+
if (!raw) return fallback;
|
|
219
|
+
const value = Number(raw);
|
|
220
|
+
if (Number.isFinite(value) && (value > 0 || (allowZero && value === 0))) return value;
|
|
221
|
+
if (!warnedEnv.has(name)) {
|
|
222
|
+
warnedEnv.add(name);
|
|
223
|
+
console.warn(`[sungen] ${name}=${JSON.stringify(raw)} is not a ${allowZero ? 'non-negative' : 'positive'} number of milliseconds — using the default ${fallback}.`);
|
|
224
|
+
}
|
|
225
|
+
return fallback;
|
|
226
|
+
}
|
|
227
|
+
|
|
208
228
|
async function settleAndHold(
|
|
209
229
|
page: SettleablePage,
|
|
210
230
|
matches: (u: URL) => boolean,
|
|
@@ -212,8 +232,9 @@ async function settleAndHold(
|
|
|
212
232
|
label: string,
|
|
213
233
|
consequence: string,
|
|
214
234
|
): Promise<void> {
|
|
215
|
-
|
|
216
|
-
const
|
|
235
|
+
// 0 holds nothing (the operator's call); 0 for networkidle would mean "no timeout", so it is refused.
|
|
236
|
+
const settleMs = opts.settleMs ?? msEnv('SUNGEN_URL_SETTLE_MS', 1000, true);
|
|
237
|
+
const networkIdleMs = opts.networkIdleMs ?? msEnv('SUNGEN_URL_NETWORKIDLE_MS', 3000);
|
|
217
238
|
const arrivedAt = page.url();
|
|
218
239
|
|
|
219
240
|
await page.waitForLoadState('networkidle', { timeout: networkIdleMs }).catch(() => undefined);
|