@sun-asterisk/sungen 2.2.3 β 2.3.0
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/README.md +4 -4
- package/dist/cli/commands/update.d.ts +3 -0
- package/dist/cli/commands/update.d.ts.map +1 -0
- package/dist/cli/commands/update.js +21 -0
- package/dist/cli/commands/update.js.map +1 -0
- package/dist/cli/index.js +3 -1
- package/dist/cli/index.js.map +1 -1
- package/dist/generators/gherkin-parser/index.d.ts +2 -0
- package/dist/generators/gherkin-parser/index.d.ts.map +1 -1
- package/dist/generators/gherkin-parser/index.js +16 -2
- package/dist/generators/gherkin-parser/index.js.map +1 -1
- package/dist/generators/test-generator/adapters/playwright/templates/steps/assertions/attribute-assertion.hbs +3 -0
- package/dist/generators/test-generator/adapters/playwright/templates/steps/partials/locator-base.hbs +12 -1
- package/dist/generators/test-generator/adapters/playwright/templates/steps/partials/locator.hbs +12 -1
- package/dist/generators/test-generator/patterns/assertion-patterns.d.ts.map +1 -1
- package/dist/generators/test-generator/patterns/assertion-patterns.js +12 -0
- package/dist/generators/test-generator/patterns/assertion-patterns.js.map +1 -1
- package/dist/generators/test-generator/patterns/index.d.ts +9 -0
- package/dist/generators/test-generator/patterns/index.d.ts.map +1 -1
- package/dist/generators/test-generator/patterns/index.js +32 -0
- package/dist/generators/test-generator/patterns/index.js.map +1 -1
- package/dist/generators/test-generator/patterns/table-patterns.d.ts.map +1 -1
- package/dist/generators/test-generator/patterns/table-patterns.js +8 -5
- package/dist/generators/test-generator/patterns/table-patterns.js.map +1 -1
- package/dist/orchestrator/ai-rules-updater.d.ts +13 -0
- package/dist/orchestrator/ai-rules-updater.d.ts.map +1 -0
- package/dist/orchestrator/ai-rules-updater.js +157 -0
- package/dist/orchestrator/ai-rules-updater.js.map +1 -0
- package/dist/orchestrator/project-initializer.d.ts.map +1 -1
- package/dist/orchestrator/project-initializer.js +2 -27
- package/dist/orchestrator/project-initializer.js.map +1 -1
- package/dist/orchestrator/screen-manager.d.ts +1 -0
- package/dist/orchestrator/screen-manager.d.ts.map +1 -1
- package/dist/orchestrator/screen-manager.js +70 -3
- package/dist/orchestrator/screen-manager.js.map +1 -1
- package/dist/orchestrator/templates/ai-instructions/claude-cmd-add-screen.md +18 -9
- package/dist/orchestrator/templates/ai-instructions/claude-cmd-make-tc.md +11 -4
- package/dist/orchestrator/templates/ai-instructions/claude-cmd-make-test.md +9 -11
- package/dist/orchestrator/templates/ai-instructions/claude-skill-gherkin-syntax.md +27 -8
- package/dist/orchestrator/templates/ai-instructions/claude-skill-selector-fix.md +91 -25
- package/dist/orchestrator/templates/ai-instructions/claude-skill-tc-generation.md +124 -71
- package/dist/orchestrator/templates/ai-instructions/copilot-cmd-add-screen.md +13 -5
- package/dist/orchestrator/templates/ai-instructions/copilot-cmd-make-tc.md +12 -4
- package/dist/orchestrator/templates/ai-instructions/copilot-cmd-make-test.md +9 -11
- package/dist/orchestrator/templates/ai-instructions/github-skill-sungen-gherkin-syntax.md +27 -8
- package/dist/orchestrator/templates/ai-instructions/github-skill-sungen-selector-fix.md +72 -31
- package/dist/orchestrator/templates/ai-instructions/github-skill-sungen-tc-generation.md +124 -72
- package/dist/orchestrator/templates/readme.md +13 -8
- package/package.json +1 -1
- package/src/cli/commands/update.ts +18 -0
- package/src/cli/index.ts +3 -1
- package/src/generators/gherkin-parser/index.ts +19 -2
- package/src/generators/test-generator/adapters/playwright/templates/steps/assertions/attribute-assertion.hbs +3 -0
- package/src/generators/test-generator/adapters/playwright/templates/steps/partials/locator-base.hbs +12 -1
- package/src/generators/test-generator/adapters/playwright/templates/steps/partials/locator.hbs +12 -1
- package/src/generators/test-generator/patterns/assertion-patterns.ts +13 -0
- package/src/generators/test-generator/patterns/index.ts +41 -0
- package/src/generators/test-generator/patterns/table-patterns.ts +8 -5
- package/src/orchestrator/ai-rules-updater.ts +139 -0
- package/src/orchestrator/project-initializer.ts +2 -32
- package/src/orchestrator/screen-manager.ts +72 -3
- package/src/orchestrator/templates/ai-instructions/claude-cmd-add-screen.md +18 -9
- package/src/orchestrator/templates/ai-instructions/claude-cmd-make-tc.md +11 -4
- package/src/orchestrator/templates/ai-instructions/claude-cmd-make-test.md +9 -11
- package/src/orchestrator/templates/ai-instructions/claude-skill-gherkin-syntax.md +27 -8
- package/src/orchestrator/templates/ai-instructions/claude-skill-selector-fix.md +91 -25
- package/src/orchestrator/templates/ai-instructions/claude-skill-tc-generation.md +124 -71
- package/src/orchestrator/templates/ai-instructions/copilot-cmd-add-screen.md +13 -5
- package/src/orchestrator/templates/ai-instructions/copilot-cmd-make-tc.md +12 -4
- package/src/orchestrator/templates/ai-instructions/copilot-cmd-make-test.md +9 -11
- package/src/orchestrator/templates/ai-instructions/github-skill-sungen-gherkin-syntax.md +27 -8
- package/src/orchestrator/templates/ai-instructions/github-skill-sungen-selector-fix.md +72 -31
- package/src/orchestrator/templates/ai-instructions/github-skill-sungen-tc-generation.md +124 -72
- package/src/orchestrator/templates/readme.md +13 -8
- package/docs/gherkin standards/gherkin-core-standard.md +0 -431
- package/docs/gherkin standards/gherkin-core-standard.vi.md +0 -399
- package/docs/gherkin-dictionary.md +0 -1126
- package/docs/makeauth.md +0 -225
|
@@ -1,431 +0,0 @@
|
|
|
1
|
-
# Gherkin Standard - Core (v2.1)
|
|
2
|
-
|
|
3
|
-
**Applies to: Manual Testing & Automation Testing**
|
|
4
|
-
|
|
5
|
-
---
|
|
6
|
-
|
|
7
|
-
## 1οΈβ£ Scenario Format (Flow Level)
|
|
8
|
-
|
|
9
|
-
### Format
|
|
10
|
-
```gherkin
|
|
11
|
-
Scenario: <Who> <Does What> <For What Result>
|
|
12
|
-
Given ...
|
|
13
|
-
When ...
|
|
14
|
-
Then ...
|
|
15
|
-
```
|
|
16
|
-
|
|
17
|
-
### Principles
|
|
18
|
-
- **Independent**: 1 Scenario = 1 complete business behavior (no shared data between scenarios)
|
|
19
|
-
- **Behavioral**: Describe "User does what" and "sees what" β focus on user behavior
|
|
20
|
-
- **Objective**: Describe business outcomes. No technical details (CSS, XPath)
|
|
21
|
-
|
|
22
|
-
### Flow
|
|
23
|
-
**Past (Setup) β Present (Interaction) β Future (Result)**
|
|
24
|
-
|
|
25
|
-
```gherkin
|
|
26
|
-
Scenario: User logs in successfully with valid credentials
|
|
27
|
-
# 1. Setup
|
|
28
|
-
Given User is on [Login] page
|
|
29
|
-
# 2. Interaction
|
|
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. Result
|
|
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
|
-
### Keyword Rules
|
|
40
|
-
- **Given** β `is on` only (setup context)
|
|
41
|
-
- **When / And** β `click`, `fill`, `select`, `press`, `clear`, `check`, `uncheck`, `hover`, `wait for`
|
|
42
|
-
- **Then / And** β `see` only (assertions)
|
|
43
|
-
- **And** β inherits from preceding keyword
|
|
44
|
-
|
|
45
|
-
> Max 5β7 `Then/And` assertions per scenario. Split into separate scenarios if more needed.
|
|
46
|
-
|
|
47
|
-
---
|
|
48
|
-
|
|
49
|
-
## 2οΈβ£ Grammar (Step Level)
|
|
50
|
-
|
|
51
|
-
### Format
|
|
52
|
-
```
|
|
53
|
-
[Keyword] User <Action> [Target Name] <Target Type> <with {{Value}}> <is State>
|
|
54
|
-
```
|
|
55
|
-
|
|
56
|
-
### Rules
|
|
57
|
-
- β
`Actor` + `Action` are **mandatory**
|
|
58
|
-
- β
`Target` is **required** for most actions (except `wait for N seconds`)
|
|
59
|
-
- β
`with {{Value}}` only used when action requires data
|
|
60
|
-
- β
`is State` only used for assertions and wait conditions
|
|
61
|
-
- β No free-text variations
|
|
62
|
-
- β No synonyms
|
|
63
|
-
|
|
64
|
-
### Structure Breakdown
|
|
65
|
-
|
|
66
|
-
| Component | Required | Example |
|
|
67
|
-
|-----------|----------|---------|
|
|
68
|
-
| Actor | β
Always | `User` |
|
|
69
|
-
| Action | β
Always | `click`, `fill`, `see` |
|
|
70
|
-
| Target | β
Most cases | `[Login] button` |
|
|
71
|
-
| Value | β οΈ When needed | `{{valid_email}}` |
|
|
72
|
-
| State | β οΈ Assertions only | `is disabled` |
|
|
73
|
-
|
|
74
|
-
---
|
|
75
|
-
|
|
76
|
-
## 3οΈβ£ Actor
|
|
77
|
-
|
|
78
|
-
### Allowed Actor
|
|
79
|
-
- β
**`User`** (only)
|
|
80
|
-
|
|
81
|
-
### Rules
|
|
82
|
-
- **Only use**: `User`
|
|
83
|
-
- **Do NOT use**: `System`, `Backend`, `API`, `App`
|
|
84
|
-
- System behavior is verified using `Then`, not as an Actor
|
|
85
|
-
|
|
86
|
-
### Examples
|
|
87
|
-
```gherkin
|
|
88
|
-
β
User is on [Login] page
|
|
89
|
-
β
User click [Submit] button
|
|
90
|
-
β System sends verification email
|
|
91
|
-
β Backend validates password
|
|
92
|
-
```
|
|
93
|
-
|
|
94
|
-
---
|
|
95
|
-
|
|
96
|
-
## 4οΈβ£ Action
|
|
97
|
-
|
|
98
|
-
### Action Matrix
|
|
99
|
-
|
|
100
|
-
| Group | Action | `with {{Value}}` | `is State` | Target Types |
|
|
101
|
-
|-------|--------|:-:|:-:|---|
|
|
102
|
-
| **Setup** | `is on` | β | β | `page`, `dialog`, `modal`, `tab` |
|
|
103
|
-
| **Interaction** | `click` | Only dynamic lists β± | β | All interactive elements |
|
|
104
|
-
| **Interaction** | `double click` | β | β | Any element |
|
|
105
|
-
| **Interaction** | `hover` | β | β | `icon`, `image`, `row`, `card`, `menuitem` |
|
|
106
|
-
| **Interaction** | `drag` | β | β | Any to any |
|
|
107
|
-
| **Interaction** | `expand` / `collapse` | β | β | `row`, `section` |
|
|
108
|
-
| **Form** | `fill` | β
| β | `field`, `textarea`, `search`, `uploader`, `slider`, `date-picker` |
|
|
109
|
-
| **Form** | `select` | β
| β | `dropdown`, `select`, `option` |
|
|
110
|
-
| **Form** | `clear` | β | β | `field`, `textarea` |
|
|
111
|
-
| **Form** | `check` | β | β | `checkbox`, `toggle`, `radio` |
|
|
112
|
-
| **Form** | `uncheck` | β | β | `checkbox`, `toggle` (NOT radio) |
|
|
113
|
-
| **Keyboard** | `press` | β | β | `key` (mandatory) |
|
|
114
|
-
| **Scroll** | `scroll to` | β | β | `section`, any element |
|
|
115
|
-
| **Frame** | `switch to` | β | β | `frame` |
|
|
116
|
-
| **Wait** | `wait for` | β οΈ Optional | β οΈ Optional | `page`, `dialog`, `modal`, `message`, any element |
|
|
117
|
-
| **Assertion** | `see` | β
| β
| All types |
|
|
118
|
-
| **Alert** | `click` | β | β | `alert` (OK/Cancel) |
|
|
119
|
-
| **Alert** | `fill` | β
| β | `alert` (prompt) |
|
|
120
|
-
|
|
121
|
-
> β± **`click` + `with {{Value}}`**: Only for dynamic lists (`row`, `item`, `card`, `option`). Never for static elements (`button`, `link`, `icon`, `tab`).
|
|
122
|
-
|
|
123
|
-
### Rules
|
|
124
|
-
- β
Use **exact verbs** from the list above
|
|
125
|
-
- β No synonyms: `type`, `enter`, `input`, `verify`, `expect`, `open`, etc.
|
|
126
|
-
- β No compound actions: `click and wait`, `fill and submit`
|
|
127
|
-
|
|
128
|
-
### Anti-patterns
|
|
129
|
-
```gherkin
|
|
130
|
-
β User types {{password}} into [Password] field β use "fill"
|
|
131
|
-
β User opens [Home] page β use "is on"
|
|
132
|
-
β User checks [Terms] checkbox β use "check" (no "s")
|
|
133
|
-
β User verifies [Success] message appears β use "see"
|
|
134
|
-
β User click [Terms] checkbox β use "check", not "click"
|
|
135
|
-
β User uncheck [Male] radio β radio cannot uncheck, use "check [Female] radio"
|
|
136
|
-
```
|
|
137
|
-
|
|
138
|
-
---
|
|
139
|
-
|
|
140
|
-
## 5οΈβ£ Target
|
|
141
|
-
|
|
142
|
-
### Format
|
|
143
|
-
```
|
|
144
|
-
[name] <element type>
|
|
145
|
-
```
|
|
146
|
-
|
|
147
|
-
### Element Types
|
|
148
|
-
|
|
149
|
-
| Group | Types | Example |
|
|
150
|
-
|---|---|---|
|
|
151
|
-
| **Context** | `page` `dialog` `modal` `drawer` `tab` `alert` `overlay` `step` | `[Login] page`, `[Confirm] dialog` |
|
|
152
|
-
| **Input** | `field` `textarea` `search` `dropdown` `option` `checkbox` `radio` `toggle` `uploader` `slider` `date-picker` | `[Email] field`, `[Global] search` |
|
|
153
|
-
| **Trigger** | `button` `link` `icon` `menuitem` `tag` | `[Submit] button`, `[Close] icon` |
|
|
154
|
-
| **Data** | `table` `row` `column` `cell` `list` `item` `card` `section` | `[Users] table`, `[Order] row` |
|
|
155
|
-
| **Feedback** | `message` `header` `label` `text` `tooltip` `badge` `breadcrumb` `image` | `[Error] message`, `[Total] label` |
|
|
156
|
-
| **System** | `key` `frame` `spinner` `progressbar` | `[Enter] key`, `[Payment] frame` |
|
|
157
|
-
|
|
158
|
-
### Naming Rules
|
|
159
|
-
- β
Use **business/UI meaningful names**, not technical selectors
|
|
160
|
-
- β
Visible text β use exact UI label: `[ΔΔng nhαΊp] button`
|
|
161
|
-
- β
No visible text β short descriptive noun: `[close] icon`
|
|
162
|
-
- β
Name > 30 chars β shorten to 1β3 meaningful words
|
|
163
|
-
- β No CSS selectors: `#email`, `.btn-primary`
|
|
164
|
-
- β No XPath: `//input[@id='email']`
|
|
165
|
-
- β No element type in brackets: `[login button]` β `[login] button`
|
|
166
|
-
|
|
167
|
-
### Examples
|
|
168
|
-
```gherkin
|
|
169
|
-
β
User click [Login] button
|
|
170
|
-
β
User fill [Email address] field with {{email}}
|
|
171
|
-
β
User select [Country] dropdown with {{country}}
|
|
172
|
-
β
User see [Welcome back] heading
|
|
173
|
-
|
|
174
|
-
β User click [#submit-btn] button
|
|
175
|
-
β User fill [input.email-field] field
|
|
176
|
-
β User see [div.alert-success] message
|
|
177
|
-
```
|
|
178
|
-
|
|
179
|
-
---
|
|
180
|
-
|
|
181
|
-
## 6οΈβ£ Value
|
|
182
|
-
|
|
183
|
-
### Format
|
|
184
|
-
```
|
|
185
|
-
{{value}}
|
|
186
|
-
```
|
|
187
|
-
|
|
188
|
-
### Naming Convention
|
|
189
|
-
- **snake_case** (lowercase with underscores)
|
|
190
|
-
- Descriptive and context-aware
|
|
191
|
-
|
|
192
|
-
### Rules
|
|
193
|
-
- β
Use `{{variable}}` syntax
|
|
194
|
-
- β
Name reflects **data purpose**, not data content
|
|
195
|
-
- β No hard-coded data in steps
|
|
196
|
-
- β No real data (emails, passwords, tokens)
|
|
197
|
-
|
|
198
|
-
### Examples
|
|
199
|
-
|
|
200
|
-
| β
Good | β Bad |
|
|
201
|
-
|--------|-------|
|
|
202
|
-
| `{{valid_email}}` | `{{user@example.com}}` |
|
|
203
|
-
| `{{invalid_password}}` | `{{123456}}` |
|
|
204
|
-
| `{{expired_otp}}` | `{{999999}}` |
|
|
205
|
-
| `{{product_name}}` | `{{iPhone 15 Pro}}` |
|
|
206
|
-
|
|
207
|
-
---
|
|
208
|
-
|
|
209
|
-
## 7οΈβ£ Assertion
|
|
210
|
-
|
|
211
|
-
### Verb
|
|
212
|
-
- **Only**: `see`
|
|
213
|
-
|
|
214
|
-
### 7 Verify Patterns
|
|
215
|
-
|
|
216
|
-
| # | Pattern | Assertion | Example |
|
|
217
|
-
|---|---------|-----------|---------|
|
|
218
|
-
| 1 | **Visibility** | `toBeVisible()` / `toBeHidden()` | `see [Success] message` / `see [Ads] modal is hidden` |
|
|
219
|
-
| 2 | **Text Content** | `toHaveText()` (exact match) | `see [Error] message with {{err_msg}}` |
|
|
220
|
-
| 3 | **Partial Text** | `toContainText()` | `see [Title] heading contains {{text}}` |
|
|
221
|
-
| 4 | **Input Value** | `toHaveValue()` | `see [Email] field with {{user_email}}` |
|
|
222
|
-
| 5 | **Component State** | `toBeDisabled()` / `toBeChecked()` etc. | `see [Submit] button is disabled` |
|
|
223
|
-
| 6 | **Count** | `toHaveCount()` | `see [Result] row with {{result_count}}` |
|
|
224
|
-
| 7 | **Page Context** | `toHaveURL()` | `see [Dashboard] page` |
|
|
225
|
-
|
|
226
|
-
> **Key distinction**: `see [T] <input type> with {{v}}` β `toHaveValue()` for inputs (field, textarea, search, dropdown, slider, date-picker). `see [T] <other type> with {{v}}` β `toHaveText()` for everything else.
|
|
227
|
-
|
|
228
|
-
### State Modifiers
|
|
229
|
-
|
|
230
|
-
| State | Assertion |
|
|
231
|
-
|-------|-----------|
|
|
232
|
-
| `hidden` | Element is not visible |
|
|
233
|
-
| `visible` | Element is visible |
|
|
234
|
-
| `disabled` | Element is disabled |
|
|
235
|
-
| `enabled` | Element is enabled |
|
|
236
|
-
| `checked` | Checkbox/radio/toggle is checked |
|
|
237
|
-
| `unchecked` | Checkbox/radio/toggle is unchecked |
|
|
238
|
-
| `focused` | Element has focus |
|
|
239
|
-
| `empty` | Element has no text/value |
|
|
240
|
-
| `loading` | Loading indicator is visible |
|
|
241
|
-
| `selected` | Element is selected |
|
|
242
|
-
| `sorted ascending` | Column sorted ascending |
|
|
243
|
-
| `sorted descending` | Column sorted descending |
|
|
244
|
-
|
|
245
|
-
### Combined Value + State
|
|
246
|
-
```gherkin
|
|
247
|
-
# Value and state can be combined:
|
|
248
|
-
Then User see [Ads] modal with {{promo_title}} is hidden
|
|
249
|
-
```
|
|
250
|
-
|
|
251
|
-
### Table Assertions
|
|
252
|
-
|
|
253
|
-
| Pattern | Example |
|
|
254
|
-
|---------|---------|
|
|
255
|
-
| Row exists | `User see [Users] table has row with {{name}}` |
|
|
256
|
-
| No row | `User see [Users] table has no row with {{name}}` |
|
|
257
|
-
| Row count | `User see [Users] table has {{count}} rows` |
|
|
258
|
-
| Column exists | `User see [Users] table has [Email] column` |
|
|
259
|
-
| Empty table | `User see [Users] table is empty` |
|
|
260
|
-
| Cell by filter | `User see [Users] table row with {{filter}} has [Status] with {{status}}` |
|
|
261
|
-
| Cell by index | `User see [Users] table row 1 [Name] cell with {{name}}` |
|
|
262
|
-
| Action in row | `User click [Edit] in [Users] table row with {{name}}` |
|
|
263
|
-
|
|
264
|
-
### Rules
|
|
265
|
-
- β
Assertions **only appear in `Then`** steps
|
|
266
|
-
- β
Verify **system state / output**
|
|
267
|
-
- β
Each step = **1 assertion**
|
|
268
|
-
- β No synonyms: `verify`, `expect`, `check`, `observe`, `validate`
|
|
269
|
-
|
|
270
|
-
---
|
|
271
|
-
|
|
272
|
-
## 8οΈβ£ Browser Alert (System Dialog)
|
|
273
|
-
|
|
274
|
-
For native browser dialogs (`window.alert`, `window.confirm`, `window.prompt`):
|
|
275
|
-
|
|
276
|
-
```gherkin
|
|
277
|
-
# Alert steps must appear BEFORE the action that triggers the dialog
|
|
278
|
-
When User click [OK] alert # accept (OK/Accept/Yes/Confirm)
|
|
279
|
-
And User click [Delete] button # this triggers the alert
|
|
280
|
-
|
|
281
|
-
When User click [Cancel] alert # dismiss (Cancel/Dismiss/No)
|
|
282
|
-
And User click [Delete] button
|
|
283
|
-
|
|
284
|
-
When User fill [Name] alert with {{v}} # fill prompt + accept
|
|
285
|
-
And User click [Rename] button
|
|
286
|
-
```
|
|
287
|
-
|
|
288
|
-
> **Important**: Register the dialog handler BEFORE the triggering action. Sungen generates `page.once('dialog', ...)` for these steps.
|
|
289
|
-
|
|
290
|
-
---
|
|
291
|
-
|
|
292
|
-
## π·οΈ Tags
|
|
293
|
-
|
|
294
|
-
### Classification Tags
|
|
295
|
-
|
|
296
|
-
| Tag | Description |
|
|
297
|
-
|-----|-------------|
|
|
298
|
-
| `@auto` | Standard scenario, ready for automation |
|
|
299
|
-
| `@manual` | Skip scenario from generation |
|
|
300
|
-
| `@smoke` | Smoke test suite |
|
|
301
|
-
| `@regression` | Regression test suite |
|
|
302
|
-
|
|
303
|
-
### Authentication Tags
|
|
304
|
-
|
|
305
|
-
| Tag | Description |
|
|
306
|
-
|-----|-------------|
|
|
307
|
-
| `@auth:<role>` | Use Playwright auth storage state for the given role |
|
|
308
|
-
| `@no-auth` | Disable inherited authentication |
|
|
309
|
-
|
|
310
|
-
Tags can be applied at **feature level** (inherited by all scenarios) or **scenario level** (overrides feature).
|
|
311
|
-
|
|
312
|
-
**Auth precedence**: Extending scenario `@auth` > Base scenario `@auth` > Feature `@auth`
|
|
313
|
-
|
|
314
|
-
### Inheritance Tags (@steps / @extend)
|
|
315
|
-
|
|
316
|
-
Use `@steps:<name>` to define a reusable block and `@extend:<name>` to inherit those steps:
|
|
317
|
-
|
|
318
|
-
```gherkin
|
|
319
|
-
@auto @auth:user @steps:kudos__open_modal
|
|
320
|
-
Scenario: Setup for opening Kudos modal
|
|
321
|
-
Given User is on [Home] page
|
|
322
|
-
When User click [Today you want...] button
|
|
323
|
-
Then User see [Send thanks] dialog # β skipped when @extend calls
|
|
324
|
-
|
|
325
|
-
@auto @auth:user @extend:kudos__open_modal
|
|
326
|
-
Scenario: User successfully sends a thank you message
|
|
327
|
-
Given User is on [Send thanks] dialog # β required: verify state after extend
|
|
328
|
-
When User fill [Search teammate] field with {{teammate_name}}
|
|
329
|
-
And User click [Send] button
|
|
330
|
-
Then User see [Success] message with {{msg_success}}
|
|
331
|
-
```
|
|
332
|
-
|
|
333
|
-
**Behavior:**
|
|
334
|
-
- `@extend` executes **only GivenβWhen** of `@steps` scenario (skips Then)
|
|
335
|
-
- The `Given` in `@extend` scenario is the **entry assertion** β confirms state after base steps ran
|
|
336
|
-
- If `@steps` scenario **fails**, `@extend` scenario is **automatically skipped**
|
|
337
|
-
- Name format: `snake_case` or `kebab-case` with module prefix: `@steps:kudos__open_modal`, `@steps:cart__add_item`
|
|
338
|
-
|
|
339
|
-
### Step-Level Annotations (comment syntax)
|
|
340
|
-
|
|
341
|
-
| Annotation | Effect |
|
|
342
|
-
|-----------|--------|
|
|
343
|
-
| `# @ignore` | Skip this step in generation |
|
|
344
|
-
| `# @ignore-testcase` | Skip entire scenario in generation |
|
|
345
|
-
|
|
346
|
-
---
|
|
347
|
-
|
|
348
|
-
## π Complete Example
|
|
349
|
-
|
|
350
|
-
```gherkin
|
|
351
|
-
@feature_auth
|
|
352
|
-
Feature: User Authentication
|
|
353
|
-
Path: /auth/login
|
|
354
|
-
|
|
355
|
-
# Happy Path
|
|
356
|
-
@auto @smoke @regression
|
|
357
|
-
Scenario: User logs in successfully with valid credentials
|
|
358
|
-
Given User is on [Login] page
|
|
359
|
-
When User fill [Email] field with {{valid_email}}
|
|
360
|
-
And User fill [Password] field with {{valid_password}}
|
|
361
|
-
And User check [Remember me] checkbox
|
|
362
|
-
And User click [Submit] button
|
|
363
|
-
Then User see [Dashboard] page
|
|
364
|
-
And User see [Welcome] heading with {{username}}
|
|
365
|
-
And User see [Logout] button is enabled
|
|
366
|
-
|
|
367
|
-
# Error Path
|
|
368
|
-
@auto @regression
|
|
369
|
-
Scenario: Login fails with invalid credentials
|
|
370
|
-
Given User is on [Login] page
|
|
371
|
-
When User fill [Email] field with {{invalid_email}}
|
|
372
|
-
And User fill [Password] field with {{invalid_password}}
|
|
373
|
-
And User click [Submit] button
|
|
374
|
-
Then User see [Login] page
|
|
375
|
-
And User see [Login error] message with {{err_invalid_credentials}}
|
|
376
|
-
And User see [Submit] button is enabled
|
|
377
|
-
|
|
378
|
-
# Registration with form controls
|
|
379
|
-
@auto @regression
|
|
380
|
-
Scenario: User registers with preferred language
|
|
381
|
-
Given User is on [Registration] page
|
|
382
|
-
When User fill [Email] field with {{new_email}}
|
|
383
|
-
And User fill [Password] field with {{new_password}}
|
|
384
|
-
And User select [Language] dropdown with {{preferred_language}}
|
|
385
|
-
And User check [Terms] checkbox
|
|
386
|
-
And User click [Sign up] button
|
|
387
|
-
Then User see [Verification] page
|
|
388
|
-
```
|
|
389
|
-
|
|
390
|
-
---
|
|
391
|
-
|
|
392
|
-
## β
Quick Reference
|
|
393
|
-
|
|
394
|
-
### Do's β
|
|
395
|
-
- Use **standard actions** from the action matrix
|
|
396
|
-
- Use **`User`** as the only actor
|
|
397
|
-
- Use **`[Target] <element type>`** format
|
|
398
|
-
- Use **`{{snake_case}}`** for values
|
|
399
|
-
- Use **`is <state>`** for state assertions
|
|
400
|
-
- Use **tags** (`@auth`, `@steps`, `@extend`) for scenario management
|
|
401
|
-
- **1 Scenario = 1 business flow**
|
|
402
|
-
- **1 Step = 1 action or assertion**
|
|
403
|
-
|
|
404
|
-
### Don'ts β
|
|
405
|
-
- No synonyms or free-text variations
|
|
406
|
-
- No system/backend/API as actors
|
|
407
|
-
- No technical selectors (CSS/XPath/ID)
|
|
408
|
-
- No hard-coded data in steps
|
|
409
|
-
- No compound actions
|
|
410
|
-
- No `verify`/`check`/`expect` (use `see`)
|
|
411
|
-
- No `open` (use `is on`)
|
|
412
|
-
- No `click` on checkbox/toggle (use `check`/`uncheck`)
|
|
413
|
-
- No `uncheck` on radio (use `check` on another option)
|
|
414
|
-
|
|
415
|
-
### Common Errors
|
|
416
|
-
|
|
417
|
-
| β Wrong | β
Correct | Reason |
|
|
418
|
-
|---|---|---|
|
|
419
|
-
| `Given User click [Login] button` | `When User click [Login] button` | `click` belongs to WHEN |
|
|
420
|
-
| `When User click [Terms] checkbox` | `When User check [Terms] checkbox` | Use `check` for checkbox |
|
|
421
|
-
| `When User press [Submit] button` | `When User press [Enter] key` | `press` only with `key` |
|
|
422
|
-
| `When User uncheck [Male] radio` | `When User check [Female] radio` | Radio cannot uncheck |
|
|
423
|
-
| `fill [email] with {{admin@mail}}` | `fill [email] field with {{admin_email}}` | No hardcode + missing type |
|
|
424
|
-
| `see [msg] with {{text}} hidden` | `see [msg] with {{text}} is hidden` | Missing `is` keyword |
|
|
425
|
-
| `see [btn] button with {{disabled}}` | `see [btn] button is disabled` | State uses `is`, not `{{}}` |
|
|
426
|
-
|
|
427
|
-
---
|
|
428
|
-
|
|
429
|
-
**Version**: 2.1
|
|
430
|
-
**Status**: Final
|
|
431
|
-
**Last Updated**: March 31, 2026
|