@sun-asterisk/sungen 2.2.2 → 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 +66 -37
- 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 +17 -3
- package/dist/generators/gherkin-parser/index.js.map +1 -1
- package/dist/generators/test-generator/adapters/playwright/templates/steps/actions/alert-accept-action.hbs +1 -0
- package/dist/generators/test-generator/adapters/playwright/templates/steps/actions/alert-dismiss-action.hbs +1 -0
- package/dist/generators/test-generator/adapters/playwright/templates/steps/actions/alert-fill-action.hbs +1 -0
- package/dist/generators/test-generator/adapters/playwright/templates/steps/assertions/alert-text-assertion.hbs +8 -0
- package/dist/generators/test-generator/adapters/playwright/templates/steps/assertions/attribute-assertion.hbs +3 -0
- package/dist/generators/test-generator/adapters/playwright/templates/steps/assertions/have-value-assertion.hbs +1 -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 +95 -57
- 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/interaction-patterns.d.ts +1 -1
- package/dist/generators/test-generator/patterns/interaction-patterns.d.ts.map +1 -1
- package/dist/generators/test-generator/patterns/interaction-patterns.js +56 -1
- package/dist/generators/test-generator/patterns/interaction-patterns.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/generators/test-generator/utils/selector-resolver.d.ts.map +1 -1
- package/dist/generators/test-generator/utils/selector-resolver.js +16 -0
- package/dist/generators/test-generator/utils/selector-resolver.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 +11 -6
- package/dist/orchestrator/templates/ai-instructions/claude-skill-error-mapping.md +22 -9
- package/dist/orchestrator/templates/ai-instructions/claude-skill-gherkin-syntax.md +170 -24
- package/dist/orchestrator/templates/ai-instructions/claude-skill-selector-fix.md +118 -12
- package/dist/orchestrator/templates/ai-instructions/claude-skill-selector-keys.md +16 -2
- 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 +11 -6
- package/dist/orchestrator/templates/ai-instructions/github-skill-sungen-error-mapping.md +22 -9
- package/dist/orchestrator/templates/ai-instructions/github-skill-sungen-gherkin-syntax.md +170 -24
- package/dist/orchestrator/templates/ai-instructions/github-skill-sungen-selector-fix.md +93 -12
- package/dist/orchestrator/templates/ai-instructions/github-skill-sungen-selector-keys.md +16 -2
- 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 +20 -3
- package/src/generators/test-generator/adapters/playwright/templates/steps/actions/alert-accept-action.hbs +1 -0
- package/src/generators/test-generator/adapters/playwright/templates/steps/actions/alert-dismiss-action.hbs +1 -0
- package/src/generators/test-generator/adapters/playwright/templates/steps/actions/alert-fill-action.hbs +1 -0
- package/src/generators/test-generator/adapters/playwright/templates/steps/assertions/alert-text-assertion.hbs +8 -0
- package/src/generators/test-generator/adapters/playwright/templates/steps/assertions/attribute-assertion.hbs +3 -0
- package/src/generators/test-generator/adapters/playwright/templates/steps/assertions/have-value-assertion.hbs +1 -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 +106 -65
- package/src/generators/test-generator/patterns/index.ts +41 -0
- package/src/generators/test-generator/patterns/interaction-patterns.ts +58 -1
- package/src/generators/test-generator/patterns/table-patterns.ts +8 -5
- package/src/generators/test-generator/utils/selector-resolver.ts +16 -0
- 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 +11 -6
- package/src/orchestrator/templates/ai-instructions/claude-skill-error-mapping.md +22 -9
- package/src/orchestrator/templates/ai-instructions/claude-skill-gherkin-syntax.md +170 -24
- package/src/orchestrator/templates/ai-instructions/claude-skill-selector-fix.md +118 -12
- package/src/orchestrator/templates/ai-instructions/claude-skill-selector-keys.md +16 -2
- 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 +11 -6
- package/src/orchestrator/templates/ai-instructions/github-skill-sungen-error-mapping.md +22 -9
- package/src/orchestrator/templates/ai-instructions/github-skill-sungen-gherkin-syntax.md +170 -24
- package/src/orchestrator/templates/ai-instructions/github-skill-sungen-selector-fix.md +93 -12
- package/src/orchestrator/templates/ai-instructions/github-skill-sungen-selector-keys.md +16 -2
- 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 -428
- package/docs/gherkin standards/gherkin-core-standard.vi.md +0 -513
- package/docs/gherkin-dictionary.md +0 -1071
- package/docs/makeauth.md +0 -225
|
@@ -1,428 +0,0 @@
|
|
|
1
|
-
# Gherkin Standard - Core (v2)
|
|
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
|
-
- **1 Scenario = 1 complete business behavior**
|
|
19
|
-
- **Given**: Initial state / preconditions
|
|
20
|
-
- **When**: Main action (trigger)
|
|
21
|
-
- **Then**: Observable result (assertion)
|
|
22
|
-
|
|
23
|
-
### Example
|
|
24
|
-
```gherkin
|
|
25
|
-
Scenario: User logs in successfully with valid credentials
|
|
26
|
-
Given User is on [Login] page
|
|
27
|
-
When User fill [Email] field with {{valid_email}}
|
|
28
|
-
And User fill [Password] field with {{valid_password}}
|
|
29
|
-
And User click [Submit] button
|
|
30
|
-
Then User see [Dashboard] page
|
|
31
|
-
```
|
|
32
|
-
|
|
33
|
-
---
|
|
34
|
-
|
|
35
|
-
## 2️⃣ Grammar (Step Level)
|
|
36
|
-
|
|
37
|
-
### Format
|
|
38
|
-
```
|
|
39
|
-
[Keyword] User <Action> [<Target>] <Target Type> <with {{Value}}> <is State>
|
|
40
|
-
```
|
|
41
|
-
|
|
42
|
-
### Rules
|
|
43
|
-
- ✅ `Actor` + `Action` are **mandatory**
|
|
44
|
-
- ✅ `Target` is **required** for most actions (except `wait for N seconds`)
|
|
45
|
-
- ✅ `with {{Value}}` only used when action requires data
|
|
46
|
-
- ✅ `is State` only used for assertions and wait conditions
|
|
47
|
-
- ❌ No free-text variations
|
|
48
|
-
- ❌ No synonyms
|
|
49
|
-
|
|
50
|
-
### Structure Breakdown
|
|
51
|
-
|
|
52
|
-
| Component | Required | Example |
|
|
53
|
-
|-----------|----------|---------|
|
|
54
|
-
| Actor | ✅ Always | `User` |
|
|
55
|
-
| Action | ✅ Always | `click`, `fill`, `see` |
|
|
56
|
-
| Target | ✅ Most cases | `[Login] button` |
|
|
57
|
-
| Value | ⚠️ When needed | `{{valid_email}}` |
|
|
58
|
-
| State | ⚠️ Assertions only | `is disabled` |
|
|
59
|
-
|
|
60
|
-
---
|
|
61
|
-
|
|
62
|
-
## 3️⃣ Actor
|
|
63
|
-
|
|
64
|
-
### Allowed Actor
|
|
65
|
-
- ✅ **`User`** (only)
|
|
66
|
-
|
|
67
|
-
### Rules
|
|
68
|
-
- **Only use**: `User`
|
|
69
|
-
- **Do NOT use**: `System`, `Backend`, `API`, `App`
|
|
70
|
-
- System behavior is verified using `Then`, not as an Actor
|
|
71
|
-
|
|
72
|
-
### Examples
|
|
73
|
-
```gherkin
|
|
74
|
-
✅ User is on [Login] page
|
|
75
|
-
✅ User click [Submit] button
|
|
76
|
-
❌ System sends verification email
|
|
77
|
-
❌ Backend validates password
|
|
78
|
-
❌ API returns success response
|
|
79
|
-
```
|
|
80
|
-
|
|
81
|
-
> **Rationale**: System behavior is an *outcome* to verify, not an actor performing steps.
|
|
82
|
-
|
|
83
|
-
---
|
|
84
|
-
|
|
85
|
-
## 4️⃣ Action
|
|
86
|
-
|
|
87
|
-
### Allowed Actions
|
|
88
|
-
|
|
89
|
-
| Group | Action | Use Case | Example |
|
|
90
|
-
|-------|--------|----------|---------|
|
|
91
|
-
| **Setup** | `is on` | Navigate to page/dialog | `User is on [Login] page` |
|
|
92
|
-
| **Setup** | `navigate to` | Navigate with data | `User navigate to [Profile] page with {{user_id}}` |
|
|
93
|
-
| **Interaction** | `click` | Click button/link/element | `User click [Submit] button` |
|
|
94
|
-
| **Interaction** | `double click` | Double click element | `User double click [Cell] element` |
|
|
95
|
-
| **Interaction** | `hover` | Hover over element | `User hover [Info] icon` |
|
|
96
|
-
| **Interaction** | `drag` | Drag to destination | `User drag [Card] to [Column]` |
|
|
97
|
-
| **Form** | `fill` | Enter text in field | `User fill [Email] field with {{email}}` |
|
|
98
|
-
| **Form** | `clear` | Clear field content | `User clear [Search] field` |
|
|
99
|
-
| **Form** | `select` | Choose from dropdown | `User select [Country] dropdown with {{country}}` |
|
|
100
|
-
| **Form** | `check` | Check checkbox | `User check [Remember me] checkbox` |
|
|
101
|
-
| **Form** | `uncheck` | Uncheck checkbox | `User uncheck [Newsletter] checkbox` |
|
|
102
|
-
| **Form** | `toggle` | Toggle switch | `User toggle [Dark mode] switch` |
|
|
103
|
-
| **Form** | `upload` | Upload file | `User upload [Avatar] file with {{path}}` |
|
|
104
|
-
| **Keyboard** | `press` | Press key (global or on element) | `User press Enter on [Search] field` |
|
|
105
|
-
| **Scroll** | `scroll to` | Scroll element into view | `User scroll to [Footer] section` |
|
|
106
|
-
| **Frame** | `switch to` | Enter/exit iframe | `User switch to [Payment] frame` |
|
|
107
|
-
| **Expand** | `expand` / `collapse` | Expand/collapse row | `User expand [Row 1] row` |
|
|
108
|
-
| **Wait** | `wait for` | Wait for element/timeout | `User wait for [Loading] spinner is hidden` |
|
|
109
|
-
| **Assertion** | `see` | Verify visibility/state/text | `User see [Error] message` |
|
|
110
|
-
|
|
111
|
-
### Rules
|
|
112
|
-
- ✅ Use **exact verbs** from the list above
|
|
113
|
-
- ❌ No synonyms: `type`, `enter`, `input`, `verify`, `expect`, `open`, etc.
|
|
114
|
-
- ❌ No compound actions: `click and wait`, `fill and submit`
|
|
115
|
-
|
|
116
|
-
### Anti-patterns
|
|
117
|
-
```gherkin
|
|
118
|
-
❌ User types {{password}} into [Password] field → use "fill"
|
|
119
|
-
❌ User opens [Home] page → use "is on"
|
|
120
|
-
❌ User checks [Terms] checkbox → use "check" (no "s")
|
|
121
|
-
❌ User verifies [Success] message appears → use "see"
|
|
122
|
-
```
|
|
123
|
-
|
|
124
|
-
---
|
|
125
|
-
|
|
126
|
-
## 5️⃣ Target
|
|
127
|
-
|
|
128
|
-
### Format
|
|
129
|
-
```
|
|
130
|
-
[name] <element type>
|
|
131
|
-
```
|
|
132
|
-
|
|
133
|
-
### Element Types
|
|
134
|
-
|
|
135
|
-
| Element Type | When to Use | Example |
|
|
136
|
-
|--------------|-------------|---------|
|
|
137
|
-
| `page` | Entire screen/page | `[Login] page` |
|
|
138
|
-
| `button` | Clickable button | `[Submit] button` |
|
|
139
|
-
| `link` | Hyperlink | `[Forgot password] link` |
|
|
140
|
-
| `field` | Text input | `[Email] field` |
|
|
141
|
-
| `textarea` | Text area / rich editor | `[Message] textarea` |
|
|
142
|
-
| `heading` | Heading element | `[Welcome] heading` |
|
|
143
|
-
| `text` | Text content | `[Price] text` |
|
|
144
|
-
| `checkbox` | Checkbox input | `[Remember me] checkbox` |
|
|
145
|
-
| `radio` | Radio button | `[Payment method] radio` |
|
|
146
|
-
| `switch` | Toggle switch | `[Dark mode] switch` |
|
|
147
|
-
| `dropdown` | Select / combobox | `[Country] dropdown` |
|
|
148
|
-
| `dialog` / `modal` | Modal / dialog overlay | `[Confirm] dialog` |
|
|
149
|
-
| `menu` / `menuitem` | Menu elements | `[Write Kudos] menuitem` |
|
|
150
|
-
| `tab` / `tabpanel` | Tab elements | `[Settings] tab` |
|
|
151
|
-
| `table` / `row` / `cell` | Table elements | `[Users] table` |
|
|
152
|
-
| `list` / `listitem` | List elements | `[Results] list` |
|
|
153
|
-
| `icon` / `image` | Visual icon/image | `[Close] icon` |
|
|
154
|
-
| `alert` | Alert/notification | `[Error] alert` |
|
|
155
|
-
| `spinner` / `progressbar` | Loading indicators | `[Loading] spinner` |
|
|
156
|
-
| `section` / `region` / `nav` | Layout landmarks | `[Footer] section` |
|
|
157
|
-
| `frame` / `iframe` | Iframe elements | `[Payment] frame` |
|
|
158
|
-
| `uploader` / `file` | File upload | `[Avatar] uploader` |
|
|
159
|
-
| `columnheader` | Table column header | `[Name] columnheader` |
|
|
160
|
-
| `tooltip` | Tooltip | `[Help] tooltip` |
|
|
161
|
-
| `slider` | Slider/range | `[Volume] slider` |
|
|
162
|
-
| `tree` / `treeitem` | Tree elements | `[Folder] treeitem` |
|
|
163
|
-
|
|
164
|
-
### Rules
|
|
165
|
-
- ✅ Use **business/UI meaningful names**, not technical selectors
|
|
166
|
-
- ✅ Keep names **simple and descriptive**
|
|
167
|
-
- ❌ No CSS selectors: `#email`, `.btn-primary`
|
|
168
|
-
- ❌ No XPath: `//input[@id='email']`
|
|
169
|
-
- ❌ No IDs: `email-input`, `submit-btn-123`
|
|
170
|
-
|
|
171
|
-
### Examples
|
|
172
|
-
```gherkin
|
|
173
|
-
✅ User click [Login] button
|
|
174
|
-
✅ User fill [Email address] field with {{email}}
|
|
175
|
-
✅ User select [Country] dropdown with {{country}}
|
|
176
|
-
✅ User see [Welcome back] heading
|
|
177
|
-
|
|
178
|
-
❌ User click [#submit-btn] button
|
|
179
|
-
❌ User fill [input.email-field] field
|
|
180
|
-
❌ User see [div.alert-success] message
|
|
181
|
-
```
|
|
182
|
-
|
|
183
|
-
---
|
|
184
|
-
|
|
185
|
-
## 6️⃣ Value
|
|
186
|
-
|
|
187
|
-
### Format
|
|
188
|
-
```
|
|
189
|
-
{{value}}
|
|
190
|
-
```
|
|
191
|
-
|
|
192
|
-
### Naming Convention
|
|
193
|
-
- **snake_case** (lowercase with underscores)
|
|
194
|
-
- Descriptive and context-aware
|
|
195
|
-
|
|
196
|
-
### Rules
|
|
197
|
-
- ✅ Use `{{variable}}` syntax
|
|
198
|
-
- ✅ Name reflects **data purpose**, not data content
|
|
199
|
-
- ❌ No hard-coded data in steps
|
|
200
|
-
- ❌ No real data (emails, passwords, tokens)
|
|
201
|
-
- ❌ No environment-specific values (URLs, API keys)
|
|
202
|
-
|
|
203
|
-
### Examples
|
|
204
|
-
|
|
205
|
-
| ✅ Good | ❌ Bad |
|
|
206
|
-
|--------|-------|
|
|
207
|
-
| `{{valid_email}}` | `{{user@example.com}}` |
|
|
208
|
-
| `{{invalid_password}}` | `{{123456}}` |
|
|
209
|
-
| `{{expired_otp}}` | `{{999999}}` |
|
|
210
|
-
| `{{admin_username}}` | `{{admin}}` |
|
|
211
|
-
| `{{product_name}}` | `{{iPhone 15 Pro}}` |
|
|
212
|
-
|
|
213
|
-
### Data Organization
|
|
214
|
-
```yaml
|
|
215
|
-
# test-data/login.yaml
|
|
216
|
-
valid_email: "user@example.com"
|
|
217
|
-
valid_password: "SecurePass123!"
|
|
218
|
-
invalid_email: "not-an-email"
|
|
219
|
-
expired_otp: "000000"
|
|
220
|
-
```
|
|
221
|
-
|
|
222
|
-
---
|
|
223
|
-
|
|
224
|
-
## 7️⃣ Assertion
|
|
225
|
-
|
|
226
|
-
### Verb
|
|
227
|
-
- **Only**: `see`
|
|
228
|
-
|
|
229
|
-
### Rules
|
|
230
|
-
- ✅ Assertions **only appear in `Then`** steps
|
|
231
|
-
- ✅ Verify **system state / output**
|
|
232
|
-
- ✅ Each step = **1 assertion**
|
|
233
|
-
- ❌ Do not describe user actions
|
|
234
|
-
- ❌ No synonyms: `verify`, `expect`, `check`, `observe`, `validate`
|
|
235
|
-
|
|
236
|
-
### Examples
|
|
237
|
-
```gherkin
|
|
238
|
-
✅ Then User see [Error] message
|
|
239
|
-
✅ And User see [Dashboard] page
|
|
240
|
-
✅ And User see [Welcome] heading with {{username}}
|
|
241
|
-
✅ And User see [Submit] button is disabled
|
|
242
|
-
|
|
243
|
-
❌ Then User verifies [Error] message
|
|
244
|
-
❌ Then System displays [Dashboard] page
|
|
245
|
-
❌ Then [Success] message appears
|
|
246
|
-
```
|
|
247
|
-
|
|
248
|
-
### Assertion Patterns
|
|
249
|
-
|
|
250
|
-
| Pattern | Use Case | Example |
|
|
251
|
-
|---------|----------|---------|
|
|
252
|
-
| Simple visibility | Element is visible | `User see [Login] button` |
|
|
253
|
-
| Visibility with value | Element has specific text | `User see [Welcome] heading with {{username}}` |
|
|
254
|
-
| State assertion | Element state | `User see [Submit] button is disabled` |
|
|
255
|
-
| State with value | Element with text + state | `User see [Panel] dialog with {{title}} is hidden` |
|
|
256
|
-
| Text contains | Partial text match | `User see [Message] text contains {{partial}}` |
|
|
257
|
-
| Text has text | Exact text match | `User see [Counter] text has text {{count}}` |
|
|
258
|
-
| Has attribute | Attribute check | `User see [Avatar] image has {{avatar_url}}` |
|
|
259
|
-
|
|
260
|
-
### State Modifiers
|
|
261
|
-
|
|
262
|
-
| State | Assertion |
|
|
263
|
-
|-------|-----------|
|
|
264
|
-
| `hidden` | Element is not visible |
|
|
265
|
-
| `visible` | Element is visible |
|
|
266
|
-
| `disabled` | Element is disabled |
|
|
267
|
-
| `enabled` | Element is enabled |
|
|
268
|
-
| `checked` | Checkbox/radio is checked |
|
|
269
|
-
| `unchecked` | Checkbox/radio is unchecked |
|
|
270
|
-
| `focused` | Element has focus |
|
|
271
|
-
| `empty` | Element has no text |
|
|
272
|
-
| `loading` | Loading indicator is visible |
|
|
273
|
-
| `selected` | Element is selected |
|
|
274
|
-
| `sorted ascending` | Column sorted ascending |
|
|
275
|
-
| `sorted descending` | Column sorted descending |
|
|
276
|
-
|
|
277
|
-
### Table Assertions
|
|
278
|
-
|
|
279
|
-
| Pattern | Example |
|
|
280
|
-
|---------|---------|
|
|
281
|
-
| Row exists | `User see [Users] table row with {{name}} has [Status] with {{status}}` |
|
|
282
|
-
| No row | `User see [Users] table has no row with {{name}}` |
|
|
283
|
-
| Row count | `User see [Users] table has {{count}} rows` |
|
|
284
|
-
| Column exists | `User see [Users] table has [Email] column` |
|
|
285
|
-
| Cell by index | `User see [Users] table row 1 [Name] cell with {{name}}` |
|
|
286
|
-
| Empty table | `User see [Users] table is empty` |
|
|
287
|
-
| Action in row | `User click [Edit] in [Users] table row with {{name}}` |
|
|
288
|
-
|
|
289
|
-
---
|
|
290
|
-
|
|
291
|
-
## 🏷️ Tags
|
|
292
|
-
|
|
293
|
-
### Scenario Tags
|
|
294
|
-
|
|
295
|
-
| Tag | Description |
|
|
296
|
-
|-----|-------------|
|
|
297
|
-
| `@auth:<role>` | Use Playwright auth storage state for the given role |
|
|
298
|
-
| `@no-auth` | Disable inherited authentication |
|
|
299
|
-
| `@steps:<name>` | Mark scenario as a reusable step block |
|
|
300
|
-
| `@extend:<name>` | Prepend steps from a `@steps` block before own steps |
|
|
301
|
-
| `@manual` | Skip scenario from generation |
|
|
302
|
-
|
|
303
|
-
Tags can be applied at **feature level** (inherited by all scenarios) or **scenario level** (overrides feature).
|
|
304
|
-
|
|
305
|
-
**Auth precedence**: Extending scenario `@auth` > Base scenario `@auth` > Feature `@auth`
|
|
306
|
-
|
|
307
|
-
### Reusable Steps (@steps / @extend)
|
|
308
|
-
|
|
309
|
-
Use `@steps:<name>` to define a reusable block and `@extend:<name>` to inherit those steps:
|
|
310
|
-
|
|
311
|
-
```gherkin
|
|
312
|
-
@auth:user @steps:open-dialog
|
|
313
|
-
Scenario: Open kudos dialog
|
|
314
|
-
Given User is on [kudo] page
|
|
315
|
-
When User click [Notifications] button
|
|
316
|
-
And User click [Write Kudos] menuitem
|
|
317
|
-
Then User see [panel] dialog with {{kudo_title}}
|
|
318
|
-
|
|
319
|
-
@auth:user @extend:open-dialog
|
|
320
|
-
Scenario: User sends a thank you message
|
|
321
|
-
Given User is on [panel] dialog with {{kudo_title}}
|
|
322
|
-
When User click [Search] button
|
|
323
|
-
And User fill [Search] field with {{teammate_name}}
|
|
324
|
-
And User click [teammate] row with {{teammate_name}}
|
|
325
|
-
And User fill [Title] field with {{teammate_title}}
|
|
326
|
-
And User click [Send] button
|
|
327
|
-
And User wait for [panel] dialog with {{kudo_title}} is hidden
|
|
328
|
-
Then User see [panel] modal with {{kudo_title}} is hidden
|
|
329
|
-
```
|
|
330
|
-
|
|
331
|
-
**Behavior:**
|
|
332
|
-
- `@steps` scenarios generate their own test AND register steps for reuse
|
|
333
|
-
- `@extend` scenarios get base steps prepended inline — fully self-contained test
|
|
334
|
-
- Multiple scenarios can extend the same `@steps` block
|
|
335
|
-
- Generated code includes section comments: `// [from @steps:<name>]`
|
|
336
|
-
|
|
337
|
-
### Step-Level Annotations (comment syntax)
|
|
338
|
-
|
|
339
|
-
| Annotation | Effect |
|
|
340
|
-
|-----------|--------|
|
|
341
|
-
| `# @ignore` | Skip this step in generation |
|
|
342
|
-
| `# @ignore-testcase` | Skip entire scenario in generation |
|
|
343
|
-
| `# @skip-production` | Skip step in production environment |
|
|
344
|
-
|
|
345
|
-
---
|
|
346
|
-
|
|
347
|
-
## 📋 Complete Example
|
|
348
|
-
|
|
349
|
-
```gherkin
|
|
350
|
-
@auth:user
|
|
351
|
-
Feature: User Authentication
|
|
352
|
-
Path: /auth/login
|
|
353
|
-
|
|
354
|
-
Scenario: User logs in successfully with valid credentials
|
|
355
|
-
Given User is on [Login] page
|
|
356
|
-
When User fill [Email] field with {{valid_email}}
|
|
357
|
-
And User fill [Password] field with {{valid_password}}
|
|
358
|
-
And User check [Remember me] checkbox
|
|
359
|
-
And User click [Submit] button
|
|
360
|
-
Then User see [Dashboard] page
|
|
361
|
-
And User see [Welcome] heading with {{username}}
|
|
362
|
-
|
|
363
|
-
Scenario: User fails to login with invalid credentials
|
|
364
|
-
Given User is on [Login] page
|
|
365
|
-
When User fill [Email] field with {{invalid_email}}
|
|
366
|
-
And User fill [Password] field with {{invalid_password}}
|
|
367
|
-
And User click [Submit] button
|
|
368
|
-
Then User see [Error] alert
|
|
369
|
-
And User see [Login] page
|
|
370
|
-
And User see [Submit] button is enabled
|
|
371
|
-
|
|
372
|
-
Scenario: User selects preferred language during registration
|
|
373
|
-
Given User is on [Registration] page
|
|
374
|
-
When User fill [Email] field with {{new_email}}
|
|
375
|
-
And User fill [Password] field with {{new_password}}
|
|
376
|
-
And User select [Language] dropdown with {{preferred_language}}
|
|
377
|
-
And User check [Terms] checkbox
|
|
378
|
-
And User click [Sign up] button
|
|
379
|
-
Then User see [Verification] page
|
|
380
|
-
```
|
|
381
|
-
|
|
382
|
-
---
|
|
383
|
-
|
|
384
|
-
## ✅ Quick Reference
|
|
385
|
-
|
|
386
|
-
### Do's ✅
|
|
387
|
-
- Use **standard actions** from section 4
|
|
388
|
-
- Use **`User`** as the only actor
|
|
389
|
-
- Use **`[Target] <element type>`** format
|
|
390
|
-
- Use **`{{snake_case}}`** for values
|
|
391
|
-
- Use **`is <state>`** for state assertions
|
|
392
|
-
- **1 Scenario = 1 business flow**
|
|
393
|
-
- **1 Step = 1 action or assertion**
|
|
394
|
-
|
|
395
|
-
### Don'ts ❌
|
|
396
|
-
- No synonyms or free-text variations
|
|
397
|
-
- No system/backend/API as actors
|
|
398
|
-
- No technical selectors (CSS/XPath/ID)
|
|
399
|
-
- No hard-coded data in steps
|
|
400
|
-
- No compound actions
|
|
401
|
-
- No `verify`/`check`/`expect` (use `see`)
|
|
402
|
-
- No `open` (use `is on`)
|
|
403
|
-
|
|
404
|
-
---
|
|
405
|
-
|
|
406
|
-
## 🎯 Benefits
|
|
407
|
-
|
|
408
|
-
| Benefit | Description |
|
|
409
|
-
|---------|-------------|
|
|
410
|
-
| **Consistency** | Same patterns across all test cases |
|
|
411
|
-
| **Readability** | Non-technical stakeholders can understand |
|
|
412
|
-
| **Maintainability** | Easy to update when UI changes |
|
|
413
|
-
| **Automation-Ready** | Direct mapping to Playwright code via 17 pattern shapes |
|
|
414
|
-
| **No Ambiguity** | Single interpretation per step |
|
|
415
|
-
| **Tool Support** | Compatible with Sungen v2 compiler |
|
|
416
|
-
|
|
417
|
-
---
|
|
418
|
-
|
|
419
|
-
## 📚 Related Documentation
|
|
420
|
-
- [Gherkin Dictionary](../gherkin-dictionary.md) — Full grammar, all 17 patterns, compiler rules
|
|
421
|
-
- [Sungen GitHub](https://github.com/sun-asterisk/sungen)
|
|
422
|
-
- [Playwright Documentation](https://playwright.dev)
|
|
423
|
-
|
|
424
|
-
---
|
|
425
|
-
|
|
426
|
-
**Version**: 2.0
|
|
427
|
-
**Status**: Final
|
|
428
|
-
**Last Updated**: March 19, 2026
|