@sun-asterisk/sungen 2.4.2 → 2.4.5

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 (73) hide show
  1. package/dist/cli/commands/add.d.ts.map +1 -1
  2. package/dist/cli/commands/add.js +7 -1
  3. package/dist/cli/commands/add.js.map +1 -1
  4. package/dist/cli/index.js +1 -1
  5. package/dist/generators/test-generator/code-generator.d.ts.map +1 -1
  6. package/dist/generators/test-generator/code-generator.js +27 -4
  7. package/dist/generators/test-generator/code-generator.js.map +1 -1
  8. package/dist/orchestrator/ai-rules-updater.d.ts.map +1 -1
  9. package/dist/orchestrator/ai-rules-updater.js +2 -0
  10. package/dist/orchestrator/ai-rules-updater.js.map +1 -1
  11. package/dist/orchestrator/project-initializer.d.ts +4 -0
  12. package/dist/orchestrator/project-initializer.d.ts.map +1 -1
  13. package/dist/orchestrator/project-initializer.js +20 -3
  14. package/dist/orchestrator/project-initializer.js.map +1 -1
  15. package/dist/orchestrator/screen-manager.d.ts +9 -0
  16. package/dist/orchestrator/screen-manager.d.ts.map +1 -1
  17. package/dist/orchestrator/screen-manager.js +120 -0
  18. package/dist/orchestrator/screen-manager.js.map +1 -1
  19. package/dist/orchestrator/templates/ai-instructions/claude-cmd-add-screen.md +22 -19
  20. package/dist/orchestrator/templates/ai-instructions/claude-cmd-create-test.md +10 -2
  21. package/dist/orchestrator/templates/ai-instructions/claude-cmd-review.md +5 -0
  22. package/dist/orchestrator/templates/ai-instructions/claude-cmd-run-test.md +25 -16
  23. package/dist/orchestrator/templates/ai-instructions/claude-config.md +4 -97
  24. package/dist/orchestrator/templates/ai-instructions/claude-skill-gherkin-syntax.md +48 -122
  25. package/dist/orchestrator/templates/ai-instructions/claude-skill-selector-fix.md +172 -25
  26. package/dist/orchestrator/templates/ai-instructions/claude-skill-tc-generation.md +62 -34
  27. package/dist/orchestrator/templates/ai-instructions/claude-skill-tc-review.md +19 -14
  28. package/dist/orchestrator/templates/ai-instructions/claude-skill-test-design-techniques.md +99 -0
  29. package/dist/orchestrator/templates/ai-instructions/claude-skill-viewpoint.md +151 -64
  30. package/dist/orchestrator/templates/ai-instructions/copilot-cmd-add-screen.md +21 -15
  31. package/dist/orchestrator/templates/ai-instructions/copilot-cmd-create-test.md +10 -3
  32. package/dist/orchestrator/templates/ai-instructions/copilot-cmd-review.md +5 -0
  33. package/dist/orchestrator/templates/ai-instructions/copilot-cmd-run-test.md +24 -15
  34. package/dist/orchestrator/templates/ai-instructions/copilot-config.md +4 -97
  35. package/dist/orchestrator/templates/ai-instructions/github-skill-sungen-gherkin-syntax.md +48 -122
  36. package/dist/orchestrator/templates/ai-instructions/github-skill-sungen-selector-fix.md +172 -25
  37. package/dist/orchestrator/templates/ai-instructions/github-skill-sungen-tc-generation.md +63 -29
  38. package/dist/orchestrator/templates/ai-instructions/github-skill-sungen-tc-review.md +19 -14
  39. package/dist/orchestrator/templates/ai-instructions/github-skill-sungen-test-design-techniques.md +99 -0
  40. package/dist/orchestrator/templates/ai-instructions/github-skill-sungen-viewpoint.md +151 -64
  41. package/dist/orchestrator/templates/readme.md +1 -1
  42. package/dist/orchestrator/templates/tsconfig.json +21 -0
  43. package/package.json +1 -1
  44. package/src/cli/commands/add.ts +8 -1
  45. package/src/cli/index.ts +1 -1
  46. package/src/generators/test-generator/code-generator.ts +29 -4
  47. package/src/orchestrator/ai-rules-updater.ts +2 -0
  48. package/src/orchestrator/project-initializer.ts +24 -3
  49. package/src/orchestrator/screen-manager.ts +125 -0
  50. package/src/orchestrator/templates/ai-instructions/claude-cmd-add-screen.md +22 -19
  51. package/src/orchestrator/templates/ai-instructions/claude-cmd-create-test.md +10 -2
  52. package/src/orchestrator/templates/ai-instructions/claude-cmd-review.md +5 -0
  53. package/src/orchestrator/templates/ai-instructions/claude-cmd-run-test.md +25 -16
  54. package/src/orchestrator/templates/ai-instructions/claude-config.md +4 -97
  55. package/src/orchestrator/templates/ai-instructions/claude-skill-gherkin-syntax.md +48 -122
  56. package/src/orchestrator/templates/ai-instructions/claude-skill-selector-fix.md +172 -25
  57. package/src/orchestrator/templates/ai-instructions/claude-skill-tc-generation.md +62 -34
  58. package/src/orchestrator/templates/ai-instructions/claude-skill-tc-review.md +19 -14
  59. package/src/orchestrator/templates/ai-instructions/claude-skill-test-design-techniques.md +99 -0
  60. package/src/orchestrator/templates/ai-instructions/claude-skill-viewpoint.md +151 -64
  61. package/src/orchestrator/templates/ai-instructions/copilot-cmd-add-screen.md +21 -15
  62. package/src/orchestrator/templates/ai-instructions/copilot-cmd-create-test.md +10 -3
  63. package/src/orchestrator/templates/ai-instructions/copilot-cmd-review.md +5 -0
  64. package/src/orchestrator/templates/ai-instructions/copilot-cmd-run-test.md +24 -15
  65. package/src/orchestrator/templates/ai-instructions/copilot-config.md +4 -97
  66. package/src/orchestrator/templates/ai-instructions/github-skill-sungen-gherkin-syntax.md +48 -122
  67. package/src/orchestrator/templates/ai-instructions/github-skill-sungen-selector-fix.md +172 -25
  68. package/src/orchestrator/templates/ai-instructions/github-skill-sungen-tc-generation.md +63 -29
  69. package/src/orchestrator/templates/ai-instructions/github-skill-sungen-tc-review.md +19 -14
  70. package/src/orchestrator/templates/ai-instructions/github-skill-sungen-test-design-techniques.md +99 -0
  71. package/src/orchestrator/templates/ai-instructions/github-skill-sungen-viewpoint.md +151 -64
  72. package/src/orchestrator/templates/readme.md +1 -1
  73. package/src/orchestrator/templates/tsconfig.json +21 -0
@@ -1,6 +1,6 @@
1
1
  ---
2
2
  name: sungen-viewpoint
3
- description: '7 UI patterns x 4 viewpoints — structured checklist for test case generation and review. Auto-loaded by make-tc and review commands.'
3
+ description: '10 UI patterns x 4 viewpoints — structured checklist for test case generation and review. Auto-loaded by create-test and review commands.'
4
4
  user-invocable: false
5
5
  ---
6
6
 
@@ -13,148 +13,234 @@ user-invocable: false
13
13
  | **Logic** | Business rules, interactions, state changes | VP-LOGIC |
14
14
  | **Security** | Auth, injection, permissions | VP-SEC |
15
15
 
16
+ ## Shared Checks (apply across all patterns)
17
+
18
+ These appear in multiple patterns — test once per screen, not per pattern:
19
+
20
+ | Check | ER |
21
+ |---|---|
22
+ | **Loading State** | Spinner/skeleton shown, UI interaction locked during fetch |
23
+ | **Empty State** | Clear message when no data, layout intact |
24
+ | **XSS/Injection** | Malicious input sanitized to plain text, never executed |
25
+ | **URL Manipulation** | Invalid URL params fallback to defaults, no server crash |
26
+
16
27
  ---
17
28
 
18
- ## 1. Form & Inputs
29
+ ## GROUP 1: DATA ENTRY
30
+
31
+ ### 1. Form & Inputs
19
32
 
20
33
  **UI/UX**
21
- - Field States: disabled/readonly fields are dimmed and locked
22
- - Button States: Submit disabled when invalid, enabled when valid
23
- - Loading States: Spinner + block UI while waiting for server
24
- - Keyboard Navigation: Tab order correct, Enter submits form
34
+ - Field States: disabled/readonly fields dimmed and locked, no interaction allowed
35
+ - Button States: Submit disabled when form invalid, auto-enabled when valid
36
+ - Keyboard Nav: Tab order correct, Enter submits form
25
37
 
26
38
  **Data & Validate**
27
- - Requirements: required field blank shows error, optional allowed blank
28
- - Boundaries & Types: min/max length, format (email, number) with error messages
29
- - Whitespace: trims excess whitespace or errors on spaces-only
30
- - Error Messaging: error at correct location, disappears on correction (Error Recovery)
39
+ - Required/Optional: blank required field shows error; optional allows blank
40
+ - Boundaries & Format: min/max length, format (email, number) with error messages
41
+ - Whitespace: auto-trim or reject spaces-only input
42
+ - Error Recovery: error at correct field, disappears immediately when user corrects data
31
43
 
32
44
  **Logic**
33
- - Dependencies: Field A value determines Field B status/data
34
- - Submission Control: prevent double submit (disable button after first click)
35
- - Success Flow: redirect / success toast / reset form
45
+ - Field Dependencies: Field A value determines Field B status/options
46
+ - Double Submit Prevention: button disabled after first click, only 1 request sent
47
+ - Success Flow: redirect / success toast / form reset
36
48
  - Failure Flow: server error retains form data + shows system error
37
49
 
38
50
  **Security**
39
- - Injection Protection: XSS/SQL injection sanitized to plain text, never executed
51
+ - Shared: XSS/Injection
40
52
 
41
53
  ---
42
54
 
43
- ## 2. Data Table
55
+ ## GROUP 2: DATA MANAGEMENT
56
+
57
+ ### 2. Data Table
44
58
 
45
59
  **UI/UX**
46
- - Empty State: clear message when no data, layout intact
47
- - Loading State: skeleton/spinner, table interaction locked during fetch
48
- - Layout & Truncation: long content truncated with tooltip, column width stable
60
+ - Shared: Empty State, Loading State
61
+ - Truncation: long content shows `...` with tooltip on hover, column width stable
49
62
  - Sticky Elements: fixed header on vertical scroll, fixed action column on horizontal scroll
50
63
 
51
64
  **Data & Validate**
52
- - Consistency: total record count on UI matches server data
53
- - Row Limit: displayed rows never exceed page size/limit
54
- - Cell Integrity: cell data matches database, correct format (date, currency, status)
55
- - **Use `table match data:` with inline DataTable** for multi-row content verification (filter-based, resilient to data changes)
56
- - Use row scope (`row in [Table] table with {{v}}` + `column with {{v}}`) for single-row detail checks or when you need actions on a row
65
+ - Record Count: "Total records" on UI matches server data exactly
66
+ - Row Limit: displayed rows never exceed configured page size
67
+ - Cell Integrity: cell data matches database, correct format (date, currency, status label)
57
68
 
58
69
  **Logic**
59
- - Sorting: column sort refreshes data with correct order, updates header icon
70
+ - Sorting: column sort refreshes table with correct order, updates header icon
60
71
  - Row Actions: Edit/Delete/View buttons act on correct row ID
61
72
 
62
73
  **Security**
63
- - UI-level RBAC: hide sensitive columns or privileged buttons without authority
64
- - XSS Rendering: malicious code in database displayed as plain text
74
+ - RBAC: hide sensitive columns or privileged action buttons without authority
75
+ - Shared: XSS/Injection (data from DB displayed safely)
76
+
77
+ ---
78
+
79
+ ### 3. Create / Add
80
+
81
+ **UI/UX**
82
+ - Blank Slate: all fields empty or BA-specified defaults, NO cache from previous operation
83
+ - Required Indicator: required fields marked with visual cue (e.g., red *)
84
+ - Unsaved Changes: navigate away with dirty form → browser/system warning popup
85
+
86
+ **Data & Validate**
87
+ - → Inherited: all Form & Inputs validation rules apply
88
+ - Unique Constraint: duplicate unique field (e.g., Employee ID) → reject save, inline error
89
+ - Data Dependency: selecting parent field loads correct child options
90
+
91
+ **Logic**
92
+ - Save & Close: toast notification, redirect to list, new record visible per sort rule
93
+ - Save & Add Another: save to DB, form resets to blank for next entry
94
+ - Double Submit Prevention: → same as Form & Inputs
95
+ - Cancel: form closes, NO garbage record in DB, next open shows blank form
96
+
97
+ **Security**
98
+ - API Bypass / 403: unauthorized POST → system blocks (403 Forbidden), no record created
99
+ - → Shared: XSS/Injection (persisted safely, not executed on display)
100
+
101
+ ---
102
+
103
+ ### 4. Update / Edit
104
+
105
+ **UI/UX**
106
+ - Pre-fill / Data Binding: all fields display exact current DB data (text, dropdown, radio, date...)
107
+ - Readonly Fields: identity fields (ID, username, employee code) disabled, no interaction
108
+ - Cancel: no data changed in DB; if dirty → unsaved changes warning
109
+
110
+ **Data & Validate**
111
+ - → Inherited: all Form & Inputs validation rules apply
112
+ - Unique Self: saving without changing unique field → success, no self-duplicate error
113
+ - Unique Conflict: changing unique field to existing value → duplicate error, block save
114
+ - Unchanged Submit: Save disabled until dirty, or success without DB UPDATE
115
+
116
+ **Logic**
117
+ - Update Success: toast "Updated successfully", new data reflects on UI immediately without reload
118
+ - Concurrent Edit: another user already edited → conflict warning, require reload
119
+
120
+ **Security**
121
+ - Authorization / 403: access edit without permission → 403 page
122
+ - Not Found / 404: edit deleted object → 404
65
123
 
66
124
  ---
67
125
 
68
- ## 3. Search
126
+ ### 5. Delete
69
127
 
70
128
  **UI/UX**
71
- - No Results: "No results found" message, list empty, Clear button visible
72
- - Loading State: spinner/skeleton, list dimmed, interaction locked
129
+ - Confirmation: click Delete MUST show confirmation dialog, delete button in warning color
130
+ - Cancel: popup closes, record intact on UI and DB, no API called
131
+ - Success Update: toast "Deleted successfully", record disappears immediately without reload
132
+ - Pagination Fallback: delete only record on current page → auto-navigate to previous page
133
+
134
+ **Data & Validate — Dependencies**
135
+ - Independent: delete succeeds normally
136
+ - Referenced (Restrict): delete parent with children → blocked, clear error "in use at [Module]"
137
+ - Referenced (Cascade): warning first, then deletes parent AND all related children
138
+ - Referenced (Set Null): parent deleted, child reference set to Unassigned/Empty
139
+
140
+ **Logic — Storage**
141
+ - Soft Delete: record hidden from UI, DB retains with status flag (is_deleted, deleted_at)
142
+ - Hard Delete: record removed from UI AND permanently deleted from DB
143
+
144
+ **Security**
145
+ - Deleted Access / 404: soft or hard delete → direct URL/API returns 404
146
+ - API Bypass: API delete on restricted object → backend rejects with business error, no 500
147
+
148
+ ---
149
+
150
+ ### 6. Search
151
+
152
+ **UI/UX**
153
+ - → Shared: Empty State ("No results found"), Loading State
73
154
  - Clear Action: search box empties, list reloads default data
74
155
 
75
156
  **Data & Validate**
76
- - Cleanup: auto-trim whitespace, results match cleaned keyword
77
- - Input Limits: prevent input beyond max length or show error
78
- - Normalization: case-insensitive matching, handles Vietnamese accents
157
+ - Whitespace: auto-trim, results match cleaned keyword
158
+ - Input Limits: prevent beyond max length or show error
159
+ - Normalization: case-insensitive, handles accented characters correctly
79
160
 
80
161
  **Logic**
81
- - Matching: partial/exact match returns correct results, no 500 errors
82
- - Multi-keyword: results based on AND/OR logic
83
- - Performance: debounce ~300ms before API call
162
+ - Matching: partial/exact match returns correct results, no 500
163
+ - Multi-keyword: results based on AND/OR logic per spec
164
+ - Debounce: ~300ms delay before API call
84
165
 
85
166
  **Security**
86
- - Injection: XSS/SQL encoded as plain text, never executed
87
- - Wildcards: `%, _, *` treated as normal text (escaped)
167
+ - → Shared: XSS/Injection
168
+ - Wildcards: `%`, `_`, `*` treated as literal text (escaped), not DB commands
88
169
 
89
170
  ---
90
171
 
91
- ## 4. Filter
172
+ ### 7. Filter
92
173
 
93
174
  **UI/UX**
94
175
  - Feedback: selected filters displayed as tags/badges
95
176
  - Persistence: collapse/expand retains selected values
96
- - Conflicts: conflicting conditions show "No data" message, header layout intact
177
+ - Conflicts: conflicting conditions show "No data" message, layout intact
97
178
 
98
179
  **Data & Validate**
99
- - Range Validation: start > end or min > max shows field error, Apply button disabled
180
+ - Range Validation: start > end or min > max field error, Apply disabled
100
181
  - Dropdown Integrity: options match 100% of actual data, hide unauthorized values
101
182
 
102
183
  **Logic**
103
- - Logic AND/OR: results satisfy correct filter logic, Total Count updated
184
+ - AND/OR Logic: results satisfy correct filter logic, total count updated
104
185
  - Dependent Filters: selecting Filter A updates Filter B options
105
- - Reset & Navigation: reset returns original data or preserves state depending on action
186
+ - Reset & Navigation: reset returns original data or preserves state per spec
106
187
 
107
188
  **Security**
108
- - URL Manipulation: erroneous URL params ignored, defaults assigned, no 500 error
189
+ - Shared: URL Manipulation
109
190
 
110
191
  ---
111
192
 
112
- ## 5. Pagination
193
+ ### 8. Pagination
113
194
 
114
195
  **UI/UX**
115
196
  - Boundary States: Previous/First disabled on page 1, Next/Last disabled on last page
116
- - Active & Loading: active page highlighted, loading effect during page transition
117
- - Hidden State: pagination bar hidden when data fits one page
197
+ - Active Page: highlighted, loading effect during page transition
198
+ - Hidden: pagination bar hidden when data fits one page
118
199
 
119
200
  **Data & Validate**
120
- - Label Consistency: "Viewing X of Y" matches actual data
201
+ - Label Consistency: "Viewing X of Y" matches actual data exactly
121
202
  - Zero Records: pagination hidden, empty state displayed
122
203
 
123
204
  **Logic**
124
205
  - Navigation: loads correct dataset for page (page 2, limit 10 = records 11-20)
125
206
  - Change Page Size: shows correct quantity, resets to page 1
126
207
  - Interaction Resets: new search/filter resets to page 1
127
- - Delete Fallback: deleting all records on last page pushes to previous page
128
208
 
129
209
  **Security**
130
- - URL Manipulation: invalid page/size in URL fallbacks to defaults, no server crash
210
+ - Shared: URL Manipulation
131
211
 
132
212
  ---
133
213
 
134
- ## 6. Modal / Dialog
214
+ ## GROUP 3: NAVIGATION & CONTAINERS
215
+
216
+ ### 9. Modal / Dialog
135
217
 
136
218
  **UI/UX**
137
- - Overlay & Backdrop: centered modal, backdrop blur, background scroll locked
219
+ - Overlay: centered modal, backdrop blur, background scroll locked
138
220
  - Focus Trapping: Tab key cycles only within modal elements
139
221
  - Responsive: modal resizes, action buttons always visible or scrollable
140
222
 
141
223
  **Data & Validate**
142
- - Dismiss Actions: close via X, Cancel, Escape, backdrop click. Resets data on reopen
224
+ - Dismiss Actions: close via X, Cancel, Escape, backdrop click resets data to default on reopen
143
225
 
144
226
  **Logic**
145
- - Submissions: action button shows loading, modal closes on success, background data updated
146
- - Failure: modal stays open on API error, shows error message, retains entered data
227
+ - Submit Success: action button shows loading, modal closes, background data updated
228
+ - Submit Failure: modal stays open, shows error message, retains entered data
147
229
  - Stacked Modals: Modal B over A has higher z-index, closing B keeps A intact
148
230
 
149
231
  **Security**
150
- - Reload & Security: handles deep linking if present, removes HTML from DOM on close (protect sensitive data)
232
+ - DOM Cleanup: remove HTML from DOM on close to protect sensitive data
233
+ - Reload: handles deep linking if present
151
234
 
152
235
  ---
153
236
 
154
- ## 7. List / Card
237
+ ## GROUP 4: DISPLAY PATTERNS
238
+
239
+ ### 10. List / Card
155
240
 
156
241
  **UI/UX**
157
- - Visual States: empty state when empty, skeleton when loading, hover effect (shadow/scale) on card
242
+ - Shared: Empty State, Loading State
243
+ - Hover Effect: shadow/scale on card hover
158
244
  - Content: text truncation without breaking card height, placeholder image on broken image
159
245
 
160
246
  **Data & Validate**
@@ -164,25 +250,26 @@ user-invocable: false
164
250
  **Logic**
165
251
  - Navigation: clicking card navigates to correct detail page
166
252
  - Direct Actions: Like/Add to Cart updates immediately without reloading list
167
- - Loading Flows: Load More / Infinite Scroll appends records, maintains scroll position
253
+ - Infinite Scroll / Load More: appends records, maintains scroll position
168
254
  - Layout Toggle: Grid/List view switch changes UI but preserves data
169
255
 
170
256
  **Security**
171
- - RBAC & Resilience: hide sensitive data/privileged buttons from DOM. Network loss shows error + "Try again" button
257
+ - RBAC: hide sensitive data or privileged buttons from DOM
258
+ - Network Resilience: error message + "Retry" button on connection loss
172
259
 
173
260
  ---
174
261
 
175
262
  ## Security Tag Rules
176
263
 
177
- For VP-SEC scenarios testing **unauthorized access** (no login, wrong role, direct URL access):
178
- - Use **`@no-auth`** tag — this runs the test without authentication, which is exactly what you want to verify.
179
- - Do NOT use `@manual` for these — they are automatable with `@no-auth`.
264
+ For VP-SEC scenarios testing **unauthorized access** (no login, wrong role, direct URL):
265
+ - Use **`@no-auth`** tag — runs without authentication to verify redirect/block.
266
+ - Do NOT use `@manual` for these — they are automatable.
180
267
 
181
268
  ```gherkin
182
- @no-auth
269
+ @critical @no-auth
183
270
  Scenario: VP-SEC-001 Unauthenticated user cannot access admin page
184
271
  Given User is on [Admin] page
185
272
  Then User see [Login] page
186
273
  ```
187
274
 
188
- Use `@manual` only when the environment truly cannot be set up automatically (e.g., third-party OAuth, physical device).
275
+ Use `@manual` only when the environment truly cannot be set up automatically.
@@ -1,9 +1,9 @@
1
1
  ---
2
2
  name: sungen-add-screen
3
- description: 'Add a new Sungen screen — scaffolds directories and delegates to /sungen-create-test for test case creation'
3
+ description: 'Add a new Sungen screen — scaffolds directories, helps fill spec.md, and can auto-capture a live-page screenshot via Playwright MCP'
4
4
  argument-hint: '[screen-name] [url-path]'
5
5
  agent: 'agent'
6
- tools: [vscode, execute, read, agent, edit, search, web, browser, todo]
6
+ tools: [vscode, execute, read, agent, edit, search, web, browser, todo, 'playwright/*']
7
7
  ---
8
8
 
9
9
  **Input**: Screen name and URL path (e.g., `/sungen-add-screen login /login`).
@@ -24,23 +24,29 @@ Run with #tool:terminal:
24
24
  sungen add --screen ${input:screen} --path ${input:path}
25
25
  ```
26
26
 
27
- ### 2. Fill requirements (recommended)
27
+ ### 2. Prepare requirements
28
28
 
29
- Ask the user: "Would you like to fill in `requirements/spec.md` now? This helps generate higher quality test cases."
29
+ Ask the user to choose how to prepare requirements this is the foundation for high-quality test generation:
30
30
 
31
- - If yes → open `qa/screens/${input:screen}/requirements/spec.md` and help the user fill sections, fields, validation rules, business rules, and states.
32
- - If they have UI designs (screenshots, Figma exports, mockups) suggest copying them to `requirements/ui/`.
33
- - If no proceed to step 3.
31
+ - **Fill `spec.md` + capture live-page screenshot** (Recommended) best test quality
32
+ - **Fill `spec.md` only** app not live yet, or no need for visuals
33
+ - **Capture live-page screenshot only** spec will come later
34
+ - **Skip requirements prep** — proceed to `/sungen-create-test` immediately
34
35
 
35
- ### 3. Create test cases
36
+ **If "Fill `spec.md`" is chosen**: open `qa/screens/${input:screen}/requirements/spec.md` and help the user fill sections, fields, validation rules, business rules, and states.
36
37
 
37
- Ask the user: "Would you like to create test cases now?"
38
+ **If "Capture live-page screenshot" is chosen**:
39
+ 1. Read `baseURL` from `playwright.config.ts` (fall back to `APP_BASE_URL` env, then ask the user).
40
+ 2. `browser_navigate` to `<baseURL>${input:path}`.
41
+ 3. If redirected to login → ask the user to log in manually in the MCP browser, wait for confirmation, then re-navigate. (No auth persistence needed here — that's handled by Phase 0.5 in `sungen-selector-fix` when tests run.)
42
+ 4. `browser_take_screenshot` with `filename: "qa/screens/${input:screen}/requirements/ui/${input:screen}.png"`.
43
+ 5. If the screen has multiple important states (empty, loaded, error, modal open), offer additional captures named `${input:screen}-<state>.png`.
38
44
 
39
- If yes → **tell the user to run `/sungen-create-test ${input:screen}` as a separate command.** Do NOT attempt to generate test cases yourself in this session — the `create-test` command auto-loads the `sungen-gherkin-syntax` and `sungen-tc-generation` skills which contain the full Gherkin syntax rules, pattern shapes, viewpoint checklists, and output format.
45
+ If the user has additional UI designs (Figma exports, mockups), suggest copying them to `requirements/ui/`.
40
46
 
41
- ### 4. Confirm
47
+ ### 3. Next steps
42
48
 
43
- If the user declined test case creation, tell them next steps:
44
- - Fill `requirements/spec.md` with screen specs (if not done)
45
- - Run `/sungen-create-test` to create test cases
46
- - Run `/sungen-run-test` to generate selectors, compile, and run tests
49
+ Tell the user what was created and offer next steps:
50
+
51
+ - **`/sungen-create-test ${input:screen}`** Create test cases from requirements/designs (Recommended)
52
+ - **Done for now** I'll come back later
@@ -23,15 +23,22 @@ You are a **Senior QA Engineer**. You structure test cases by viewpoint categori
23
23
  3. **Read requirements** — check `qa/screens/${input:screen}/requirements/`:
24
24
  - If `spec.md` exists → read it as PRIMARY source (sections, fields, validation rules, business rules, states).
25
25
  - If `ui/` has images → read them for visual context (layout, element positions, states).
26
- - If `notes.md` exists → read for edge cases and additional context.
26
+ - If `test-viewpoint.md` exists → read it. If it only contains HTML comments (scaffold template), ask:
27
+ - **1) Fill test-viewpoint.md first** — identify edge cases, known issues, and design decisions before generating tests
28
+ - **2) Continue without it** — generate tests from spec and other sources only
27
29
  - Summarize what you found in requirements and present to the user.
28
30
  4. **Screen input** (supplements requirements, or is primary source if no requirements):
29
31
  - Ask: "How should I get the screen design? **1) Figma design** (provide Figma URL — recommended), **2) UI images** (screenshots/mockups in `requirements/ui/`), or **3) Live page scan** (optional, via Playwright MCP)?"
30
32
  - Recommend Figma or UI images first. Live page scan is optional — useful to verify specs vs actual UI or capture real data.
31
- - If live page, explore via #tool:playwright (see [copilot-instructions.md](../../copilot-instructions.md) for MCP rules). If auth needed, ask user to log in manually.
33
+ - If live page: `browser_navigate` ONE `browser_snapshot`. If auth redirect ask user to log in manually. Never use `browser_run_code` or `browser_evaluate` to inject cookies.
32
34
  - If exploring, verify and supplement requirements — flag any discrepancies found.
33
35
  5. Identify screen sections → ask user which to focus on (per `sungen-tc-generation` skill). When requirements exist, use the "Requirements-Driven Generation" strategy. Present sections as a numbered list and let user pick.
34
36
  6. Generate or update `.feature` + `test-data.yaml` following `sungen-gherkin-syntax` and `sungen-tc-generation` skills.
35
- 7. Show summary next: `/sungen-review ${input:screen}` or `/sungen-run-test ${input:screen}`
37
+ 7. Show summary and offer next steps:
38
+
39
+ - **`/sungen-review ${input:screen}`** — Review syntax, coverage, viewpoint quality (Recommended)
40
+ - **`/sungen-run-test ${input:screen}`** — Skip review, generate selectors and run tests now
41
+ - **`/sungen-create-test ${input:screen}`** — Add more test cases for another section/viewpoint
42
+ - **Done for now** — I'll come back later
36
43
 
37
44
  **No selectors.yaml** — selectors are generated during `/sungen-run-test`.
@@ -22,3 +22,8 @@ You are a **Senior QA Reviewer**. You evaluate Gherkin test cases using the `sun
22
22
  2. Follow the `sungen-tc-review` skill — score 3 dimensions: Syntax (30pts), Coverage (40pts), Viewpoint (30pts). Use `sungen-viewpoint` for pattern checklists.
23
23
  3. Output review report per `sungen-tc-review` format. **>= 60%**: PASS. **< 60%**: FAIL with recommendations.
24
24
  4. If FAIL and user confirms → update test cases following `sungen-gherkin-syntax` and `sungen-tc-generation` skills, then re-review.
25
+ 5. After PASS (or user decides to proceed), offer next steps:
26
+
27
+ - **`/sungen-run-test ${input:screen}`** — Generate selectors, compile, and run tests (Recommended)
28
+ - **`/sungen-create-test ${input:screen}`** — Add more test cases before running
29
+ - **Done for now** — I'll come back later
@@ -1,6 +1,6 @@
1
1
  ---
2
2
  name: sungen-run-test
3
- description: 'Compile and run Playwright tests — auto-fixes selectors on failure. Uses sungen-selector-fix, sungen-selector-keys, and sungen-error-mapping skills.'
3
+ description: 'Generate selectors + auth state via Playwright MCP, compile, and run Playwright tests — auto-fixes selectors on failure. Uses sungen-selector-fix, sungen-selector-keys, and sungen-error-mapping skills.'
4
4
  argument-hint: '[screen-name]'
5
5
  agent: 'agent'
6
6
  tools: [vscode, execute, read, agent, edit, search, web, browser, todo, 'playwright/*']
@@ -16,20 +16,29 @@ You are a **Senior Developer**. Use `sungen-selector-fix`, `sungen-selector-keys
16
16
 
17
17
  - **screen** — ${input:screen:screen name (e.g., login, dashboard)}
18
18
 
19
- ## Phase 1: Compile & Run (no MCP)
19
+ ## Pre-run (phased per `sungen-selector-fix` skill)
20
20
 
21
- 1. Verify `qa/screens/${input:screen}/` has `.feature` + `test-data.yaml`
22
- 2. Ensure `selectors.yaml` has page selector. If missing, ask user for URL path
23
- 3. `sungen generate --screen ${input:screen}`
24
- 4. `npx playwright test specs/generated/${input:screen}/*.spec.ts --reporter=line`
25
- 5. If all pass → done
21
+ 1. Verify `qa/screens/${input:screen}/` has `.feature` + `test-data.yaml`.
22
+ 2. **Phase 0 — Selector Pre-gen**: if `selectors.yaml` is missing/empty or doesn't cover the feature file's `[Reference]`s, run Phase 0 from `sungen-selector-fix` — confirm with user, `browser_navigate` one `browser_snapshot` → merge YAML entries.
23
+ 3. **Phase 0.5 — Auth Persistence**: if the feature has `@auth:<role>` tags and `specs/.auth/<role>.json` is missing/expired, run Phase 0.5 from `sungen-selector-fix` user logs in manually in MCP browser → `browser_storage_state` → `specs/.auth/<role>.json`. Offer `sungen makeauth <role>` as CLI fallback only if `browser_storage_state` isn't available in this MCP version.
24
+ 4. Compile: `sungen generate --screen ${input:screen}`.
26
25
 
27
- ## Phase 2: Targeted Fix (only if failures)
26
+ ## Run & Fix (phased per `sungen-selector-fix` skill)
28
27
 
29
- 6. Parse failures → group by root cause
30
- 7. Navigate to page ONCE via #tool:playwright ONE `browser_snapshot`
31
- 8. Fix broken selectors per `sungen-selector-fix` skill
32
- 9. Recompile re-run only failing tests
33
- 10. Repeat up to 3 attempts
34
- 11. Final full run for regression check
35
- 12. Still failing → ask user
28
+ 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.
29
+ 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.
30
+ 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.
31
+ 8. **Phase 4 — Regression**: One final full run. Report results. No more fix loops.
32
+
33
+ ## Next steps
34
+
35
+ After showing results, offer next steps:
36
+
37
+ If all tests **passed**:
38
+ - **`/sungen-create-test ${input:screen}`** — Add more test cases (Recommended)
39
+ - **Done** — All tests passed, I'm finished
40
+
41
+ If tests **failed** (after retries):
42
+ - **`/sungen-run-test ${input:screen}`** — Re-run after manual fixes
43
+ - **`/sungen-create-test ${input:screen}`** — Revise test cases
44
+ - **Done for now** — I'll fix manually later
@@ -10,8 +10,9 @@ You generate 3 files for sungen — a Gherkin compiler that produces Playwright
10
10
  | `sungen-gherkin-syntax` | All 70+ step patterns, selector types, YAML key rules, tags, element types |
11
11
  | `sungen-error-mapping` | Playwright & sungen error → fix mapping |
12
12
  | `sungen-tc-generation` | Test case generation strategy, output format |
13
+ | `sungen-test-design-techniques` | EP, BVA, Decision Table, State Transition — systematic scenario generation |
13
14
  | `sungen-tc-review` | Review scoring, quality rules, checklist |
14
- | `sungen-viewpoint` | 7 UI patterns x 4 viewpoints — coverage checklists |
15
+ | `sungen-viewpoint` | 10 UI patterns x 4 viewpoints — coverage checklists |
15
16
  | `sungen-selector-keys` | YAML key generation from `[Reference]` names, suffixes, lookup priority |
16
17
  | `sungen-selector-fix` | Selector generation from live page, auto-fix strategy |
17
18
 
@@ -26,6 +27,8 @@ You generate 3 files for sungen — a Gherkin compiler that produces Playwright
26
27
 
27
28
  **Order:** add-screen → create-test → review → run-test.
28
29
 
30
+ After each command completes, present the next actions as selectable options. Never just print text — always give clickable choices so the user can continue the workflow seamlessly.
31
+
29
32
  ## File Structure
30
33
 
31
34
  ```
@@ -38,102 +41,6 @@ qa/screens/<screen-name>/
38
41
  └── ui/ # Screenshots, mockups
39
42
  ```
40
43
 
41
- ## Complete Example
42
-
43
- Given a login page, here are the 3 files you generate:
44
-
45
- **qa/screens/login/features/login.feature**
46
- ```gherkin
47
- @no-auth
48
- Feature: Login Screen
49
-
50
- Scenario: VP-LOGIC-001 Successful login
51
- Given User is on [login] page
52
- When User fill [Email] field with {{email}}
53
- And User fill [Password] field with {{password}}
54
- And User click [Submit] button
55
- Then User see [Welcome] heading with {{welcome_text}}
56
- And User see [Dashboard] link
57
- ```
58
-
59
- **qa/screens/login/selectors/login.yaml**
60
- ```yaml
61
- login:
62
- type: 'page'
63
- value: '/login'
64
-
65
- email:
66
- type: 'placeholder'
67
- value: 'Enter your email'
68
-
69
- password:
70
- type: 'placeholder'
71
- value: 'Enter your password'
72
-
73
- submit:
74
- type: 'role'
75
- value: 'button'
76
- name: 'Submit'
77
-
78
- welcome:
79
- type: 'role'
80
- value: 'heading'
81
- name: 'Welcome'
82
-
83
- dashboard:
84
- type: 'role'
85
- value: 'link'
86
- name: 'Dashboard'
87
- ```
88
-
89
- **qa/screens/login/test-data/login.yaml**
90
- ```yaml
91
- email: 'admin@example.com'
92
- password: 'password123'
93
- welcome_text: 'Welcome back'
94
- ```
95
-
96
- ## Critical Gherkin Rules (quick reference)
97
-
98
- 1. **NEVER write `is visible`** — `User see [T] type` already asserts visibility. Only use `is hidden` to assert absence.
99
- 2. **Use `@no-auth` for pre-login pages** (login, register, forgot-password). Use `@auth:role` for authenticated pages.
100
- 3. **Scenario names use VP prefix** — `VP-UI-001`, `VP-VAL-001`, `VP-LOGIC-001`, `VP-SEC-001`.
101
- 4. **Values use `{{snake_case}}`** — never hardcode data in `.feature`. All values go in `test-data.yaml`.
102
- 5. **Selectors are deferred** — `selectors.yaml` is generated during `/sungen-run-test` from the live page, NOT during `/sungen-create-test`.
103
- 6. **Every `{{variable}}` must exist in `test-data.yaml`** — missing variables cause compile failures.
104
- 7. **Assertion type is determined by element type** — input types (`field`, `textarea`, `search`, `dropdown`, `slider`, `date-picker`) → `toHaveValue()`. Everything else → `toHaveText()`. Wrong type = wrong assertion = test failure.
105
-
106
- ## Using Playwright MCP to explore pages
107
-
108
- When exploring a page to generate test files:
109
- 1. Read `playwright.config.ts` for `baseURL`
110
- 2. Use `browser_navigate` to open `baseURL + /path`
111
- 3. Use `browser_snapshot` to see all elements
112
- 4. Generate the 3 files from the snapshot
113
-
114
- ### Allowed MCP tools
115
-
116
- | Tool | Use for |
117
- |---|---|
118
- | `browser_navigate` | Open pages |
119
- | `browser_snapshot` | Capture all accessible elements |
120
- | `browser_click` | Interact with elements (open dialogs, dropdowns) |
121
- | `browser_fill_form` | Fill form fields |
122
- | `browser_evaluate` | **Read-only DOM queries only** (e.g., detect `data-testid` attributes) |
123
-
124
- **NEVER use `browser_run_code`** — fails with `require is not defined`.
125
-
126
- ### Authentication via MCP
127
-
128
- 1. `browser_navigate` to `baseURL`
129
- 2. If redirected to login, ask the user to log in manually:
130
- > "This page requires login. Please log in using the browser. Confirm when you're done."
131
- 3. Once confirmed, `browser_navigate` to the target page and take `browser_snapshot`
132
-
133
- **Never use `sungen makeauth`.** Always let the user log in manually via the MCP browser.
134
- **NEVER use `browser_evaluate` to inject cookies or localStorage** — causes size limit issues and server 500 errors. Use `browser_evaluate` ONLY for read-only DOM queries.
135
- **Minimize navigations** — take one snapshot per page, do not navigate repeatedly.
136
-
137
44
  ## CLI Commands
138
45
 
139
46
  ```bash