@sun-asterisk/sungen 3.2.33 → 3.2.34-beta.1
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 +54 -10
- package/dist/cli/commands/audit.js.map +1 -1
- package/dist/cli/commands/capability.d.ts.map +1 -1
- package/dist/cli/commands/capability.js +5 -1
- package/dist/cli/commands/capability.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/defect.d.ts +7 -0
- package/dist/cli/commands/defect.d.ts.map +1 -0
- package/dist/cli/commands/defect.js +68 -0
- package/dist/cli/commands/defect.js.map +1 -0
- package/dist/cli/commands/delivery.d.ts.map +1 -1
- package/dist/cli/commands/delivery.js +75 -42
- 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/triage.d.ts +7 -0
- package/dist/cli/commands/triage.d.ts.map +1 -0
- package/dist/cli/commands/triage.js +98 -0
- package/dist/cli/commands/triage.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/commands/viewpoint.d.ts +7 -0
- package/dist/cli/commands/viewpoint.d.ts.map +1 -0
- package/dist/cli/commands/viewpoint.js +70 -0
- package/dist/cli/commands/viewpoint.js.map +1 -0
- package/dist/cli/index.js +13 -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 +4 -0
- package/dist/exporters/csv-exporter.d.ts.map +1 -1
- package/dist/exporters/csv-exporter.js +12 -11
- package/dist/exporters/csv-exporter.js.map +1 -1
- package/dist/exporters/feature-parser.d.ts +8 -0
- package/dist/exporters/feature-parser.d.ts.map +1 -1
- package/dist/exporters/feature-parser.js +12 -0
- package/dist/exporters/feature-parser.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 +55 -12
- package/dist/exporters/matrix/build.js.map +1 -1
- package/dist/exporters/matrix/carry-manual-results.d.ts +19 -0
- package/dist/exporters/matrix/carry-manual-results.d.ts.map +1 -1
- package/dist/exporters/matrix/carry-manual-results.js +76 -6
- package/dist/exporters/matrix/carry-manual-results.js.map +1 -1
- package/dist/exporters/matrix/export.d.ts +8 -2
- package/dist/exporters/matrix/export.d.ts.map +1 -1
- package/dist/exporters/matrix/export.js +15 -3
- 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-csv.js +1 -1
- package/dist/exporters/matrix/render-csv.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/render-xlsx.d.ts.map +1 -1
- package/dist/exporters/matrix/render-xlsx.js +3 -0
- package/dist/exporters/matrix/render-xlsx.js.map +1 -1
- package/dist/exporters/matrix/types.d.ts +13 -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/playwright-report-parser.d.ts.map +1 -1
- package/dist/exporters/playwright-report-parser.js +1 -0
- package/dist/exporters/playwright-report-parser.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 +49 -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/exporters/types.d.ts +5 -0
- package/dist/exporters/types.d.ts.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 +48 -15
- package/dist/harness/audit.js.map +1 -1
- package/dist/harness/counted-assertions.d.ts +2 -0
- package/dist/harness/counted-assertions.d.ts.map +1 -0
- package/dist/harness/counted-assertions.js +38 -0
- package/dist/harness/counted-assertions.js.map +1 -0
- 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/defect-draft.d.ts +14 -0
- package/dist/harness/defect-draft.d.ts.map +1 -0
- package/dist/harness/defect-draft.js +143 -0
- package/dist/harness/defect-draft.js.map +1 -0
- package/dist/harness/defects.d.ts +24 -0
- package/dist/harness/defects.d.ts.map +1 -0
- package/dist/harness/defects.js +118 -0
- package/dist/harness/defects.js.map +1 -0
- package/dist/harness/manifest.d.ts.map +1 -1
- package/dist/harness/manifest.js +2 -2
- package/dist/harness/manifest.js.map +1 -1
- package/dist/harness/next-step.d.ts +2 -4
- package/dist/harness/next-step.d.ts.map +1 -1
- package/dist/harness/next-step.js +50 -5
- package/dist/harness/next-step.js.map +1 -1
- package/dist/harness/parse.d.ts +45 -0
- package/dist/harness/parse.d.ts.map +1 -1
- package/dist/harness/parse.js +142 -24
- 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/script-check.d.ts.map +1 -1
- package/dist/harness/script-check.js +7 -1
- package/dist/harness/script-check.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 +92 -21
- 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/triage-signals.d.ts +20 -0
- package/dist/harness/triage-signals.d.ts.map +1 -0
- package/dist/harness/triage-signals.js +30 -0
- package/dist/harness/triage-signals.js.map +1 -0
- package/dist/harness/triage-unit.d.ts +23 -0
- package/dist/harness/triage-unit.d.ts.map +1 -0
- package/dist/harness/triage-unit.js +142 -0
- package/dist/harness/triage-unit.js.map +1 -0
- package/dist/harness/triage.d.ts +28 -0
- package/dist/harness/triage.d.ts.map +1 -0
- package/dist/harness/triage.js +99 -0
- package/dist/harness/triage.js.map +1 -0
- 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-baseline.d.ts.map +1 -1
- package/dist/harness/viewpoint-baseline.js +7 -1
- package/dist/harness/viewpoint-baseline.js.map +1 -1
- package/dist/harness/viewpoint-draft-header.d.ts +7 -0
- package/dist/harness/viewpoint-draft-header.d.ts.map +1 -0
- package/dist/harness/viewpoint-draft-header.js +100 -0
- package/dist/harness/viewpoint-draft-header.js.map +1 -0
- package/dist/harness/viewpoint-ledger.d.ts +13 -3
- package/dist/harness/viewpoint-ledger.d.ts.map +1 -1
- package/dist/harness/viewpoint-ledger.js +104 -18
- package/dist/harness/viewpoint-ledger.js.map +1 -1
- package/dist/harness/viewpoint-mode.d.ts +9 -0
- package/dist/harness/viewpoint-mode.d.ts.map +1 -0
- package/dist/harness/viewpoint-mode.js +52 -0
- package/dist/harness/viewpoint-mode.js.map +1 -0
- package/dist/harness/viewpoint-priority.d.ts +19 -0
- package/dist/harness/viewpoint-priority.d.ts.map +1 -0
- package/dist/harness/viewpoint-priority.js +36 -0
- package/dist/harness/viewpoint-priority.js.map +1 -0
- package/dist/harness/viewpoint-review-open.d.ts +6 -0
- package/dist/harness/viewpoint-review-open.d.ts.map +1 -0
- package/dist/harness/viewpoint-review-open.js +90 -0
- package/dist/harness/viewpoint-review-open.js.map +1 -0
- package/dist/harness/viewpoint-scan-refs.d.ts +50 -0
- package/dist/harness/viewpoint-scan-refs.d.ts.map +1 -0
- package/dist/harness/viewpoint-scan-refs.js +200 -0
- package/dist/harness/viewpoint-scan-refs.js.map +1 -0
- package/dist/harness/viewpoint-scan.d.ts +41 -0
- package/dist/harness/viewpoint-scan.d.ts.map +1 -0
- package/dist/harness/viewpoint-scan.js +118 -0
- package/dist/harness/viewpoint-scan.js.map +1 -0
- package/dist/orchestrator/flow-manager.d.ts +0 -1
- package/dist/orchestrator/flow-manager.d.ts.map +1 -1
- package/dist/orchestrator/flow-manager.js +3 -52
- package/dist/orchestrator/flow-manager.js.map +1 -1
- package/dist/orchestrator/screen-manager.d.ts.map +1 -1
- package/dist/orchestrator/screen-manager.js +8 -62
- 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 +32 -24
- package/dist/orchestrator/templates/ai-src/commands/review.md +2 -2
- package/dist/orchestrator/templates/ai-src/commands/run-test.md +78 -15
- 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 +22 -0
- package/dist/orchestrator/templates/ai-src/skills/sungen-gherkin-syntax/SKILL.md +18 -9
- package/dist/orchestrator/templates/ai-src/skills/sungen-harness-audit/SKILL.md +5 -1
- 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 +42 -2
- package/dist/orchestrator/templates/ai-src/skills/sungen-tc-review/SKILL.md +7 -0
- package/dist/orchestrator/templates/ai-src/skills/sungen-viewpoint/SKILL.md +18 -0
- package/dist/orchestrator/templates/ai-src/skills/sungen-viewpoint/review-checklist.md +63 -0
- package/dist/orchestrator/templates/ai-src/skills/sungen-viewpoint/viewpoint-template.md +158 -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 +23 -0
- package/dist/orchestrator/viewpoint-pattern-catalog.d.ts.map +1 -0
- package/dist/orchestrator/viewpoint-pattern-catalog.js +48 -0
- package/dist/orchestrator/viewpoint-pattern-catalog.js.map +1 -0
- package/dist/orchestrator/viewpoint-scaffold.d.ts +3 -0
- package/dist/orchestrator/viewpoint-scaffold.d.ts.map +1 -0
- package/dist/orchestrator/viewpoint-scaffold.js +70 -0
- package/dist/orchestrator/viewpoint-scaffold.js.map +1 -0
- package/package.json +3 -3
- package/src/cli/commands/audit.ts +49 -10
- package/src/cli/commands/capability.ts +3 -1
- package/src/cli/commands/changed.ts +2 -4
- package/src/cli/commands/dashboard.ts +1 -26
- package/src/cli/commands/defect.ts +49 -0
- package/src/cli/commands/delivery.ts +70 -42
- package/src/cli/commands/results-merge.ts +7 -1
- package/src/cli/commands/select.ts +88 -0
- package/src/cli/commands/triage.ts +57 -0
- package/src/cli/commands/update.ts +3 -0
- package/src/cli/commands/viewpoint.ts +58 -0
- package/src/cli/index.ts +13 -2
- package/src/dashboard/templates/index.html +1 -1
- package/src/dashboard/types.ts +1 -0
- package/src/exporters/csv-exporter.ts +12 -11
- package/src/exporters/feature-parser.ts +12 -0
- package/src/exporters/json-exporter.ts +6 -1
- package/src/exporters/manual-hybrid-oracle.ts +112 -0
- package/src/exporters/matrix/build.ts +57 -11
- package/src/exporters/matrix/carry-manual-results.ts +70 -7
- package/src/exporters/matrix/export.ts +16 -2
- package/src/exporters/matrix/gates.ts +6 -0
- package/src/exporters/matrix/render-csv.ts +1 -1
- package/src/exporters/matrix/render-testcase-sheet.ts +10 -4
- package/src/exporters/matrix/render-xlsx.ts +3 -0
- package/src/exporters/matrix/types.ts +13 -1
- package/src/exporters/matrix/wording.ts +10 -1
- package/src/exporters/playwright-report-parser.ts +1 -0
- package/src/exporters/run-environment.ts +89 -0
- package/src/exporters/scenario-merger.ts +51 -5
- package/src/exporters/test-data-resolver.ts +0 -6
- package/src/exporters/types.ts +5 -0
- 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 +52 -17
- package/src/harness/counted-assertions.ts +33 -0
- package/src/harness/data-driven-lint.ts +82 -24
- package/src/harness/defect-draft.ts +115 -0
- package/src/harness/defects.ts +94 -0
- package/src/harness/manifest.ts +2 -2
- package/src/harness/next-step.ts +47 -5
- package/src/harness/parse.ts +151 -27
- package/src/harness/quality-gates.ts +6 -4
- package/src/harness/read-text.ts +25 -0
- package/src/harness/script-check.ts +7 -1
- package/src/harness/select-by-ids.ts +83 -0
- package/src/harness/sensors.ts +91 -21
- package/src/harness/spec-branches.ts +1 -1
- package/src/harness/triage-signals.ts +46 -0
- package/src/harness/triage-unit.ts +113 -0
- package/src/harness/triage.ts +127 -0
- package/src/harness/ui-inventory.ts +164 -0
- package/src/harness/viewpoint-baseline.ts +7 -1
- package/src/harness/viewpoint-draft-header.ts +55 -0
- package/src/harness/viewpoint-ledger.ts +111 -24
- package/src/harness/viewpoint-mode.ts +49 -0
- package/src/harness/viewpoint-priority.ts +38 -0
- package/src/harness/viewpoint-review-open.ts +51 -0
- package/src/harness/viewpoint-scan-refs.ts +154 -0
- package/src/harness/viewpoint-scan.ts +111 -0
- package/src/orchestrator/flow-manager.ts +3 -53
- package/src/orchestrator/screen-manager.ts +7 -61
- 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 +32 -24
- package/src/orchestrator/templates/ai-src/commands/review.md +2 -2
- package/src/orchestrator/templates/ai-src/commands/run-test.md +78 -15
- 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 +22 -0
- package/src/orchestrator/templates/ai-src/skills/sungen-gherkin-syntax/SKILL.md +18 -9
- package/src/orchestrator/templates/ai-src/skills/sungen-harness-audit/SKILL.md +5 -1
- 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 +42 -2
- package/src/orchestrator/templates/ai-src/skills/sungen-tc-review/SKILL.md +7 -0
- package/src/orchestrator/templates/ai-src/skills/sungen-viewpoint/SKILL.md +18 -0
- package/src/orchestrator/templates/ai-src/skills/sungen-viewpoint/review-checklist.md +63 -0
- package/src/orchestrator/templates/ai-src/skills/sungen-viewpoint/viewpoint-template.md +158 -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 +61 -0
- package/src/orchestrator/viewpoint-scaffold.ts +36 -0
|
@@ -0,0 +1,154 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Building blocks of `sungen viewpoint scan` (viewpoint-scan.ts): the markdown table walker, the
|
|
3
|
+
* item-reference reader and the item universe. Pure, read-only, format-tolerant by design — a
|
|
4
|
+
* QA-written file is never judged here, only its ids and item numbers are read.
|
|
5
|
+
*/
|
|
6
|
+
import * as fs from 'fs';
|
|
7
|
+
import * as path from 'path';
|
|
8
|
+
import { readTextFile, stripHtmlComments } from './read-text';
|
|
9
|
+
import { parseUiInventory } from './ui-inventory';
|
|
10
|
+
import { parseSpecClauses } from './spec-coverage';
|
|
11
|
+
|
|
12
|
+
export interface TableRow {
|
|
13
|
+
/** 1-based line in the (comment-stripped, newline-preserving) text. */
|
|
14
|
+
line: number;
|
|
15
|
+
raw: string;
|
|
16
|
+
/** Cells with `**`, backticks and edge spaces removed. */
|
|
17
|
+
cells: string[];
|
|
18
|
+
/** The table's header cells; null for a table with no separator line. */
|
|
19
|
+
header: string[] | null;
|
|
20
|
+
/** Text of every heading enclosing the row (outermost first) — where a `# MANUAL/ENV` mark may sit. */
|
|
21
|
+
section: string;
|
|
22
|
+
}
|
|
23
|
+
|
|
24
|
+
const SEPARATOR = /^\s*\|?\s*:?-{2,}:?\s*(\|\s*:?-{2,}:?\s*)*\|?\s*$/;
|
|
25
|
+
const splitCells = (line: string): string[] => line.trim().replace(/^\|/, '').replace(/\|$/, '')
|
|
26
|
+
.split(/(?<!\\)\|/).map((c) => c.replace(/\*\*|`/g, '').trim());
|
|
27
|
+
|
|
28
|
+
/** Every body row of every markdown table, with its header and enclosing headings. */
|
|
29
|
+
export function tableRows(text: string): TableRow[] {
|
|
30
|
+
const lines = text.split('\n');
|
|
31
|
+
const out: TableRow[] = [];
|
|
32
|
+
const headings: string[] = []; // index = level − 1
|
|
33
|
+
let header: string[] | null = null;
|
|
34
|
+
for (let i = 0; i < lines.length; i++) {
|
|
35
|
+
const raw = lines[i];
|
|
36
|
+
const h = raw.match(/^(#{1,6})\s+(.*)$/);
|
|
37
|
+
if (h) { headings.length = h[1].length - 1; headings[h[1].length - 1] = h[2]; header = null; continue; }
|
|
38
|
+
if (!raw.includes('|')) { header = null; continue; }
|
|
39
|
+
if (SEPARATOR.test(raw)) continue;
|
|
40
|
+
if (i + 1 < lines.length && SEPARATOR.test(lines[i + 1])) { header = splitCells(raw); continue; }
|
|
41
|
+
out.push({ line: i + 1, raw, cells: splitCells(raw), header, section: headings.join(' ') });
|
|
42
|
+
}
|
|
43
|
+
return out;
|
|
44
|
+
}
|
|
45
|
+
|
|
46
|
+
const NUM = String.raw`(?<!\d)\d{1,3}(?:\.\d{1,3})*(?![\d])`;
|
|
47
|
+
const LIST = new RegExp(`(?:\\bitems?|項目|(?<![\\w-])UI[\\s-]*#?|#)\\s*(${NUM}(?:\\s*(?:[-–—~〜~,;&/]|(?<![\\p{L}\\p{N}])(?:và|and)(?![\\p{L}\\p{N}]))\\s*${NUM})*)`, 'giu');
|
|
48
|
+
|
|
49
|
+
/** `009` → `9`, `4.03` → `4.3`; null when the text is not a plain (dotted) number. */
|
|
50
|
+
export function normRef(s: string): string | null {
|
|
51
|
+
const t = s.replace(/[[\]§#]/g, '').trim();
|
|
52
|
+
return /^\d+(\.\d+)*$/.test(t) ? t.split('.').map((p) => String(Number(p))).join('.') : null;
|
|
53
|
+
}
|
|
54
|
+
|
|
55
|
+
/**
|
|
56
|
+
* The refs strictly between `a` and `b` (normalised): `4`–`6` → `5`, `5.4`–`5.8` → `5.5 … 5.7`.
|
|
57
|
+
* Only the last level steps, so both ends need the same prefix; `5.4–6.2` or `3–5.2` cannot be
|
|
58
|
+
* enumerated without the item list and give nothing.
|
|
59
|
+
*/
|
|
60
|
+
function between(a: string, b: string): string[] {
|
|
61
|
+
const pa = a.split('.');
|
|
62
|
+
const pb = b.split('.');
|
|
63
|
+
if (pa.length !== pb.length || pa.slice(0, -1).join('.') !== pb.slice(0, -1).join('.')) return [];
|
|
64
|
+
const lo = Number(pa[pa.length - 1]);
|
|
65
|
+
const hi = Number(pb[pb.length - 1]);
|
|
66
|
+
if (!(hi > lo && hi - lo < 200)) return [];
|
|
67
|
+
const prefix = pa.slice(0, -1).map((p) => `${p}.`).join('');
|
|
68
|
+
return Array.from({ length: hi - lo - 1 }, (_, k) => `${prefix}${lo + 1 + k}`);
|
|
69
|
+
}
|
|
70
|
+
|
|
71
|
+
/**
|
|
72
|
+
* Item numbers a cell cites: `item 9`, `item 2, 3, 7`, `item 4–6`, `item 5.4–5.8`, `項目 4.3〜4.6`, `UI #9`,
|
|
73
|
+
* `UI-009`, `[9]`, `§4.3.2`. Prose (`Auth guard`), message codes (`M02`) and question ids
|
|
74
|
+
* (`Q-01`) are not refs.
|
|
75
|
+
*/
|
|
76
|
+
export function extractRefs(text: string): string[] {
|
|
77
|
+
const refs = new Set<string>();
|
|
78
|
+
const add = (s: string): void => { const r = normRef(s); if (r) refs.add(r); };
|
|
79
|
+
for (const m of text.matchAll(LIST)) {
|
|
80
|
+
let prev: string | null = null;
|
|
81
|
+
let range = false;
|
|
82
|
+
for (const tok of m[1].matchAll(new RegExp(`(${NUM})|([-–—~〜~])`, 'g'))) {
|
|
83
|
+
if (tok[2]) { range = prev !== null; continue; }
|
|
84
|
+
const n = normRef(tok[1]);
|
|
85
|
+
if (!n) continue;
|
|
86
|
+
if (range && prev) for (const r of between(prev, n)) refs.add(r);
|
|
87
|
+
refs.add(n); prev = n; range = false;
|
|
88
|
+
}
|
|
89
|
+
}
|
|
90
|
+
for (const m of text.matchAll(/\[(\d{1,3})\]/g)) add(m[1]);
|
|
91
|
+
for (const m of text.matchAll(/§\s*(\d{1,3}(?:\.\d{1,3})*)/g)) add(m[1]);
|
|
92
|
+
return [...refs];
|
|
93
|
+
}
|
|
94
|
+
|
|
95
|
+
export type ItemSource = 'spec-ids' | 'spec-table' | 'spec-ids+spec-table' | 'ui-inventory' | 'none';
|
|
96
|
+
export interface UniverseItem { ref: string; name: string }
|
|
97
|
+
/** Every list a citation could point at, each in its own notation. */
|
|
98
|
+
export interface ItemUniverses { specIds: UniverseItem[]; specTable: UniverseItem[]; inventory: UniverseItem[] }
|
|
99
|
+
|
|
100
|
+
const NO_COL = /^(no\.?|#|stt|№|番号)$/i;
|
|
101
|
+
const TYPE_COL = /種別|\b(type|kind)\b|loại/i;
|
|
102
|
+
const NAME_COL = /item|name|tên|項目|名|field|label|trường|thành phần|component/i;
|
|
103
|
+
|
|
104
|
+
/**
|
|
105
|
+
* The unit's lists, by where each id is DECLARED: requirement ids spec.md declares (`**FR-BC-03**:`),
|
|
106
|
+
* the spec's item table (`No` + name + type columns), and ui-inventory ids (`UI-NNN`). An id's shape
|
|
107
|
+
* says nothing about which list it belongs to — `item 9` on a mockup and `UI-009` in the inventory
|
|
108
|
+
* number different things.
|
|
109
|
+
*/
|
|
110
|
+
export function itemUniverses(reqDir: string): ItemUniverses {
|
|
111
|
+
const read = (f: string): string | null => {
|
|
112
|
+
const p = path.join(reqDir, f);
|
|
113
|
+
return fs.existsSync(p) ? stripHtmlComments(readTextFile(p)) : null;
|
|
114
|
+
};
|
|
115
|
+
const out: ItemUniverses = { specIds: [], specTable: [], inventory: [] };
|
|
116
|
+
const spec = read('spec.md');
|
|
117
|
+
if (spec) {
|
|
118
|
+
out.specIds = parseSpecClauses(path.join(reqDir, 'spec.md')).frs.map((f) => ({ ref: f.id, name: f.text.slice(0, 80) }));
|
|
119
|
+
for (const row of tableRows(spec)) {
|
|
120
|
+
const h = row.header;
|
|
121
|
+
const no = h?.findIndex((c) => NO_COL.test(c)) ?? -1;
|
|
122
|
+
const type = h?.findIndex((c) => TYPE_COL.test(c)) ?? -1;
|
|
123
|
+
const name = h?.findIndex((c, i) => i !== no && i !== type && NAME_COL.test(c)) ?? -1;
|
|
124
|
+
if (no < 0 || type < 0 || name < 0) continue;
|
|
125
|
+
const ref = normRef(row.cells[no] ?? '');
|
|
126
|
+
if (ref) out.specTable.push({ ref, name: row.cells[name] ?? '' });
|
|
127
|
+
}
|
|
128
|
+
}
|
|
129
|
+
const inv = read('ui-inventory.md');
|
|
130
|
+
if (inv) {
|
|
131
|
+
out.inventory = parseUiInventory(inv).items.flatMap((i) => {
|
|
132
|
+
const ref = normRef(i.id.replace(/^UI-/i, ''));
|
|
133
|
+
return ref ? [{ ref, name: i.item }] : [];
|
|
134
|
+
});
|
|
135
|
+
}
|
|
136
|
+
return out;
|
|
137
|
+
}
|
|
138
|
+
|
|
139
|
+
/**
|
|
140
|
+
* The list(s) the viewpoint actually cites — a list nobody cites says nothing about gaps. The spec's
|
|
141
|
+
* ids and its item table, each when cited (both when both are: the notations cannot collide, and
|
|
142
|
+
* dropping one would under-report); the table also when nothing is cited at all (then every item is
|
|
143
|
+
* uncited, which is true); the inventory only when the viewpoint writes `UI-NNN`; else none.
|
|
144
|
+
*/
|
|
145
|
+
export function citedUniverse(u: ItemUniverses, cited: ReadonlySet<string>, writesInventoryIds: boolean): { source: ItemSource; items: UniverseItem[] } {
|
|
146
|
+
const hits = (items: UniverseItem[]): boolean => items.some((i) => cited.has(i.ref));
|
|
147
|
+
const ids = hits(u.specIds);
|
|
148
|
+
const table = u.specTable.length > 0 && (cited.size === 0 || hits(u.specTable));
|
|
149
|
+
if (ids && table) return { source: 'spec-ids+spec-table', items: [...u.specIds, ...u.specTable] };
|
|
150
|
+
if (ids) return { source: 'spec-ids', items: u.specIds };
|
|
151
|
+
if (table) return { source: 'spec-table', items: u.specTable };
|
|
152
|
+
if (writesInventoryIds && hits(u.inventory)) return { source: 'ui-inventory', items: u.inventory };
|
|
153
|
+
return { source: 'none', items: [] };
|
|
154
|
+
}
|
|
@@ -0,0 +1,111 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* `sungen viewpoint scan` — the code half of reviewing a QA-written test-viewpoint.md.
|
|
3
|
+
*
|
|
4
|
+
* It does set arithmetic on ids and nothing else: which VP rows exist, what each cites, which spec
|
|
5
|
+
* items nobody cites, which ids no scenario carries. It never judges meaning, never edits the file,
|
|
6
|
+
* and feeds no audit finding, score or baseline.
|
|
7
|
+
*
|
|
8
|
+
* A VP row is a markdown table row whose FIRST cell is a full id (`VP-UI-001`, `FL-LOGIN-3`).
|
|
9
|
+
* Priority-table rows (`VP-LOGIN (Auth)`), bullets and appendix text are not rows. This is
|
|
10
|
+
* deliberately NOT `parseViewpointItems` (viewpoint-ledger.ts), which also reads id-less rows.
|
|
11
|
+
*/
|
|
12
|
+
import * as fs from 'fs';
|
|
13
|
+
import * as path from 'path';
|
|
14
|
+
import { readViewpointText, readTextFile } from './read-text';
|
|
15
|
+
import { featureFilesFor } from './unit-paths';
|
|
16
|
+
import { tableRows, extractRefs, itemUniverses, citedUniverse, ItemSource } from './viewpoint-scan-refs';
|
|
17
|
+
import { viewpointMode, ViewpointMode } from './viewpoint-mode';
|
|
18
|
+
|
|
19
|
+
export interface VpRow {
|
|
20
|
+
id: string;
|
|
21
|
+
line: number;
|
|
22
|
+
/** Item numbers the row cites (normalised: `009` → `9`), and spec-declared ids it cites (`FR-BC-03`). */
|
|
23
|
+
refs: string[];
|
|
24
|
+
/** `# MANUAL/ENV` or `@manual` on the row or an enclosing heading. */
|
|
25
|
+
manual: boolean;
|
|
26
|
+
/** The Kỳ vọng / Expected cell has text (best effort when the table has no such header). */
|
|
27
|
+
hasExpected: boolean;
|
|
28
|
+
}
|
|
29
|
+
|
|
30
|
+
export interface ViewpointScan {
|
|
31
|
+
/** The create-test mode this file calls for (viewpoint-mode.ts): 2 = AI drafts, 1 = review only. */
|
|
32
|
+
mode: ViewpointMode;
|
|
33
|
+
modeReason: string;
|
|
34
|
+
vpRows: VpRow[];
|
|
35
|
+
/** Distinct VP ids among `vpRows` — a reused id is several rows but one id. */
|
|
36
|
+
distinctIds: number;
|
|
37
|
+
rowsWithoutExpected: string[];
|
|
38
|
+
manualRows: string[];
|
|
39
|
+
itemSource: ItemSource;
|
|
40
|
+
/** Spec/inventory items no VP row cites — a hint for the review, not a verdict. */
|
|
41
|
+
uncitedItems: { ref: string; name: string }[];
|
|
42
|
+
/** VP ids no feature file mentions; null when the unit has no feature file yet. */
|
|
43
|
+
withoutScenario: string[] | null;
|
|
44
|
+
/** Why `vpRows` is empty, else null. */
|
|
45
|
+
note: string | null;
|
|
46
|
+
}
|
|
47
|
+
|
|
48
|
+
const VP_ID = /^(VP|FL)-[A-Z][A-Z0-9]*(-[A-Z0-9]+)*-\d+$/;
|
|
49
|
+
const MANUAL = /\bMANUAL\/ENV\b|@manual\b/i;
|
|
50
|
+
const EXPECTED_COL = /kỳ vọng|kết quả mong đợi|expected|期待/i;
|
|
51
|
+
/** Whole-word match (Unicode-aware: `\b` fails on `ồ`) so `Resource` / `Datasource` are not a source column. */
|
|
52
|
+
const SOURCE_COL = /(?<![\p{L}\p{N}])(?:nguồn|source|tham chiếu|ref|出典|根拠)(?![\p{L}\p{N}])/iu;
|
|
53
|
+
const PRIORITY = /^(critical|high|med(?:ium)?|low|cao|trung bình|thấp)$/i;
|
|
54
|
+
const BLANK = /^[\s\-–—…]*$/;
|
|
55
|
+
const SPEC_ID = /(?<![\w-])[A-Z][A-Z0-9]*(?:-[A-Z0-9]+)*-\d+[A-Z]?(?![\w-])/gi;
|
|
56
|
+
export const NO_VP_IDS_NOTE = 'file has no VP ids; review falls back to AI-only';
|
|
57
|
+
|
|
58
|
+
/**
|
|
59
|
+
* VP rows of one viewpoint text (already comment-stripped, as `readViewpointText` returns it).
|
|
60
|
+
* `specIds`: the requirement ids spec.md declares — only those count as spec citations.
|
|
61
|
+
*/
|
|
62
|
+
export function scanViewpointText(text: string, specIds: ReadonlySet<string> = new Set()): VpRow[] {
|
|
63
|
+
const rows: VpRow[] = [];
|
|
64
|
+
for (const r of tableRows(text)) {
|
|
65
|
+
const id = r.cells[0];
|
|
66
|
+
if (!VP_ID.test(id)) continue;
|
|
67
|
+
const exp = r.header?.findIndex((c) => EXPECTED_COL.test(c)) ?? -1;
|
|
68
|
+
const src = r.header?.findIndex((c) => SOURCE_COL.test(c)) ?? -1;
|
|
69
|
+
const cites = src > 0 ? r.cells[src] ?? '' : r.cells.slice(1).join(' | ');
|
|
70
|
+
rows.push({
|
|
71
|
+
id,
|
|
72
|
+
line: r.line,
|
|
73
|
+
refs: [...extractRefs(cites), ...[...cites.matchAll(SPEC_ID)].map((m) => m[0].toUpperCase()).filter((id) => specIds.has(id))],
|
|
74
|
+
manual: MANUAL.test(r.raw) || MANUAL.test(r.section),
|
|
75
|
+
// Without a Kỳ vọng header: any later cell with text that is neither a priority word nor a ref.
|
|
76
|
+
hasExpected: exp > 0
|
|
77
|
+
? !BLANK.test(r.cells[exp] ?? '')
|
|
78
|
+
: r.cells.slice(2).some((c) => !BLANK.test(c) && !PRIORITY.test(c) && extractRefs(c).length === 0),
|
|
79
|
+
});
|
|
80
|
+
}
|
|
81
|
+
return rows;
|
|
82
|
+
}
|
|
83
|
+
|
|
84
|
+
/** Scan one unit directory (`qa/screens/<n>`, `qa/flows/<n>`, …); `unit` names its feature files. */
|
|
85
|
+
export function scanViewpointUnit(unitDir: string, unit: string): ViewpointScan {
|
|
86
|
+
const reqDir = path.join(unitDir, 'requirements');
|
|
87
|
+
const vpPath = path.join(reqDir, 'test-viewpoint.md');
|
|
88
|
+
const vpText = readViewpointText(vpPath);
|
|
89
|
+
const universes = itemUniverses(reqDir);
|
|
90
|
+
const vpRows = scanViewpointText(vpText, new Set(universes.specIds.map((i) => i.ref)));
|
|
91
|
+
const { mode, reason } = viewpointMode(fs.existsSync(vpPath) ? readTextFile(vpPath) : null, vpRows);
|
|
92
|
+
const cited = new Set(vpRows.flatMap((r) => r.refs));
|
|
93
|
+
const { source, items } = citedUniverse(universes, cited, /(?<![\w-])UI-\d{1,3}\b/i.test(vpText));
|
|
94
|
+
const features = featureFilesFor(unitDir, unit).filter((f) => fs.existsSync(f));
|
|
95
|
+
// Same rule as the ledger (viewpoint-ledger.ts): an id is carried when the feature text contains it.
|
|
96
|
+
const featureText = features.map((f) => readTextFile(f).toLowerCase()).join('\n');
|
|
97
|
+
|
|
98
|
+
return {
|
|
99
|
+
mode,
|
|
100
|
+
modeReason: reason,
|
|
101
|
+
vpRows,
|
|
102
|
+
distinctIds: new Set(vpRows.map((r) => r.id)).size,
|
|
103
|
+
rowsWithoutExpected: vpRows.filter((r) => !r.hasExpected).map((r) => r.id),
|
|
104
|
+
manualRows: vpRows.filter((r) => r.manual).map((r) => r.id),
|
|
105
|
+
itemSource: source,
|
|
106
|
+
uncitedItems: items.filter((i) => !cited.has(i.ref)),
|
|
107
|
+
withoutScenario: features.length === 0 ? null : vpRows.filter((r) => !featureText.includes(r.id.toLowerCase())).map((r) => r.id),
|
|
108
|
+
note: vpRows.length > 0 ? null
|
|
109
|
+
: fs.existsSync(vpPath) ? NO_VP_IDS_NOTE : 'requirements/test-viewpoint.md is missing',
|
|
110
|
+
};
|
|
111
|
+
}
|
|
@@ -8,6 +8,7 @@ import * as fs from 'fs';
|
|
|
8
8
|
import * as path from 'path';
|
|
9
9
|
import { readCapabilities } from '../harness/capability';
|
|
10
10
|
import { testDataHeader, ensureTestDataGuideFiles } from './test-data-guide';
|
|
11
|
+
import { viewpointScaffold } from './viewpoint-scaffold';
|
|
11
12
|
|
|
12
13
|
export interface FlowOptions {
|
|
13
14
|
name: string;
|
|
@@ -143,7 +144,7 @@ export class FlowManager {
|
|
|
143
144
|
fs.writeFileSync(specPath, this.generateSpecTemplate(options, flowName, isMobile), 'utf-8');
|
|
144
145
|
|
|
145
146
|
const viewpointPath = path.join(requirementsDir, 'test-viewpoint.md');
|
|
146
|
-
fs.writeFileSync(viewpointPath,
|
|
147
|
+
fs.writeFileSync(viewpointPath, viewpointScaffold(`${options.name} Flow`, isMobile), 'utf-8');
|
|
147
148
|
|
|
148
149
|
console.log(`Created files:`);
|
|
149
150
|
console.log(` ${path.relative(this.cwd, featurePath)}`);
|
|
@@ -217,7 +218,7 @@ export class FlowManager {
|
|
|
217
218
|
restored.push(file);
|
|
218
219
|
};
|
|
219
220
|
ensure(path.join(paths.requirementsDir, 'spec.md'), () => this.generateSpecTemplate(options, flowName, isMobile));
|
|
220
|
-
ensure(path.join(paths.requirementsDir, 'test-viewpoint.md'), () =>
|
|
221
|
+
ensure(path.join(paths.requirementsDir, 'test-viewpoint.md'), () => viewpointScaffold(`${options.name} Flow`, isMobile));
|
|
221
222
|
ensure(paths.featurePath, () => this.generateFeatureTemplate(options, flowName, isMobile));
|
|
222
223
|
return restored;
|
|
223
224
|
}
|
|
@@ -287,57 +288,6 @@ export class FlowManager {
|
|
|
287
288
|
`;
|
|
288
289
|
}
|
|
289
290
|
|
|
290
|
-
private generateViewpointTemplate(options: FlowOptions): string {
|
|
291
|
-
return [
|
|
292
|
-
`# ${options.name} Flow — Test Viewpoints`,
|
|
293
|
-
'',
|
|
294
|
-
'## Edge Cases',
|
|
295
|
-
'',
|
|
296
|
-
'<!-- Sample — replace with actual edge cases for this flow:',
|
|
297
|
-
'- Network drops between screen transitions — should resume or show error?',
|
|
298
|
-
'- Session expires mid-flow — should redirect to login and preserve progress?',
|
|
299
|
-
'- Browser back button at step 3 — should return to step 2 with data intact?',
|
|
300
|
-
'- Complete flow twice rapidly — should prevent duplicate submissions',
|
|
301
|
-
'-->',
|
|
302
|
-
'',
|
|
303
|
-
'## Known Issues',
|
|
304
|
-
'',
|
|
305
|
-
'<!-- Sample — replace with actual known issues:',
|
|
306
|
-
'- [BUG-001] Form data lost if user navigates away and returns',
|
|
307
|
-
'- [BUG-002] Confirmation page shows stale data on slow connections',
|
|
308
|
-
'-->',
|
|
309
|
-
'',
|
|
310
|
-
'## Design Decisions',
|
|
311
|
-
'',
|
|
312
|
-
'<!-- Sample — replace with actual design decisions:',
|
|
313
|
-
'- Flow requires completing all steps in order (no skip)',
|
|
314
|
-
'- Draft is auto-saved at each step transition',
|
|
315
|
-
'- Cancel at any step discards the entire flow',
|
|
316
|
-
'-->',
|
|
317
|
-
'',
|
|
318
|
-
'## Cross-Screen Concerns',
|
|
319
|
-
'',
|
|
320
|
-
'<!-- Sample — replace with actual cross-screen concerns:',
|
|
321
|
-
'- Auth role must remain consistent across all screens',
|
|
322
|
-
'- Data entered in step 1 must be visible in confirmation (step 3)',
|
|
323
|
-
'- Error in step 2 should allow returning to step 1 without re-entering data',
|
|
324
|
-
'-->',
|
|
325
|
-
'',
|
|
326
|
-
'## Priority Viewpoints',
|
|
327
|
-
'',
|
|
328
|
-
'<!-- Rate importance for this flow (High / Medium / Low / Skip):',
|
|
329
|
-
'',
|
|
330
|
-
'| VP | Priority | Reason |',
|
|
331
|
-
'|---|----------|--------|',
|
|
332
|
-
'| VP-UI | Medium | Standard forms across screens |',
|
|
333
|
-
'| VP-VAL | High | Cross-screen validation rules |',
|
|
334
|
-
'| VP-LOGIC | High | Multi-step business logic, state transitions |',
|
|
335
|
-
'| VP-SEC | Medium | Auth must persist, role-based access at each screen |',
|
|
336
|
-
'-->',
|
|
337
|
-
'',
|
|
338
|
-
].join('\n');
|
|
339
|
-
}
|
|
340
|
-
|
|
341
291
|
private generateFeatureTemplate(options: FlowOptions, flowName: string, isMobile: boolean): string {
|
|
342
292
|
const description = options.description || `complete the ${options.name} flow`;
|
|
343
293
|
|
|
@@ -5,10 +5,10 @@
|
|
|
5
5
|
|
|
6
6
|
import * as fs from 'fs';
|
|
7
7
|
import * as path from 'path';
|
|
8
|
-
import { chromium } from '@playwright/test';
|
|
9
8
|
import { readCapabilities } from '../harness/capability';
|
|
10
9
|
import { testDataHeader, ensureTestDataGuideFiles } from './test-data-guide';
|
|
11
10
|
import { resolveWebBaseUrl } from '../exporters/env-qa';
|
|
11
|
+
import { viewpointScaffold } from './viewpoint-scaffold';
|
|
12
12
|
|
|
13
13
|
export interface ScreenOptions {
|
|
14
14
|
name: string;
|
|
@@ -158,68 +158,11 @@ export class ScreenManager {
|
|
|
158
158
|
fs.writeFileSync(specPath, this.generateSpecTemplate(options, screenName), 'utf-8');
|
|
159
159
|
}
|
|
160
160
|
|
|
161
|
-
// Generate requirements test-viewpoint.md (only on first screen creation)
|
|
161
|
+
// Generate requirements test-viewpoint.md (only on first screen creation): the QA template,
|
|
162
|
+
// samples inside comments, so an untouched file declares nothing (see viewpoint-scaffold.ts).
|
|
162
163
|
const viewpointPath = path.join(requirementsDir, 'test-viewpoint.md');
|
|
163
164
|
if (!fs.existsSync(viewpointPath)) {
|
|
164
|
-
fs.writeFileSync(viewpointPath,
|
|
165
|
-
`# ${options.name} — Test Viewpoints`,
|
|
166
|
-
'',
|
|
167
|
-
'## Edge Cases',
|
|
168
|
-
'',
|
|
169
|
-
'<!-- Sample — replace with actual edge cases for this screen:',
|
|
170
|
-
'- Paste emoji into text fields (e.g., 🎉👋) — should accept or sanitize?',
|
|
171
|
-
'- Input 10,000+ characters into free text — truncate or reject?',
|
|
172
|
-
'- Double-click Submit rapidly — should only create 1 record',
|
|
173
|
-
'- Browser back button after successful submit — should not re-submit',
|
|
174
|
-
'-->',
|
|
175
|
-
'',
|
|
176
|
-
'## Known Issues',
|
|
177
|
-
'',
|
|
178
|
-
'<!-- Sample — replace with actual known issues:',
|
|
179
|
-
'- [BUG-001] Date picker does not work on Safari < 16',
|
|
180
|
-
'- [BUG-002] File upload silently fails for files > 20MB (no error shown)',
|
|
181
|
-
'- Search does not handle Vietnamese accents correctly ("Nguyên" ≠ "Nguyen")',
|
|
182
|
-
'-->',
|
|
183
|
-
'',
|
|
184
|
-
'## Design Decisions',
|
|
185
|
-
'',
|
|
186
|
-
'<!-- Sample — replace with actual design decisions:',
|
|
187
|
-
'- Show all validation errors at once (not one at a time) — per UX review',
|
|
188
|
-
'- Cancel button resets form completely (no draft saving)',
|
|
189
|
-
'- Anonymous mode hides sender name but keeps department visible',
|
|
190
|
-
'-->',
|
|
191
|
-
'',
|
|
192
|
-
'## UI Patterns Identified',
|
|
193
|
-
'',
|
|
194
|
-
'<!-- Check applicable patterns for this screen (from sungen-viewpoint skill):',
|
|
195
|
-
'',
|
|
196
|
-
'| # | Pattern | Applicable? | Notes |',
|
|
197
|
-
'|---|---------|-------------|-------|',
|
|
198
|
-
'| 1 | Form & Inputs | ☐ | |',
|
|
199
|
-
'| 2 | Data Table | ☐ | |',
|
|
200
|
-
'| 3 | Create / Add | ☐ | |',
|
|
201
|
-
'| 4 | Update / Edit | ☐ | |',
|
|
202
|
-
'| 5 | Delete | ☐ | |',
|
|
203
|
-
'| 6 | Search | ☐ | |',
|
|
204
|
-
'| 7 | Filter | ☐ | |',
|
|
205
|
-
'| 8 | Pagination | ☐ | |',
|
|
206
|
-
'| 9 | Modal / Dialog | ☐ | |',
|
|
207
|
-
'| 10 | List / Card | ☐ | |',
|
|
208
|
-
'-->',
|
|
209
|
-
'',
|
|
210
|
-
'## Priority Viewpoints',
|
|
211
|
-
'',
|
|
212
|
-
'<!-- Rate importance for this screen (High / Medium / Low / Skip):',
|
|
213
|
-
'',
|
|
214
|
-
'| VP | Priority | Reason |',
|
|
215
|
-
'|---|----------|--------|',
|
|
216
|
-
'| VP-UI | High | Complex form with many states |',
|
|
217
|
-
'| VP-VAL | High | 14 validation rules from spec |',
|
|
218
|
-
'| VP-LOGIC | Medium | Standard CRUD, no complex business rules |',
|
|
219
|
-
'| VP-SEC | Low | Internal tool, basic auth only |',
|
|
220
|
-
'-->',
|
|
221
|
-
'',
|
|
222
|
-
].join('\n'), 'utf-8');
|
|
165
|
+
fs.writeFileSync(viewpointPath, viewpointScaffold(options.name, isMobile), 'utf-8');
|
|
223
166
|
}
|
|
224
167
|
|
|
225
168
|
// Auto-screenshot: capture page only when --capture is set and not mobile (requires --path)
|
|
@@ -272,6 +215,9 @@ export class ScreenManager {
|
|
|
272
215
|
|
|
273
216
|
let browser;
|
|
274
217
|
try {
|
|
218
|
+
// Loaded here, not at module top: @playwright/test is a peerDependency a mobile project never
|
|
219
|
+
// installs, and `sungen add` loads this module on every platform (#865).
|
|
220
|
+
const { chromium } = await import('@playwright/test');
|
|
275
221
|
browser = await chromium.launch();
|
|
276
222
|
const page = await browser.newPage({ viewport: { width: 1280, height: 720 } });
|
|
277
223
|
await page.goto(url, { waitUntil: 'networkidle', timeout: 15000 });
|
|
@@ -9,7 +9,9 @@ You are a **test-design context explorer**. You run in an **isolated context** s
|
|
|
9
9
|
## Explore (do NOT ask the user to pick a source — read all that exist)
|
|
10
10
|
- `requirements/spec.md` — primary behavior source.
|
|
11
11
|
- `requirements/spec_figma.md` — Figma supplement (if present; do NOT call Figma MCP when this exists).
|
|
12
|
-
- `requirements/ui/*` images —
|
|
12
|
+
- `requirements/ui/*` images — read **every** image (group primary vs states/variants when there are many, but open them all).
|
|
13
|
+
- `requirements/ui/figma-meta.md` — Figma MCP capture: `## Components`, `## Text Content`.
|
|
14
|
+
- `requirements/ui-inventory.md` — an existing Design Inventory: keep its `UI-NNN` ids.
|
|
13
15
|
- Live page — only if a base URL is configured and reachable: `browser_navigate` + `browser_snapshot` for real element roles/names. Fall back gracefully if it requires login / fails.
|
|
14
16
|
|
|
15
17
|
## Cross-check
|
|
@@ -20,7 +22,13 @@ Flag any **conflicts** between sources (field names, labels, behavior, states th
|
|
|
20
22
|
SOURCES: spec=<yes/no, completeness high|med|low> | figma=<...> | ui=<n images> | live=<reached|offline>
|
|
21
23
|
PAGE TYPE: <e.g. ecommerce-list / form / auth / ...>
|
|
22
24
|
RECOMMENDED ROUTE: <spec-first | source-first | ...> — authoritative source: <which>
|
|
23
|
-
CONFLICTS: <list, or "none">
|
|
25
|
+
CONFLICTS: <list, or "none"> — each conflict on a design item also appears in UI INVENTORY with source `conflict`
|
|
26
|
+
UI INVENTORY: images read: <read>/<total> · figma-meta.md: <read|absent> · spec_figma.md: <read|absent>
|
|
27
|
+
| UI-001 | <item> | <component|column|button|field|state|annotation> | spec+design | <image> |
|
|
28
|
+
| UI-014 | <item> | column | design-only | <image> |
|
|
29
|
+
| UI-015 | <item> | column | conflict — <how spec and design disagree> | <image> |
|
|
30
|
+
→ one row per item the design shows (format and id rules: `sungen-tc-generation` § Design Inventory);
|
|
31
|
+
omit the block only when the unit has no design source
|
|
24
32
|
KEY FACTS (condensed):
|
|
25
33
|
- Sections: <list>
|
|
26
34
|
- Fields/validation: <key constraints + exact error messages>
|
|
@@ -29,4 +37,4 @@ KEY FACTS (condensed):
|
|
|
29
37
|
ASSUMPTIONS / MISSING INFO: <what's unknown — to be marked in output>
|
|
30
38
|
```
|
|
31
39
|
|
|
32
|
-
Keep it tight. Do not generate test cases — that is the orchestrator's job. Do not write files.
|
|
40
|
+
Keep it tight — except UI INVENTORY, which is listed in full: it is the checklist the orchestrator writes to `ui-inventory.md`. Do not generate test cases — that is the orchestrator's job. Do not write files.
|
|
@@ -10,6 +10,8 @@ You are an **independent Senior QA Reviewer**. You did **not** write these tests
|
|
|
10
10
|
- `qa/<screens|flows>/<name>/features/<name>.feature` — the scenarios under review.
|
|
11
11
|
- `qa/<screens|flows>/<name>/requirements/test-viewpoint.md` — the viewpoint overview (priority).
|
|
12
12
|
- `qa/<screens|flows>/<name>/requirements/spec.md` — source of truth for behavior.
|
|
13
|
+
- `qa/<screens|flows>/<name>/requirements/ui/*` images, `ui/figma-meta.md`, `spec_figma.md` — the design, when present. Open **every** image.
|
|
14
|
+
- `qa/<screens|flows>/<name>/requirements/ui-inventory.md` — the Design Inventory create-test wrote (`UI-NNN` rows).
|
|
13
15
|
- `.sungen/reports/<name>-audit.json` — the deterministic findings (don't repeat them; go deeper).
|
|
14
16
|
|
|
15
17
|
## What to judge (semantic — the gate misses these)
|
|
@@ -25,6 +27,7 @@ You are an **independent Senior QA Reviewer**. You did **not** write these tests
|
|
|
25
27
|
- **Flows self-clean.** A CRUD/auth chain deletes what it created (final `@api:delete_*`) or is `@cleanup`-tagged.
|
|
26
28
|
- **Idempotency uses the DB oracle.** A "no double-charge / exactly once" claim is proven by `@concurrent` + a `@query` count, not HTTP status alone (status can lie under a race).
|
|
27
29
|
- **Auth negatives** exist for protected mutations (401/403), not just the happy path.
|
|
30
|
+
7. **Design ↔ Feature** (only when the unit holds design sources). Read the design yourself — do not trust the inventory to be complete. Report: items the design shows that are **missing from `ui-inventory.md`**; inventory items **mislabelled** `spec+design` that `spec.md` never names (design-only) or names differently (conflict); and `design-only`/`conflict` items whose `@ui:` scenario does not actually prove them, or whose `# UI-DEFERRED:` reason does not hold. The audit only sees what the inventory lists — you are the check on the inventory itself.
|
|
28
31
|
|
|
29
32
|
## Output (do NOT edit any file)
|
|
30
33
|
Return a concise verdict:
|
|
@@ -38,6 +41,11 @@ ISSUES (most important first):
|
|
|
38
41
|
FIX: <the exact Gherkin step(s) to add/change>
|
|
39
42
|
2. ...
|
|
40
43
|
|
|
44
|
+
DESIGN DIFF (omit when the unit has no design source):
|
|
45
|
+
- not inventoried: <item> (<image>)
|
|
46
|
+
- mislabelled: UI-NNN <item> — is <design-only|conflict>, not spec+design
|
|
47
|
+
- unproven: UI-NNN <item> — <why the @ui scenario / deferral does not hold>
|
|
48
|
+
|
|
41
49
|
STRENGTHS: <1-2 lines, what is genuinely good>
|
|
42
50
|
```
|
|
43
51
|
|