@sun-asterisk/sungen 2.6.4 → 2.6.6

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (59) hide show
  1. package/dist/cli/index.js +1 -1
  2. package/dist/dashboard/templates/index.html +2 -2
  3. package/dist/dashboard/types.d.ts +1 -1
  4. package/dist/dashboard/types.d.ts.map +1 -1
  5. package/dist/exporters/csv-exporter.js +1 -1
  6. package/dist/exporters/csv-exporter.js.map +1 -1
  7. package/dist/exporters/feature-parser.d.ts +5 -2
  8. package/dist/exporters/feature-parser.d.ts.map +1 -1
  9. package/dist/exporters/feature-parser.js +11 -9
  10. package/dist/exporters/feature-parser.js.map +1 -1
  11. package/dist/exporters/json-exporter.js +1 -1
  12. package/dist/exporters/json-exporter.js.map +1 -1
  13. package/dist/exporters/spec-parser.js +1 -1
  14. package/dist/exporters/spec-parser.js.map +1 -1
  15. package/dist/generators/test-generator/patterns/navigation-patterns.d.ts.map +1 -1
  16. package/dist/generators/test-generator/patterns/navigation-patterns.js +26 -3
  17. package/dist/generators/test-generator/patterns/navigation-patterns.js.map +1 -1
  18. package/dist/orchestrator/templates/ai-instructions/claude-cmd-run-test.md +2 -2
  19. package/dist/orchestrator/templates/ai-instructions/claude-skill-delivery.md +1 -1
  20. package/dist/orchestrator/templates/ai-instructions/claude-skill-gherkin-syntax.md +5 -6
  21. package/dist/orchestrator/templates/ai-instructions/claude-skill-selector-fix.md +7 -7
  22. package/dist/orchestrator/templates/ai-instructions/claude-skill-tc-generation.md +28 -23
  23. package/dist/orchestrator/templates/ai-instructions/claude-skill-tc-review.md +3 -3
  24. package/dist/orchestrator/templates/ai-instructions/claude-skill-test-design-techniques.md +2 -2
  25. package/dist/orchestrator/templates/ai-instructions/claude-skill-viewpoint.md +1 -1
  26. package/dist/orchestrator/templates/ai-instructions/copilot-cmd-run-test.md +2 -2
  27. package/dist/orchestrator/templates/ai-instructions/github-skill-sungen-delivery.md +1 -1
  28. package/dist/orchestrator/templates/ai-instructions/github-skill-sungen-gherkin-syntax.md +5 -6
  29. package/dist/orchestrator/templates/ai-instructions/github-skill-sungen-selector-fix.md +7 -7
  30. package/dist/orchestrator/templates/ai-instructions/github-skill-sungen-tc-generation.md +28 -23
  31. package/dist/orchestrator/templates/ai-instructions/github-skill-sungen-tc-review.md +3 -3
  32. package/dist/orchestrator/templates/ai-instructions/github-skill-sungen-test-design-techniques.md +2 -2
  33. package/dist/orchestrator/templates/ai-instructions/github-skill-sungen-viewpoint.md +1 -1
  34. package/package.json +1 -1
  35. package/src/cli/index.ts +1 -1
  36. package/src/dashboard/templates/index.html +2 -2
  37. package/src/dashboard/types.ts +1 -1
  38. package/src/exporters/csv-exporter.ts +1 -1
  39. package/src/exporters/feature-parser.ts +11 -8
  40. package/src/exporters/json-exporter.ts +1 -1
  41. package/src/exporters/spec-parser.ts +1 -1
  42. package/src/generators/test-generator/adapters/adapter-interface.ts +1 -1
  43. package/src/generators/test-generator/patterns/navigation-patterns.ts +28 -3
  44. package/src/orchestrator/templates/ai-instructions/claude-cmd-run-test.md +2 -2
  45. package/src/orchestrator/templates/ai-instructions/claude-skill-delivery.md +1 -1
  46. package/src/orchestrator/templates/ai-instructions/claude-skill-gherkin-syntax.md +5 -6
  47. package/src/orchestrator/templates/ai-instructions/claude-skill-selector-fix.md +7 -7
  48. package/src/orchestrator/templates/ai-instructions/claude-skill-tc-generation.md +28 -23
  49. package/src/orchestrator/templates/ai-instructions/claude-skill-tc-review.md +3 -3
  50. package/src/orchestrator/templates/ai-instructions/claude-skill-test-design-techniques.md +2 -2
  51. package/src/orchestrator/templates/ai-instructions/claude-skill-viewpoint.md +1 -1
  52. package/src/orchestrator/templates/ai-instructions/copilot-cmd-run-test.md +2 -2
  53. package/src/orchestrator/templates/ai-instructions/github-skill-sungen-delivery.md +1 -1
  54. package/src/orchestrator/templates/ai-instructions/github-skill-sungen-gherkin-syntax.md +5 -6
  55. package/src/orchestrator/templates/ai-instructions/github-skill-sungen-selector-fix.md +7 -7
  56. package/src/orchestrator/templates/ai-instructions/github-skill-sungen-tc-generation.md +28 -23
  57. package/src/orchestrator/templates/ai-instructions/github-skill-sungen-tc-review.md +3 -3
  58. package/src/orchestrator/templates/ai-instructions/github-skill-sungen-test-design-techniques.md +2 -2
  59. package/src/orchestrator/templates/ai-instructions/github-skill-sungen-viewpoint.md +1 -1
@@ -105,7 +105,6 @@ export function isSampleScaffoldScenario(sc: ScenarioMetadata): boolean {
105
105
  * Extract priority from scenario tags.
106
106
  */
107
107
  export function extractPriority(tags: string[]): string {
108
- if (tags.includes('@critical')) return 'Critical';
109
108
  if (tags.includes('@high')) return 'High';
110
109
  if (tags.includes('@normal')) return 'Normal';
111
110
  if (tags.includes('@low')) return 'Low';
@@ -144,10 +143,15 @@ export function splitVpAndName(scenarioName: string): { vpId?: string; category1
144
143
 
145
144
  /**
146
145
  * Map VP prefix to Category 2.
146
+ * XSS/Injection security tests are input-validation tests → Function.
147
+ * All other VP-SEC tests (auth, RBAC, access control) → Accessing.
147
148
  */
148
- export function mapVpToCategory2(vpId: string | undefined): string {
149
+ export function mapVpToCategory2(vpId: string | undefined, scenarioName?: string): string {
149
150
  if (!vpId) return 'Function';
150
- if (vpId.startsWith('VP-SEC-')) return 'Accessing';
151
+ if (vpId.startsWith('VP-SEC-')) {
152
+ if (scenarioName && /xss|injection/i.test(scenarioName)) return 'Function';
153
+ return 'Accessing';
154
+ }
151
155
  if (vpId.startsWith('VP-UI-')) return 'GUI';
152
156
  if (vpId.startsWith('VP-VAL-')) return 'Function';
153
157
  if (vpId.startsWith('VP-LOGIC-')) return 'Function';
@@ -155,14 +159,13 @@ export function mapVpToCategory2(vpId: string | undefined): string {
155
159
  }
156
160
 
157
161
  /**
158
- * Generate TC ID: <SCREEN_UPPER>-<VP-part>-<NNN> OR <SCREEN_UPPER>-<NNN> if no VP.
162
+ * Generate TC ID: keep VP ID exactly as written (e.g. VP-UI-001) when present,
163
+ * or fall back to <SCREEN_UPPER>-<NNN> for scenarios without a VP ID.
159
164
  */
160
165
  export function generateTcId(screen: string, vpId: string | undefined, fallbackIndex: number): string {
161
- const screenUpper = screen.toUpperCase().replace(/[^A-Z0-9]/g, '-');
162
166
  if (vpId) {
163
- // VP-UI-001 → UI-001
164
- const vpPart = vpId.replace(/^VP-/, '');
165
- return `${screenUpper}-${vpPart}`;
167
+ return vpId;
166
168
  }
169
+ const screenUpper = screen.toUpperCase().replace(/[^A-Z0-9]/g, '-');
167
170
  return `${screenUpper}-${String(fallbackIndex).padStart(3, '0')}`;
168
171
  }
@@ -51,7 +51,7 @@ export function buildScreenSnapshot(input: BuildScreenSnapshotInput): ScreenSnap
51
51
  const tcId = generateTcId(input.screen, vpId, fallbackIndex);
52
52
  if (!vpId) fallbackIndex++;
53
53
 
54
- const category2 = mapVpToCategory2(vpId);
54
+ const category2 = mapVpToCategory2(vpId, category1);
55
55
  const priority = extractPriority(m.feature.tags) as ScenarioSnapshot['priority'];
56
56
  const baseType = extractTestcaseType(m.feature.tags);
57
57
  const authRole = extractAuthRole(m.feature.tags);
@@ -52,7 +52,7 @@ function extractTestBlock(content: string, startIdx: number): {
52
52
  */
53
53
  function extractDescribeBlocks(content: string): Array<{ name: string; bodyStart: number; bodyEnd: number }> {
54
54
  const result: Array<{ name: string; bodyStart: number; bodyEnd: number }> = [];
55
- const regex = /test\.describe\s*\(\s*['"]([^'"]+)['"]\s*,\s*\(\s*\)\s*=>\s*\{/g;
55
+ const regex = /test\.describe(?:\.serial)?\s*\(\s*['"]([^'"]+)['"]\s*,\s*\(\s*\)\s*=>\s*\{/g;
56
56
  let match: RegExpExecArray | null;
57
57
  while ((match = regex.exec(content)) !== null) {
58
58
  const name = match[1];
@@ -34,7 +34,7 @@ export interface ScenarioData {
34
34
  steps: Array<{ comment?: string; code: string }>;
35
35
  authRole?: string; // Auth role for storage state
36
36
  isParallel?: boolean; // @parallel: use fresh page from fixture
37
- tags?: string; // Pass-through tags for Playwright { tag: [...] }, e.g. "'@smoke', '@critical'"
37
+ tags?: string; // Pass-through tags for Playwright { tag: [...] }, e.g. "'@smoke', '@high'"
38
38
  }
39
39
 
40
40
  export interface StepTemplateData {
@@ -12,22 +12,38 @@ export const navigationPatterns: StepPattern[] = [
12
12
  (step.text.includes('open') || step.text.includes('opens') || step.text.includes('is on') || step.text.includes('navigate to')) &&
13
13
  step.elementType === 'page',
14
14
  resolver: (step, context) => {
15
- let path = context.featurePath || '/';
15
+ const isThen = context.effectiveKeyword === 'Then';
16
+ // Cross-screen page refs (e.g. Then User is on [dashboard] page) won't be in the
17
+ // current screen's selectors. Fall back to /<ref>/ for assertion paths instead of
18
+ // the current featurePath, which would silently make the assertion always pass.
19
+ const pathFallback = isThen && step.selectorRef
20
+ ? `/${step.selectorRef}/`
21
+ : (context.featurePath || '/');
22
+ let path = pathFallback;
16
23
 
17
24
  if (step.selectorRef) {
18
25
  try {
19
26
  const resolved = context.selectorResolver.resolveSelector(
20
27
  step.selectorRef, context.featureName, step.elementType, step.nth
21
28
  );
22
- path = resolved.value || path;
29
+ path = resolved.value || pathFallback;
23
30
  } catch (error) {
24
- path = context.featurePath || '/';
31
+ path = pathFallback;
25
32
  }
26
33
  }
27
34
 
28
35
  const finalPath = resolvePathVariables(path, context.scenarioSteps || []);
29
36
  const isAbsoluteUrl = /^https?:\/\//.test(finalPath);
30
37
 
38
+ // Then User is on [X] page — assert URL, don't navigate.
39
+ if (isThen) {
40
+ return {
41
+ templateName: 'route-assertion',
42
+ data: { path: finalPath },
43
+ comment: step.selectorRef ? `Assert on ${step.selectorRef} page` : `Assert page route`,
44
+ };
45
+ }
46
+
31
47
  return {
32
48
  templateName: 'navigation',
33
49
  data: { baseURL: isAbsoluteUrl ? undefined : context.baseURL, path: finalPath },
@@ -71,6 +87,7 @@ export const navigationPatterns: StepPattern[] = [
71
87
  !!(step.selectorRef || step.dataRef),
72
88
  resolver: (step, context) => {
73
89
  const route = step.selectorRef || step.dataRef;
90
+ const isThen = context.effectiveKeyword === 'Then';
74
91
 
75
92
  const inferredPath = inferPath(context.featurePath, {
76
93
  featureName: context.featureName,
@@ -81,6 +98,14 @@ export const navigationPatterns: StepPattern[] = [
81
98
  const cleanPath = pathCode.replace(/^['`]|['`]$/g, '');
82
99
  const isAbsoluteUrl = /^https?:\/\//.test(cleanPath);
83
100
 
101
+ if (isThen) {
102
+ return {
103
+ templateName: 'route-assertion',
104
+ data: { path: cleanPath },
105
+ comment: `Assert on ${route}`,
106
+ };
107
+ }
108
+
84
109
  return {
85
110
  templateName: 'navigation',
86
111
  data: { baseURL: isAbsoluteUrl ? undefined : context.baseURL, path: cleanPath },
@@ -56,8 +56,8 @@ Parse **name** from `$ARGUMENTS`. If missing, ask the user.
56
56
 
57
57
  ## Run & Fix (phased — per `sungen-selector-fix` skill)
58
58
 
59
- 5. **Phase 1 — Smoke Check**: Run first 5 `@critical`/`@high` scenarios only. If failures → diagnose, fix fundamentals (page selector, auth, base @steps), re-run. Max 2 attempts. If still broken → ask user.
60
- 6. **Phase 2 — Priority Wave**: Run all `@critical` + `@high` scenarios. Fix only failures from this wave. Max 2 attempts. Shared selectors fixed here cascade to later phases.
59
+ 5. **Phase 1 — Smoke Check**: Run first 5 `@high` scenarios only. If failures → diagnose, fix fundamentals (page selector, auth, base @steps), re-run. Max 2 attempts. If still broken → ask user.
60
+ 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.
61
61
  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.
62
62
  8. **Phase 4 — Regression**: One final full run. Report results. No more fix loops.
63
63
 
@@ -68,7 +68,7 @@ The CLI reads the **per-target result file first** (co-located with `.spec.ts`),
68
68
  | Test Data | `{{vars}}` from scenario resolved via test-data.yaml → `key: value; key2: value2` |
69
69
  | Steps | `.spec.ts` code comments for interactions (numbered) |
70
70
  | Expected results | `.spec.ts` `expect(...)` comments (numbered) |
71
- | Priority | Tag: `@critical`/`@high`/`@normal`/`@low` (default: Normal) |
71
+ | Priority | Tag: `@high`/`@normal`/`@low` (default: Normal) |
72
72
  | Testcase type | `@manual` → Manual, else Auto. Not compiled → "Not compiled" |
73
73
  | Test Result | results.json status: passed→Passed, failed/timedOut→Failed, skipped→N/A, else Pending |
74
74
  | Executed Date | results.json startTime formatted as `dd/mm/yyyy` |
@@ -192,18 +192,17 @@ Any tag not listed above passes through to Playwright `{ tag: [...] }`. Feature-
192
192
  |---|---|
193
193
  | `@smoke` | Quick sanity check — run after every deploy |
194
194
  | `@regression` | Full test suite — run nightly or before release |
195
- | `@critical` | Priority: system unusable if fails (login, auth, core CRUD) |
196
- | `@high` | Priority: major feature broken (required validation, key business rules) |
197
- | `@normal` | Priority: degraded experience (UI layout, secondary flows) |
198
- | `@low` | Priority: minor/cosmetic (tooltips, hover states, empty states) |
195
+ | `@high` | Priority: must pass login, auth, core CRUD, primary business flow |
196
+ | `@normal` | Priority: important validation rules, secondary features, search/filter |
197
+ | `@low` | Priority: minor/cosmetic tooltips, hover states, element presence |
199
198
  | `@auto` | Standard scenario, ready for automation |
200
199
  | Any custom | e.g., `@sprint-42`, `@team-payment` — any tag works |
201
200
 
202
201
  **Run filtered:**
203
202
  ```bash
204
203
  npx playwright test --grep "@smoke" # only smoke tests
205
- npx playwright test --grep "@critical" # only critical priority
206
- npx playwright test --grep "@smoke|@critical" # smoke OR critical
204
+ npx playwright test --grep "@high" # only high priority
205
+ npx playwright test --grep "@smoke|@high" # smoke OR high
207
206
  ```
208
207
 
209
208
  ### Serial vs Parallel (test execution mode)
@@ -118,7 +118,7 @@ Skip if `specs/.auth/<role>.json` already exists and a probe navigation reaches
118
118
 
119
119
  ## Phase 1: Smoke Check (catch fundamentals)
120
120
 
121
- Run **up to 5 scenarios** — pick the first `@critical` or `@high` scenarios in the feature file.
121
+ Run **up to 5 scenarios** — pick the first `@high` scenarios in the feature file.
122
122
 
123
123
  ```bash
124
124
  npx playwright test --grep "VP-.*-001|VP-.*-002|VP-.*-003|VP-.*-004|VP-.*-005" --reporter=line
@@ -134,15 +134,15 @@ npx playwright test --grep "VP-.*-001|VP-.*-002|VP-.*-003|VP-.*-004|VP-.*-005" -
134
134
 
135
135
  ---
136
136
 
137
- ## Phase 2: Priority Wave (@critical + @high)
137
+ ## Phase 2: Priority Wave (@high)
138
138
 
139
- Run all `@critical` and `@high` scenarios:
139
+ Run all `@high` scenarios:
140
140
 
141
141
  ```bash
142
- npx playwright test --grep "@critical|@high" --reporter=line
142
+ npx playwright test --grep "@high" --reporter=line
143
143
  ```
144
144
 
145
- If your Playwright config doesn't support tag grep, use scenario name grep from the feature file — collect VP IDs of `@critical` and `@high` scenarios.
145
+ If your Playwright config doesn't support tag grep, use scenario name grep from the feature file — collect VP IDs of `@high` scenarios.
146
146
 
147
147
  **Fix only failures from this wave.** Most shared selectors (buttons, headings, navigation) get fixed here because critical/high scenarios exercise them.
148
148
 
@@ -292,8 +292,8 @@ user detail:
292
292
  |---|---|---|---|
293
293
  | 0. Pre-gen | Playwright MCP snapshot → write selectors.yaml | 1 snapshot | Ask user — skip or retry navigation |
294
294
  | 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` |
295
- | 1. Smoke | First 5 @critical/@high | 2 | Ask user — fundamentals broken |
296
- | 2. Priority | All @critical + @high | 2 | Report failures, continue to Phase 3 |
295
+ | 1. Smoke | First 5 @high | 2 | Ask user — fundamentals broken |
296
+ | 2. Priority | All @high | 2 | Report failures, continue to Phase 3 |
297
297
  | 3. Full | All tests | 1 | Report @low/@normal failures, continue |
298
298
  | 4. Regression | All tests | 0 | Report final results |
299
299
 
@@ -12,7 +12,7 @@ Generate **focused test cases per screen section** using a **tier-based approach
12
12
 
13
13
  | Tier | Priority | What to generate | When |
14
14
  |---|---|---|---|
15
- | **Tier 1** (default) | `@critical` + `@high` | Happy paths, required validation, core business rules, security basics | First run of `create-test` |
15
+ | **Tier 1** (default) | `@high` | Happy paths, required validation, core business rules, security basics | First run of `create-test` |
16
16
  | **Tier 2** (expand) | `@normal` + `@low` | UI presence, optional validation, edge cases, cosmetic checks | User runs `create-test` again with "Add viewpoints" mode |
17
17
 
18
18
  **Round 1 (Tier 1)** targets **~10-15 scenarios per section** — enough to cover critical flows and catch real bugs. This is the default behavior.
@@ -24,7 +24,7 @@ Generate **focused test cases per screen section** using a **tier-based approach
24
24
  When `.feature` already has scenarios, summarize and ask:
25
25
  1. **Add new sections** — append new sections with Tier 2 (`@normal` + `@low`) scenarios, continue numbering
26
26
  2. **Add viewpoints** — expand existing sections with Tier 2 (`@normal` + `@low`) scenarios
27
- 3. **Replace all** — overwrite with fresh Tier 1 (`@critical` + `@high`) generation
27
+ 3. **Replace all** — overwrite with fresh Tier 1 (`@high`) generation
28
28
 
29
29
  For append: read highest `VP-<CAT>-<NNN>`, continue from next number. Never modify existing scenarios.
30
30
 
@@ -89,7 +89,7 @@ Apply `sungen-test-design-techniques` to spec-extracted conditions:
89
89
  Use `sungen-viewpoint` skill for per-pattern checklists across 4 viewpoints: UI/UX, Data & Validate, Logic, Security.
90
90
 
91
91
  **Tier-aware gap filling:**
92
- - **Tier 1 (first run)**: only add `@critical` and `@high` items from the checklists — core security checks (VP-SEC), required field validation (VP-VAL), key state transitions (VP-LOGIC). Skip `@normal`/`@low` items like hover states, empty states, tooltips.
92
+ - **Tier 1 (first run)**: only add `@high` items from the checklists — core security checks (VP-SEC), required field validation (VP-VAL), key state transitions (VP-LOGIC). Skip `@normal`/`@low` items like hover states, empty states, tooltips.
93
93
  - **Tier 2 (expand run)**: add `@normal` + `@low` scenarios — UI presence, optional validation, edge cases, cosmetic checks, keyboard nav, hover effects.
94
94
 
95
95
  **Validation rule**: capture actual error messages from live page or spec.md. Use `User see {{error_var}}` — never assert just "is visible".
@@ -98,24 +98,29 @@ Use `sungen-viewpoint` skill for per-pattern checklists across 4 viewpoints: UI/
98
98
 
99
99
  Every scenario **MUST** have exactly one priority tag. Add it before the scenario line (after `@extend:` if present).
100
100
 
101
+ **Rule: look at what the WHEN step does and what THEN asserts — that determines the tag.**
102
+
101
103
  | Tag | When to use |
102
104
  |---|---|
103
- | `@critical` | System unusable if fails — login/logout, authentication redirect, main create/submit/delete, permission denied |
104
- | `@high` | Major feature broken required field validation, core business rules, data displays correctly, key navigation |
105
- | `@normal` | Degraded experience UI layout/element presence, secondary flows, optional field validation, search/filter |
106
- | `@low` | Minor/cosmetic — tooltips, hover states, empty states, default sort, placeholder text |
105
+ | `@high` | WHEN performs: login/logout, submit happy path, auth-check, primary CRUD action. THEN asserts: success state, redirect, or security gate |
106
+ | `@normal` | WHEN provides invalid/empty input, OR scenario tests search/filter/notification/secondary flow. THEN asserts: error message, secondary feature result |
107
+ | `@low` | THEN only asserts: element visible, text label, placeholder, tooltip, icon, layout. WHEN (if any) is navigation only |
107
108
 
108
109
  ### Auto-assign heuristics
109
110
 
110
- | Viewpoint + Pattern | Default priority |
111
+ | Scenario type (by WHEN + THEN structure) | Tag |
111
112
  |---|---|
112
- | VP-SEC-* (all security scenarios) | `@critical` |
113
- | VP-LOGIC-* with create/submit/delete/login | `@critical` |
114
- | VP-LOGIC-* other state changes | `@high` |
115
- | VP-VAL-* required field / submit empty | `@high` |
116
- | VP-VAL-* format, boundary, optional fields | `@normal` |
117
- | VP-UI-* form fields present, table columns | `@normal` |
118
- | VP-UI-* hover, tooltip, empty state, placeholder | `@low` |
113
+ | Auth: login / logout / protected page redirect | `@high` |
114
+ | CRUD happy path: create / update / delete → success message or redirect | `@high` |
115
+ | Security: unauthenticated access redirected to login | `@high` |
116
+ | Primary business flow step completes successfully | `@high` |
117
+ | Validation: invalid / empty input → error message shown | `@normal` |
118
+ | Boundary / format validation (email, length, range) | `@normal` |
119
+ | Secondary features: search, filter, sort, pagination, notification | `@normal` |
120
+ | State transition not on primary success path (cancel, undo, back) | `@normal` |
121
+ | Element / component presence check (is it visible?) | `@low` |
122
+ | Text content: label, placeholder, tooltip, warning message text | `@low` |
123
+ | Visual / cosmetic: alignment, icon, empty state, hover style | `@low` |
119
124
 
120
125
  **`@steps:` scenarios** do NOT get a priority tag (they are setup blocks, not test cases).
121
126
 
@@ -175,11 +180,11 @@ Serial (default) is best for: CRUD flows, sequential user journeys, UI checks on
175
180
  @cleanup:forms
176
181
  Feature: kudos Screen
177
182
 
178
- @critical
183
+ @high
179
184
  Scenario: Send kudos
180
185
  ...
181
186
 
182
- @critical @no-auth
187
+ @high @no-auth
183
188
  Scenario: Unauthenticated user is redirected
184
189
  ...
185
190
  ```
@@ -205,9 +210,9 @@ Feature: <Screen> Screen
205
210
  When User click [Create] button
206
211
  Then User see [Form] dialog
207
212
 
208
- # --- Section: Create User Form (Tier 1: @critical + @high) ---
213
+ # --- Section: Create User Form (Tier 1: @high) ---
209
214
 
210
- @critical @extend:open_form
215
+ @high @extend:open_form
211
216
  Scenario: VP-LOGIC-001 Submit form with valid data creates record
212
217
  Given User is on [Form] dialog
213
218
  When User fill [Name] field with {{valid_name}}
@@ -220,7 +225,7 @@ Feature: <Screen> Screen
220
225
  When User click [Submit] button
221
226
  Then User see [Name error] message with {{name_required_error}}
222
227
 
223
- # --- Section: User Table (Tier 1: @critical + @high) ---
228
+ # --- Section: User Table (Tier 1: @high) ---
224
229
 
225
230
  @high
226
231
  Scenario: VP-VAL-010 Table displays correct data
@@ -228,7 +233,7 @@ Feature: <Screen> Screen
228
233
  | Name | Email |
229
234
  | {{name_1}} | {{email_1}} |
230
235
 
231
- @critical
236
+ @high
232
237
  Scenario: VP-SEC-010 Unauthorized user cannot access page
233
238
  Given User is not logged in
234
239
  When User navigate to [Screen] page
@@ -300,14 +305,14 @@ Feature: Award Submission Flow
300
305
  Background:
301
306
  Given User is on [Login] page
302
307
 
303
- @critical
308
+ @high
304
309
  Scenario: User login successfully
305
310
  When User fill [Login:Email] field with {{login.email}}
306
311
  And User fill [Login:Password] field with {{login.password}}
307
312
  And User click [Login:Submit] button
308
313
  Then User see [Dashboard] page
309
314
 
310
- @critical
315
+ @high
311
316
  Scenario: User navigates to awards and submits
312
317
  When User click [Dashboard:Awards] link
313
318
  Then User see [Awards] page
@@ -38,12 +38,12 @@ Score: `(dimensions_covered / 6) * 40`. Validate technique application with `sun
38
38
  | All applicable VP present (UI/VAL/LOGIC/SEC) | 10 |
39
39
  | Correct classification | 8 |
40
40
  | `VP-<CAT>-<NNN>` naming + section grouping | 4 |
41
- | Priority tag present and correct (`@critical`/`@high`/`@normal`/`@low`) | 4 |
41
+ | Priority tag present and correct (`@high`/`@normal`/`@low`) | 4 |
42
42
  | Assertion quality (see rules below) | 4 |
43
43
 
44
44
  **Classification**: UI = static/always-same appearance. VAL = input validation/errors. LOGIC = behavior/state changes (includes persisted state without When). SEC = auth/permissions.
45
45
 
46
- **Tier-aware scoring**: If the feature file only contains `@critical` + `@high` scenarios (Tier 1), do NOT penalize for missing VP-UI viewpoint — UI scenarios are intentionally deferred to Tier 2. Score "All applicable VP present" based on Tier 1-relevant viewpoints only (VAL, LOGIC, SEC). Note in the review output: *"VP-UI deferred to Tier 2 — run `/sungen:create-test` with 'Add viewpoints' to expand."*
46
+ **Tier-aware scoring**: If the feature file only contains `@high` scenarios (Tier 1), do NOT penalize for missing VP-UI viewpoint — UI scenarios are intentionally deferred to Tier 2. Score "All applicable VP present" based on Tier 1-relevant viewpoints only (VAL, LOGIC, SEC). Note in the review output: *"VP-UI deferred to Tier 2 — run `/sungen:create-test` with 'Add viewpoints' to expand."*
47
47
 
48
48
  ---
49
49
 
@@ -80,7 +80,7 @@ Do NOT mark `@manual` when data is visible in snapshot or documented in spec —
80
80
  2. **Misclassified VP** — UI tests behavior? Move to LOGIC. Logic tests appearance? Move to UI
81
81
  3. **Dynamic content** — exact match on counters/timestamps? Use `contains` instead
82
82
  4. **Duplicate across sections** — SEC scenario identical to UI? Remove duplicate
83
- 5. **Missing/wrong priority tag** — every non-`@steps` scenario needs exactly one of `@critical`/`@high`/`@normal`/`@low`. SEC→`@critical`, VAL required→`@high`, UI layout→`@normal`, hover/tooltip→`@low`
83
+ 5. **Missing/wrong priority tag** — every non-`@steps` scenario needs exactly one of `@high`/`@normal`/`@low`. SEC/CRUD happy path/auth→`@high`, validation/secondary features→`@normal`, presence/cosmetic→`@low`
84
84
  6. **Always-enabled elements** — `is enabled` on never-disabled element? Remove
85
85
  7. **Test-data completeness** — every `{{var}}` must exist in test-data.yaml
86
86
  8. **Missing BVA boundaries** — spec defines min/max range but scenarios only test midpoint? Add `min-1`, `min`, `max`, `max+1`
@@ -53,7 +53,7 @@ Scenario: VP-VAL-003 Above maximum is rejected # value = 101
53
53
  | Mode | Values | Use when |
54
54
  |---|---|---|
55
55
  | **Compact (default)** | `min-1`, `min`, `max`, `max+1` | Most fields |
56
- | **Full 6-point** | `min-1`, `min`, `min+1`, `max-1`, `max`, `max+1` | Critical fields with `@critical`/`@high` priority |
56
+ | **Full 6-point** | `min-1`, `min`, `min+1`, `max-1`, `max`, `max+1` | Critical fields with `@high` priority |
57
57
 
58
58
  **How to apply** (example: "quantity must be 1-10"):
59
59
  - `min-1` = 0 -> invalid
@@ -82,7 +82,7 @@ Scenario: VP-VAL-003 Above maximum is rejected # value = 101
82
82
  - `@normal` Form invalid + no permission → disabled
83
83
  - `@normal` Form valid + no permission → disabled
84
84
  - `@normal` Has permission + form invalid → disabled
85
- - `@critical` Form valid + has permission → succeeds
85
+ - `@high` Form valid + has permission → succeeds
86
86
 
87
87
  ---
88
88
 
@@ -266,7 +266,7 @@ For VP-SEC scenarios testing **unauthorized access** (no login, wrong role, dire
266
266
  - Do NOT use `@manual` for these — they are automatable.
267
267
 
268
268
  ```gherkin
269
- @critical @no-auth
269
+ @high @no-auth
270
270
  Scenario: VP-SEC-001 Unauthenticated user cannot access admin page
271
271
  Given User is on [Admin] page
272
272
  Then User see [Login] page
@@ -56,8 +56,8 @@ Parse **name** from `$ARGUMENTS`. If missing, ask the user.
56
56
 
57
57
  ## Run & Fix (phased — per `sungen-selector-fix` skill)
58
58
 
59
- 5. **Phase 1 — Smoke Check**: Run first 5 `@critical`/`@high` scenarios only. If failures → diagnose, fix fundamentals (page selector, auth, base @steps), re-run. Max 2 attempts. If still broken → ask user.
60
- 6. **Phase 2 — Priority Wave**: Run all `@critical` + `@high` scenarios. Fix only failures from this wave. Max 2 attempts. Shared selectors fixed here cascade to later phases.
59
+ 5. **Phase 1 — Smoke Check**: Run first 5 `@high` scenarios only. If failures → diagnose, fix fundamentals (page selector, auth, base @steps), re-run. Max 2 attempts. If still broken → ask user.
60
+ 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.
61
61
  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.
62
62
  8. **Phase 4 — Regression**: One final full run. Report results. No more fix loops.
63
63
 
@@ -68,7 +68,7 @@ The CLI reads the **per-target result file first** (co-located with `.spec.ts`),
68
68
  | Test Data | `{{vars}}` from scenario resolved via test-data.yaml → `key: value; key2: value2` |
69
69
  | Steps | `.spec.ts` code comments for interactions (numbered) |
70
70
  | Expected results | `.spec.ts` `expect(...)` comments (numbered) |
71
- | Priority | Tag: `@critical`/`@high`/`@normal`/`@low` (default: Normal) |
71
+ | Priority | Tag: `@high`/`@normal`/`@low` (default: Normal) |
72
72
  | Testcase type | `@manual` → Manual, else Auto. Not compiled → "Not compiled" |
73
73
  | Test Result | results.json status: passed→Passed, failed/timedOut→Failed, skipped→N/A, else Pending |
74
74
  | Executed Date | results.json startTime formatted as `dd/mm/yyyy` |
@@ -192,18 +192,17 @@ Any tag not listed above passes through to Playwright `{ tag: [...] }`. Feature-
192
192
  |---|---|
193
193
  | `@smoke` | Quick sanity check — run after every deploy |
194
194
  | `@regression` | Full test suite — run nightly or before release |
195
- | `@critical` | Priority: system unusable if fails (login, auth, core CRUD) |
196
- | `@high` | Priority: major feature broken (required validation, key business rules) |
197
- | `@normal` | Priority: degraded experience (UI layout, secondary flows) |
198
- | `@low` | Priority: minor/cosmetic (tooltips, hover states, empty states) |
195
+ | `@high` | Priority: must pass login, auth, core CRUD, primary business flow |
196
+ | `@normal` | Priority: important validation rules, secondary features, search/filter |
197
+ | `@low` | Priority: minor/cosmetic tooltips, hover states, element presence |
199
198
  | `@auto` | Standard scenario, ready for automation |
200
199
  | Any custom | e.g., `@sprint-42`, `@team-payment` — any tag works |
201
200
 
202
201
  **Run filtered:**
203
202
  ```bash
204
203
  npx playwright test --grep "@smoke" # only smoke tests
205
- npx playwright test --grep "@critical" # only critical priority
206
- npx playwright test --grep "@smoke|@critical" # smoke OR critical
204
+ npx playwright test --grep "@high" # only high priority
205
+ npx playwright test --grep "@smoke|@high" # smoke OR high
207
206
  ```
208
207
 
209
208
  ### Serial vs Parallel (test execution mode)
@@ -179,7 +179,7 @@ Skip if `specs/.auth/<role>.json` already exists and a probe navigation reaches
179
179
 
180
180
  ## Phase 1: Smoke Check (catch fundamentals)
181
181
 
182
- Run **up to 5 scenarios** — pick the first `@critical` or `@high` scenarios in the feature file.
182
+ Run **up to 5 scenarios** — pick the first `@high` scenarios in the feature file.
183
183
 
184
184
  ```bash
185
185
  npx playwright test --grep "VP-.*-001|VP-.*-002|VP-.*-003|VP-.*-004|VP-.*-005" --reporter=line
@@ -195,15 +195,15 @@ npx playwright test --grep "VP-.*-001|VP-.*-002|VP-.*-003|VP-.*-004|VP-.*-005" -
195
195
 
196
196
  ---
197
197
 
198
- ## Phase 2: Priority Wave (@critical + @high)
198
+ ## Phase 2: Priority Wave (@high)
199
199
 
200
- Run all `@critical` and `@high` scenarios:
200
+ Run all `@high` scenarios:
201
201
 
202
202
  ```bash
203
- npx playwright test --grep "@critical|@high" --reporter=line
203
+ npx playwright test --grep "@high" --reporter=line
204
204
  ```
205
205
 
206
- If your Playwright config doesn't support tag grep, use scenario name grep from the feature file — collect VP IDs of `@critical` and `@high` scenarios.
206
+ If your Playwright config doesn't support tag grep, use scenario name grep from the feature file — collect VP IDs of `@high` scenarios.
207
207
 
208
208
  **Fix only failures from this wave.** Most shared selectors (buttons, headings, navigation) get fixed here because critical/high scenarios exercise them.
209
209
 
@@ -353,8 +353,8 @@ user detail:
353
353
  |---|---|---|---|
354
354
  | 0. Pre-gen | Playwright MCP snapshot → write selectors.yaml | 1 snapshot | Ask user — skip or retry navigation |
355
355
  | 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` |
356
- | 1. Smoke | First 5 @critical/@high | 2 | Ask user — fundamentals broken |
357
- | 2. Priority | All @critical + @high | 2 | Report failures, continue to Phase 3 |
356
+ | 1. Smoke | First 5 @high | 2 | Ask user — fundamentals broken |
357
+ | 2. Priority | All @high | 2 | Report failures, continue to Phase 3 |
358
358
  | 3. Full | All tests | 1 | Report @low/@normal failures, continue |
359
359
  | 4. Regression | All tests | 0 | Report final results |
360
360
 
@@ -12,7 +12,7 @@ Generate **focused test cases per screen section** using a **tier-based approach
12
12
 
13
13
  | Tier | Priority | What to generate | When |
14
14
  |---|---|---|---|
15
- | **Tier 1** (default) | `@critical` + `@high` | Happy paths, required validation, core business rules, security basics | First run of `create-test` |
15
+ | **Tier 1** (default) | `@high` | Happy paths, required validation, core business rules, security basics | First run of `create-test` |
16
16
  | **Tier 2** (expand) | `@normal` + `@low` | UI presence, optional validation, edge cases, cosmetic checks | User runs `create-test` again with "Add viewpoints" mode |
17
17
 
18
18
  **Round 1 (Tier 1)** targets **~10-15 scenarios per section** — enough to cover critical flows and catch real bugs. This is the default behavior.
@@ -24,7 +24,7 @@ Generate **focused test cases per screen section** using a **tier-based approach
24
24
  When `.feature` already has scenarios, summarize and ask:
25
25
  1. **Add new sections** — append new sections with Tier 2 (`@normal` + `@low`) scenarios, continue numbering
26
26
  2. **Add viewpoints** — expand existing sections with Tier 2 (`@normal` + `@low`) scenarios
27
- 3. **Replace all** — overwrite with fresh Tier 1 (`@critical` + `@high`) generation
27
+ 3. **Replace all** — overwrite with fresh Tier 1 (`@high`) generation
28
28
 
29
29
  For append: read highest `VP-<CAT>-<NNN>`, continue from next number. Never modify existing scenarios.
30
30
 
@@ -102,7 +102,7 @@ Apply `sungen-test-design-techniques` to spec-extracted conditions:
102
102
  Use `sungen-viewpoint` skill for per-pattern checklists across 4 viewpoints: UI/UX, Data & Validate, Logic, Security.
103
103
 
104
104
  **Tier-aware gap filling:**
105
- - **Tier 1 (first run)**: only add `@critical` and `@high` items from the checklists — core security checks (VP-SEC), required field validation (VP-VAL), key state transitions (VP-LOGIC). Skip `@normal`/`@low` items like hover states, empty states, tooltips.
105
+ - **Tier 1 (first run)**: only add `@high` items from the checklists — core security checks (VP-SEC), required field validation (VP-VAL), key state transitions (VP-LOGIC). Skip `@normal`/`@low` items like hover states, empty states, tooltips.
106
106
  - **Tier 2 (expand run)**: add `@normal` + `@low` scenarios — UI presence, optional validation, edge cases, cosmetic checks, keyboard nav, hover effects.
107
107
 
108
108
  **Validation rule**: capture actual error messages from live page or spec.md. Use `User see {{error_var}}` — never assert just "is visible".
@@ -111,24 +111,29 @@ Use `sungen-viewpoint` skill for per-pattern checklists across 4 viewpoints: UI/
111
111
 
112
112
  Every scenario **MUST** have exactly one priority tag. Add it before the scenario line (after `@extend:` if present).
113
113
 
114
+ **Rule: look at what the WHEN step does and what THEN asserts — that determines the tag.**
115
+
114
116
  | Tag | When to use |
115
117
  |---|---|
116
- | `@critical` | System unusable if fails — login/logout, authentication redirect, main create/submit/delete, permission denied |
117
- | `@high` | Major feature broken required field validation, core business rules, data displays correctly, key navigation |
118
- | `@normal` | Degraded experience UI layout/element presence, secondary flows, optional field validation, search/filter |
119
- | `@low` | Minor/cosmetic — tooltips, hover states, empty states, default sort, placeholder text |
118
+ | `@high` | WHEN performs: login/logout, submit happy path, auth-check, primary CRUD action. THEN asserts: success state, redirect, or security gate |
119
+ | `@normal` | WHEN provides invalid/empty input, OR scenario tests search/filter/notification/secondary flow. THEN asserts: error message, secondary feature result |
120
+ | `@low` | THEN only asserts: element visible, text label, placeholder, tooltip, icon, layout. WHEN (if any) is navigation only |
120
121
 
121
122
  ### Auto-assign heuristics
122
123
 
123
- | Viewpoint + Pattern | Default priority |
124
+ | Scenario type (by WHEN + THEN structure) | Tag |
124
125
  |---|---|
125
- | VP-SEC-* (all security scenarios) | `@critical` |
126
- | VP-LOGIC-* with create/submit/delete/login | `@critical` |
127
- | VP-LOGIC-* other state changes | `@high` |
128
- | VP-VAL-* required field / submit empty | `@high` |
129
- | VP-VAL-* format, boundary, optional fields | `@normal` |
130
- | VP-UI-* form fields present, table columns | `@normal` |
131
- | VP-UI-* hover, tooltip, empty state, placeholder | `@low` |
126
+ | Auth: login / logout / protected page redirect | `@high` |
127
+ | CRUD happy path: create / update / delete → success message or redirect | `@high` |
128
+ | Security: unauthenticated access redirected to login | `@high` |
129
+ | Primary business flow step completes successfully | `@high` |
130
+ | Validation: invalid / empty input → error message shown | `@normal` |
131
+ | Boundary / format validation (email, length, range) | `@normal` |
132
+ | Secondary features: search, filter, sort, pagination, notification | `@normal` |
133
+ | State transition not on primary success path (cancel, undo, back) | `@normal` |
134
+ | Element / component presence check (is it visible?) | `@low` |
135
+ | Text content: label, placeholder, tooltip, warning message text | `@low` |
136
+ | Visual / cosmetic: alignment, icon, empty state, hover style | `@low` |
132
137
 
133
138
  **`@steps:` scenarios** do NOT get a priority tag (they are setup blocks, not test cases).
134
139
 
@@ -188,11 +193,11 @@ Serial (default) is best for: CRUD flows, sequential user journeys, UI checks on
188
193
  @cleanup:forms
189
194
  Feature: kudos Screen
190
195
 
191
- @critical
196
+ @high
192
197
  Scenario: Send kudos
193
198
  ...
194
199
 
195
- @critical @no-auth
200
+ @high @no-auth
196
201
  Scenario: Unauthenticated user is redirected
197
202
  ...
198
203
  ```
@@ -218,9 +223,9 @@ Feature: <Screen> Screen
218
223
  When User click [Create] button
219
224
  Then User see [Form] dialog
220
225
 
221
- # --- Section: Create User Form (Tier 1: @critical + @high) ---
226
+ # --- Section: Create User Form (Tier 1: @high) ---
222
227
 
223
- @critical @extend:open_form
228
+ @high @extend:open_form
224
229
  Scenario: VP-LOGIC-001 Submit form with valid data creates record
225
230
  Given User is on [Form] dialog
226
231
  When User fill [Name] field with {{valid_name}}
@@ -233,7 +238,7 @@ Feature: <Screen> Screen
233
238
  When User click [Submit] button
234
239
  Then User see [Name error] message with {{name_required_error}}
235
240
 
236
- # --- Section: User Table (Tier 1: @critical + @high) ---
241
+ # --- Section: User Table (Tier 1: @high) ---
237
242
 
238
243
  @high
239
244
  Scenario: VP-VAL-010 Table displays correct data
@@ -241,7 +246,7 @@ Feature: <Screen> Screen
241
246
  | Name | Email |
242
247
  | {{name_1}} | {{email_1}} |
243
248
 
244
- @critical
249
+ @high
245
250
  Scenario: VP-SEC-010 Unauthorized user cannot access page
246
251
  Given User is not logged in
247
252
  When User navigate to [Screen] page
@@ -317,14 +322,14 @@ Feature: Award Submission Flow
317
322
  Background:
318
323
  Given User is on [Login] page
319
324
 
320
- @critical
325
+ @high
321
326
  Scenario: User login successfully
322
327
  When User fill [Login:Email] field with {{login.email}}
323
328
  And User fill [Login:Password] field with {{login.password}}
324
329
  And User click [Login:Submit] button
325
330
  Then User see [Dashboard] page
326
331
 
327
- @critical
332
+ @high
328
333
  Scenario: User navigates to awards and submits
329
334
  Given User is on [Awards] page
330
335
  When User fill [Awards:Nominee] field with {{submission.nominee}}