@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,483 @@
|
|
|
1
|
+
# TUI Steps Reference
|
|
2
|
+
|
|
3
|
+
Complete reference for TUI (Terminal User Interface) steps. Available only in `@tui` scenarios.
|
|
4
|
+
|
|
5
|
+
**Prerequisites:** TUI testing requires `tmux` installed on the system and `tui-tester` configured.
|
|
6
|
+
|
|
7
|
+
## Lifecycle Steps
|
|
8
|
+
|
|
9
|
+
### Start Application
|
|
10
|
+
|
|
11
|
+
```gherkin
|
|
12
|
+
Given I start the TUI application
|
|
13
|
+
Given the TUI application is running
|
|
14
|
+
```
|
|
15
|
+
|
|
16
|
+
Starts the TUI application and waits for it to be ready.
|
|
17
|
+
|
|
18
|
+
### Stop Application
|
|
19
|
+
|
|
20
|
+
```gherkin
|
|
21
|
+
When I stop the TUI application
|
|
22
|
+
```
|
|
23
|
+
|
|
24
|
+
### Restart Application
|
|
25
|
+
|
|
26
|
+
```gherkin
|
|
27
|
+
When I restart the TUI application
|
|
28
|
+
```
|
|
29
|
+
|
|
30
|
+
## Input Steps
|
|
31
|
+
|
|
32
|
+
### Type Text
|
|
33
|
+
|
|
34
|
+
```gherkin
|
|
35
|
+
When I type {string}
|
|
36
|
+
When I type {string} slowly
|
|
37
|
+
```
|
|
38
|
+
|
|
39
|
+
**Example:**
|
|
40
|
+
```gherkin
|
|
41
|
+
When I type "hello world"
|
|
42
|
+
When I type "search term" slowly
|
|
43
|
+
```
|
|
44
|
+
|
|
45
|
+
### Press Key
|
|
46
|
+
|
|
47
|
+
```gherkin
|
|
48
|
+
When I press {string}
|
|
49
|
+
When I press enter
|
|
50
|
+
When I press tab
|
|
51
|
+
When I press escape
|
|
52
|
+
```
|
|
53
|
+
|
|
54
|
+
**Example:**
|
|
55
|
+
```gherkin
|
|
56
|
+
When I press "ArrowDown"
|
|
57
|
+
When I press "Backspace"
|
|
58
|
+
When I press enter
|
|
59
|
+
When I press tab
|
|
60
|
+
When I press escape
|
|
61
|
+
```
|
|
62
|
+
|
|
63
|
+
### Press Key with Modifier
|
|
64
|
+
|
|
65
|
+
```gherkin
|
|
66
|
+
When I press {string} with ctrl
|
|
67
|
+
When I press {string} with alt
|
|
68
|
+
When I press {string} with shift
|
|
69
|
+
When I press ctrl+{word}
|
|
70
|
+
When I press alt+{word}
|
|
71
|
+
When I press shift+{word}
|
|
72
|
+
When I press ctrl+shift+{word}
|
|
73
|
+
```
|
|
74
|
+
|
|
75
|
+
**Example:**
|
|
76
|
+
```gherkin
|
|
77
|
+
When I press "c" with ctrl
|
|
78
|
+
When I press "s" with ctrl
|
|
79
|
+
When I press "F1" with alt
|
|
80
|
+
When I press ctrl+c
|
|
81
|
+
When I press ctrl+shift+p
|
|
82
|
+
```
|
|
83
|
+
|
|
84
|
+
### Fill Field
|
|
85
|
+
|
|
86
|
+
```gherkin
|
|
87
|
+
When I fill the TUI field {string} with {string}
|
|
88
|
+
When I enter {string} in the {string} field
|
|
89
|
+
```
|
|
90
|
+
|
|
91
|
+
**Example:**
|
|
92
|
+
```gherkin
|
|
93
|
+
When I fill the TUI field "Username" with "admin"
|
|
94
|
+
When I enter "secret123" in the "Password" field
|
|
95
|
+
```
|
|
96
|
+
|
|
97
|
+
### Select Option
|
|
98
|
+
|
|
99
|
+
```gherkin
|
|
100
|
+
When I select {string}
|
|
101
|
+
When I select option {string}
|
|
102
|
+
```
|
|
103
|
+
|
|
104
|
+
**Example:**
|
|
105
|
+
```gherkin
|
|
106
|
+
When I select "Yes"
|
|
107
|
+
When I select option "Continue"
|
|
108
|
+
```
|
|
109
|
+
|
|
110
|
+
## Navigation Steps
|
|
111
|
+
|
|
112
|
+
### Navigate Up/Down
|
|
113
|
+
|
|
114
|
+
```gherkin
|
|
115
|
+
When I navigate down {int} times
|
|
116
|
+
When I navigate up {int} times
|
|
117
|
+
```
|
|
118
|
+
|
|
119
|
+
**Example:**
|
|
120
|
+
```gherkin
|
|
121
|
+
When I navigate down 3 times
|
|
122
|
+
When I navigate up 2 times
|
|
123
|
+
```
|
|
124
|
+
|
|
125
|
+
### Navigate to Option
|
|
126
|
+
|
|
127
|
+
```gherkin
|
|
128
|
+
When I navigate to {string} and select
|
|
129
|
+
```
|
|
130
|
+
|
|
131
|
+
**Example:**
|
|
132
|
+
```gherkin
|
|
133
|
+
When I navigate to "Settings" and select
|
|
134
|
+
```
|
|
135
|
+
|
|
136
|
+
### Go Back
|
|
137
|
+
|
|
138
|
+
```gherkin
|
|
139
|
+
When I go back
|
|
140
|
+
```
|
|
141
|
+
|
|
142
|
+
Presses Escape.
|
|
143
|
+
|
|
144
|
+
## Mouse Steps
|
|
145
|
+
|
|
146
|
+
### Click at Position
|
|
147
|
+
|
|
148
|
+
```gherkin
|
|
149
|
+
When I click at position {int}, {int}
|
|
150
|
+
```
|
|
151
|
+
|
|
152
|
+
**Example:**
|
|
153
|
+
```gherkin
|
|
154
|
+
When I click at position 10, 5
|
|
155
|
+
```
|
|
156
|
+
|
|
157
|
+
### Click on Text
|
|
158
|
+
|
|
159
|
+
```gherkin
|
|
160
|
+
When I click on {string}
|
|
161
|
+
```
|
|
162
|
+
|
|
163
|
+
**Example:**
|
|
164
|
+
```gherkin
|
|
165
|
+
When I click on "Submit"
|
|
166
|
+
```
|
|
167
|
+
|
|
168
|
+
## Menu Steps
|
|
169
|
+
|
|
170
|
+
### Open Menu
|
|
171
|
+
|
|
172
|
+
```gherkin
|
|
173
|
+
When I open the menu
|
|
174
|
+
```
|
|
175
|
+
|
|
176
|
+
Presses Alt+M.
|
|
177
|
+
|
|
178
|
+
### Select Menu Item
|
|
179
|
+
|
|
180
|
+
```gherkin
|
|
181
|
+
When I select menu item {string}
|
|
182
|
+
```
|
|
183
|
+
|
|
184
|
+
**Example:**
|
|
185
|
+
```gherkin
|
|
186
|
+
When I select menu item "File"
|
|
187
|
+
When I select menu item "Save As"
|
|
188
|
+
```
|
|
189
|
+
|
|
190
|
+
### Select from Dropdown
|
|
191
|
+
|
|
192
|
+
```gherkin
|
|
193
|
+
When I select from dropdown {string} value {string}
|
|
194
|
+
```
|
|
195
|
+
|
|
196
|
+
**Example:**
|
|
197
|
+
```gherkin
|
|
198
|
+
When I select from dropdown "Theme" value "Dark"
|
|
199
|
+
```
|
|
200
|
+
|
|
201
|
+
## Form Steps
|
|
202
|
+
|
|
203
|
+
### Fill Form
|
|
204
|
+
|
|
205
|
+
```gherkin
|
|
206
|
+
When I fill the form:
|
|
207
|
+
| Field | Value |
|
|
208
|
+
| Username | admin |
|
|
209
|
+
| Password | secret123 |
|
|
210
|
+
```
|
|
211
|
+
|
|
212
|
+
### Submit Form
|
|
213
|
+
|
|
214
|
+
```gherkin
|
|
215
|
+
When I submit the form
|
|
216
|
+
When I submit the form with ctrl+s
|
|
217
|
+
```
|
|
218
|
+
|
|
219
|
+
## Assertion Steps
|
|
220
|
+
|
|
221
|
+
### Assert Text Visible
|
|
222
|
+
|
|
223
|
+
```gherkin
|
|
224
|
+
Then I should see {string}
|
|
225
|
+
Then I should see {string} in the terminal
|
|
226
|
+
Then I should see text {string}
|
|
227
|
+
Then the screen should contain {string}
|
|
228
|
+
```
|
|
229
|
+
|
|
230
|
+
**Example:**
|
|
231
|
+
```gherkin
|
|
232
|
+
Then I should see "Welcome"
|
|
233
|
+
Then I should see "Login successful" in the terminal
|
|
234
|
+
Then the screen should contain "Press Enter to continue"
|
|
235
|
+
```
|
|
236
|
+
|
|
237
|
+
### Assert Text Not Visible
|
|
238
|
+
|
|
239
|
+
```gherkin
|
|
240
|
+
Then I should not see {string}
|
|
241
|
+
```
|
|
242
|
+
|
|
243
|
+
**Example:**
|
|
244
|
+
```gherkin
|
|
245
|
+
Then I should not see "Error"
|
|
246
|
+
```
|
|
247
|
+
|
|
248
|
+
### Assert Pattern
|
|
249
|
+
|
|
250
|
+
```gherkin
|
|
251
|
+
Then the screen should match pattern {string}
|
|
252
|
+
```
|
|
253
|
+
|
|
254
|
+
**Example:**
|
|
255
|
+
```gherkin
|
|
256
|
+
Then the screen should match pattern "Version \\d+\\.\\d+\\.\\d+"
|
|
257
|
+
```
|
|
258
|
+
|
|
259
|
+
### Assert Multiple Texts
|
|
260
|
+
|
|
261
|
+
```gherkin
|
|
262
|
+
Then I should see all of:
|
|
263
|
+
| Text |
|
|
264
|
+
| Welcome |
|
|
265
|
+
| Username |
|
|
266
|
+
| Password |
|
|
267
|
+
```
|
|
268
|
+
|
|
269
|
+
```gherkin
|
|
270
|
+
Then I should not see any of:
|
|
271
|
+
| Text |
|
|
272
|
+
| Error |
|
|
273
|
+
| Failed |
|
|
274
|
+
```
|
|
275
|
+
|
|
276
|
+
### Assert Line Content
|
|
277
|
+
|
|
278
|
+
```gherkin
|
|
279
|
+
Then line {int} should contain {string}
|
|
280
|
+
Then the first line should contain {string}
|
|
281
|
+
Then the last line should contain {string}
|
|
282
|
+
```
|
|
283
|
+
|
|
284
|
+
**Example:**
|
|
285
|
+
```gherkin
|
|
286
|
+
Then line 1 should contain "Welcome"
|
|
287
|
+
Then the first line should contain "Application Name"
|
|
288
|
+
Then the last line should contain "Press Q to quit"
|
|
289
|
+
```
|
|
290
|
+
|
|
291
|
+
## Wait Steps
|
|
292
|
+
|
|
293
|
+
### Wait for Text
|
|
294
|
+
|
|
295
|
+
```gherkin
|
|
296
|
+
When I wait for {string}
|
|
297
|
+
When I wait for {string} for {int} seconds
|
|
298
|
+
```
|
|
299
|
+
|
|
300
|
+
**Example:**
|
|
301
|
+
```gherkin
|
|
302
|
+
When I wait for "Ready"
|
|
303
|
+
When I wait for "Loading complete" for 10 seconds
|
|
304
|
+
```
|
|
305
|
+
|
|
306
|
+
### Wait Fixed Time
|
|
307
|
+
|
|
308
|
+
```gherkin
|
|
309
|
+
When I wait {int} seconds
|
|
310
|
+
```
|
|
311
|
+
|
|
312
|
+
**Example:**
|
|
313
|
+
```gherkin
|
|
314
|
+
When I wait 2 seconds
|
|
315
|
+
```
|
|
316
|
+
|
|
317
|
+
## Snapshot Steps
|
|
318
|
+
|
|
319
|
+
### Take Snapshot
|
|
320
|
+
|
|
321
|
+
```gherkin
|
|
322
|
+
Then I take a snapshot named {string}
|
|
323
|
+
```
|
|
324
|
+
|
|
325
|
+
**Example:**
|
|
326
|
+
```gherkin
|
|
327
|
+
Then I take a snapshot named "main-menu"
|
|
328
|
+
```
|
|
329
|
+
|
|
330
|
+
### Match Snapshot
|
|
331
|
+
|
|
332
|
+
```gherkin
|
|
333
|
+
Then the screen should match snapshot {string}
|
|
334
|
+
```
|
|
335
|
+
|
|
336
|
+
**Example:**
|
|
337
|
+
```gherkin
|
|
338
|
+
Then the screen should match snapshot "login-screen"
|
|
339
|
+
```
|
|
340
|
+
|
|
341
|
+
## Utility Steps
|
|
342
|
+
|
|
343
|
+
### Clear Terminal
|
|
344
|
+
|
|
345
|
+
```gherkin
|
|
346
|
+
When I clear the terminal
|
|
347
|
+
```
|
|
348
|
+
|
|
349
|
+
### Resize Terminal
|
|
350
|
+
|
|
351
|
+
```gherkin
|
|
352
|
+
When I resize the terminal to {int}x{int}
|
|
353
|
+
```
|
|
354
|
+
|
|
355
|
+
**Example:**
|
|
356
|
+
```gherkin
|
|
357
|
+
When I resize the terminal to 120x40
|
|
358
|
+
```
|
|
359
|
+
|
|
360
|
+
### Capture Screen
|
|
361
|
+
|
|
362
|
+
```gherkin
|
|
363
|
+
When I capture the screen
|
|
364
|
+
Then I print the screen
|
|
365
|
+
```
|
|
366
|
+
|
|
367
|
+
### Execute Command
|
|
368
|
+
|
|
369
|
+
```gherkin
|
|
370
|
+
When I execute command {string}
|
|
371
|
+
When I run {string}
|
|
372
|
+
```
|
|
373
|
+
|
|
374
|
+
**Example:**
|
|
375
|
+
```gherkin
|
|
376
|
+
When I execute command "ls -la"
|
|
377
|
+
When I run "npm test"
|
|
378
|
+
```
|
|
379
|
+
|
|
380
|
+
## Dialog Steps
|
|
381
|
+
|
|
382
|
+
### Confirm Dialog
|
|
383
|
+
|
|
384
|
+
```gherkin
|
|
385
|
+
When I confirm the dialog
|
|
386
|
+
```
|
|
387
|
+
|
|
388
|
+
Types 'y' and presses Enter.
|
|
389
|
+
|
|
390
|
+
### Cancel Dialog
|
|
391
|
+
|
|
392
|
+
```gherkin
|
|
393
|
+
When I cancel the dialog
|
|
394
|
+
```
|
|
395
|
+
|
|
396
|
+
Types 'n' and presses Enter.
|
|
397
|
+
|
|
398
|
+
### Dismiss Dialog
|
|
399
|
+
|
|
400
|
+
```gherkin
|
|
401
|
+
When I dismiss the dialog
|
|
402
|
+
```
|
|
403
|
+
|
|
404
|
+
Presses Escape.
|
|
405
|
+
|
|
406
|
+
## Quit Steps
|
|
407
|
+
|
|
408
|
+
### Quit Application
|
|
409
|
+
|
|
410
|
+
```gherkin
|
|
411
|
+
When I quit the application
|
|
412
|
+
When I force quit the application
|
|
413
|
+
```
|
|
414
|
+
|
|
415
|
+
`quit` presses Q, `force quit` presses Ctrl+C.
|
|
416
|
+
|
|
417
|
+
## Complete TUI Example
|
|
418
|
+
|
|
419
|
+
```gherkin
|
|
420
|
+
@tui
|
|
421
|
+
Feature: CLI Application
|
|
422
|
+
|
|
423
|
+
Background:
|
|
424
|
+
Given I start the TUI application
|
|
425
|
+
|
|
426
|
+
Scenario: Navigate menu and select option
|
|
427
|
+
When I wait for "Main Menu"
|
|
428
|
+
Then I should see "1. Settings"
|
|
429
|
+
And I should see "2. Help"
|
|
430
|
+
And I should see "3. Exit"
|
|
431
|
+
|
|
432
|
+
When I navigate down 1 times
|
|
433
|
+
And I press enter
|
|
434
|
+
Then I should see "Settings"
|
|
435
|
+
|
|
436
|
+
When I go back
|
|
437
|
+
Then I should see "Main Menu"
|
|
438
|
+
|
|
439
|
+
Scenario: Fill login form
|
|
440
|
+
When I wait for "Login"
|
|
441
|
+
When I fill the form:
|
|
442
|
+
| Field | Value |
|
|
443
|
+
| Username | admin |
|
|
444
|
+
| Password | secret123 |
|
|
445
|
+
And I submit the form
|
|
446
|
+
Then I should see "Welcome, admin"
|
|
447
|
+
|
|
448
|
+
Scenario: Use keyboard shortcuts
|
|
449
|
+
When I press ctrl+s
|
|
450
|
+
Then I should see "Saved"
|
|
451
|
+
|
|
452
|
+
When I press "?" with shift
|
|
453
|
+
Then I should see "Help"
|
|
454
|
+
|
|
455
|
+
Scenario: Snapshot test
|
|
456
|
+
When I wait for "Dashboard"
|
|
457
|
+
Then I take a snapshot named "dashboard"
|
|
458
|
+
Then the screen should match snapshot "dashboard"
|
|
459
|
+
```
|
|
460
|
+
|
|
461
|
+
## TUI Configuration
|
|
462
|
+
|
|
463
|
+
Configure TUI in your fixtures:
|
|
464
|
+
|
|
465
|
+
```typescript
|
|
466
|
+
import { createBddTest, TuiTesterAdapter } from '@esimplicitylabs/katalyst-xspec';
|
|
467
|
+
|
|
468
|
+
const test = createBddTest({
|
|
469
|
+
createTui: () => new TuiTesterAdapter({
|
|
470
|
+
command: ['node', 'dist/cli.js'],
|
|
471
|
+
size: { cols: 100, rows: 30 },
|
|
472
|
+
cwd: process.cwd(),
|
|
473
|
+
env: { NODE_ENV: 'test' },
|
|
474
|
+
debug: false,
|
|
475
|
+
snapshotDir: './snapshots',
|
|
476
|
+
}),
|
|
477
|
+
});
|
|
478
|
+
```
|
|
479
|
+
|
|
480
|
+
Environment variables:
|
|
481
|
+
- `TUI_COLS` - Terminal columns (default: 80)
|
|
482
|
+
- `TUI_ROWS` - Terminal rows (default: 24)
|
|
483
|
+
- `DEBUG` - Enable debug output
|