@sun-asterisk/sungen 2.4.1 → 2.4.2

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/cli/index.js CHANGED
@@ -16,7 +16,7 @@ async function main() {
16
16
  program
17
17
  .name('sungen')
18
18
  .description('Deterministic E2E Test Compiler — Gherkin + Selectors → Playwright')
19
- .version('2.4.1');
19
+ .version('2.4.2');
20
20
  // Global options
21
21
  program
22
22
  .option('-v, --verbose', 'Enable verbose logging');
@@ -247,3 +247,39 @@ Options: `nth` `exact` `scope` `match` `variant` `frame` `contenteditable` `colu
247
247
  | Missing `is` for state | `with {{text}} hidden` | `with {{text}} is hidden` |
248
248
  | State as value | `with {{disabled}}` | `is disabled` |
249
249
  | Missing target type | `fill [email] with {{v}}` | `fill [email] field with {{v}}` |
250
+ | Using Background | `Background: Given User is on...` | Use `@steps` + `@extend` instead |
251
+ | `is on` after When | `When ... And User is on [X] dialog` | `And User see [X] dialog` or separate Given |
252
+
253
+ ## Background vs @steps/@extend
254
+
255
+ **Do NOT use `Background:` block.** Use `@steps` + `@extend` instead.
256
+
257
+ **Why:**
258
+ - `Background` runs before EVERY scenario but cannot set dialog/frame scope correctly
259
+ - `Background` with `When` + `And User is on [X] dialog` creates keyword mismatch (`is on` = Given, not When)
260
+ - `@steps` + `@extend` gives explicit control: base steps run Given→When, extending scenario starts with `Given User is on [X] dialog` (correct scope setup)
261
+
262
+ **Wrong:**
263
+ ```gherkin
264
+ Background:
265
+ Given User is on [Kudos] page
266
+ When User click [Open] button
267
+ And User is on [Modal] dialog ← keyword mismatch
268
+
269
+ Scenario: VP-UI-001 Title visible
270
+ Then User see [Title] heading
271
+ ```
272
+
273
+ **Correct:**
274
+ ```gherkin
275
+ @steps:open_modal
276
+ Scenario: Open modal
277
+ Given User is on [Kudos] page
278
+ When User click [Open] button
279
+ Then User see [Modal] dialog
280
+
281
+ @extend:open_modal
282
+ Scenario: VP-UI-001 Title visible
283
+ Given User is on [Modal] dialog
284
+ Then User see [Title] heading
285
+ ```
@@ -68,25 +68,38 @@ And User wait for [Page Title] heading is visible
68
68
 
69
69
  **Feature file** — `qa/screens/<screen>/features/<screen>.feature`
70
70
 
71
+ **Never use `Background:`.** Use `@steps` + `@extend` for shared setup (see `sungen-gherkin-syntax` skill).
72
+
71
73
  ```gherkin
72
74
  @auth:role
73
75
  Feature: <Screen> Screen
74
76
 
77
+ # Shared setup — use @steps, not Background
78
+ @steps:open_form
79
+ Scenario: Open form
80
+ Given User is on [Screen] page
81
+ And User wait for [Screen Title] heading is visible
82
+ When User click [Create] button
83
+ Then User see [Form] dialog
84
+
75
85
  # ============================================================
76
86
  # Section: Create User Form
77
87
  # ============================================================
78
88
 
79
89
  # --- UI/UX ---
80
90
 
91
+ @extend:open_form
81
92
  Scenario: VP-UI-001 Form displays all fields with correct defaults
82
- Given User is on [Create User] page
93
+ Given User is on [Form] dialog
83
94
  Then User see [Name] field
84
95
  And User see [Email] field
85
96
  And User see [Submit] button is disabled
86
97
 
87
98
  # --- Validation ---
88
99
 
100
+ @extend:open_form
89
101
  Scenario: VP-VAL-001 Submit with all empty fields shows errors
102
+ Given User is on [Form] dialog
90
103
  When User click [Submit] button
91
104
  Then User see [Name error] message with {{name_required_error}}
92
105
 
@@ -1,6 +1,6 @@
1
1
  ---
2
2
  name: sungen-gherkin-syntax
3
- description: 'Sungen Gherkin patterns, selector types, and YAML key rules. Use this when writing or editing .feature, selectors.yaml, or test-data.yaml files.'
3
+ description: 'Sungen Gherkin patterns, selector types, and YAML key rules. Auto-loaded when writing .feature, selectors.yaml, or test-data.yaml.'
4
4
  user-invocable: false
5
5
  ---
6
6
 
@@ -247,3 +247,39 @@ Options: `nth` `exact` `scope` `match` `variant` `frame` `contenteditable` `colu
247
247
  | Missing `is` for state | `with {{text}} hidden` | `with {{text}} is hidden` |
248
248
  | State as value | `with {{disabled}}` | `is disabled` |
249
249
  | Missing target type | `fill [email] with {{v}}` | `fill [email] field with {{v}}` |
250
+ | Using Background | `Background: Given User is on...` | Use `@steps` + `@extend` instead |
251
+ | `is on` after When | `When ... And User is on [X] dialog` | `And User see [X] dialog` or separate Given |
252
+
253
+ ## Background vs @steps/@extend
254
+
255
+ **Do NOT use `Background:` block.** Use `@steps` + `@extend` instead.
256
+
257
+ **Why:**
258
+ - `Background` runs before EVERY scenario but cannot set dialog/frame scope correctly
259
+ - `Background` with `When` + `And User is on [X] dialog` creates keyword mismatch (`is on` = Given, not When)
260
+ - `@steps` + `@extend` gives explicit control: base steps run Given→When, extending scenario starts with `Given User is on [X] dialog` (correct scope setup)
261
+
262
+ **Wrong:**
263
+ ```gherkin
264
+ Background:
265
+ Given User is on [Kudos] page
266
+ When User click [Open] button
267
+ And User is on [Modal] dialog ← keyword mismatch
268
+
269
+ Scenario: VP-UI-001 Title visible
270
+ Then User see [Title] heading
271
+ ```
272
+
273
+ **Correct:**
274
+ ```gherkin
275
+ @steps:open_modal
276
+ Scenario: Open modal
277
+ Given User is on [Kudos] page
278
+ When User click [Open] button
279
+ Then User see [Modal] dialog
280
+
281
+ @extend:open_modal
282
+ Scenario: VP-UI-001 Title visible
283
+ Given User is on [Modal] dialog
284
+ Then User see [Title] heading
285
+ ```
@@ -68,25 +68,38 @@ And User wait for [Page Title] heading is visible
68
68
 
69
69
  **Feature file** — `qa/screens/<screen>/features/<screen>.feature`
70
70
 
71
+ **Never use `Background:`.** Use `@steps` + `@extend` for shared setup (see `sungen-gherkin-syntax` skill).
72
+
71
73
  ```gherkin
72
74
  @auth:role
73
75
  Feature: <Screen> Screen
74
76
 
77
+ # Shared setup — use @steps, not Background
78
+ @steps:open_form
79
+ Scenario: Open form
80
+ Given User is on [Screen] page
81
+ And User wait for [Screen Title] heading is visible
82
+ When User click [Create] button
83
+ Then User see [Form] dialog
84
+
75
85
  # ============================================================
76
86
  # Section: Create User Form
77
87
  # ============================================================
78
88
 
79
89
  # --- UI/UX ---
80
90
 
91
+ @extend:open_form
81
92
  Scenario: VP-UI-001 Form displays all fields with correct defaults
82
- Given User is on [Create User] page
93
+ Given User is on [Form] dialog
83
94
  Then User see [Name] field
84
95
  And User see [Email] field
85
96
  And User see [Submit] button is disabled
86
97
 
87
98
  # --- Validation ---
88
99
 
100
+ @extend:open_form
89
101
  Scenario: VP-VAL-001 Submit with all empty fields shows errors
102
+ Given User is on [Form] dialog
90
103
  When User click [Submit] button
91
104
  Then User see [Name error] message with {{name_required_error}}
92
105
 
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@sun-asterisk/sungen",
3
- "version": "2.4.1",
3
+ "version": "2.4.2",
4
4
  "description": "Deterministic E2E Test Compiler - Gherkin + Selectors → Playwright tests",
5
5
  "main": "dist/index.js",
6
6
  "types": "dist/index.d.ts",
package/src/cli/index.ts CHANGED
@@ -17,7 +17,7 @@ async function main() {
17
17
  program
18
18
  .name('sungen')
19
19
  .description('Deterministic E2E Test Compiler — Gherkin + Selectors → Playwright')
20
- .version('2.4.1');
20
+ .version('2.4.2');
21
21
 
22
22
  // Global options
23
23
  program
@@ -247,3 +247,39 @@ Options: `nth` `exact` `scope` `match` `variant` `frame` `contenteditable` `colu
247
247
  | Missing `is` for state | `with {{text}} hidden` | `with {{text}} is hidden` |
248
248
  | State as value | `with {{disabled}}` | `is disabled` |
249
249
  | Missing target type | `fill [email] with {{v}}` | `fill [email] field with {{v}}` |
250
+ | Using Background | `Background: Given User is on...` | Use `@steps` + `@extend` instead |
251
+ | `is on` after When | `When ... And User is on [X] dialog` | `And User see [X] dialog` or separate Given |
252
+
253
+ ## Background vs @steps/@extend
254
+
255
+ **Do NOT use `Background:` block.** Use `@steps` + `@extend` instead.
256
+
257
+ **Why:**
258
+ - `Background` runs before EVERY scenario but cannot set dialog/frame scope correctly
259
+ - `Background` with `When` + `And User is on [X] dialog` creates keyword mismatch (`is on` = Given, not When)
260
+ - `@steps` + `@extend` gives explicit control: base steps run Given→When, extending scenario starts with `Given User is on [X] dialog` (correct scope setup)
261
+
262
+ **Wrong:**
263
+ ```gherkin
264
+ Background:
265
+ Given User is on [Kudos] page
266
+ When User click [Open] button
267
+ And User is on [Modal] dialog ← keyword mismatch
268
+
269
+ Scenario: VP-UI-001 Title visible
270
+ Then User see [Title] heading
271
+ ```
272
+
273
+ **Correct:**
274
+ ```gherkin
275
+ @steps:open_modal
276
+ Scenario: Open modal
277
+ Given User is on [Kudos] page
278
+ When User click [Open] button
279
+ Then User see [Modal] dialog
280
+
281
+ @extend:open_modal
282
+ Scenario: VP-UI-001 Title visible
283
+ Given User is on [Modal] dialog
284
+ Then User see [Title] heading
285
+ ```
@@ -68,25 +68,38 @@ And User wait for [Page Title] heading is visible
68
68
 
69
69
  **Feature file** — `qa/screens/<screen>/features/<screen>.feature`
70
70
 
71
+ **Never use `Background:`.** Use `@steps` + `@extend` for shared setup (see `sungen-gherkin-syntax` skill).
72
+
71
73
  ```gherkin
72
74
  @auth:role
73
75
  Feature: <Screen> Screen
74
76
 
77
+ # Shared setup — use @steps, not Background
78
+ @steps:open_form
79
+ Scenario: Open form
80
+ Given User is on [Screen] page
81
+ And User wait for [Screen Title] heading is visible
82
+ When User click [Create] button
83
+ Then User see [Form] dialog
84
+
75
85
  # ============================================================
76
86
  # Section: Create User Form
77
87
  # ============================================================
78
88
 
79
89
  # --- UI/UX ---
80
90
 
91
+ @extend:open_form
81
92
  Scenario: VP-UI-001 Form displays all fields with correct defaults
82
- Given User is on [Create User] page
93
+ Given User is on [Form] dialog
83
94
  Then User see [Name] field
84
95
  And User see [Email] field
85
96
  And User see [Submit] button is disabled
86
97
 
87
98
  # --- Validation ---
88
99
 
100
+ @extend:open_form
89
101
  Scenario: VP-VAL-001 Submit with all empty fields shows errors
102
+ Given User is on [Form] dialog
90
103
  When User click [Submit] button
91
104
  Then User see [Name error] message with {{name_required_error}}
92
105
 
@@ -1,6 +1,6 @@
1
1
  ---
2
2
  name: sungen-gherkin-syntax
3
- description: 'Sungen Gherkin patterns, selector types, and YAML key rules. Use this when writing or editing .feature, selectors.yaml, or test-data.yaml files.'
3
+ description: 'Sungen Gherkin patterns, selector types, and YAML key rules. Auto-loaded when writing .feature, selectors.yaml, or test-data.yaml.'
4
4
  user-invocable: false
5
5
  ---
6
6
 
@@ -247,3 +247,39 @@ Options: `nth` `exact` `scope` `match` `variant` `frame` `contenteditable` `colu
247
247
  | Missing `is` for state | `with {{text}} hidden` | `with {{text}} is hidden` |
248
248
  | State as value | `with {{disabled}}` | `is disabled` |
249
249
  | Missing target type | `fill [email] with {{v}}` | `fill [email] field with {{v}}` |
250
+ | Using Background | `Background: Given User is on...` | Use `@steps` + `@extend` instead |
251
+ | `is on` after When | `When ... And User is on [X] dialog` | `And User see [X] dialog` or separate Given |
252
+
253
+ ## Background vs @steps/@extend
254
+
255
+ **Do NOT use `Background:` block.** Use `@steps` + `@extend` instead.
256
+
257
+ **Why:**
258
+ - `Background` runs before EVERY scenario but cannot set dialog/frame scope correctly
259
+ - `Background` with `When` + `And User is on [X] dialog` creates keyword mismatch (`is on` = Given, not When)
260
+ - `@steps` + `@extend` gives explicit control: base steps run Given→When, extending scenario starts with `Given User is on [X] dialog` (correct scope setup)
261
+
262
+ **Wrong:**
263
+ ```gherkin
264
+ Background:
265
+ Given User is on [Kudos] page
266
+ When User click [Open] button
267
+ And User is on [Modal] dialog ← keyword mismatch
268
+
269
+ Scenario: VP-UI-001 Title visible
270
+ Then User see [Title] heading
271
+ ```
272
+
273
+ **Correct:**
274
+ ```gherkin
275
+ @steps:open_modal
276
+ Scenario: Open modal
277
+ Given User is on [Kudos] page
278
+ When User click [Open] button
279
+ Then User see [Modal] dialog
280
+
281
+ @extend:open_modal
282
+ Scenario: VP-UI-001 Title visible
283
+ Given User is on [Modal] dialog
284
+ Then User see [Title] heading
285
+ ```
@@ -68,25 +68,38 @@ And User wait for [Page Title] heading is visible
68
68
 
69
69
  **Feature file** — `qa/screens/<screen>/features/<screen>.feature`
70
70
 
71
+ **Never use `Background:`.** Use `@steps` + `@extend` for shared setup (see `sungen-gherkin-syntax` skill).
72
+
71
73
  ```gherkin
72
74
  @auth:role
73
75
  Feature: <Screen> Screen
74
76
 
77
+ # Shared setup — use @steps, not Background
78
+ @steps:open_form
79
+ Scenario: Open form
80
+ Given User is on [Screen] page
81
+ And User wait for [Screen Title] heading is visible
82
+ When User click [Create] button
83
+ Then User see [Form] dialog
84
+
75
85
  # ============================================================
76
86
  # Section: Create User Form
77
87
  # ============================================================
78
88
 
79
89
  # --- UI/UX ---
80
90
 
91
+ @extend:open_form
81
92
  Scenario: VP-UI-001 Form displays all fields with correct defaults
82
- Given User is on [Create User] page
93
+ Given User is on [Form] dialog
83
94
  Then User see [Name] field
84
95
  And User see [Email] field
85
96
  And User see [Submit] button is disabled
86
97
 
87
98
  # --- Validation ---
88
99
 
100
+ @extend:open_form
89
101
  Scenario: VP-VAL-001 Submit with all empty fields shows errors
102
+ Given User is on [Form] dialog
90
103
  When User click [Submit] button
91
104
  Then User see [Name error] message with {{name_required_error}}
92
105