@esimplicitylabs/katalyst-xspec 0.6.0 → 0.7.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.
- package/README.md +7 -3
- package/cli/init.cjs +111 -97
- package/cli/upgrade.cjs +63 -1
- package/dist/{chunk-ACAXOGKZ.js → chunk-UTTKW2SR.js} +106 -165
- package/dist/index.d.ts +6 -3
- package/dist/index.js +3 -4
- package/dist/steps/index.d.ts +0 -9
- package/dist/steps/index.js +1 -1
- package/package.json +2 -2
- package/skills/katalyst-bdd-architecture/SKILL.md +10 -9
- package/skills/katalyst-bdd-architecture/references/adapters.md +1 -1
- package/skills/katalyst-bdd-architecture/references/custom-steps.md +15 -19
- package/skills/katalyst-bdd-create-test/SKILL.md +34 -29
- package/skills/katalyst-bdd-create-test/references/api-patterns.md +0 -15
- package/skills/katalyst-bdd-create-test/references/hybrid-patterns.md +1 -14
- package/skills/katalyst-bdd-create-test/references/tui-patterns.md +3 -27
- package/skills/katalyst-bdd-create-test/references/ui-patterns.md +0 -19
- package/skills/katalyst-bdd-quickstart/SKILL.md +57 -55
- package/skills/katalyst-bdd-step-reference/SKILL.md +15 -19
- package/skills/katalyst-bdd-step-reference/references/api-steps.md +1 -2
- package/skills/katalyst-bdd-step-reference/references/shared-steps.md +1 -5
- package/skills/katalyst-bdd-step-reference/references/tui-steps.md +7 -5
- package/skills/katalyst-bdd-step-reference/references/ui-steps.md +1 -2
- package/skills/katalyst-bdd-troubleshooting/SKILL.md +23 -24
|
@@ -4,7 +4,7 @@ Common patterns for hybrid testing (combining API and UI) with the Katalyst BDD
|
|
|
4
4
|
|
|
5
5
|
## Core Principle
|
|
6
6
|
|
|
7
|
-
Hybrid tests
|
|
7
|
+
Hybrid tests are scenarios that mix API and UI steps. No tag is needed — every step works in any scenario. Put them in a folder a project reads (e.g. `features/ui/`). The typical flow:
|
|
8
8
|
1. **Setup** - Create test data via API (fast, reliable)
|
|
9
9
|
2. **Test** - Verify behavior in UI (user-facing validation)
|
|
10
10
|
3. **Cleanup** - Remove test data via API (automatic)
|
|
@@ -14,7 +14,6 @@ Hybrid tests use `@hybrid` tag to access both API and UI steps. The typical flow
|
|
|
14
14
|
### Create via API, Verify in UI
|
|
15
15
|
|
|
16
16
|
```gherkin
|
|
17
|
-
@hybrid
|
|
18
17
|
Scenario: Create user via API, verify in admin panel
|
|
19
18
|
# API: Create test data
|
|
20
19
|
Given I am authenticated as an admin via API
|
|
@@ -39,7 +38,6 @@ Scenario: Create user via API, verify in admin panel
|
|
|
39
38
|
### Setup Data, Test Workflow
|
|
40
39
|
|
|
41
40
|
```gherkin
|
|
42
|
-
@hybrid
|
|
43
41
|
Scenario: Test order workflow with pre-created product
|
|
44
42
|
# API: Create product
|
|
45
43
|
Given I am authenticated as an admin via API
|
|
@@ -67,7 +65,6 @@ Scenario: Test order workflow with pre-created product
|
|
|
67
65
|
### Verify API Changes Reflect in UI
|
|
68
66
|
|
|
69
67
|
```gherkin
|
|
70
|
-
@hybrid
|
|
71
68
|
Scenario: API update reflects in UI
|
|
72
69
|
# API: Create and update
|
|
73
70
|
Given I am authenticated as an admin via API
|
|
@@ -96,7 +93,6 @@ Scenario: API update reflects in UI
|
|
|
96
93
|
### Share IDs Between Layers
|
|
97
94
|
|
|
98
95
|
```gherkin
|
|
99
|
-
@hybrid
|
|
100
96
|
Scenario: Use API-created ID in UI navigation
|
|
101
97
|
# API: Create resource
|
|
102
98
|
Given I am authenticated as an admin via API
|
|
@@ -117,7 +113,6 @@ Scenario: Use API-created ID in UI navigation
|
|
|
117
113
|
### Share Data Between Layers
|
|
118
114
|
|
|
119
115
|
```gherkin
|
|
120
|
-
@hybrid
|
|
121
116
|
Scenario: Verify API data in UI
|
|
122
117
|
# Setup variables
|
|
123
118
|
Given I generate a UUID and store as "runId"
|
|
@@ -148,7 +143,6 @@ Scenario: Verify API data in UI
|
|
|
148
143
|
### Separate API and UI Auth
|
|
149
144
|
|
|
150
145
|
```gherkin
|
|
151
|
-
@hybrid
|
|
152
146
|
Scenario: Different auth for API vs UI
|
|
153
147
|
# API: Admin creates data
|
|
154
148
|
Given I am authenticated as an admin via API
|
|
@@ -169,7 +163,6 @@ Scenario: Different auth for API vs UI
|
|
|
169
163
|
### Use API Token in UI
|
|
170
164
|
|
|
171
165
|
```gherkin
|
|
172
|
-
@hybrid
|
|
173
166
|
Scenario: Get token from API, use in UI
|
|
174
167
|
# API: Login and get token
|
|
175
168
|
When I POST "/auth/login" with JSON body:
|
|
@@ -190,7 +183,6 @@ Scenario: Get token from API, use in UI
|
|
|
190
183
|
### Multi-Step Business Process
|
|
191
184
|
|
|
192
185
|
```gherkin
|
|
193
|
-
@hybrid
|
|
194
186
|
Scenario: Complete order processing workflow
|
|
195
187
|
# API: Setup - Create customer and product
|
|
196
188
|
Given I am authenticated as an admin via API
|
|
@@ -228,7 +220,6 @@ Scenario: Complete order processing workflow
|
|
|
228
220
|
### Data Synchronization Test
|
|
229
221
|
|
|
230
222
|
```gherkin
|
|
231
|
-
@hybrid
|
|
232
223
|
Scenario: Real-time sync between API and UI
|
|
233
224
|
Given I am authenticated as an admin via API
|
|
234
225
|
Given I generate a UUID and store as "runId"
|
|
@@ -264,7 +255,6 @@ Scenario: Real-time sync between API and UI
|
|
|
264
255
|
### Clean State Between Tests
|
|
265
256
|
|
|
266
257
|
```gherkin
|
|
267
|
-
@hybrid
|
|
268
258
|
Feature: User Settings
|
|
269
259
|
|
|
270
260
|
Background:
|
|
@@ -301,7 +291,6 @@ Feature: User Settings
|
|
|
301
291
|
### Seed Multiple Resources
|
|
302
292
|
|
|
303
293
|
```gherkin
|
|
304
|
-
@hybrid
|
|
305
294
|
Scenario: Dashboard with multiple data types
|
|
306
295
|
Given I am authenticated as an admin via API
|
|
307
296
|
Given I generate a UUID and store as "runId"
|
|
@@ -339,7 +328,6 @@ Scenario: Dashboard with multiple data types
|
|
|
339
328
|
### Test Error States
|
|
340
329
|
|
|
341
330
|
```gherkin
|
|
342
|
-
@hybrid
|
|
343
331
|
Scenario: UI shows error when API resource deleted
|
|
344
332
|
# API: Create and immediately delete
|
|
345
333
|
Given I am authenticated as an admin via API
|
|
@@ -361,7 +349,6 @@ Scenario: UI shows error when API resource deleted
|
|
|
361
349
|
## Complete Example: User Onboarding Flow
|
|
362
350
|
|
|
363
351
|
```gherkin
|
|
364
|
-
@hybrid
|
|
365
352
|
Feature: User Onboarding
|
|
366
353
|
As a product owner
|
|
367
354
|
I want to test the complete onboarding flow
|
|
@@ -7,7 +7,6 @@ Common patterns for TUI (Terminal User Interface) testing with the Katalyst BDD
|
|
|
7
7
|
### Start and Verify
|
|
8
8
|
|
|
9
9
|
```gherkin
|
|
10
|
-
@tui
|
|
11
10
|
Scenario: Application starts successfully
|
|
12
11
|
Given I start the TUI application
|
|
13
12
|
When I wait for "Welcome"
|
|
@@ -17,7 +16,6 @@ Scenario: Application starts successfully
|
|
|
17
16
|
### Execute Command
|
|
18
17
|
|
|
19
18
|
```gherkin
|
|
20
|
-
@tui
|
|
21
19
|
Scenario: Run a command
|
|
22
20
|
Given I start the TUI application
|
|
23
21
|
When I type "help"
|
|
@@ -28,7 +26,6 @@ Scenario: Run a command
|
|
|
28
26
|
### Interactive Input
|
|
29
27
|
|
|
30
28
|
```gherkin
|
|
31
|
-
@tui
|
|
32
29
|
Scenario: Respond to prompt
|
|
33
30
|
Given I start the TUI application
|
|
34
31
|
When I wait for "Enter your name:"
|
|
@@ -42,7 +39,6 @@ Scenario: Respond to prompt
|
|
|
42
39
|
### Menu Navigation
|
|
43
40
|
|
|
44
41
|
```gherkin
|
|
45
|
-
@tui
|
|
46
42
|
Scenario: Navigate main menu
|
|
47
43
|
Given I start the TUI application
|
|
48
44
|
When I wait for "Main Menu"
|
|
@@ -61,7 +57,6 @@ Scenario: Navigate main menu
|
|
|
61
57
|
### Arrow Key Navigation
|
|
62
58
|
|
|
63
59
|
```gherkin
|
|
64
|
-
@tui
|
|
65
60
|
Scenario: Navigate with arrow keys
|
|
66
61
|
Given I start the TUI application
|
|
67
62
|
When I wait for "Select option:"
|
|
@@ -73,7 +68,6 @@ Scenario: Navigate with arrow keys
|
|
|
73
68
|
### Navigate to Specific Item
|
|
74
69
|
|
|
75
70
|
```gherkin
|
|
76
|
-
@tui
|
|
77
71
|
Scenario: Select specific menu item
|
|
78
72
|
Given I start the TUI application
|
|
79
73
|
When I wait for "Menu"
|
|
@@ -84,7 +78,6 @@ Scenario: Select specific menu item
|
|
|
84
78
|
### Back Navigation
|
|
85
79
|
|
|
86
80
|
```gherkin
|
|
87
|
-
@tui
|
|
88
81
|
Scenario: Go back to previous screen
|
|
89
82
|
Given I start the TUI application
|
|
90
83
|
When I navigate to "Settings" and select
|
|
@@ -98,7 +91,6 @@ Scenario: Go back to previous screen
|
|
|
98
91
|
### Fill Single Field
|
|
99
92
|
|
|
100
93
|
```gherkin
|
|
101
|
-
@tui
|
|
102
94
|
Scenario: Fill text field
|
|
103
95
|
Given I start the TUI application
|
|
104
96
|
When I wait for "Username:"
|
|
@@ -112,11 +104,10 @@ Scenario: Fill text field
|
|
|
112
104
|
### Fill Form with Table
|
|
113
105
|
|
|
114
106
|
```gherkin
|
|
115
|
-
@tui
|
|
116
107
|
Scenario: Fill complete form
|
|
117
108
|
Given I start the TUI application
|
|
118
109
|
When I wait for "New User"
|
|
119
|
-
And I fill the form:
|
|
110
|
+
And I fill the TUI form:
|
|
120
111
|
| Field | Value |
|
|
121
112
|
| Name | John Doe |
|
|
122
113
|
| Email | john@example.com |
|
|
@@ -128,7 +119,6 @@ Scenario: Fill complete form
|
|
|
128
119
|
### Select from Dropdown
|
|
129
120
|
|
|
130
121
|
```gherkin
|
|
131
|
-
@tui
|
|
132
122
|
Scenario: Select dropdown value
|
|
133
123
|
Given I start the TUI application
|
|
134
124
|
When I wait for "Configuration"
|
|
@@ -143,7 +133,6 @@ Scenario: Select dropdown value
|
|
|
143
133
|
### Special Keys
|
|
144
134
|
|
|
145
135
|
```gherkin
|
|
146
|
-
@tui
|
|
147
136
|
Scenario: Use special keys
|
|
148
137
|
Given I start the TUI application
|
|
149
138
|
When I press "F1"
|
|
@@ -155,7 +144,6 @@ Scenario: Use special keys
|
|
|
155
144
|
### Modifier Keys
|
|
156
145
|
|
|
157
146
|
```gherkin
|
|
158
|
-
@tui
|
|
159
147
|
Scenario: Keyboard shortcuts
|
|
160
148
|
Given I start the TUI application
|
|
161
149
|
When I press ctrl+s
|
|
@@ -171,7 +159,6 @@ Scenario: Keyboard shortcuts
|
|
|
171
159
|
### Text Editing
|
|
172
160
|
|
|
173
161
|
```gherkin
|
|
174
|
-
@tui
|
|
175
162
|
Scenario: Edit text
|
|
176
163
|
Given I start the TUI application
|
|
177
164
|
When I wait for "Editor"
|
|
@@ -254,7 +241,6 @@ Scenario: Long operation
|
|
|
254
241
|
### Confirm Dialog
|
|
255
242
|
|
|
256
243
|
```gherkin
|
|
257
|
-
@tui
|
|
258
244
|
Scenario: Confirm action
|
|
259
245
|
Given I start the TUI application
|
|
260
246
|
When I type "delete all"
|
|
@@ -267,7 +253,6 @@ Scenario: Confirm action
|
|
|
267
253
|
### Cancel Dialog
|
|
268
254
|
|
|
269
255
|
```gherkin
|
|
270
|
-
@tui
|
|
271
256
|
Scenario: Cancel action
|
|
272
257
|
Given I start the TUI application
|
|
273
258
|
When I type "delete all"
|
|
@@ -280,7 +265,6 @@ Scenario: Cancel action
|
|
|
280
265
|
### Dismiss Dialog
|
|
281
266
|
|
|
282
267
|
```gherkin
|
|
283
|
-
@tui
|
|
284
268
|
Scenario: Dismiss with escape
|
|
285
269
|
Given I start the TUI application
|
|
286
270
|
When I press "F1"
|
|
@@ -294,7 +278,6 @@ Scenario: Dismiss with escape
|
|
|
294
278
|
### Create Baseline Snapshot
|
|
295
279
|
|
|
296
280
|
```gherkin
|
|
297
|
-
@tui
|
|
298
281
|
Scenario: Capture main screen
|
|
299
282
|
Given I start the TUI application
|
|
300
283
|
When I wait for "Dashboard"
|
|
@@ -304,7 +287,6 @@ Scenario: Capture main screen
|
|
|
304
287
|
### Verify Against Snapshot
|
|
305
288
|
|
|
306
289
|
```gherkin
|
|
307
|
-
@tui
|
|
308
290
|
Scenario: Verify screen matches snapshot
|
|
309
291
|
Given I start the TUI application
|
|
310
292
|
When I wait for "Dashboard"
|
|
@@ -314,7 +296,6 @@ Scenario: Verify screen matches snapshot
|
|
|
314
296
|
### Multiple Snapshots
|
|
315
297
|
|
|
316
298
|
```gherkin
|
|
317
|
-
@tui
|
|
318
299
|
Scenario: Capture workflow snapshots
|
|
319
300
|
Given I start the TUI application
|
|
320
301
|
When I wait for "Welcome"
|
|
@@ -332,7 +313,6 @@ Scenario: Capture workflow snapshots
|
|
|
332
313
|
### Error Messages
|
|
333
314
|
|
|
334
315
|
```gherkin
|
|
335
|
-
@tui
|
|
336
316
|
Scenario: Show error on invalid input
|
|
337
317
|
Given I start the TUI application
|
|
338
318
|
When I type "invalid-command"
|
|
@@ -343,11 +323,10 @@ Scenario: Show error on invalid input
|
|
|
343
323
|
### Validation Errors
|
|
344
324
|
|
|
345
325
|
```gherkin
|
|
346
|
-
@tui
|
|
347
326
|
Scenario: Form validation
|
|
348
327
|
Given I start the TUI application
|
|
349
328
|
When I wait for "New User"
|
|
350
|
-
And I fill the form:
|
|
329
|
+
And I fill the TUI form:
|
|
351
330
|
| Field | Value |
|
|
352
331
|
| Email | not-an-email |
|
|
353
332
|
And I submit the form
|
|
@@ -359,7 +338,6 @@ Scenario: Form validation
|
|
|
359
338
|
### Restart Application
|
|
360
339
|
|
|
361
340
|
```gherkin
|
|
362
|
-
@tui
|
|
363
341
|
Scenario: Application restart
|
|
364
342
|
Given I start the TUI application
|
|
365
343
|
When I wait for "Ready"
|
|
@@ -375,7 +353,6 @@ Scenario: Application restart
|
|
|
375
353
|
### Quit Application
|
|
376
354
|
|
|
377
355
|
```gherkin
|
|
378
|
-
@tui
|
|
379
356
|
Scenario: Graceful quit
|
|
380
357
|
Given I start the TUI application
|
|
381
358
|
When I quit the application
|
|
@@ -390,7 +367,6 @@ Scenario: Force quit
|
|
|
390
367
|
## Complete Example: CLI Todo App
|
|
391
368
|
|
|
392
369
|
```gherkin
|
|
393
|
-
@tui
|
|
394
370
|
Feature: Todo CLI Application
|
|
395
371
|
As a user
|
|
396
372
|
I want to manage todos from the terminal
|
|
@@ -446,7 +422,7 @@ Feature: Todo CLI Application
|
|
|
446
422
|
And I press enter
|
|
447
423
|
Then I should see "Settings"
|
|
448
424
|
|
|
449
|
-
When I fill the form:
|
|
425
|
+
When I fill the TUI form:
|
|
450
426
|
| Field | Value |
|
|
451
427
|
| Theme | Dark |
|
|
452
428
|
| Compact | Yes |
|
|
@@ -7,7 +7,6 @@ Common patterns for UI testing with the Katalyst BDD framework.
|
|
|
7
7
|
### Basic Navigation
|
|
8
8
|
|
|
9
9
|
```gherkin
|
|
10
|
-
@ui
|
|
11
10
|
Scenario: Navigate to page
|
|
12
11
|
Given I navigate to "/dashboard"
|
|
13
12
|
Then I should see text "Dashboard"
|
|
@@ -17,7 +16,6 @@ Scenario: Navigate to page
|
|
|
17
16
|
### Navigation with Auth
|
|
18
17
|
|
|
19
18
|
```gherkin
|
|
20
|
-
@ui
|
|
21
19
|
Scenario: Navigate after login
|
|
22
20
|
Given I am authenticated in UI as "user"
|
|
23
21
|
Given I navigate to "/profile"
|
|
@@ -27,7 +25,6 @@ Scenario: Navigate after login
|
|
|
27
25
|
### Back Navigation
|
|
28
26
|
|
|
29
27
|
```gherkin
|
|
30
|
-
@ui
|
|
31
28
|
Scenario: Go back to previous page
|
|
32
29
|
Given I navigate to "/page1"
|
|
33
30
|
When I click the link "Go to Page 2"
|
|
@@ -41,7 +38,6 @@ Scenario: Go back to previous page
|
|
|
41
38
|
### Simple Login Form
|
|
42
39
|
|
|
43
40
|
```gherkin
|
|
44
|
-
@ui
|
|
45
41
|
Scenario: User login
|
|
46
42
|
Given I navigate to "/login"
|
|
47
43
|
When I fill in "Email" with "user@example.com"
|
|
@@ -54,7 +50,6 @@ Scenario: User login
|
|
|
54
50
|
### Login with Fetch Intercept (Bypassing Auth)
|
|
55
51
|
|
|
56
52
|
```gherkin
|
|
57
|
-
@ui
|
|
58
53
|
Scenario: Test page as authenticated user
|
|
59
54
|
Given I am authenticated in UI as "admin"
|
|
60
55
|
Given I navigate to "/admin/dashboard"
|
|
@@ -64,7 +59,6 @@ Scenario: Test page as authenticated user
|
|
|
64
59
|
### Login with Specific Roles
|
|
65
60
|
|
|
66
61
|
```gherkin
|
|
67
|
-
@ui
|
|
68
62
|
Scenario: Test with multiple roles
|
|
69
63
|
Given I am authenticated in UI as "admin,manager,editor"
|
|
70
64
|
Given I navigate to "/settings"
|
|
@@ -75,7 +69,6 @@ Scenario: Test with multiple roles
|
|
|
75
69
|
### Login with Tenant
|
|
76
70
|
|
|
77
71
|
```gherkin
|
|
78
|
-
@ui
|
|
79
72
|
Scenario: Multi-tenant login
|
|
80
73
|
Given I am authenticated in UI as "admin" for tenant "acme-corp"
|
|
81
74
|
Given I navigate to "/dashboard"
|
|
@@ -87,7 +80,6 @@ Scenario: Multi-tenant login
|
|
|
87
80
|
### Simple Form Fill
|
|
88
81
|
|
|
89
82
|
```gherkin
|
|
90
|
-
@ui
|
|
91
83
|
Scenario: Fill contact form
|
|
92
84
|
Given I navigate to "/contact"
|
|
93
85
|
When I fill in "Name" with "John Doe"
|
|
@@ -100,7 +92,6 @@ Scenario: Fill contact form
|
|
|
100
92
|
### Form with Data Table
|
|
101
93
|
|
|
102
94
|
```gherkin
|
|
103
|
-
@ui
|
|
104
95
|
Scenario: Fill registration form
|
|
105
96
|
Given I navigate to "/register"
|
|
106
97
|
When I fill the form:
|
|
@@ -117,7 +108,6 @@ Scenario: Fill registration form
|
|
|
117
108
|
### Form with Dropdowns
|
|
118
109
|
|
|
119
110
|
```gherkin
|
|
120
|
-
@ui
|
|
121
111
|
Scenario: Fill form with dropdown
|
|
122
112
|
Given I navigate to "/settings"
|
|
123
113
|
When I fill in "Display Name" with "John"
|
|
@@ -130,7 +120,6 @@ Scenario: Fill form with dropdown
|
|
|
130
120
|
### Clear and Fill Form
|
|
131
121
|
|
|
132
122
|
```gherkin
|
|
133
|
-
@ui
|
|
134
123
|
Scenario: Update existing form data
|
|
135
124
|
Given I navigate to "/profile/edit"
|
|
136
125
|
When I clear and fill the form:
|
|
@@ -144,7 +133,6 @@ Scenario: Update existing form data
|
|
|
144
133
|
### Form Validation
|
|
145
134
|
|
|
146
135
|
```gherkin
|
|
147
|
-
@ui
|
|
148
136
|
Scenario: Form shows validation errors
|
|
149
137
|
Given I navigate to "/register"
|
|
150
138
|
When I fill in "Email" with "invalid-email"
|
|
@@ -245,7 +233,6 @@ Then I verify that "first" element with "test ID" "result" becomes "visible" dur
|
|
|
245
233
|
### Modal Interaction
|
|
246
234
|
|
|
247
235
|
```gherkin
|
|
248
|
-
@ui
|
|
249
236
|
Scenario: Confirm deletion in modal
|
|
250
237
|
Given I navigate to "/items"
|
|
251
238
|
When I click the button "Delete"
|
|
@@ -259,7 +246,6 @@ Scenario: Confirm deletion in modal
|
|
|
259
246
|
### Cancel Modal
|
|
260
247
|
|
|
261
248
|
```gherkin
|
|
262
|
-
@ui
|
|
263
249
|
Scenario: Cancel modal
|
|
264
250
|
Given I navigate to "/items"
|
|
265
251
|
When I click the button "Delete"
|
|
@@ -273,7 +259,6 @@ Scenario: Cancel modal
|
|
|
273
259
|
### Tab Interaction
|
|
274
260
|
|
|
275
261
|
```gherkin
|
|
276
|
-
@ui
|
|
277
262
|
Scenario: Switch between tabs
|
|
278
263
|
Given I navigate to "/settings"
|
|
279
264
|
Then the "General" tab should be active
|
|
@@ -285,7 +270,6 @@ Scenario: Switch between tabs
|
|
|
285
270
|
### Sidebar Navigation
|
|
286
271
|
|
|
287
272
|
```gherkin
|
|
288
|
-
@ui
|
|
289
273
|
Scenario: Sidebar navigation
|
|
290
274
|
Given I navigate to "/app"
|
|
291
275
|
Then the sidebar should be visible
|
|
@@ -298,7 +282,6 @@ Scenario: Sidebar navigation
|
|
|
298
282
|
### Test Mobile View
|
|
299
283
|
|
|
300
284
|
```gherkin
|
|
301
|
-
@ui
|
|
302
285
|
Scenario: Mobile navigation
|
|
303
286
|
Given the viewport is "mobile" size
|
|
304
287
|
Given I navigate to "/home"
|
|
@@ -310,7 +293,6 @@ Scenario: Mobile navigation
|
|
|
310
293
|
### Test Custom Viewport
|
|
311
294
|
|
|
312
295
|
```gherkin
|
|
313
|
-
@ui
|
|
314
296
|
Scenario: Test at specific resolution
|
|
315
297
|
Given the viewport is 1920x1080
|
|
316
298
|
Given I navigate to "/dashboard"
|
|
@@ -362,7 +344,6 @@ Then I log all cookies
|
|
|
362
344
|
## Complete Example: E-commerce Checkout
|
|
363
345
|
|
|
364
346
|
```gherkin
|
|
365
|
-
@ui
|
|
366
347
|
Feature: Checkout Flow
|
|
367
348
|
As a customer
|
|
368
349
|
I want to complete checkout
|
|
@@ -9,22 +9,23 @@ This skill helps you get started with the @esimplicitylabs/katalyst-xspec BDD te
|
|
|
9
9
|
|
|
10
10
|
## Step 1: Scaffold a New Project
|
|
11
11
|
|
|
12
|
-
Run the scaffolding command:
|
|
12
|
+
Run the scaffolding command (positional target folder, or `.` for the current folder):
|
|
13
13
|
|
|
14
14
|
```bash
|
|
15
|
-
npx @esimplicitylabs/katalyst-xspec init
|
|
15
|
+
npx @esimplicitylabs/katalyst-xspec init my-tests
|
|
16
|
+
cd my-tests
|
|
17
|
+
npm install
|
|
18
|
+
npx playwright install chromium # REQUIRED once: UI tests fail without the browser
|
|
19
|
+
npm test # scaffolded examples pass with no .env
|
|
16
20
|
```
|
|
17
21
|
|
|
18
22
|
Options:
|
|
19
|
-
- `--dir <name>` -
|
|
23
|
+
- `<dir>` or `--dir <name>` - Target directory (`init .` = current folder)
|
|
20
24
|
- `--force` - Overwrite existing files
|
|
25
|
+
- `--with-skills` / `--no-skills` - Install (or skip) agent skills without prompting
|
|
26
|
+
- `--skills-agents opencode,claude-code,cursor,generic` - Which agents get skills
|
|
21
27
|
|
|
22
|
-
|
|
23
|
-
```bash
|
|
24
|
-
npx @esimplicitylabs/katalyst-xspec init --dir my-tests
|
|
25
|
-
cd my-tests
|
|
26
|
-
npm install
|
|
27
|
-
```
|
|
28
|
+
The project's `package.json` name comes from the folder name (npm-safe, e.g. `My Demo` -> `my-demo`).
|
|
28
29
|
|
|
29
30
|
## Step 2: Understand the Project Structure
|
|
30
31
|
|
|
@@ -34,22 +35,20 @@ The scaffold creates:
|
|
|
34
35
|
my-tests/
|
|
35
36
|
├── features/
|
|
36
37
|
│ ├── api/
|
|
37
|
-
│ │ └──
|
|
38
|
+
│ │ └── example.feature # JSONPlaceholder: GET /users/1, POST /posts
|
|
38
39
|
│ ├── ui/
|
|
39
|
-
│ │ └──
|
|
40
|
-
│ ├── hybrid/
|
|
41
|
-
│ │ └── 00_hybrid_examples.feature # Combined API+UI tests
|
|
42
|
-
│ ├── tui/
|
|
43
|
-
│ │ └── 00_tui_examples.feature # Terminal UI tests
|
|
40
|
+
│ │ └── example.feature # Sauce Demo login (standard_user / secret_sauce)
|
|
44
41
|
│ └── steps/
|
|
45
|
-
│ ├── fixtures.ts
|
|
46
|
-
│ └── steps.ts
|
|
47
|
-
├── playwright.config.ts
|
|
48
|
-
├── .env.example
|
|
49
|
-
├── tsconfig.json
|
|
50
|
-
└── package.json
|
|
42
|
+
│ ├── fixtures.ts # Adapter configuration
|
|
43
|
+
│ └── steps.ts # Step registration
|
|
44
|
+
├── playwright.config.ts # Projects: api, ui (tui commented out)
|
|
45
|
+
├── .env.example # Environment template
|
|
46
|
+
├── tsconfig.json # TypeScript config
|
|
47
|
+
└── package.json # Dependencies
|
|
51
48
|
```
|
|
52
49
|
|
|
50
|
+
Each Playwright project reads one folder. Steps are untagged: any step works in any scenario. Do NOT add `@api`/`@ui`/`@hybrid`/`@tui` tags — they are not needed (and are ignored).
|
|
51
|
+
|
|
53
52
|
### Key Files
|
|
54
53
|
|
|
55
54
|
**`features/steps/fixtures.ts`** - Configures adapters:
|
|
@@ -75,17 +74,21 @@ export { test };
|
|
|
75
74
|
```typescript
|
|
76
75
|
import { defineBddProject } from 'playwright-bdd';
|
|
77
76
|
|
|
77
|
+
import { tagsForProject, resolveExtraTags } from '@esimplicitylabs/katalyst-xspec';
|
|
78
|
+
|
|
79
|
+
const tags = tagsForProject({ extraTags: resolveExtraTags(process.env.TEST_TAGS) });
|
|
80
|
+
|
|
78
81
|
const apiBdd = defineBddProject({
|
|
79
82
|
name: 'api',
|
|
80
|
-
features: 'features/api/**/*.feature',
|
|
83
|
+
features: 'features/api/**/*.feature', // selected by folder only
|
|
81
84
|
steps: 'features/steps/**/*.ts',
|
|
82
|
-
tags
|
|
85
|
+
tags, // only skips @Skip/@ignore + applies TEST_TAGS
|
|
83
86
|
});
|
|
84
87
|
```
|
|
85
88
|
|
|
86
|
-
## Step 3:
|
|
89
|
+
## Step 3: Point It at Your App
|
|
87
90
|
|
|
88
|
-
|
|
91
|
+
The examples use absolute URLs to public demo sites. To test your own app, copy the environment template:
|
|
89
92
|
|
|
90
93
|
```bash
|
|
91
94
|
cp .env.example .env
|
|
@@ -99,9 +102,9 @@ API_BASE_URL=http://localhost:3000
|
|
|
99
102
|
|
|
100
103
|
# Authentication (required -- no hardcoded defaults)
|
|
101
104
|
DEFAULT_ADMIN_USERNAME=admin@example.com
|
|
102
|
-
DEFAULT_ADMIN_PASSWORD=
|
|
105
|
+
DEFAULT_ADMIN_PASSWORD=changeme
|
|
103
106
|
DEFAULT_USER_USERNAME=user@example.com
|
|
104
|
-
DEFAULT_USER_PASSWORD=
|
|
107
|
+
DEFAULT_USER_PASSWORD=changeme
|
|
105
108
|
API_AUTH_LOGIN_PATH=/auth/login
|
|
106
109
|
|
|
107
110
|
# UI Configuration
|
|
@@ -113,13 +116,15 @@ HEADLESS=true
|
|
|
113
116
|
# CLEANUP_RULES='[{"varMatch":"user","path":"/api/users/{id}"}]'
|
|
114
117
|
```
|
|
115
118
|
|
|
116
|
-
|
|
119
|
+
Then use relative paths in features, e.g. `Given I navigate to "/login"`, `When I GET "/health"`.
|
|
117
120
|
|
|
118
|
-
|
|
121
|
+
### Required Variables by Step Type
|
|
122
|
+
|
|
123
|
+
| Steps used | Required Variables |
|
|
119
124
|
|-----------|-------------------|
|
|
120
|
-
|
|
|
121
|
-
|
|
|
122
|
-
|
|
|
125
|
+
| API steps with relative paths | `API_BASE_URL` |
|
|
126
|
+
| UI steps with relative paths | `FRONTEND_URL` or `BASE_URL` |
|
|
127
|
+
| Both in one scenario | Both API and UI variables |
|
|
123
128
|
| Auth steps | `DEFAULT_*_USERNAME`, `DEFAULT_*_PASSWORD` |
|
|
124
129
|
|
|
125
130
|
## Step 4: Write Your First Test
|
|
@@ -129,7 +134,6 @@ HEADLESS=true
|
|
|
129
134
|
Create `features/api/health.feature`:
|
|
130
135
|
|
|
131
136
|
```gherkin
|
|
132
|
-
@api
|
|
133
137
|
Feature: Health Check
|
|
134
138
|
|
|
135
139
|
Scenario: API is healthy
|
|
@@ -142,7 +146,6 @@ Feature: Health Check
|
|
|
142
146
|
Create `features/ui/home.feature`:
|
|
143
147
|
|
|
144
148
|
```gherkin
|
|
145
|
-
@ui
|
|
146
149
|
Feature: Home Page
|
|
147
150
|
|
|
148
151
|
Scenario: Home page loads
|
|
@@ -150,12 +153,11 @@ Feature: Home Page
|
|
|
150
153
|
Then I should see text "Welcome"
|
|
151
154
|
```
|
|
152
155
|
|
|
153
|
-
###
|
|
156
|
+
### Mixed API + UI Test
|
|
154
157
|
|
|
155
|
-
Create `features/
|
|
158
|
+
Any scenario can mix API and UI steps — no tag or separate project needed. Put it in a folder a project reads (e.g. `features/ui/`, since it needs a browser). Create `features/ui/workflow.feature`:
|
|
156
159
|
|
|
157
160
|
```gherkin
|
|
158
|
-
@hybrid
|
|
159
161
|
Feature: User Workflow
|
|
160
162
|
|
|
161
163
|
Scenario: Create via API, verify in UI
|
|
@@ -173,19 +175,18 @@ Feature: User Workflow
|
|
|
173
175
|
|
|
174
176
|
## Step 5: Run Tests
|
|
175
177
|
|
|
176
|
-
|
|
178
|
+
`npm test` runs `bddgen && playwright test` (generates specs from features, then runs them). If you call `npx playwright test` directly, run `npm run gen` first.
|
|
177
179
|
|
|
178
180
|
```bash
|
|
179
|
-
#
|
|
180
|
-
npm run gen
|
|
181
|
-
|
|
182
|
-
# 2. Run all tests
|
|
181
|
+
# Run all tests
|
|
183
182
|
npm test
|
|
184
183
|
|
|
185
|
-
#
|
|
186
|
-
npx playwright test --project
|
|
187
|
-
npx playwright test --project
|
|
188
|
-
|
|
184
|
+
# Run one project (folder)
|
|
185
|
+
npx playwright test --project api
|
|
186
|
+
npx playwright test --project ui
|
|
187
|
+
|
|
188
|
+
# Run only scenarios with your own tag
|
|
189
|
+
TEST_TAGS=@smoke npm test
|
|
189
190
|
```
|
|
190
191
|
|
|
191
192
|
### Common Run Commands
|
|
@@ -225,16 +226,14 @@ Open the Playwright report:
|
|
|
225
226
|
npx playwright show-report
|
|
226
227
|
```
|
|
227
228
|
|
|
228
|
-
##
|
|
229
|
+
## Optional Tags
|
|
230
|
+
|
|
231
|
+
Tags are only for your own grouping and filtering (`TEST_TAGS=@smoke npm test`, or `TEST_TAGS=smoke,critical`).
|
|
229
232
|
|
|
230
233
|
| Tag | Purpose |
|
|
231
234
|
|-----|---------|
|
|
232
|
-
| `@api` | API-only tests |
|
|
233
|
-
| `@ui` | UI-only tests |
|
|
234
|
-
| `@tui` | Terminal UI tests |
|
|
235
|
-
| `@hybrid` | Combined API+UI tests |
|
|
236
235
|
| `@smoke` | Quick smoke tests |
|
|
237
|
-
| `@Skip` | Skip this scenario |
|
|
236
|
+
| `@Skip` / `@ignore` | Skip this scenario (excluded by default) |
|
|
238
237
|
| `@wip` | Work in progress |
|
|
239
238
|
|
|
240
239
|
## Quick Reference: Essential Steps
|
|
@@ -266,14 +265,15 @@ Given I register cleanup DELETE "/resource/{id}"
|
|
|
266
265
|
|
|
267
266
|
| Issue | Solution |
|
|
268
267
|
|-------|----------|
|
|
269
|
-
| "No tests found" | Run `npm run gen` first |
|
|
270
|
-
|
|
|
268
|
+
| "No tests found" | Run `npm run gen` first; check the feature is in a folder a project reads |
|
|
269
|
+
| "Executable doesn't exist" | Run `npx playwright install chromium` |
|
|
270
|
+
| Step not found | Check exact step wording in `katalyst-bdd-step-reference` (no tags needed) |
|
|
271
271
|
| Auth fails | Verify `.env` credentials |
|
|
272
272
|
| Can't find element | Use `When I pause for debugging` |
|
|
273
273
|
|
|
274
274
|
## Next Steps
|
|
275
275
|
|
|
276
|
-
1. **Create more tests** - Add feature files to `features/api
|
|
276
|
+
1. **Create more tests** - Add feature files to `features/api/` or `features/ui/`
|
|
277
277
|
2. **Learn steps** - See full step reference with `katalyst-bdd-step-reference` skill
|
|
278
278
|
3. **Patterns** - Learn test patterns with `katalyst-bdd-create-test` skill
|
|
279
279
|
4. **Custom adapters** - Extend framework with `katalyst-bdd-architecture` skill
|
|
@@ -290,3 +290,5 @@ This updates:
|
|
|
290
290
|
- Package dependencies
|
|
291
291
|
- Configuration templates
|
|
292
292
|
- Step definitions
|
|
293
|
+
|
|
294
|
+
Upgrading from 0.6 or earlier: run `npx katalyst-xspec upgrade --migrate` to remove old `@api`/`@ui`/`@hybrid`/`@tui` tag filters from `playwright.config.*`. Old tags left in feature files are harmless.
|