@esimplicitylabs/katalyst-xspec 0.6.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/LICENSE +7 -0
- package/README.md +69 -0
- package/bin/katalyst-xspec.cjs +54 -0
- package/cli/init.cjs +679 -0
- package/cli/stubs.cjs +365 -0
- package/cli/upgrade.cjs +1014 -0
- package/dist/chunk-ACAXOGKZ.js +1611 -0
- package/dist/index.d.ts +881 -0
- package/dist/index.js +1091 -0
- package/dist/steps/index.d.ts +151 -0
- package/dist/steps/index.js +50 -0
- package/package.json +80 -0
- package/scripts/postinstall.cjs +85 -0
- package/skills/katalyst-bdd-architecture/SKILL.md +517 -0
- package/skills/katalyst-bdd-architecture/references/adapters.md +310 -0
- package/skills/katalyst-bdd-architecture/references/custom-steps.md +360 -0
- package/skills/katalyst-bdd-architecture/references/ports.md +256 -0
- package/skills/katalyst-bdd-create-test/SKILL.md +366 -0
- package/skills/katalyst-bdd-create-test/references/api-patterns.md +371 -0
- package/skills/katalyst-bdd-create-test/references/hybrid-patterns.md +420 -0
- package/skills/katalyst-bdd-create-test/references/tui-patterns.md +458 -0
- package/skills/katalyst-bdd-create-test/references/ui-patterns.md +415 -0
- package/skills/katalyst-bdd-quickstart/SKILL.md +292 -0
- package/skills/katalyst-bdd-step-reference/SKILL.md +147 -0
- package/skills/katalyst-bdd-step-reference/references/api-steps.md +247 -0
- package/skills/katalyst-bdd-step-reference/references/shared-steps.md +340 -0
- package/skills/katalyst-bdd-step-reference/references/tui-steps.md +483 -0
- package/skills/katalyst-bdd-step-reference/references/ui-steps.md +521 -0
- package/skills/katalyst-bdd-troubleshooting/SKILL.md +449 -0
|
@@ -0,0 +1,340 @@
|
|
|
1
|
+
# Shared Steps Reference
|
|
2
|
+
|
|
3
|
+
Complete reference for shared steps. Available in all scenarios regardless of tag (`@api`, `@ui`, `@tui`, `@hybrid`).
|
|
4
|
+
|
|
5
|
+
## Variable Steps
|
|
6
|
+
|
|
7
|
+
### Set Variable
|
|
8
|
+
|
|
9
|
+
```gherkin
|
|
10
|
+
Given I set variable {string} to {string}
|
|
11
|
+
```
|
|
12
|
+
|
|
13
|
+
Sets a variable that can be used in subsequent steps via `{varName}` interpolation.
|
|
14
|
+
|
|
15
|
+
**Example:**
|
|
16
|
+
```gherkin
|
|
17
|
+
Given I set variable "baseUrl" to "https://api.example.com"
|
|
18
|
+
Given I set variable "email" to "test@example.com"
|
|
19
|
+
Given I set variable "userId" to "123"
|
|
20
|
+
```
|
|
21
|
+
|
|
22
|
+
### Generate UUID
|
|
23
|
+
|
|
24
|
+
```gherkin
|
|
25
|
+
Given I generate a UUID and store as {string}
|
|
26
|
+
```
|
|
27
|
+
|
|
28
|
+
Generates a unique identifier useful for creating unique test data.
|
|
29
|
+
|
|
30
|
+
**Example:**
|
|
31
|
+
```gherkin
|
|
32
|
+
Given I generate a UUID and store as "runId"
|
|
33
|
+
Given I set variable "email" to "test-{runId}@example.com"
|
|
34
|
+
# email becomes something like "test-a1b2c3d4-e5f6-7890-abcd-ef1234567890@example.com"
|
|
35
|
+
```
|
|
36
|
+
|
|
37
|
+
### Assert Variable Value
|
|
38
|
+
|
|
39
|
+
```gherkin
|
|
40
|
+
Then the variable {string} should equal {string}
|
|
41
|
+
```
|
|
42
|
+
|
|
43
|
+
**Example:**
|
|
44
|
+
```gherkin
|
|
45
|
+
Then the variable "status" should equal "active"
|
|
46
|
+
Then the variable "userId" should equal "123"
|
|
47
|
+
```
|
|
48
|
+
|
|
49
|
+
## Variable Interpolation
|
|
50
|
+
|
|
51
|
+
Variables are interpolated in step parameters using `{varName}` syntax:
|
|
52
|
+
|
|
53
|
+
```gherkin
|
|
54
|
+
# Set variables
|
|
55
|
+
Given I set variable "userId" to "42"
|
|
56
|
+
Given I set variable "action" to "update"
|
|
57
|
+
|
|
58
|
+
# Use in API paths
|
|
59
|
+
When I GET "/users/{userId}" # becomes /users/42
|
|
60
|
+
When I POST "/users/{userId}/{action}" # becomes /users/42/update
|
|
61
|
+
|
|
62
|
+
# Use in JSON bodies
|
|
63
|
+
When I POST "/users" with JSON body:
|
|
64
|
+
"""
|
|
65
|
+
{
|
|
66
|
+
"id": "{userId}",
|
|
67
|
+
"email": "user-{userId}@example.com"
|
|
68
|
+
}
|
|
69
|
+
"""
|
|
70
|
+
|
|
71
|
+
# Use in assertions
|
|
72
|
+
Then the value at "id" should equal "{userId}"
|
|
73
|
+
|
|
74
|
+
# Use in UI
|
|
75
|
+
Given I navigate to "/users/{userId}/profile"
|
|
76
|
+
Then I should see text "User {userId}"
|
|
77
|
+
```
|
|
78
|
+
|
|
79
|
+
## Header Steps
|
|
80
|
+
|
|
81
|
+
### Set HTTP Header
|
|
82
|
+
|
|
83
|
+
```gherkin
|
|
84
|
+
Given I set header {string} to {string}
|
|
85
|
+
```
|
|
86
|
+
|
|
87
|
+
Sets a header that will be included in subsequent API requests.
|
|
88
|
+
|
|
89
|
+
**Example:**
|
|
90
|
+
```gherkin
|
|
91
|
+
Given I set header "X-API-Key" to "abc123"
|
|
92
|
+
Given I set header "Content-Type" to "application/json"
|
|
93
|
+
Given I set header "Authorization" to "Bearer {token}"
|
|
94
|
+
Given I set header "X-Request-ID" to "{runId}"
|
|
95
|
+
```
|
|
96
|
+
|
|
97
|
+
## Cleanup Steps
|
|
98
|
+
|
|
99
|
+
Cleanup steps register resources to be deleted after the test completes.
|
|
100
|
+
|
|
101
|
+
### Register DELETE Cleanup
|
|
102
|
+
|
|
103
|
+
```gherkin
|
|
104
|
+
Given I register cleanup DELETE {string}
|
|
105
|
+
```
|
|
106
|
+
|
|
107
|
+
**Example:**
|
|
108
|
+
```gherkin
|
|
109
|
+
# After creating a user
|
|
110
|
+
When I POST "/users" with JSON body:
|
|
111
|
+
"""
|
|
112
|
+
{ "email": "test@example.com" }
|
|
113
|
+
"""
|
|
114
|
+
Then the response status should be 201
|
|
115
|
+
And I store the value at "id" as "userId"
|
|
116
|
+
Given I register cleanup DELETE "/users/{userId}"
|
|
117
|
+
```
|
|
118
|
+
|
|
119
|
+
### Register POST Cleanup
|
|
120
|
+
|
|
121
|
+
```gherkin
|
|
122
|
+
Given I register cleanup POST {string}
|
|
123
|
+
```
|
|
124
|
+
|
|
125
|
+
### Register PATCH Cleanup
|
|
126
|
+
|
|
127
|
+
```gherkin
|
|
128
|
+
Given I register cleanup PATCH {string}
|
|
129
|
+
```
|
|
130
|
+
|
|
131
|
+
### Register PUT Cleanup
|
|
132
|
+
|
|
133
|
+
```gherkin
|
|
134
|
+
Given I register cleanup PUT {string}
|
|
135
|
+
```
|
|
136
|
+
|
|
137
|
+
### Disable Cleanup
|
|
138
|
+
|
|
139
|
+
```gherkin
|
|
140
|
+
Given I disable cleanup
|
|
141
|
+
```
|
|
142
|
+
|
|
143
|
+
Prevents cleanup from running for the current scenario. Useful when you want to inspect data after test failure.
|
|
144
|
+
|
|
145
|
+
## Feature Flag Steps
|
|
146
|
+
|
|
147
|
+
Feature flags allow conditional behavior in tests.
|
|
148
|
+
|
|
149
|
+
### Enable Flag
|
|
150
|
+
|
|
151
|
+
```gherkin
|
|
152
|
+
Given the feature flag {string} is enabled
|
|
153
|
+
```
|
|
154
|
+
|
|
155
|
+
**Example:**
|
|
156
|
+
```gherkin
|
|
157
|
+
Given the feature flag "DARK_MODE" is enabled
|
|
158
|
+
Given the feature flag "NEW_CHECKOUT" is enabled
|
|
159
|
+
```
|
|
160
|
+
|
|
161
|
+
### Disable Flag
|
|
162
|
+
|
|
163
|
+
```gherkin
|
|
164
|
+
Given the feature flag {string} is disabled
|
|
165
|
+
```
|
|
166
|
+
|
|
167
|
+
**Example:**
|
|
168
|
+
```gherkin
|
|
169
|
+
Given the feature flag "BETA_FEATURES" is disabled
|
|
170
|
+
```
|
|
171
|
+
|
|
172
|
+
### Set Flag Value
|
|
173
|
+
|
|
174
|
+
```gherkin
|
|
175
|
+
Given the feature flag {string} is set to {string}
|
|
176
|
+
```
|
|
177
|
+
|
|
178
|
+
**Example:**
|
|
179
|
+
```gherkin
|
|
180
|
+
Given the feature flag "MAX_ITEMS" is set to "100"
|
|
181
|
+
Given the feature flag "THEME" is set to "dark"
|
|
182
|
+
```
|
|
183
|
+
|
|
184
|
+
### Enable Multiple Flags
|
|
185
|
+
|
|
186
|
+
```gherkin
|
|
187
|
+
Given the following feature flags are enabled:
|
|
188
|
+
| Flag |
|
|
189
|
+
| DARK_MODE |
|
|
190
|
+
| NEW_CHECKOUT |
|
|
191
|
+
| BETA_FEATURES |
|
|
192
|
+
```
|
|
193
|
+
|
|
194
|
+
### Disable Multiple Flags
|
|
195
|
+
|
|
196
|
+
```gherkin
|
|
197
|
+
Given the following feature flags are disabled:
|
|
198
|
+
| Flag |
|
|
199
|
+
| LEGACY_MODE |
|
|
200
|
+
| OLD_DASHBOARD |
|
|
201
|
+
```
|
|
202
|
+
|
|
203
|
+
### Assert Flag State
|
|
204
|
+
|
|
205
|
+
```gherkin
|
|
206
|
+
Then the feature flag {string} should be enabled
|
|
207
|
+
Then the feature flag {string} should be disabled
|
|
208
|
+
```
|
|
209
|
+
|
|
210
|
+
**Example:**
|
|
211
|
+
```gherkin
|
|
212
|
+
Then the feature flag "DARK_MODE" should be enabled
|
|
213
|
+
Then the feature flag "LEGACY_MODE" should be disabled
|
|
214
|
+
```
|
|
215
|
+
|
|
216
|
+
### Log All Flags
|
|
217
|
+
|
|
218
|
+
```gherkin
|
|
219
|
+
Then I log all feature flags
|
|
220
|
+
```
|
|
221
|
+
|
|
222
|
+
Prints all current feature flag states to console.
|
|
223
|
+
|
|
224
|
+
## World State
|
|
225
|
+
|
|
226
|
+
The World object stores test state:
|
|
227
|
+
|
|
228
|
+
```typescript
|
|
229
|
+
type World = {
|
|
230
|
+
vars: Record<string, string>; // Test variables
|
|
231
|
+
headers: Record<string, string>; // HTTP headers
|
|
232
|
+
cleanup: CleanupItem[]; // Cleanup registrations
|
|
233
|
+
skipCleanup?: boolean; // Skip cleanup flag
|
|
234
|
+
|
|
235
|
+
// Last API response (populated after API calls)
|
|
236
|
+
lastResponse?: APIResponse;
|
|
237
|
+
lastStatus?: number;
|
|
238
|
+
lastText?: string;
|
|
239
|
+
lastJson?: unknown;
|
|
240
|
+
lastHeaders?: Record<string, string>;
|
|
241
|
+
lastContentType?: string;
|
|
242
|
+
};
|
|
243
|
+
```
|
|
244
|
+
|
|
245
|
+
## Complete Examples
|
|
246
|
+
|
|
247
|
+
### API Test with Variables and Cleanup
|
|
248
|
+
|
|
249
|
+
```gherkin
|
|
250
|
+
@api
|
|
251
|
+
Feature: User Management
|
|
252
|
+
|
|
253
|
+
Background:
|
|
254
|
+
Given I am authenticated as an admin via API
|
|
255
|
+
Given I generate a UUID and store as "runId"
|
|
256
|
+
|
|
257
|
+
Scenario: Create user with cleanup
|
|
258
|
+
Given I set variable "email" to "test-{runId}@example.com"
|
|
259
|
+
When I POST "/admin/users" with JSON body:
|
|
260
|
+
"""
|
|
261
|
+
{
|
|
262
|
+
"email": "{email}",
|
|
263
|
+
"name": "Test User {runId}"
|
|
264
|
+
}
|
|
265
|
+
"""
|
|
266
|
+
Then the response status should be 201
|
|
267
|
+
And I store the value at "id" as "userId"
|
|
268
|
+
Given I register cleanup DELETE "/admin/users/{userId}"
|
|
269
|
+
|
|
270
|
+
# Verify the user was created
|
|
271
|
+
When I GET "/admin/users/{userId}"
|
|
272
|
+
Then the response status should be 200
|
|
273
|
+
And the value at "email" should equal "{email}"
|
|
274
|
+
```
|
|
275
|
+
|
|
276
|
+
### UI Test with Variables
|
|
277
|
+
|
|
278
|
+
```gherkin
|
|
279
|
+
@ui
|
|
280
|
+
Feature: Search
|
|
281
|
+
|
|
282
|
+
Scenario: Search with generated term
|
|
283
|
+
Given I generate a UUID and store as "searchId"
|
|
284
|
+
Given I set variable "searchTerm" to "product-{searchId}"
|
|
285
|
+
Given I navigate to "/search"
|
|
286
|
+
When I fill in "Search" with "{searchTerm}"
|
|
287
|
+
And I click the button "Search"
|
|
288
|
+
Then I should see text "No results for {searchTerm}"
|
|
289
|
+
```
|
|
290
|
+
|
|
291
|
+
### Hybrid Test with Shared State
|
|
292
|
+
|
|
293
|
+
```gherkin
|
|
294
|
+
@hybrid
|
|
295
|
+
Feature: User Onboarding
|
|
296
|
+
|
|
297
|
+
Scenario: Create user via API, verify in UI
|
|
298
|
+
# Setup: Generate unique data
|
|
299
|
+
Given I generate a UUID and store as "testId"
|
|
300
|
+
Given I set variable "userEmail" to "onboard-{testId}@test.com"
|
|
301
|
+
Given I set variable "userName" to "Test User {testId}"
|
|
302
|
+
|
|
303
|
+
# API: Create user
|
|
304
|
+
Given I am authenticated as an admin via API
|
|
305
|
+
When I POST "/admin/users" with JSON body:
|
|
306
|
+
"""
|
|
307
|
+
{
|
|
308
|
+
"email": "{userEmail}",
|
|
309
|
+
"name": "{userName}"
|
|
310
|
+
}
|
|
311
|
+
"""
|
|
312
|
+
Then the response status should be 201
|
|
313
|
+
And I store the value at "id" as "userId"
|
|
314
|
+
Given I register cleanup DELETE "/admin/users/{userId}"
|
|
315
|
+
|
|
316
|
+
# UI: Verify user appears
|
|
317
|
+
Given I navigate to "/admin/users"
|
|
318
|
+
Then I should see text "{userEmail}"
|
|
319
|
+
Then I should see text "{userName}"
|
|
320
|
+
```
|
|
321
|
+
|
|
322
|
+
### Feature Flags Example
|
|
323
|
+
|
|
324
|
+
```gherkin
|
|
325
|
+
@ui
|
|
326
|
+
Feature: Feature Flag Testing
|
|
327
|
+
|
|
328
|
+
Scenario: Test with feature enabled
|
|
329
|
+
Given the feature flag "NEW_DASHBOARD" is enabled
|
|
330
|
+
Given the feature flag "ANALYTICS" is enabled
|
|
331
|
+
Given I navigate to "/dashboard"
|
|
332
|
+
Then I should see text "New Dashboard"
|
|
333
|
+
And I should see text "Analytics Panel"
|
|
334
|
+
|
|
335
|
+
Scenario: Test with feature disabled
|
|
336
|
+
Given the feature flag "NEW_DASHBOARD" is disabled
|
|
337
|
+
Given I navigate to "/dashboard"
|
|
338
|
+
Then I should see text "Classic Dashboard"
|
|
339
|
+
And I should not see text "Analytics Panel"
|
|
340
|
+
```
|