@sun-asterisk/sungen 2.4.0 → 2.4.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.
Files changed (45) hide show
  1. package/dist/cli/index.js +1 -1
  2. package/dist/generators/gherkin-parser/index.d.ts +8 -0
  3. package/dist/generators/gherkin-parser/index.d.ts.map +1 -1
  4. package/dist/generators/gherkin-parser/index.js +12 -0
  5. package/dist/generators/gherkin-parser/index.js.map +1 -1
  6. package/dist/generators/test-generator/adapters/playwright/templates/steps/assertions/table-match-data.hbs +15 -0
  7. package/dist/generators/test-generator/patterns/index.d.ts.map +1 -1
  8. package/dist/generators/test-generator/patterns/index.js +2 -1
  9. package/dist/generators/test-generator/patterns/index.js.map +1 -1
  10. package/dist/generators/test-generator/patterns/table-patterns.d.ts +4 -1
  11. package/dist/generators/test-generator/patterns/table-patterns.d.ts.map +1 -1
  12. package/dist/generators/test-generator/patterns/table-patterns.js +49 -1
  13. package/dist/generators/test-generator/patterns/table-patterns.js.map +1 -1
  14. package/dist/orchestrator/templates/ai-instructions/claude-cmd-run-test.md +19 -16
  15. package/dist/orchestrator/templates/ai-instructions/claude-skill-error-mapping.md +5 -5
  16. package/dist/orchestrator/templates/ai-instructions/claude-skill-gherkin-syntax.md +8 -1
  17. package/dist/orchestrator/templates/ai-instructions/claude-skill-selector-fix.md +46 -61
  18. package/dist/orchestrator/templates/ai-instructions/claude-skill-tc-generation.md +20 -0
  19. package/dist/orchestrator/templates/ai-instructions/claude-skill-viewpoint.md +3 -1
  20. package/dist/orchestrator/templates/ai-instructions/copilot-cmd-run-test.md +19 -16
  21. package/dist/orchestrator/templates/ai-instructions/github-skill-sungen-error-mapping.md +5 -5
  22. package/dist/orchestrator/templates/ai-instructions/github-skill-sungen-gherkin-syntax.md +8 -1
  23. package/dist/orchestrator/templates/ai-instructions/github-skill-sungen-selector-fix.md +46 -61
  24. package/dist/orchestrator/templates/ai-instructions/github-skill-sungen-tc-generation.md +20 -0
  25. package/dist/orchestrator/templates/ai-instructions/github-skill-sungen-viewpoint.md +3 -1
  26. package/dist/orchestrator/templates/readme.md +82 -19
  27. package/package.json +1 -1
  28. package/src/cli/index.ts +1 -1
  29. package/src/generators/gherkin-parser/index.ts +23 -0
  30. package/src/generators/test-generator/adapters/playwright/templates/steps/assertions/table-match-data.hbs +15 -0
  31. package/src/generators/test-generator/patterns/index.ts +2 -1
  32. package/src/generators/test-generator/patterns/table-patterns.ts +58 -1
  33. package/src/orchestrator/templates/ai-instructions/claude-cmd-run-test.md +19 -16
  34. package/src/orchestrator/templates/ai-instructions/claude-skill-error-mapping.md +5 -5
  35. package/src/orchestrator/templates/ai-instructions/claude-skill-gherkin-syntax.md +8 -1
  36. package/src/orchestrator/templates/ai-instructions/claude-skill-selector-fix.md +46 -61
  37. package/src/orchestrator/templates/ai-instructions/claude-skill-tc-generation.md +20 -0
  38. package/src/orchestrator/templates/ai-instructions/claude-skill-viewpoint.md +3 -1
  39. package/src/orchestrator/templates/ai-instructions/copilot-cmd-run-test.md +19 -16
  40. package/src/orchestrator/templates/ai-instructions/github-skill-sungen-error-mapping.md +5 -5
  41. package/src/orchestrator/templates/ai-instructions/github-skill-sungen-gherkin-syntax.md +8 -1
  42. package/src/orchestrator/templates/ai-instructions/github-skill-sungen-selector-fix.md +46 -61
  43. package/src/orchestrator/templates/ai-instructions/github-skill-sungen-tc-generation.md +20 -0
  44. package/src/orchestrator/templates/ai-instructions/github-skill-sungen-viewpoint.md +3 -1
  45. package/src/orchestrator/templates/readme.md +82 -19
@@ -1,6 +1,6 @@
1
1
  # Sungen Test Automation
2
2
 
3
- This project uses [Sungen v2](https://github.com/sun-asterisk/sungen) — a deterministic E2E test compiler.
3
+ This project uses [Sungen v2.4.1](https://github.com/sun-asterisk/sungen) — a deterministic E2E test compiler.
4
4
 
5
5
  ## How it works
6
6
 
@@ -37,16 +37,16 @@ sungen generate → compiles Gherkin + selectors + data → Playwright .spec.ts
37
37
  ## Workflow
38
38
 
39
39
  ```
40
- Step 1 Step 2 Step 3
41
- ┌──────────┐ ┌──────────┐ ┌──────────┐
42
- │ /add- │────────▶│ /create-test │────────▶│ /make-
43
- │ screen │ │ │ │ test │
44
- └──────────┘ └──────────┘ └──────────┘
45
- Scaffold Pick sections Generate
46
- directories → design TCs selectors
47
- → generate → compile
48
- .feature + → run tests
49
- test-data → auto-fix
40
+ Step 1 Step 2 Step 3 Step 4
41
+ ┌──────────┐ ┌──────────┐ ┌──────────┐ ┌──────────┐
42
+ │ /add- │────────▶│ /create- │────────▶│ /run- │────────▶│ /review
43
+ │ screen │ │ test │ │ test │ │ │
44
+ └──────────┘ └──────────┘ └──────────┘ └──────────┘
45
+ Scaffold Pick sections Generate Review
46
+ directories → design TCs selectors syntax &
47
+ → generate → compile coverage
48
+ .feature + → run tests → score &
49
+ test-data → auto-fix auto-fix
50
50
  ```
51
51
 
52
52
  Use AI commands (Claude Code or GitHub Copilot) to drive the workflow:
@@ -84,6 +84,17 @@ AI acts as a **Senior Developer**:
84
84
  3. Compiles Gherkin → Playwright `.spec.ts`
85
85
  4. Runs tests, auto-fixes selectors on failure (up to 5 attempts)
86
86
 
87
+ ### Step 4: Review test cases
88
+
89
+ | Claude Code | GitHub Copilot (VS Code) |
90
+ |---|---|
91
+ | `/sungen:review login` | `/sungen-review login` |
92
+
93
+ AI acts as a **Senior QA Reviewer**:
94
+ 1. Validates syntax against all Gherkin rules
95
+ 2. Scores coverage across viewpoint categories
96
+ 3. Can auto-fix issues when `--fix` flag is used
97
+
87
98
  ### Auth setup
88
99
 
89
100
  If any page requires authentication, the AI will ask you to **log in manually via the MCP browser** during Step 2 or Step 3. No separate auth command needed.
@@ -123,38 +134,85 @@ Add to `.vscode/settings.json` to auto-load Gherkin syntax when editing `.featur
123
134
  ### Syntax
124
135
 
125
136
  ```
126
- User <action> [<Target>] <type> with {{<Value>}}
137
+ [Keyword] User <action> [Target] <type> <in [Parent] parentType> <with {{value}}> <is state>
127
138
  ```
128
139
 
129
140
  - `[Target]` → selector reference → lookup in `selectors/*.yaml`
130
- - `{{Value}}` → test data reference → lookup in `test-data/*.yaml`
131
- - `<type>` → element type: button, link, field, heading, text, etc.
141
+ - `{{value}}` → test data reference → lookup in `test-data/*.yaml`
142
+ - `<type>` → element type: button, link, field, heading, text, table, etc.
143
+ - `in [Parent] parentType` → optional parent scope for disambiguation
132
144
 
133
145
  ### Key Patterns
134
146
 
135
147
  | Pattern | Example |
136
148
  |---|---|
137
149
  | Navigate | `User is on [login] page` |
150
+ | Navigate with data | `User is on [user detail] page with {{user_id}}` |
138
151
  | Click | `User click [Submit] button` |
139
152
  | Fill | `User fill [Email] field with {{email}}` |
140
- | Assert visible | `User see [Welcome] heading is visible` |
153
+ | Select | `User select [Country] dropdown with {{country}}` |
154
+ | Check | `User check [Remember me] checkbox` |
155
+ | Upload | `User fill [Avatar] uploader with {{file}}` |
156
+ | Clear | `User clear [Search] field` |
157
+ | Hover | `User hover [Info] icon` |
158
+ | Keyboard | `User press Enter on [Search] field` |
159
+ | Scroll | `User scroll to [Footer] section` |
160
+ | Assert visible | `User see [Welcome] heading` |
161
+ | Assert hidden | `User see [Error] message is hidden` |
141
162
  | Assert text | `User see [Title] heading with {{title}}` |
163
+ | Assert value | `User see [Email] field with {{email}}` |
142
164
  | Assert state | `User see [Submit] button is disabled` |
143
- | Wait for | `User wait for [Modal] dialog is visible` |
165
+ | Contains text | `User see [Message] text contains {{partial}}` |
166
+ | Wait for | `User wait for [Modal] dialog` |
144
167
  | Table row | `User see [Username] row in [Users] table with {{name}}` |
168
+ | Table cell | `User see [Status] column with {{status}}` (row scoped) |
145
169
  | Table column | `User see [Email] column in [Users] table` |
170
+ | Table count | `User see [Users] table with {{count}}` |
171
+ | Table empty | `User see [Users] table is empty` |
172
+ | Table action | `User click [Edit] button in [Users] table with {{name}}` |
173
+ | Table match | `User see [Users] table match data:` + inline DataTable |
174
+ | Alert | `User click [OK] alert` |
175
+ | Frame | `User switch to [Payment] frame` |
176
+
177
+ ### Table Match Data
178
+
179
+ Verify multiple rows exist using filter-based matching (resilient to data changes and row reordering):
180
+
181
+ ```gherkin
182
+ Then User see [Users] table match data:
183
+ | ID | Name | Status |
184
+ | {{id_1}} | {{name_1}} | {{status_1}} |
185
+ | {{id_2}} | {{name_2}} | {{status_2}} |
186
+ ```
187
+
188
+ First row = headers, remaining rows = expected data. For single-row verification + actions, use row scope patterns instead.
146
189
 
147
- States: `hidden` `visible` `disabled` `enabled` `checked` `unchecked` `focused` `empty` `loading` `selected`
190
+ ### States
191
+
192
+ `hidden` `visible` `disabled` `enabled` `checked` `unchecked` `focused` `empty` `loading` `selected` `sorted ascending` `sorted descending`
193
+
194
+ ### Element Types
195
+
196
+ | Group | Types |
197
+ |---|---|
198
+ | **Context** | `page` `dialog` `modal` `drawer` `tab` `alert` `overlay` `step` |
199
+ | **Input** | `field` `textarea` `search` `dropdown` `option` `checkbox` `radio` `toggle` `uploader` `slider` `date-picker` |
200
+ | **Trigger** | `button` `link` `icon` `menuitem` `tag` |
201
+ | **Data** | `table` `row` `column` `cell` `list` `item` `card` `section` |
202
+ | **Feedback** | `message` `header` `label` `text` `tooltip` `badge` `breadcrumb` `image` |
203
+ | **System** | `key` `frame` `spinner` `progressbar` |
148
204
 
149
205
  ### Tags
150
206
 
151
207
  | Tag | Purpose |
152
208
  |---|---|
209
+ | `@auto` | Standard scenario, ready for automation |
210
+ | `@manual` | Skip scenario in generation |
211
+ | `@smoke` / `@regression` | Test suite grouping |
153
212
  | `@auth:role` | Use Playwright storage state for auth |
154
213
  | `@no-auth` | Disable inherited auth for this scenario |
155
214
  | `@steps:name` | Define reusable step group |
156
215
  | `@extend:name` | Inherit steps from another scenario |
157
- | `@manual` | Skip scenario in generation |
158
216
 
159
217
  ### YAML Selector Keys
160
218
 
@@ -167,10 +225,15 @@ Keys are **lowercase with spaces**, Unicode preserved:
167
225
 
168
226
  ```yaml
169
227
  search:
170
- type: 'placeholder' # testid, role, placeholder, label, text, locator, page
228
+ type: 'placeholder' # testid, role, placeholder, label, text, locator, page, upload, frame
171
229
  value: 'Search users' # placeholder text, role name, CSS selector, etc.
172
230
  name: 'Search' # accessible name (for role type)
173
231
  nth: 0 # element index (for multiple matches)
232
+ exact: true # exact name matching
233
+ columns: # table column config (for table type)
234
+ status:
235
+ index: 2
236
+ header: Status
174
237
  ```
175
238
 
176
239
  Priority: `data-testid` > `role+name` > `placeholder` > `label` > `text` > `CSS locator`