@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.
Files changed (29) hide show
  1. package/LICENSE +7 -0
  2. package/README.md +69 -0
  3. package/bin/katalyst-xspec.cjs +54 -0
  4. package/cli/init.cjs +679 -0
  5. package/cli/stubs.cjs +365 -0
  6. package/cli/upgrade.cjs +1014 -0
  7. package/dist/chunk-ACAXOGKZ.js +1611 -0
  8. package/dist/index.d.ts +881 -0
  9. package/dist/index.js +1091 -0
  10. package/dist/steps/index.d.ts +151 -0
  11. package/dist/steps/index.js +50 -0
  12. package/package.json +80 -0
  13. package/scripts/postinstall.cjs +85 -0
  14. package/skills/katalyst-bdd-architecture/SKILL.md +517 -0
  15. package/skills/katalyst-bdd-architecture/references/adapters.md +310 -0
  16. package/skills/katalyst-bdd-architecture/references/custom-steps.md +360 -0
  17. package/skills/katalyst-bdd-architecture/references/ports.md +256 -0
  18. package/skills/katalyst-bdd-create-test/SKILL.md +366 -0
  19. package/skills/katalyst-bdd-create-test/references/api-patterns.md +371 -0
  20. package/skills/katalyst-bdd-create-test/references/hybrid-patterns.md +420 -0
  21. package/skills/katalyst-bdd-create-test/references/tui-patterns.md +458 -0
  22. package/skills/katalyst-bdd-create-test/references/ui-patterns.md +415 -0
  23. package/skills/katalyst-bdd-quickstart/SKILL.md +292 -0
  24. package/skills/katalyst-bdd-step-reference/SKILL.md +147 -0
  25. package/skills/katalyst-bdd-step-reference/references/api-steps.md +247 -0
  26. package/skills/katalyst-bdd-step-reference/references/shared-steps.md +340 -0
  27. package/skills/katalyst-bdd-step-reference/references/tui-steps.md +483 -0
  28. package/skills/katalyst-bdd-step-reference/references/ui-steps.md +521 -0
  29. package/skills/katalyst-bdd-troubleshooting/SKILL.md +449 -0
@@ -0,0 +1,458 @@
1
+ # TUI Test Patterns
2
+
3
+ Common patterns for TUI (Terminal User Interface) testing with the Katalyst BDD framework.
4
+
5
+ ## Basic Patterns
6
+
7
+ ### Start and Verify
8
+
9
+ ```gherkin
10
+ @tui
11
+ Scenario: Application starts successfully
12
+ Given I start the TUI application
13
+ When I wait for "Welcome"
14
+ Then I should see "Press Enter to continue"
15
+ ```
16
+
17
+ ### Execute Command
18
+
19
+ ```gherkin
20
+ @tui
21
+ Scenario: Run a command
22
+ Given I start the TUI application
23
+ When I type "help"
24
+ And I press enter
25
+ Then I should see "Available commands"
26
+ ```
27
+
28
+ ### Interactive Input
29
+
30
+ ```gherkin
31
+ @tui
32
+ Scenario: Respond to prompt
33
+ Given I start the TUI application
34
+ When I wait for "Enter your name:"
35
+ And I type "John"
36
+ And I press enter
37
+ Then I should see "Hello, John"
38
+ ```
39
+
40
+ ## Navigation Patterns
41
+
42
+ ### Menu Navigation
43
+
44
+ ```gherkin
45
+ @tui
46
+ Scenario: Navigate main menu
47
+ Given I start the TUI application
48
+ When I wait for "Main Menu"
49
+ Then I should see all of:
50
+ | Text |
51
+ | 1. New |
52
+ | 2. Open |
53
+ | 3. Save |
54
+ | 4. Exit |
55
+
56
+ When I type "2"
57
+ And I press enter
58
+ Then I should see "Open File"
59
+ ```
60
+
61
+ ### Arrow Key Navigation
62
+
63
+ ```gherkin
64
+ @tui
65
+ Scenario: Navigate with arrow keys
66
+ Given I start the TUI application
67
+ When I wait for "Select option:"
68
+ And I navigate down 2 times
69
+ And I press enter
70
+ Then I should see "Option 3 selected"
71
+ ```
72
+
73
+ ### Navigate to Specific Item
74
+
75
+ ```gherkin
76
+ @tui
77
+ Scenario: Select specific menu item
78
+ Given I start the TUI application
79
+ When I wait for "Menu"
80
+ And I navigate to "Settings" and select
81
+ Then I should see "Settings Panel"
82
+ ```
83
+
84
+ ### Back Navigation
85
+
86
+ ```gherkin
87
+ @tui
88
+ Scenario: Go back to previous screen
89
+ Given I start the TUI application
90
+ When I navigate to "Settings" and select
91
+ Then I should see "Settings Panel"
92
+ When I go back
93
+ Then I should see "Main Menu"
94
+ ```
95
+
96
+ ## Form Patterns
97
+
98
+ ### Fill Single Field
99
+
100
+ ```gherkin
101
+ @tui
102
+ Scenario: Fill text field
103
+ Given I start the TUI application
104
+ When I wait for "Username:"
105
+ And I fill the TUI field "Username" with "admin"
106
+ And I press tab
107
+ And I fill the TUI field "Password" with "secret123"
108
+ And I press enter
109
+ Then I should see "Login successful"
110
+ ```
111
+
112
+ ### Fill Form with Table
113
+
114
+ ```gherkin
115
+ @tui
116
+ Scenario: Fill complete form
117
+ Given I start the TUI application
118
+ When I wait for "New User"
119
+ And I fill the form:
120
+ | Field | Value |
121
+ | Name | John Doe |
122
+ | Email | john@example.com |
123
+ | Role | Admin |
124
+ And I submit the form
125
+ Then I should see "User created"
126
+ ```
127
+
128
+ ### Select from Dropdown
129
+
130
+ ```gherkin
131
+ @tui
132
+ Scenario: Select dropdown value
133
+ Given I start the TUI application
134
+ When I wait for "Configuration"
135
+ And I select from dropdown "Theme" value "Dark"
136
+ And I select from dropdown "Language" value "English"
137
+ And I submit the form with ctrl+s
138
+ Then I should see "Configuration saved"
139
+ ```
140
+
141
+ ## Keyboard Patterns
142
+
143
+ ### Special Keys
144
+
145
+ ```gherkin
146
+ @tui
147
+ Scenario: Use special keys
148
+ Given I start the TUI application
149
+ When I press "F1"
150
+ Then I should see "Help"
151
+ When I press escape
152
+ Then I should not see "Help"
153
+ ```
154
+
155
+ ### Modifier Keys
156
+
157
+ ```gherkin
158
+ @tui
159
+ Scenario: Keyboard shortcuts
160
+ Given I start the TUI application
161
+ When I press ctrl+s
162
+ Then I should see "Saved"
163
+
164
+ When I press ctrl+n
165
+ Then I should see "New Document"
166
+
167
+ When I press ctrl+shift+p
168
+ Then I should see "Command Palette"
169
+ ```
170
+
171
+ ### Text Editing
172
+
173
+ ```gherkin
174
+ @tui
175
+ Scenario: Edit text
176
+ Given I start the TUI application
177
+ When I wait for "Editor"
178
+ And I type "Hello World" slowly
179
+ And I press "Home"
180
+ And I type "Say: "
181
+ Then the first line should contain "Say: Hello World"
182
+ ```
183
+
184
+ ## Assertion Patterns
185
+
186
+ ### Text Visibility
187
+
188
+ ```gherkin
189
+ Then I should see "Welcome"
190
+ Then I should not see "Error"
191
+ Then the screen should contain "Ready"
192
+ ```
193
+
194
+ ### Multiple Text Assertions
195
+
196
+ ```gherkin
197
+ Then I should see all of:
198
+ | Text |
199
+ | File |
200
+ | Edit |
201
+ | View |
202
+ | Help |
203
+
204
+ Then I should not see any of:
205
+ | Text |
206
+ | Error |
207
+ | Warning |
208
+ | Failed |
209
+ ```
210
+
211
+ ### Line-Specific Assertions
212
+
213
+ ```gherkin
214
+ Then the first line should contain "Application v1.0"
215
+ Then the last line should contain "Press Q to quit"
216
+ Then line 5 should contain "Status: Ready"
217
+ ```
218
+
219
+ ### Pattern Matching
220
+
221
+ ```gherkin
222
+ Then the screen should match pattern "Version \d+\.\d+\.\d+"
223
+ Then the screen should match pattern "Connected to .+"
224
+ ```
225
+
226
+ ## Wait Patterns
227
+
228
+ ### Wait for Text
229
+
230
+ ```gherkin
231
+ When I wait for "Ready"
232
+ When I wait for "Loading complete" for 10 seconds
233
+ ```
234
+
235
+ ### Wait Fixed Time
236
+
237
+ ```gherkin
238
+ When I wait 2 seconds
239
+ ```
240
+
241
+ ### Wait in Background
242
+
243
+ ```gherkin
244
+ Scenario: Long operation
245
+ Given I start the TUI application
246
+ When I type "process-large-file"
247
+ And I press enter
248
+ When I wait for "Processing complete" for 30 seconds
249
+ Then I should see "Done"
250
+ ```
251
+
252
+ ## Dialog Patterns
253
+
254
+ ### Confirm Dialog
255
+
256
+ ```gherkin
257
+ @tui
258
+ Scenario: Confirm action
259
+ Given I start the TUI application
260
+ When I type "delete all"
261
+ And I press enter
262
+ Then I should see "Are you sure? (y/n)"
263
+ When I confirm the dialog
264
+ Then I should see "Deleted"
265
+ ```
266
+
267
+ ### Cancel Dialog
268
+
269
+ ```gherkin
270
+ @tui
271
+ Scenario: Cancel action
272
+ Given I start the TUI application
273
+ When I type "delete all"
274
+ And I press enter
275
+ Then I should see "Are you sure? (y/n)"
276
+ When I cancel the dialog
277
+ Then I should see "Cancelled"
278
+ ```
279
+
280
+ ### Dismiss Dialog
281
+
282
+ ```gherkin
283
+ @tui
284
+ Scenario: Dismiss with escape
285
+ Given I start the TUI application
286
+ When I press "F1"
287
+ Then I should see "Help Dialog"
288
+ When I dismiss the dialog
289
+ Then I should not see "Help Dialog"
290
+ ```
291
+
292
+ ## Snapshot Patterns
293
+
294
+ ### Create Baseline Snapshot
295
+
296
+ ```gherkin
297
+ @tui
298
+ Scenario: Capture main screen
299
+ Given I start the TUI application
300
+ When I wait for "Dashboard"
301
+ Then I take a snapshot named "dashboard-baseline"
302
+ ```
303
+
304
+ ### Verify Against Snapshot
305
+
306
+ ```gherkin
307
+ @tui
308
+ Scenario: Verify screen matches snapshot
309
+ Given I start the TUI application
310
+ When I wait for "Dashboard"
311
+ Then the screen should match snapshot "dashboard-baseline"
312
+ ```
313
+
314
+ ### Multiple Snapshots
315
+
316
+ ```gherkin
317
+ @tui
318
+ Scenario: Capture workflow snapshots
319
+ Given I start the TUI application
320
+ When I wait for "Welcome"
321
+ Then I take a snapshot named "01-welcome"
322
+
323
+ When I navigate to "Settings" and select
324
+ Then I take a snapshot named "02-settings"
325
+
326
+ When I go back
327
+ Then the screen should match snapshot "01-welcome"
328
+ ```
329
+
330
+ ## Error Handling Patterns
331
+
332
+ ### Error Messages
333
+
334
+ ```gherkin
335
+ @tui
336
+ Scenario: Show error on invalid input
337
+ Given I start the TUI application
338
+ When I type "invalid-command"
339
+ And I press enter
340
+ Then I should see "Unknown command"
341
+ ```
342
+
343
+ ### Validation Errors
344
+
345
+ ```gherkin
346
+ @tui
347
+ Scenario: Form validation
348
+ Given I start the TUI application
349
+ When I wait for "New User"
350
+ And I fill the form:
351
+ | Field | Value |
352
+ | Email | not-an-email |
353
+ And I submit the form
354
+ Then I should see "Invalid email format"
355
+ ```
356
+
357
+ ## Application Lifecycle Patterns
358
+
359
+ ### Restart Application
360
+
361
+ ```gherkin
362
+ @tui
363
+ Scenario: Application restart
364
+ Given I start the TUI application
365
+ When I wait for "Ready"
366
+ And I type "corrupt-state"
367
+ And I press enter
368
+ Then I should see "Error"
369
+
370
+ When I restart the TUI application
371
+ Then I should see "Ready"
372
+ And I should not see "Error"
373
+ ```
374
+
375
+ ### Quit Application
376
+
377
+ ```gherkin
378
+ @tui
379
+ Scenario: Graceful quit
380
+ Given I start the TUI application
381
+ When I quit the application
382
+ # Application should exit cleanly
383
+
384
+ Scenario: Force quit
385
+ Given I start the TUI application
386
+ When I force quit the application
387
+ # Sends Ctrl+C
388
+ ```
389
+
390
+ ## Complete Example: CLI Todo App
391
+
392
+ ```gherkin
393
+ @tui
394
+ Feature: Todo CLI Application
395
+ As a user
396
+ I want to manage todos from the terminal
397
+ So that I can track my tasks efficiently
398
+
399
+ Background:
400
+ Given I start the TUI application
401
+ When I wait for "Todo Manager"
402
+
403
+ Scenario: Add new todo
404
+ When I type "add Buy groceries"
405
+ And I press enter
406
+ Then I should see "Todo added: Buy groceries"
407
+ And I should see "[ ] Buy groceries"
408
+
409
+ Scenario: Complete todo
410
+ # Setup
411
+ When I type "add Test todo"
412
+ And I press enter
413
+ Then I should see "[ ] Test todo"
414
+
415
+ # Complete it
416
+ When I type "done 1"
417
+ And I press enter
418
+ Then I should see "[x] Test todo"
419
+
420
+ Scenario: List todos with filter
421
+ # Add some todos
422
+ When I type "add Task 1"
423
+ And I press enter
424
+ When I type "add Task 2"
425
+ And I press enter
426
+ When I type "done 1"
427
+ And I press enter
428
+
429
+ # Filter completed
430
+ When I type "list --completed"
431
+ And I press enter
432
+ Then I should see "[x] Task 1"
433
+ And I should not see "[ ] Task 2"
434
+
435
+ Scenario: Interactive menu navigation
436
+ When I type "menu"
437
+ And I press enter
438
+ Then I should see all of:
439
+ | Text |
440
+ | 1. Add Todo |
441
+ | 2. List |
442
+ | 3. Settings |
443
+ | 4. Exit |
444
+
445
+ When I navigate down 2 times
446
+ And I press enter
447
+ Then I should see "Settings"
448
+
449
+ When I fill the form:
450
+ | Field | Value |
451
+ | Theme | Dark |
452
+ | Compact | Yes |
453
+ And I submit the form
454
+ Then I should see "Settings saved"
455
+
456
+ Scenario: Snapshot test for main screen
457
+ Then the screen should match snapshot "main-menu"
458
+ ```