@sun-asterisk/sungen 2.2.3 β†’ 2.3.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 (86) hide show
  1. package/README.md +6 -6
  2. package/dist/cli/commands/update.d.ts +3 -0
  3. package/dist/cli/commands/update.d.ts.map +1 -0
  4. package/dist/cli/commands/update.js +21 -0
  5. package/dist/cli/commands/update.js.map +1 -0
  6. package/dist/cli/index.js +3 -1
  7. package/dist/cli/index.js.map +1 -1
  8. package/dist/generators/gherkin-parser/index.d.ts +2 -0
  9. package/dist/generators/gherkin-parser/index.d.ts.map +1 -1
  10. package/dist/generators/gherkin-parser/index.js +16 -2
  11. package/dist/generators/gherkin-parser/index.js.map +1 -1
  12. package/dist/generators/test-generator/adapters/playwright/templates/steps/assertions/attribute-assertion.hbs +3 -0
  13. package/dist/generators/test-generator/adapters/playwright/templates/steps/partials/locator-base.hbs +12 -1
  14. package/dist/generators/test-generator/adapters/playwright/templates/steps/partials/locator.hbs +12 -1
  15. package/dist/generators/test-generator/patterns/assertion-patterns.d.ts.map +1 -1
  16. package/dist/generators/test-generator/patterns/assertion-patterns.js +12 -0
  17. package/dist/generators/test-generator/patterns/assertion-patterns.js.map +1 -1
  18. package/dist/generators/test-generator/patterns/index.d.ts +9 -0
  19. package/dist/generators/test-generator/patterns/index.d.ts.map +1 -1
  20. package/dist/generators/test-generator/patterns/index.js +32 -0
  21. package/dist/generators/test-generator/patterns/index.js.map +1 -1
  22. package/dist/generators/test-generator/patterns/interaction-patterns.d.ts.map +1 -1
  23. package/dist/generators/test-generator/patterns/interaction-patterns.js +0 -13
  24. package/dist/generators/test-generator/patterns/interaction-patterns.js.map +1 -1
  25. package/dist/generators/test-generator/patterns/table-patterns.d.ts.map +1 -1
  26. package/dist/generators/test-generator/patterns/table-patterns.js +8 -5
  27. package/dist/generators/test-generator/patterns/table-patterns.js.map +1 -1
  28. package/dist/orchestrator/ai-rules-updater.d.ts +13 -0
  29. package/dist/orchestrator/ai-rules-updater.d.ts.map +1 -0
  30. package/dist/orchestrator/ai-rules-updater.js +159 -0
  31. package/dist/orchestrator/ai-rules-updater.js.map +1 -0
  32. package/dist/orchestrator/project-initializer.d.ts.map +1 -1
  33. package/dist/orchestrator/project-initializer.js +2 -27
  34. package/dist/orchestrator/project-initializer.js.map +1 -1
  35. package/dist/orchestrator/screen-manager.d.ts +1 -0
  36. package/dist/orchestrator/screen-manager.d.ts.map +1 -1
  37. package/dist/orchestrator/screen-manager.js +70 -3
  38. package/dist/orchestrator/screen-manager.js.map +1 -1
  39. package/dist/orchestrator/templates/ai-instructions/claude-cmd-add-screen.md +18 -9
  40. package/dist/orchestrator/templates/ai-instructions/claude-cmd-make-tc.md +12 -4
  41. package/dist/orchestrator/templates/ai-instructions/claude-cmd-make-test.md +9 -11
  42. package/dist/orchestrator/templates/ai-instructions/claude-skill-gherkin-review.md +228 -0
  43. package/dist/orchestrator/templates/ai-instructions/claude-skill-gherkin-syntax.md +30 -11
  44. package/dist/orchestrator/templates/ai-instructions/claude-skill-selector-fix.md +91 -25
  45. package/dist/orchestrator/templates/ai-instructions/claude-skill-tc-generation.md +92 -71
  46. package/dist/orchestrator/templates/ai-instructions/copilot-cmd-add-screen.md +13 -5
  47. package/dist/orchestrator/templates/ai-instructions/copilot-cmd-make-tc.md +13 -4
  48. package/dist/orchestrator/templates/ai-instructions/copilot-cmd-make-test.md +9 -11
  49. package/dist/orchestrator/templates/ai-instructions/github-skill-sungen-gherkin-review.md +228 -0
  50. package/dist/orchestrator/templates/ai-instructions/github-skill-sungen-gherkin-syntax.md +30 -11
  51. package/dist/orchestrator/templates/ai-instructions/github-skill-sungen-selector-fix.md +72 -31
  52. package/dist/orchestrator/templates/ai-instructions/github-skill-sungen-tc-generation.md +92 -72
  53. package/dist/orchestrator/templates/readme.md +13 -8
  54. package/package.json +1 -1
  55. package/src/cli/commands/update.ts +18 -0
  56. package/src/cli/index.ts +3 -1
  57. package/src/generators/gherkin-parser/index.ts +19 -2
  58. package/src/generators/test-generator/adapters/playwright/templates/steps/assertions/attribute-assertion.hbs +3 -0
  59. package/src/generators/test-generator/adapters/playwright/templates/steps/partials/locator-base.hbs +12 -1
  60. package/src/generators/test-generator/adapters/playwright/templates/steps/partials/locator.hbs +12 -1
  61. package/src/generators/test-generator/patterns/assertion-patterns.ts +13 -0
  62. package/src/generators/test-generator/patterns/index.ts +41 -0
  63. package/src/generators/test-generator/patterns/interaction-patterns.ts +0 -14
  64. package/src/generators/test-generator/patterns/table-patterns.ts +8 -5
  65. package/src/orchestrator/ai-rules-updater.ts +141 -0
  66. package/src/orchestrator/project-initializer.ts +2 -32
  67. package/src/orchestrator/screen-manager.ts +72 -3
  68. package/src/orchestrator/templates/ai-instructions/claude-cmd-add-screen.md +18 -9
  69. package/src/orchestrator/templates/ai-instructions/claude-cmd-make-tc.md +12 -4
  70. package/src/orchestrator/templates/ai-instructions/claude-cmd-make-test.md +9 -11
  71. package/src/orchestrator/templates/ai-instructions/claude-skill-gherkin-review.md +228 -0
  72. package/src/orchestrator/templates/ai-instructions/claude-skill-gherkin-syntax.md +30 -11
  73. package/src/orchestrator/templates/ai-instructions/claude-skill-selector-fix.md +91 -25
  74. package/src/orchestrator/templates/ai-instructions/claude-skill-tc-generation.md +92 -71
  75. package/src/orchestrator/templates/ai-instructions/copilot-cmd-add-screen.md +13 -5
  76. package/src/orchestrator/templates/ai-instructions/copilot-cmd-make-tc.md +13 -4
  77. package/src/orchestrator/templates/ai-instructions/copilot-cmd-make-test.md +9 -11
  78. package/src/orchestrator/templates/ai-instructions/github-skill-sungen-gherkin-review.md +228 -0
  79. package/src/orchestrator/templates/ai-instructions/github-skill-sungen-gherkin-syntax.md +30 -11
  80. package/src/orchestrator/templates/ai-instructions/github-skill-sungen-selector-fix.md +72 -31
  81. package/src/orchestrator/templates/ai-instructions/github-skill-sungen-tc-generation.md +92 -72
  82. package/src/orchestrator/templates/readme.md +13 -8
  83. package/docs/gherkin standards/gherkin-core-standard.md +0 -431
  84. package/docs/gherkin standards/gherkin-core-standard.vi.md +0 -399
  85. package/docs/gherkin-dictionary.md +0 -1126
  86. package/docs/makeauth.md +0 -225
@@ -1,399 +0,0 @@
1
- # Tieu Chuan Gherkin - Cot Loi v2.1
2
-
3
- **Ap dung cho: Kiem thu thu cong & Kiem thu tu dong**
4
-
5
- ---
6
-
7
- ## 1️⃣ Dinh Dang Scenario (Cap do Flow)
8
-
9
- ### Dinh dang
10
- ```gherkin
11
- Scenario: <Ai> <Lam gi> <De dat ket qua gi>
12
- Given ...
13
- When ...
14
- Then ...
15
- ```
16
-
17
- ### Nguyen tac
18
- - **Doc lap**: 1 Scenario = 1 hanh vi nghiep vu hoan chinh (khong dung chung du lieu giua cac scenario)
19
- - **Hanh vi**: Mo ta "User lam gi" va "Thay gi" β€” tap trung vao hanh vi nguoi dung
20
- - **Khach quan**: Mo ta ket qua nghiep vu. Khong chua chi tiet ky thuat (CSS, XPath)
21
-
22
- ### Luong
23
- **Qua khu (Setup) β†’ Hien tai (Tuong tac) β†’ Tuong lai (Ket qua)**
24
-
25
- ```gherkin
26
- Scenario: User logs in successfully with valid credentials
27
- # 1. Thiet lap
28
- Given User is on [Login] page
29
- # 2. Tuong tac
30
- When User fill [Email] field with {{valid_email}}
31
- And User fill [Password] field with {{valid_password}}
32
- And User click [Submit] button
33
- # 3. Ket qua
34
- Then User see [Dashboard] page
35
- And User see [Welcome] heading with {{username}}
36
- And User see [Logout] button is enabled
37
- ```
38
-
39
- ### Quy tac tu khoa
40
- - **Given** β†’ chi `is on` (thiet lap ngu canh)
41
- - **When / And** β†’ `click`, `fill`, `select`, `press`, `clear`, `check`, `uncheck`, `hover`, `wait for`
42
- - **Then / And** β†’ chi `see` (xac nhan)
43
- - **And** β†’ ke thua tu khoa truoc do
44
-
45
- > Toi da 5-7 buoc `Then/And` moi scenario. Tach thanh scenario rieng neu can nhieu hon.
46
-
47
- ---
48
-
49
- ## 2️⃣ Ngu Phap (Cap do Step)
50
-
51
- ### Dinh dang
52
- ```
53
- [Keyword] User <Action> [Target Name] <Target Type> <with {{Value}}> <is State>
54
- ```
55
-
56
- ### Quy tac
57
- - βœ… `Actor` + `Action` la **bat buoc**
58
- - βœ… `Target` la **bat buoc** voi hau het action (tru `wait for` timeout)
59
- - βœ… `with {{Value}}` chi dung khi action can du lieu
60
- - βœ… `is State` chi dung cho assertion va wait
61
- - ❌ Khong viet tu do (free-text)
62
- - ❌ Khong dung tu dong nghia
63
-
64
- ### Cau truc chi tiet
65
-
66
- | Thanh phan | Bat buoc | Vi du |
67
- |-----------|----------|---------|
68
- | Actor | βœ… Luon luon | `User` |
69
- | Action | βœ… Luon luon | `click`, `fill`, `see` |
70
- | Target | βœ… Hau het | `[Login] button` |
71
- | Value | ⚠️ Khi can | `{{valid_email}}` |
72
- | State | ⚠️ Khi can | `is disabled` |
73
-
74
- ---
75
-
76
- ## 3️⃣ Actor (Tac nhan)
77
-
78
- ### Actor duoc phep
79
- - βœ… **`User`** (duy nhat)
80
-
81
- ### Quy tac
82
- - **Chi dung**: `User`
83
- - **KHONG dung**: `System`, `Backend`, `API`, `App`
84
- - Hanh vi cua he thong duoc verify bang `Then`, khong phai Actor
85
-
86
- ---
87
-
88
- ## 4️⃣ Action (Hanh dong)
89
-
90
- ### Ma tran Action
91
-
92
- | Nhom | Action | `with {{Value}}` | `is State` | Target Types |
93
- |------|--------|:-:|:-:|---|
94
- | **Setup** | `is on` | ❌ | ❌ | `page`, `dialog`, `modal`, `tab` |
95
- | **Tuong tac** | `click` | Chi list dong ✱ | ❌ | Moi phan tu tuong tac |
96
- | **Tuong tac** | `double click` | ❌ | ❌ | Bat ky |
97
- | **Tuong tac** | `hover` | ❌ | ❌ | `icon`, `image`, `row`, `card`, `menuitem` |
98
- | **Tuong tac** | `drag` | ❌ | ❌ | Bat ky |
99
- | **Tuong tac** | `expand` / `collapse` | ❌ | ❌ | `row`, `section` |
100
- | **Form** | `fill` | βœ… | ❌ | `field`, `textarea`, `search`, `uploader`, `slider`, `date-picker` |
101
- | **Form** | `select` | βœ… | ❌ | `dropdown`, `select`, `option` |
102
- | **Form** | `clear` | ❌ | ❌ | `field`, `textarea` |
103
- | **Form** | `check` | ❌ | ❌ | `checkbox`, `toggle`, `radio` |
104
- | **Form** | `uncheck` | ❌ | ❌ | `checkbox`, `toggle` (KHONG cho radio) |
105
- | **Phim** | `press` | ❌ | ❌ | `key` (bat buoc) |
106
- | **Cuon** | `scroll to` | ❌ | ❌ | `section`, bat ky |
107
- | **Frame** | `switch to` | ❌ | ❌ | `frame` |
108
- | **Cho** | `wait for` | ⚠️ | ⚠️ | `page`, `dialog`, `modal`, `message`, bat ky |
109
- | **Xac nhan** | `see` | βœ… | βœ… | Tat ca |
110
- | **Alert** | `click` | ❌ | ❌ | `alert` (OK/Cancel) |
111
- | **Alert** | `fill` | βœ… | ❌ | `alert` (prompt) |
112
-
113
- > ✱ **`click` + `with {{Value}}`**: Chi cho list dong (`row`, `item`, `card`, `option`). Khong dung cho phan tu tinh (`button`, `link`, `icon`, `tab`).
114
-
115
- ### Quy tac
116
- - βœ… Dung **dong tu chinh xac** tu danh sach
117
- - ❌ Khong dung tu dong nghia: `type`, `enter`, `input`, `verify`, `expect`, v.v.
118
- - ❌ Khong dung action ket hop: `click and wait`, `fill and submit`
119
-
120
- ### Anti-patterns (Mau sai)
121
- ```gherkin
122
- ❌ User types {{password}} into [Password] field β†’ Dung: User fill [Password] field with {{password}}
123
- ❌ User opens [Home] page β†’ Dung: User is on [Home] page
124
- ❌ User click [Terms] checkbox β†’ Dung: User check [Terms] checkbox
125
- ❌ User uncheck [Male] radio β†’ Radio khong the uncheck, dung: User check [Female] radio
126
- ❌ User verifies [Success] message β†’ Dung: User see [Success] message
127
- ```
128
-
129
- ---
130
-
131
- ## 5️⃣ Target (Doi tuong)
132
-
133
- ### Dinh dang
134
- ```
135
- [name] <element type>
136
- ```
137
-
138
- ### Cac loai Element
139
-
140
- | Nhom | Types | Vi du |
141
- |---|---|---|
142
- | **Context** | `page` `dialog` `modal` `drawer` `tab` `alert` `overlay` `step` | `[Login] page`, `[Confirm] dialog` |
143
- | **Input** | `field` `textarea` `search` `dropdown` `option` `checkbox` `radio` `toggle` `uploader` `slider` `date-picker` | `[Email] field`, `[Global] search` |
144
- | **Trigger** | `button` `link` `icon` `menuitem` `tag` | `[Submit] button`, `[Close] icon` |
145
- | **Data** | `table` `row` `column` `cell` `list` `item` `card` `section` | `[Users] table`, `[Order] row` |
146
- | **Feedback** | `message` `header` `label` `text` `tooltip` `badge` `breadcrumb` `image` | `[Error] message`, `[Total] label` |
147
- | **System** | `key` `frame` `spinner` `progressbar` | `[Enter] key`, `[Payment] frame` |
148
-
149
- ### Quy tac dat ten
150
- - βœ… Dung **ten co nghia nghiep vu/UI**, khong dung selector ky thuat
151
- - βœ… Co visible text β†’ dung dung nhan UI: `[Dang nhap] button`
152
- - βœ… Khong co visible text β†’ danh tu ngan gon: `[close] icon`
153
- - βœ… Ten > 30 ky tu β†’ rut gon 1-3 tu co nghia
154
- - ❌ Khong dung CSS: `#email`, `.btn-primary`
155
- - ❌ Khong gop element type vao ngoac vuong: `[login button]` β†’ `[login] button`
156
-
157
- ---
158
-
159
- ## 6️⃣ Value (Gia tri)
160
-
161
- ### Dinh dang
162
- ```
163
- {{value}}
164
- ```
165
-
166
- ### Quy uoc
167
- - **snake_case** (chu thuong voi dau gach duoi)
168
- - Mo ta ro rang va theo ngu canh
169
-
170
- ### Quy tac
171
- - βœ… Su dung cu phap `{{variable}}`
172
- - βœ… Ten phan anh **muc dich cua du lieu**, khong phai noi dung
173
- - ❌ Khong hard-code du lieu trong step
174
- - ❌ Khong chua du lieu that (email, password, token)
175
-
176
- ### Vi du
177
-
178
- | βœ… Dung | ❌ Sai |
179
- |--------|-------|
180
- | `{{valid_email}}` | `{{user@example.com}}` |
181
- | `{{invalid_password}}` | `{{123456}}` |
182
- | `{{product_name}}` | `{{iPhone 15 Pro}}` |
183
-
184
- ---
185
-
186
- ## 7️⃣ Assertion (Xac nhan)
187
-
188
- ### Dong tu
189
- - **Duy nhat**: `see`
190
-
191
- ### 7 Pattern Verify
192
-
193
- | # | Pattern | Assertion | Vi du |
194
- |---|---------|-----------|-------|
195
- | 1 | **Hien thi** | `toBeVisible()` / `toBeHidden()` | `see [Success] message` / `see [Ads] modal is hidden` |
196
- | 2 | **Noi dung text** | `toHaveText()` (khop chinh xac) | `see [Error] message with {{err_msg}}` |
197
- | 3 | **Text mot phan** | `toContainText()` | `see [Title] heading contains {{text}}` |
198
- | 4 | **Gia tri input** | `toHaveValue()` | `see [Email] field with {{user_email}}` |
199
- | 5 | **Trang thai** | `toBeDisabled()` / `toBeChecked()` v.v. | `see [Submit] button is disabled` |
200
- | 6 | **So luong** | `toHaveCount()` | `see [Result] row with {{result_count}}` |
201
- | 7 | **Dieu huong** | `toHaveURL()` | `see [Dashboard] page` |
202
-
203
- > **Phan biet quan trong**: `see [T] <input type> with {{v}}` β†’ `toHaveValue()` cho input (field, textarea, search, dropdown, slider, date-picker). `see [T] <other type> with {{v}}` β†’ `toHaveText()` cho tat ca con lai.
204
-
205
- ### States (Trang thai)
206
-
207
- | State | Mo ta |
208
- |-------|-------|
209
- | `hidden` | Element bi an |
210
- | `visible` | Element hien thi |
211
- | `disabled` | Element bi vo hieu |
212
- | `enabled` | Element co the tuong tac |
213
- | `checked` | Checkbox/radio/toggle duoc chon |
214
- | `unchecked` | Checkbox/radio/toggle chua chon |
215
- | `focused` | Element dang duoc focus |
216
- | `empty` | Element rong |
217
- | `loading` | Dang tai |
218
- | `selected` | Duoc chon |
219
- | `sorted ascending` | Sap xep tang dan |
220
- | `sorted descending` | Sap xep giam dan |
221
-
222
- ### Ket hop Value + State
223
- ```gherkin
224
- Then User see [Ads] modal with {{promo_title}} is hidden
225
- ```
226
-
227
- ### Xac nhan bang (Table)
228
-
229
- | Mau | Vi du |
230
- |------|-------|
231
- | Dong ton tai | `User see [Users] table has row with {{name}}` |
232
- | Khong co dong | `User see [Users] table has no row with {{name}}` |
233
- | Dem dong | `User see [Users] table has {{count}} rows` |
234
- | Cot ton tai | `User see [Users] table has [Email] column` |
235
- | Bang rong | `User see [Users] table is empty` |
236
- | O theo bo loc | `User see [Users] table row with {{filter}} has [Status] with {{status}}` |
237
- | O theo chi so | `User see [Users] table row 1 [Name] cell with {{name}}` |
238
- | Hanh dong trong dong | `User click [Edit] in [Users] table row with {{name}}` |
239
-
240
- ### Quy tac
241
- - βœ… Assertion **chi xuat hien trong `Then`**
242
- - βœ… Moi step = **1 assertion**
243
- - ❌ Khong dung tu dong nghia: `verify`, `expect`, `check`, `validate`
244
-
245
- ---
246
-
247
- ## 8️⃣ Browser Alert (System Dialog)
248
-
249
- Cho dialog he thong (`window.alert`, `window.confirm`, `window.prompt`):
250
-
251
- ```gherkin
252
- # Buoc alert phai dat TRUOC hanh dong kich hoat dialog
253
- When User click [OK] alert # chap nhan (OK/Accept/Yes/Confirm)
254
- And User click [Delete] button # hanh dong kich hoat alert
255
-
256
- When User click [Cancel] alert # tu choi (Cancel/Dismiss/No)
257
- And User click [Delete] button
258
-
259
- When User fill [Name] alert with {{v}} # nhap prompt + chap nhan
260
- And User click [Rename] button
261
- ```
262
-
263
- > **Quan trong**: Dang ky dialog handler TRUOC hanh dong kich hoat. Sungen sinh `page.once('dialog', ...)`.
264
-
265
- ---
266
-
267
- ## 🏷️ Tags
268
-
269
- ### Tags phan loai
270
-
271
- | Tag | Mo ta |
272
- |-----|-------|
273
- | `@auto` | Scenario tu dong, san sang chay |
274
- | `@manual` | Bo qua khi sinh code |
275
- | `@smoke` | Tap kiem thu Smoke |
276
- | `@regression` | Tap kiem thu Regression |
277
-
278
- ### Tags xac thuc
279
-
280
- | Tag | Mo ta |
281
- |-----|-------|
282
- | `@auth:<role>` | Su dung trang thai auth Playwright cho role |
283
- | `@no-auth` | Tat authentication ke thua |
284
-
285
- **Thu tu uu tien Auth**: Scenario ke thua `@auth` > Scenario goc `@auth` > Feature `@auth`
286
-
287
- ### Tags ke thua (@steps / @extend)
288
-
289
- ```gherkin
290
- @auto @auth:user @steps:kudos__open_modal
291
- Scenario: Setup for opening Kudos modal
292
- Given User is on [Home] page
293
- When User click [Today you want...] button
294
- Then User see [Send thanks] dialog # ← bo qua khi @extend goi
295
-
296
- @auto @auth:user @extend:kudos__open_modal
297
- Scenario: User successfully sends a thank you message
298
- Given User is on [Send thanks] dialog # ← bat buoc: xac nhan trang thai sau extend
299
- When User fill [Search teammate] field with {{teammate_name}}
300
- And User click [Send] button
301
- Then User see [Success] message with {{msg_success}}
302
- ```
303
-
304
- **Hanh vi:**
305
- - `@extend` thuc thi **chi Given→When** cua `@steps` (bo qua Then)
306
- - `Given` trong `@extend` la **assertion xac nhan trang thai** sau khi base steps chay
307
- - Neu `@steps` **fail**, `@extend` se **tu dong bo qua (skip)**
308
- - Dinh dang ten: `snake_case` hoac `kebab-case` voi prefix module: `@steps:kudos__open_modal`
309
-
310
- ---
311
-
312
- ## πŸ“‹ Vi du hoan chinh
313
-
314
- ```gherkin
315
- @feature_auth
316
- Feature: Xac thuc nguoi dung
317
- Path: /auth/login
318
-
319
- # Happy Path
320
- @auto @smoke @regression
321
- Scenario: User logs in successfully with valid credentials
322
- Given User is on [Login] page
323
- When User fill [Email] field with {{valid_email}}
324
- And User fill [Password] field with {{valid_password}}
325
- And User check [Remember me] checkbox
326
- And User click [Login] button
327
- Then User see [Dashboard] page
328
- And User see [Welcome] message with {{user_fullname}}
329
- And User see [Logout] button is enabled
330
-
331
- # Error Path
332
- @auto @regression
333
- Scenario: Login fails with invalid credentials
334
- Given User is on [Login] page
335
- When User fill [Email] field with {{invalid_email}}
336
- And User fill [Password] field with {{invalid_password}}
337
- And User click [Login] button
338
- Then User see [Login] page
339
- And User see [Login error] message with {{err_invalid_credentials}}
340
- And User see [Login] button is enabled
341
-
342
- # Dung @extend
343
- @auto @auth:user @steps:navigate_to_profile
344
- Scenario: Setup β€” Navigate to Profile page
345
- Given User is on [Dashboard] page
346
- When User click [Avatar] icon
347
- And User click [My account] menuitem
348
- Then User see [Profile] page # ← @extend bo qua buoc nay
349
-
350
- @auto @auth:user @extend:navigate_to_profile
351
- Scenario: User updates display name successfully
352
- Given User is on [Profile] page # ← Xac nhan trang thai sau extend
353
- When User fill [Display name] field with {{new_display_name}}
354
- And User click [Save changes] button
355
- Then User see [Success] message with {{msg_save_success}}
356
- And User see [Display name] field with {{new_display_name}}
357
- ```
358
-
359
- ---
360
-
361
- ## βœ… Tham Khao Nhanh
362
-
363
- ### Nen lam βœ…
364
- - Dung **action chuan** tu ma tran action
365
- - Dung **`User`** la actor duy nhat
366
- - Dung dinh dang **`[Target] <element type>`**
367
- - Dung **`{{snake_case}}`** cho gia tri
368
- - Dung **`is <state>`** cho xac nhan trang thai
369
- - Dung **tags** (`@auth`, `@steps`, `@extend`) de quan ly scenario
370
- - **1 Scenario = 1 flow nghiep vu**
371
- - **1 Step = 1 action hoac assertion**
372
-
373
- ### Khong nen lam ❌
374
- - Khong dung tu dong nghia hoac viet tu do
375
- - Khong dung system/backend/API lam actor
376
- - Khong dung selector ky thuat (CSS/XPath/ID)
377
- - Khong hard-code du lieu trong step
378
- - Khong dung action ket hop
379
- - Khong dung `verify`/`check`/`expect` thay cho `see`
380
- - Khong `click` checkbox/toggle (dung `check`/`uncheck`)
381
- - Khong `uncheck` radio (dung `check` option khac)
382
-
383
- ### Loi thuong gap
384
-
385
- | ❌ Sai | βœ… Dung | Ly do |
386
- |---|---|---|
387
- | `Given User click [Login] button` | `When User click [Login] button` | `click` thuoc WHEN |
388
- | `When User click [Terms] checkbox` | `When User check [Terms] checkbox` | Dung `check` cho checkbox |
389
- | `When User press [Submit] button` | `When User press [Enter] key` | `press` chi di voi `key` |
390
- | `When User uncheck [Male] radio` | `When User check [Female] radio` | Radio khong the uncheck |
391
- | `fill [email] with {{admin@mail}}` | `fill [email] field with {{admin_email}}` | Khong hardcode + thieu type |
392
- | `see [msg] with {{text}} hidden` | `see [msg] with {{text}} is hidden` | Thieu tu noi `is` |
393
- | `see [btn] button with {{disabled}}` | `see [btn] button is disabled` | State dung `is`, khong dung `{{}}` |
394
-
395
- ---
396
-
397
- **Phien ban**: 2.1
398
- **Trang thai**: Final
399
- **Cap nhat lan cuoi**: 31 thang 3, 2026