@desplega.ai/qa-use 2.8.7 → 2.10.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.
Files changed (47) hide show
  1. package/README.md +13 -4
  2. package/dist/lib/api/browser-types.d.ts +1 -0
  3. package/dist/lib/api/browser-types.d.ts.map +1 -1
  4. package/dist/lib/api/browser.d.ts.map +1 -1
  5. package/dist/lib/api/browser.js +3 -2
  6. package/dist/lib/api/browser.js.map +1 -1
  7. package/dist/lib/api/index.d.ts +1 -0
  8. package/dist/lib/api/index.d.ts.map +1 -1
  9. package/dist/lib/api/index.js +1 -0
  10. package/dist/lib/api/index.js.map +1 -1
  11. package/dist/lib/tunnel/index.d.ts.map +1 -1
  12. package/dist/lib/tunnel/index.js +10 -1
  13. package/dist/lib/tunnel/index.js.map +1 -1
  14. package/dist/package.json +4 -2
  15. package/dist/src/cli/commands/browser/create.d.ts.map +1 -1
  16. package/dist/src/cli/commands/browser/create.js +41 -12
  17. package/dist/src/cli/commands/browser/create.js.map +1 -1
  18. package/dist/src/cli/commands/docs.d.ts +6 -0
  19. package/dist/src/cli/commands/docs.d.ts.map +1 -0
  20. package/dist/src/cli/commands/docs.js +71 -0
  21. package/dist/src/cli/commands/docs.js.map +1 -0
  22. package/dist/src/cli/commands/info.d.ts.map +1 -1
  23. package/dist/src/cli/commands/info.js +7 -5
  24. package/dist/src/cli/commands/info.js.map +1 -1
  25. package/dist/src/cli/commands/setup.d.ts +1 -1
  26. package/dist/src/cli/commands/setup.d.ts.map +1 -1
  27. package/dist/src/cli/commands/setup.js +100 -34
  28. package/dist/src/cli/commands/setup.js.map +1 -1
  29. package/dist/src/cli/generated/docs-content.d.ts +15 -0
  30. package/dist/src/cli/generated/docs-content.d.ts.map +1 -0
  31. package/dist/src/cli/generated/docs-content.js +2507 -0
  32. package/dist/src/cli/generated/docs-content.js.map +1 -0
  33. package/dist/src/cli/index.js +47 -3
  34. package/dist/src/cli/index.js.map +1 -1
  35. package/dist/src/cli/lib/config.d.ts +4 -0
  36. package/dist/src/cli/lib/config.d.ts.map +1 -1
  37. package/dist/src/cli/lib/config.js +1 -1
  38. package/dist/src/cli/lib/config.js.map +1 -1
  39. package/dist/src/server.d.ts.map +1 -1
  40. package/dist/src/server.js +14 -4
  41. package/dist/src/server.js.map +1 -1
  42. package/lib/api/browser-types.ts +1 -0
  43. package/lib/api/browser.test.ts +63 -4
  44. package/lib/api/browser.ts +3 -2
  45. package/lib/api/index.ts +2 -0
  46. package/lib/tunnel/index.ts +11 -1
  47. package/package.json +4 -2
@@ -0,0 +1,2507 @@
1
+ /**
2
+ * Auto-generated documentation content for the docs command.
3
+ * DO NOT EDIT MANUALLY — Generated from plugins/qa-use/skills/qa-use/
4
+ * Run 'bun run generate:docs' to regenerate.
5
+ */
6
+ export const MAIN_DOC = `---
7
+ name: qa-use
8
+ description: E2E testing and browser automation with qa-use CLI. Use when the user needs to run tests, verify features, automate browser interactions, or debug test failures.
9
+ allowed-tools: Bash(qa-use *)
10
+ ---
11
+
12
+ # qa-use
13
+
14
+ E2E testing and browser automation for AI-driven development workflows.
15
+
16
+ ## Critical Insight: Plugin Commands as Shortcuts
17
+
18
+ **For AI Harnesses (codex, opencode, etc.):**
19
+
20
+ Plugin commands (slash commands like \`/qa-use:verify\`) are **convenience shortcuts** that wrap CLI workflows. Harnesses with only the Bash tool can access ALL functionality via CLI commands documented below.
21
+
22
+ **Pattern throughout this document:**
23
+ - **CLI Workflow**: Step-by-step CLI commands (works for ALL harnesses)
24
+ - **Plugin Shortcut**: Optional slash command (convenience)
25
+
26
+ ## Setup & Configuration
27
+
28
+ Before using any qa-use commands, verify configuration is in place:
29
+
30
+ \`\`\`bash
31
+ # Check current configuration (no-op if already configured)
32
+ qa-use setup
33
+
34
+ # Configure with API key (validates against server)
35
+ qa-use setup --api-key <key>
36
+
37
+ # View full configuration details
38
+ qa-use info
39
+ \`\`\`
40
+
41
+ **Environment Variables (alternative to config file):**
42
+
43
+ | Variable | Description |
44
+ |----------|-------------|
45
+ | \`QA_USE_API_KEY\` | API key for authentication |
46
+ | \`QA_USE_REGION\` | Region: \`us\` (default) or \`auto\` |
47
+ | \`QA_USE_API_URL\` | Override API base URL |
48
+
49
+ **Config file:** \`.qa-use-tests.json\` in the project directory or \`~/.qa-use.json\` in the home directory. Environment variables take precedence.
50
+
51
+ **If you encounter "API key not configured", 401, or auth errors:** Run \`qa-use setup\` to check config state. NEVER fabricate or guess API keys.
52
+
53
+ ## Core Workflow
54
+
55
+ ### 1. Browser Control & Session Lifecycle
56
+
57
+ **CLI Workflow:**
58
+ \`\`\`bash
59
+ # Create browser session
60
+ qa-use browser create --viewport desktop
61
+
62
+ # For localhost testing
63
+ qa-use browser create --tunnel --no-headless
64
+
65
+ # Navigate
66
+ qa-use browser goto https://example.com
67
+
68
+ # Snapshot to get element refs (ALWAYS do this before interacting)
69
+ qa-use browser snapshot
70
+
71
+ # Interact by ref
72
+ qa-use browser click e3
73
+ qa-use browser fill e5 "text"
74
+
75
+ # Close
76
+ qa-use browser close
77
+ \`\`\`
78
+
79
+ **Plugin Shortcut:**
80
+ \`\`\`
81
+ /qa-use:explore https://example.com
82
+ \`\`\`
83
+ (Wraps create + goto + snapshot with autonomous exploration)
84
+
85
+ **Critical:** Always run \`snapshot\` before your **first** interaction on a page. Never guess element refs.
86
+
87
+ **Snapshot Diff Feature (use it to avoid unnecessary snapshots):**
88
+ After each action (goto, click, fill, etc.), the browser automatically shows DOM changes:
89
+ - **Summary**: "5 elements added, 1 element modified"
90
+ - **Added elements**: \`+ [e54] generic "Thanks for agreeing!"\` (green)
91
+ - **Modified elements**: \`~ [e18] checkbox "I agree..."\` with \`+attrs: checked, active\` (yellow)
92
+ - **Removed elements**: \`- [e99] button "Submit"\` (red)
93
+
94
+ **When you can skip a full \`snapshot\`:** If the diff output from your last action already shows the element ref you need to interact with next, use it directly — no need for an intermediate \`snapshot\`. For example, if clicking a button shows \`+ [e54] button "Submit"\` in the diff, you can \`click e54\` immediately.
95
+
96
+ **When you still need a full \`snapshot\`:** Run \`snapshot\` when you need to find elements that weren't in the diff (e.g., pre-existing elements you haven't interacted with yet), or when the diff was truncated (shows "... and N more changes").
97
+
98
+ ### 2. Understanding Blocks
99
+
100
+ **What are blocks?**
101
+
102
+ Blocks are atomic recorded interactions from a browser session. They are:
103
+ - Automatically captured during any browser interaction (click, fill, goto, scroll, etc.)
104
+ - Stored server-side with the session
105
+ - Retrieved via \`qa-use browser get-blocks\`
106
+ - The foundation for test generation
107
+
108
+ **Why blocks matter:**
109
+ - **Record-once, replay-many**: Interactive recording becomes automated test
110
+ - **AI-friendly**: Agents can analyze blocks to understand user intent
111
+ - **Version control**: Blocks stored with session enable test iteration
112
+ - **Bridge CLI → Tests**: Natural workflow from exploration to automation
113
+
114
+ **How blocks work:**
115
+
116
+ \`\`\`bash
117
+ # 1. Create session and interact
118
+ qa-use browser create --tunnel --no-headless
119
+ qa-use browser goto https://example.com
120
+ qa-use browser snapshot # Returns: [ref=e1] button
121
+ qa-use browser click e1 # Records as block
122
+ qa-use browser fill e5 "text" # Records as block
123
+
124
+ # 2. Retrieve blocks (JSON array)
125
+ qa-use browser get-blocks
126
+ # Returns:
127
+ # [
128
+ # {"type": "goto", "url": "...", "timestamp": "..."},
129
+ # {"type": "click", "ref": "e1", "timestamp": "..."},
130
+ # {"type": "fill", "ref": "e5", "value": "text", "timestamp": "..."}
131
+ # ]
132
+
133
+ # 3. Generate test YAML from blocks
134
+ qa-use browser generate-test -n "my_test" -o qa-tests/my_test.yaml
135
+
136
+ # 4. Run generated test
137
+ qa-use test run my_test
138
+ \`\`\`
139
+
140
+ **Plugin Shortcut:**
141
+ \`\`\`
142
+ /qa-use:record start my_test
143
+ # ... perform interactions ...
144
+ /qa-use:record stop
145
+ \`\`\`
146
+ (Wraps the interactive workflow with AI-powered test generation)
147
+
148
+ ### 3. Test Management
149
+
150
+ **CLI Workflow:**
151
+ \`\`\`bash
152
+ # Run test by name
153
+ qa-use test run login
154
+
155
+ # Run with autofix (AI self-healing)
156
+ qa-use test run login --autofix
157
+
158
+ # Validate syntax
159
+ qa-use test validate login
160
+
161
+ # Show test details
162
+ qa-use test info login
163
+
164
+ # List test runs
165
+ qa-use test runs --status failed
166
+ \`\`\`
167
+
168
+ **Plugin Shortcut:**
169
+ \`\`\`
170
+ /qa-use:test-run login --autofix
171
+ \`\`\`
172
+ (Convenience shortcut for common test execution)
173
+
174
+ ### 4. Test Sync Lifecycle
175
+
176
+ **CLI Workflow:**
177
+ \`\`\`bash
178
+ # Pull tests from cloud
179
+ qa-use test sync pull
180
+
181
+ # Push all local tests to cloud
182
+ qa-use test sync push --all
183
+
184
+ # Push specific test
185
+ qa-use test sync push --id <uuid>
186
+
187
+ # Force push (overwrite conflicts)
188
+ qa-use test sync push --force
189
+
190
+ # Compare local vs cloud
191
+ qa-use test diff login.yaml
192
+ \`\`\`
193
+
194
+ **No Plugin Shortcut** - Use CLI commands directly
195
+
196
+ ## Essential Commands
197
+
198
+ ### Browser Session Management
199
+
200
+ | Command | Description |
201
+ |---------|-------------|
202
+ | \`qa-use browser create\` | Create remote browser session |
203
+ | \`qa-use browser create <url>\` | Create session and navigate to URL |
204
+ | \`qa-use browser create --tunnel\` | Create local browser with API tunnel |
205
+ | \`qa-use browser create --no-headless\` | Show browser window (tunnel mode only) |
206
+ | \`qa-use browser create --viewport <size>\` | Set viewport: \`desktop\`, \`tablet\`, \`mobile\` |
207
+ | \`qa-use browser create --ws-url <url>\` | Connect to existing WebSocket browser |
208
+ | \`qa-use browser create --after-test-id <uuid>\` | Run a test first, then become interactive |
209
+ | \`qa-use browser create --var <key=value>\` | Override app config variables (repeatable) |
210
+ | \`qa-use browser list\` | List active sessions |
211
+ | \`qa-use browser status\` | Show current session details (app_url, recording_url, etc.) |
212
+ | \`qa-use browser close\` | Close active session |
213
+
214
+ Sessions auto-persist in \`~/.qa-use.json\`. One active session = no \`-s\` flag needed.
215
+
216
+ ### Navigation
217
+
218
+ | Command | Description |
219
+ |---------|-------------|
220
+ | \`qa-use browser goto <url>\` | Navigate to URL |
221
+ | \`qa-use browser back\` | Go back |
222
+ | \`qa-use browser forward\` | Go forward |
223
+ | \`qa-use browser reload\` | Reload page |
224
+
225
+ ### Element Interaction
226
+
227
+ | Command | Description |
228
+ |---------|-------------|
229
+ | \`qa-use browser click <ref>\` | Click element by ref |
230
+ | \`qa-use browser click --text "Button"\` | Click by semantic description |
231
+ | \`qa-use browser fill <ref> "value"\` | Fill input field |
232
+ | \`qa-use browser type <ref> "text"\` | Type with delays (for autocomplete) |
233
+ | \`qa-use browser press <key>\` | Press key (e.g., \`Enter\`, \`Tab\`) |
234
+ | \`qa-use browser check <ref>\` | Check checkbox |
235
+ | \`qa-use browser uncheck <ref>\` | Uncheck checkbox |
236
+ | \`qa-use browser select <ref> "option"\` | Select dropdown option |
237
+ | \`qa-use browser hover <ref>\` | Hover over element |
238
+ | \`qa-use browser scroll down 500\` | Scroll by pixels |
239
+ | \`qa-use browser scroll-into-view <ref>\` | Scroll element into view |
240
+ | \`qa-use browser drag <ref> --target <ref>\` | Drag element to target |
241
+ | \`qa-use browser mfa-totp [ref] <secret>\` | Generate TOTP code (optionally fill) |
242
+ | \`qa-use browser upload <ref> <file>...\` | Upload file(s) to input (base64-encoded, works remote & tunnel) |
243
+
244
+ ### Inspection & Snapshot Diff
245
+
246
+ | Command | Description |
247
+ |---------|-------------|
248
+ | \`qa-use browser snapshot\` | Get full ARIA tree with element refs (use only when diff output is insufficient) |
249
+ | \`qa-use browser url\` | Get current URL |
250
+ | \`qa-use browser screenshot\` | Save screenshot.png |
251
+ | \`qa-use browser screenshot file.png\` | Save to custom path |
252
+ | \`qa-use browser screenshot --base64\` | Output base64 to stdout |
253
+ | \`qa-use browser evaluate <expression>\` | Execute JavaScript in browser context |
254
+
255
+ The snapshot-diff feature automatically displays DOM changes after each browser action:
256
+ - **Added elements**: Shown with \`+\` prefix and green color — these refs are immediately usable
257
+ - **Modified elements**: Shown with \`~\` prefix and yellow color, including attribute changes (\`+attrs: checked\`)
258
+ - **Removed elements**: Shown with \`-\` prefix and red color — do NOT use these refs
259
+
260
+ **Downloads:** When an action triggers a file download (e.g., clicking a download link), the response includes download info: filename, size, and a presigned URL. Use \`qa-use browser downloads\` to list all downloads or \`--save <dir>\` to save them locally.
261
+
262
+ Use diff output to interact with newly appeared elements directly, without running a full \`snapshot\` first.
263
+
264
+ ### Test Operations
265
+
266
+ | Command | Description |
267
+ |---------|-------------|
268
+ | \`qa-use test run <name>\` | Run test by name |
269
+ | \`qa-use test run --all\` | Run all tests |
270
+ | \`qa-use test run <name> --tunnel\` | Run with local browser tunnel |
271
+ | \`qa-use test run <name> --autofix\` | Enable AI self-healing |
272
+ | \`qa-use test run <name> --update-local\` | Persist AI fixes to file |
273
+ | \`qa-use test run <name> --download\` | Download assets to \`/tmp/qa-use/downloads/\` |
274
+ | \`qa-use test run <name> --var key=value\` | Override variable |
275
+ | \`qa-use test validate <name>\` | Validate test syntax |
276
+ | \`qa-use test list\` | List available tests |
277
+ | \`qa-use test info <name>\` | Show test details (steps, tags, description) |
278
+ | \`qa-use test info --id <uuid>\` | Show cloud test details by ID |
279
+ | \`qa-use test runs [name]\` | List test run history |
280
+ | \`qa-use test runs --id <uuid>\` | Filter runs by test ID |
281
+ | \`qa-use test runs --status failed\` | Filter runs by status |
282
+ | \`qa-use test init\` | Initialize test directory |
283
+ | \`qa-use test sync pull\` | Pull tests from cloud |
284
+ | \`qa-use test sync push --all\` | Push all local tests to cloud |
285
+ | \`qa-use test sync push --id <uuid>\` | Push specific test |
286
+ | \`qa-use test sync push --force\` | Push tests, overwriting conflicts |
287
+ | \`qa-use test diff <file>\` | Compare local vs cloud test |
288
+ | \`qa-use test schema [path]\` | View test definition schema |
289
+
290
+ ### API Operations (Dynamic OpenAPI)
291
+
292
+ \`qa-use api\` dynamically discovers operations from \`/api/v1/openapi.json\` and caches metadata locally for offline fallback.
293
+
294
+ | Command | Description |
295
+ |---------|-------------|
296
+ | \`qa-use api ls\` | List available \`/api/v1/*\` routes from OpenAPI |
297
+ | \`qa-use api ls --refresh\` | Force refresh OpenAPI cache |
298
+ | \`qa-use api ls --offline\` | Use cached OpenAPI metadata only |
299
+ | \`qa-use api /api/v1/tests\` | Call endpoint (method inferred when possible) |
300
+ | \`qa-use api -X GET /api/v1/test-runs -f limit=5\` | GET with query fields |
301
+ | \`qa-use api -X POST /api/v1/tests-actions/run --input body.json\` | POST with JSON body file |
302
+ | \`qa-use api -X GET /api/v1/test-runs/<id>\` | Fetch detail endpoint by ID |
303
+
304
+ **No Plugin Shortcut** - Use CLI commands directly.
305
+
306
+ ### Logs & Debugging
307
+
308
+ | Command | Description |
309
+ |---------|-------------|
310
+ | \`qa-use browser logs console\` | View console logs from session |
311
+ | \`qa-use browser logs console -s <id>\` | View logs from specific/closed session |
312
+ | \`qa-use browser logs network\` | View network request logs |
313
+ | \`qa-use browser logs network -s <id>\` | View network logs from specific session |
314
+ | \`qa-use browser downloads\` | List downloaded files from session |
315
+ | \`qa-use browser downloads --save <dir>\` | Save downloaded files to local directory |
316
+ | \`qa-use browser downloads --json\` | Output download info as JSON |
317
+
318
+ ### Test Generation
319
+
320
+ | Command | Description |
321
+ |---------|-------------|
322
+ | \`qa-use browser generate-test\` | Generate test YAML from recorded session |
323
+ | \`qa-use browser generate-test -s <id>\` | Generate from specific session |
324
+ | \`qa-use browser generate-test -n <name>\` | Specify test name |
325
+ | \`qa-use browser generate-test -o <path>\` | Specify output path |
326
+ | \`qa-use browser get-blocks\` | Get recorded interaction blocks (JSON) |
327
+
328
+ ### Waiting
329
+
330
+ | Command | Description |
331
+ |---------|-------------|
332
+ | \`qa-use browser wait <ms>\` | Fixed wait |
333
+ | \`qa-use browser wait-for-selector ".class"\` | Wait for selector |
334
+ | \`qa-use browser wait-for-load\` | Wait for page load |
335
+
336
+ ### Variable Overrides
337
+
338
+ Use \`--var\` to override app config variables at runtime. Common variables:
339
+
340
+ | Variable | Description |
341
+ |----------|-------------|
342
+ | \`base_url\` | Base URL for the app (e.g., preview deployment URL) |
343
+ | \`login_url\` | Login page URL |
344
+ | \`login_username\` | Username/email for authentication |
345
+ | \`login_password\` | Password for authentication |
346
+
347
+ Example with ephemeral preview URL:
348
+ \`\`\`bash
349
+ qa-use browser create --after-test-id <login-test-uuid> \\
350
+ --var base_url=https://preview-123.example.com \\
351
+ --var login_url=https://preview-123.example.com/auth/login
352
+ \`\`\`
353
+
354
+ ## Common Patterns
355
+
356
+ ### Pattern 1: Feature Verification
357
+
358
+ **CLI Workflow:**
359
+ \`\`\`bash
360
+ # 1. Search for existing test
361
+ qa-use test list | grep "login"
362
+
363
+ # 2. Run test with autofix
364
+ qa-use test run login --autofix
365
+
366
+ # 3. Debug failures
367
+ qa-use browser logs console
368
+ \`\`\`
369
+
370
+ **Plugin Shortcut:**
371
+ \`\`\`
372
+ /qa-use:verify "login works with valid credentials"
373
+ \`\`\`
374
+ (Wraps the above CLI workflow with AI-powered test discovery and analysis)
375
+
376
+ ### Pattern 2: Record & Generate Test
377
+
378
+ **CLI Workflow:**
379
+ \`\`\`bash
380
+ # 1. Create session
381
+ qa-use browser create --tunnel --no-headless
382
+
383
+ # 2. Navigate and interact
384
+ qa-use browser goto https://example.com
385
+ qa-use browser snapshot
386
+ qa-use browser click e1
387
+ qa-use browser fill e5 "test"
388
+
389
+ # 3. Generate test from blocks
390
+ qa-use browser get-blocks
391
+ qa-use browser generate-test -n "my_test"
392
+
393
+ # 4. Run test
394
+ qa-use test run my_test
395
+ \`\`\`
396
+
397
+ **Plugin Shortcut:**
398
+ \`\`\`
399
+ /qa-use:record start my_test
400
+ # ... perform interactions ...
401
+ /qa-use:record stop
402
+ \`\`\`
403
+
404
+ ### Pattern 3: Authenticated Exploration
405
+
406
+ **CLI Workflow:**
407
+ \`\`\`bash
408
+ # Create session that runs login test first
409
+ qa-use browser create --after-test-id <login-test-uuid>
410
+
411
+ # Session now authenticated, explore
412
+ qa-use browser goto /dashboard
413
+ qa-use browser snapshot
414
+ \`\`\`
415
+
416
+ **Plugin Shortcut:**
417
+ \`\`\`
418
+ /qa-use:explore /dashboard
419
+ \`\`\`
420
+ (Automatically handles auth detection and session creation)
421
+
422
+ ### Pattern 4: Edit Existing Test
423
+
424
+ **CLI Workflow:**
425
+ \`\`\`bash
426
+ # 1. Open test file in editor
427
+ vim qa-tests/login.yaml
428
+
429
+ # 2. Validate syntax
430
+ qa-use test validate login
431
+
432
+ # 3. Run to verify
433
+ qa-use test run login
434
+ \`\`\`
435
+
436
+ **Plugin Shortcut:**
437
+ \`\`\`
438
+ /qa-use:record edit login
439
+ \`\`\`
440
+ (AI-assisted editing with validation)
441
+
442
+ ### Pattern 5: Using Snapshot Diff to Avoid Unnecessary Snapshots
443
+
444
+ **CLI Workflow:**
445
+ \`\`\`bash
446
+ # Create session and navigate
447
+ qa-use browser create --tunnel --no-headless
448
+ qa-use browser goto https://evals.desplega.ai/checkboxes
449
+
450
+ # goto shows diff — initial page load shows all elements:
451
+ # Changes: 45 elements added
452
+ # + [e18] checkbox "I agree to the terms and conditions"
453
+ # + [e19] generic "I agree to the terms and conditions"
454
+
455
+ # ✅ Use ref from diff directly — no snapshot needed!
456
+ qa-use browser click e18
457
+
458
+ # Diff shows what changed:
459
+ # Changes: 5 elements added, 1 element modified
460
+ # + [e54] generic "Thanks for agreeing!"
461
+ # + [e55] link "Terms and Conditions"
462
+ # ~ [e18] checkbox "I agree to the terms and conditions"
463
+ # +attrs: active, checked
464
+
465
+ # ✅ Can click e55 directly from diff output — no snapshot needed!
466
+ qa-use browser click e55
467
+
468
+ # ❌ Need to find an element NOT in the diff? Now run snapshot:
469
+ qa-use browser snapshot
470
+ \`\`\`
471
+
472
+ **Key principle:** Use diff output as your primary source of element refs after actions. Only fall back to \`snapshot\` when you need to find elements that weren't in the diff.
473
+
474
+ **Benefits:**
475
+ - Fewer API calls = faster automation
476
+ - Diff refs are always fresh (just returned from the server)
477
+ - Instantly see what changed (new elements, attribute changes, removals)
478
+
479
+ **No Plugin Shortcut** - Automatic feature in all browser commands
480
+
481
+ ## CI/CD Integration
482
+
483
+ ### Running Tests in CI
484
+
485
+ **Environment Variables:**
486
+ \`\`\`bash
487
+ export QA_USE_API_KEY="your-api-key"
488
+ export QA_USE_REGION="us" # Optional: "us" or "auto"
489
+ \`\`\`
490
+
491
+ **Basic Test Execution:**
492
+ \`\`\`bash
493
+ # Run all tests
494
+ qa-use test run --all
495
+
496
+ # Run specific tag
497
+ qa-use test run --tag smoke
498
+
499
+ # Exit codes: 0 = pass, 1 = fail
500
+ \`\`\`
501
+
502
+ ### GitHub Actions Example
503
+
504
+ \`\`\`yaml
505
+ name: QA Tests
506
+ on: [push, pull_request]
507
+
508
+ jobs:
509
+ test:
510
+ runs-on: ubuntu-latest
511
+ steps:
512
+ - uses: actions/checkout@v3
513
+ - uses: actions/setup-node@v3
514
+ with:
515
+ node-version: '20'
516
+ - name: Install qa-use
517
+ run: npm install -g @desplega.ai/qa-use
518
+ - name: Run tests
519
+ run: qa-use test run --all
520
+ env:
521
+ QA_USE_API_KEY: \${{ secrets.QA_USE_API_KEY }}
522
+ \`\`\`
523
+
524
+ ### Test Artifacts
525
+
526
+ **Screenshots:**
527
+ - Automatically saved on failure
528
+ - Location: \`/tmp/qa-use/downloads/\` (local) or cloud (remote)
529
+
530
+ **Logs:**
531
+ - Console logs: \`qa-use browser logs console -s <session-id>\`
532
+ - Network logs: \`qa-use browser logs network -s <session-id>\`
533
+
534
+ ## Advanced Topics
535
+
536
+ ### Localhost Testing (Tunnel Mode)
537
+
538
+ **When to use tunnel mode:**
539
+
540
+ \`\`\`
541
+ Testing localhost (http://localhost:3000)?
542
+ ├─ YES → Use --tunnel
543
+ │ └─ qa-use browser create --tunnel [--no-headless]
544
+ │ (Starts local Playwright, creates localtunnel, keeps running)
545
+
546
+ └─ NO (Public URL) → Use remote browser (default)
547
+ └─ qa-use browser create
548
+ (Uses desplega.ai cloud browser via WebSocket)
549
+ \`\`\`
550
+
551
+ **The \`--tunnel\` flag is a binary choice:**
552
+ - **Local tunnel mode**: Playwright on your machine + localtunnel
553
+ - **Remote mode**: WebSocket URL to cloud-hosted browser
554
+
555
+ **For test execution:**
556
+ \`\`\`bash
557
+ # Local app
558
+ qa-use test run my_test --tunnel [--headful]
559
+
560
+ # Public app
561
+ qa-use test run my_test
562
+ \`\`\`
563
+
564
+ **Plugin shortcuts handle tunnel detection automatically:**
565
+ \`\`\`
566
+ /qa-use:explore http://localhost:3000
567
+ /qa-use:record start local_test
568
+ \`\`\`
569
+
570
+ See [references/localhost-testing.md](references/localhost-testing.md) for troubleshooting.
571
+
572
+ ### Session Persistence
573
+
574
+ Sessions are stored in \`~/.qa-use.json\` and have:
575
+ - **TTL**: 30 minutes (default)
576
+ - **Auto-resolve**: One active session = no \`-s\` flag needed
577
+ - **Cleanup**: Automatic on timeout or explicit \`browser close\`
578
+
579
+ ### Block Limitations
580
+
581
+ **What's captured:**
582
+ - goto, click, fill, type, check, uncheck, select, hover
583
+ - scroll, scroll-into-view, drag, upload, press
584
+
585
+ **What's NOT captured:**
586
+ - Assertions (must be added manually)
587
+ - Waits (inferred from timing, may need adjustment)
588
+ - Complex interactions (multi-drag, hover sequences)
589
+
590
+ **Manual editing:** Edit generated YAML to add assertions and refine selectors.
591
+
592
+ ### WebSocket Sessions
593
+
594
+ **Sharing sessions across processes:**
595
+ \`\`\`bash
596
+ # Process 1: Create session
597
+ qa-use browser create --tunnel
598
+ # Output: ws://localhost:12345/browser/abc123
599
+
600
+ # Process 2: Connect to session
601
+ qa-use browser goto https://example.com --ws-url ws://localhost:12345/browser/abc123
602
+ \`\`\`
603
+
604
+ ## Deep-Dive References
605
+
606
+ Access any reference at runtime via the CLI: \`qa-use docs <topic>\`
607
+
608
+ | Topic | CLI Command | Description |
609
+ |-------|-------------|-------------|
610
+ | [browser-commands.md](references/browser-commands.md) | \`qa-use docs browser-commands\` | Complete browser CLI reference with all flags |
611
+ | [test-format.md](references/test-format.md) | \`qa-use docs test-format\` | Full test YAML specification |
612
+ | [localhost-testing.md](references/localhost-testing.md) | \`qa-use docs localhost-testing\` | Tunnel setup for local development |
613
+ | [failure-debugging.md](references/failure-debugging.md) | \`qa-use docs failure-debugging\` | Failure classification and diagnostics |
614
+ | [ci.md](references/ci.md) | \`qa-use docs ci\` | CI/CD integration patterns and examples |
615
+
616
+ Use \`qa-use docs --list\` to discover all available topics and templates.
617
+
618
+ ## Templates
619
+
620
+ | Template | Description |
621
+ |----------|-------------|
622
+ | [basic-test.yaml](templates/basic-test.yaml) | Simple navigation and assertion |
623
+ | [auth-flow.yaml](templates/auth-flow.yaml) | Login flow with credentials |
624
+ | [form-test.yaml](templates/form-test.yaml) | Form submission with validation |
625
+
626
+ ## Test Format Overview
627
+
628
+ \`\`\`yaml
629
+ name: Login Test
630
+ description: Validates login functionality with valid credentials
631
+ tags:
632
+ - smoke
633
+ - auth
634
+ app_config: <app-config-id>
635
+ variables:
636
+ email: test@example.com
637
+ password: secret123
638
+ depends_on: setup-test # Optional
639
+ steps:
640
+ - action: goto
641
+ url: /login
642
+ - action: fill
643
+ target: email input
644
+ value: $email
645
+ - action: click
646
+ target: login button
647
+ - action: to_be_visible
648
+ target: dashboard
649
+ \`\`\`
650
+
651
+ See [references/test-format.md](references/test-format.md) for complete specification.
652
+
653
+ ## Common Mistakes
654
+
655
+ | ❌ Wrong | ✅ Correct |
656
+ |---------|-----------|
657
+ | \`browser navigate <url>\` | \`browser goto <url>\` |
658
+ | \`browser destroy\` | \`browser close\` |
659
+ | \`browser close <session-id>\` | \`browser close\` |
660
+ | Guessing element refs | Use refs from diff output or \`snapshot\` |
661
+ | Running \`snapshot\` after every action | Use diff output; only \`snapshot\` when needed |
662
+ | Testing localhost without \`--tunnel\` | Use \`--tunnel\` flag |
663
+ | \`test sync --pull\` | \`test sync pull\` (subcommand, not flag) |
664
+ | \`test sync --push\` | \`test sync push\` (subcommand, not flag) |
665
+
666
+ ## Troubleshooting
667
+
668
+ When stuck or encountering unexpected errors, use the built-in documentation:
669
+
670
+ \`\`\`bash
671
+ # Check configuration state
672
+ qa-use setup
673
+
674
+ # Browse main documentation
675
+ qa-use docs
676
+
677
+ # List all available topics
678
+ qa-use docs --list
679
+
680
+ # Access specific topic
681
+ qa-use docs <topic>
682
+ \`\`\`
683
+
684
+ | Situation | Command |
685
+ |-----------|---------|
686
+ | Auth / API key errors | \`qa-use setup\` then \`qa-use docs\` |
687
+ | Unknown browser command | \`qa-use docs browser-commands\` |
688
+ | Test failures | \`qa-use docs failure-debugging\` |
689
+ | Localhost / tunnel issues | \`qa-use docs localhost-testing\` |
690
+ | Test YAML syntax | \`qa-use docs test-format\` |
691
+ | CI/CD setup | \`qa-use docs ci\` |
692
+
693
+ **Key rules:**
694
+ - ALWAYS consult \`qa-use docs\` before improvising workarounds
695
+ - NEVER fabricate API keys, tokens, URLs, or credentials
696
+ - If \`qa-use setup\` shows no config, report it — don't guess
697
+
698
+ ## npx Alternative
699
+
700
+ All commands use \`qa-use\` assuming global install. For one-off use:
701
+ \`\`\`bash
702
+ npx @desplega.ai/qa-use browser <command>
703
+ \`\`\`
704
+ `;
705
+ export const REFERENCE_DOCS = {
706
+ 'browser-commands': {
707
+ title: 'Browser Commands Reference',
708
+ content: `# Browser Commands Reference
709
+
710
+ Complete reference for \`qa-use browser\` CLI commands.
711
+
712
+ ## Session Management
713
+
714
+ ### create
715
+
716
+ Create a new browser session.
717
+
718
+ \`\`\`bash
719
+ qa-use browser create [url] [options]
720
+ \`\`\`
721
+
722
+ | Argument / Flag | Description |
723
+ |------|-------------|
724
+ | \`[url]\` | URL to navigate to after session is ready |
725
+ | \`--viewport <size>\` | Viewport size: \`desktop\` (1280x720), \`tablet\` (768x1024), \`mobile\` (375x667) |
726
+ | \`--tunnel\` | Run local browser with API tunnel (for localhost testing) |
727
+ | \`--headless\` | Run in headless mode (default with \`--tunnel\`) |
728
+ | \`--no-headless\` | Show browser window (use with \`--tunnel\` for debugging) |
729
+ | \`--ws-url <url>\` | Connect to existing WebSocket browser endpoint |
730
+ | \`--after-test-id <uuid>\` | Run a test before session becomes interactive (start after login, etc.) |
731
+
732
+ **Examples:**
733
+ \`\`\`bash
734
+ qa-use browser create # Remote browser, default viewport
735
+ qa-use browser create https://example.com # Remote browser, navigate to URL
736
+ qa-use browser create --viewport mobile # Remote browser, mobile viewport
737
+ qa-use browser create --tunnel # Local headless browser with tunnel
738
+ qa-use browser create --tunnel --no-headless # Local visible browser for debugging
739
+ qa-use browser create --ws-url wss://... # Connect to existing browser
740
+ qa-use browser create --after-test-id <uuid> # Start session after running a test
741
+ qa-use browser create --after-test-id <uuid> https://example.com/dashboard # After login, go to dashboard
742
+ \`\`\`
743
+
744
+ **Starting after login (--after-test-id):**
745
+
746
+ The \`--after-test-id\` flag runs an existing test before the session becomes interactive. This is extremely useful for:
747
+ - **Bypassing login walls** - use a test that logs in, then start exploring from the authenticated state
748
+ - **Starting from a specific page state** - run a test that navigates to a complex form, then continue manually
749
+ - **Resuming from checkpoints** - save common setup steps as a test, reuse across explorations
750
+
751
+ \`\`\`bash
752
+ # First, create a login test and get its ID from the test listing
753
+ qa-use test run --list
754
+
755
+ # Then create a session that starts after login
756
+ qa-use browser create --after-test-id 4292938b-338d-4c1c-952e-6bcdf3f7731a
757
+
758
+ # Session is now logged in and ready for exploration
759
+ qa-use browser snapshot
760
+ \`\`\`
761
+
762
+ **Error handling for --after-test-id:**
763
+ - If test not found: "Test not found" (exit 1)
764
+ - If test belongs to different org: "Test belongs to different organization" (exit 1)
765
+ - If test fails: Session status becomes "failed" with error message displayed
766
+
767
+ **Session persistence:** Sessions are stored in \`~/.qa-use.json\`. If only one active session exists, it's used automatically for all commands.
768
+
769
+ ### list
770
+
771
+ List all active browser sessions.
772
+
773
+ \`\`\`bash
774
+ qa-use browser list
775
+ \`\`\`
776
+
777
+ Shows session IDs, creation time, and status.
778
+
779
+ ### status
780
+
781
+ Show detailed status of current session.
782
+
783
+ \`\`\`bash
784
+ qa-use browser status
785
+ qa-use browser -s <session-id> status
786
+ \`\`\`
787
+
788
+ **Output includes:**
789
+ - Session ID
790
+ - Current URL
791
+ - Viewport size
792
+ - \`app_url\` - Web UI for viewing the session
793
+ - \`recording_url\` - URL to download session recording
794
+ - \`har_url\` - URL to download HAR file (network logs)
795
+ - Creation time and deadline
796
+
797
+ ### close
798
+
799
+ Close the active browser session.
800
+
801
+ \`\`\`bash
802
+ qa-use browser close
803
+ \`\`\`
804
+
805
+ **Note:** Takes no arguments. Closes the currently active session. Use \`browser list\` first if you have multiple sessions and need to switch.
806
+
807
+ ## Navigation
808
+
809
+ ### goto
810
+
811
+ Navigate to a URL.
812
+
813
+ \`\`\`bash
814
+ qa-use browser goto <url>
815
+ \`\`\`
816
+
817
+ URL can be absolute (\`https://example.com\`) or relative (\`/login\`).
818
+
819
+ ### back / forward / reload
820
+
821
+ History navigation.
822
+
823
+ \`\`\`bash
824
+ qa-use browser back
825
+ qa-use browser forward
826
+ qa-use browser reload
827
+ \`\`\`
828
+
829
+ ## Element Targeting
830
+
831
+ ### snapshot
832
+
833
+ Get the page's ARIA accessibility tree with element refs.
834
+
835
+ \`\`\`bash
836
+ qa-use browser snapshot [options]
837
+ \`\`\`
838
+
839
+ | Flag | Description |
840
+ |------|-------------|
841
+ | \`-i, --interactive\` | Only include interactive elements (buttons, inputs, links) |
842
+ | \`-c, --compact\` | Remove empty structural elements |
843
+ | \`-d, --max-depth <n>\` | Limit tree depth (1-20, where 1 = top level only) |
844
+ | \`--scope <selector>\` | CSS selector to scope snapshot (e.g., \`#main\`, \`.form\`) |
845
+ | \`--json\` | Output raw JSON including filter_stats |
846
+
847
+ **Output format:**
848
+ \`\`\`
849
+ - heading "Page Title" [level=1] [ref=e2]
850
+ - button "Click Me" [ref=e3]
851
+ - textbox "Email" [ref=e4]
852
+ - link "Sign Up" [ref=e5]
853
+ \`\`\`
854
+
855
+ **Filtering examples:**
856
+ \`\`\`bash
857
+ # Get only interactive elements (great for reducing token count)
858
+ qa-use browser snapshot --interactive
859
+
860
+ # Combine filters for maximum reduction
861
+ qa-use browser snapshot --interactive --compact --max-depth 3
862
+
863
+ # Scope to specific section
864
+ qa-use browser snapshot --scope "#main-content"
865
+ \`\`\`
866
+
867
+ **Typical reductions:**
868
+ - \`--max-depth 3\`: ~98% reduction
869
+ - \`--interactive\`: 0-80% depending on page
870
+ - Combined \`--interactive --max-depth 4\`: ~95% reduction
871
+
872
+ Use the \`[ref=eN]\` values in interaction commands.
873
+
874
+ **Critical workflow:** Run \`snapshot\` before your first interaction on a new page. After that, use the snapshot diff output from actions to get fresh refs — only run \`snapshot\` again when you need elements not shown in the diff. Refs are session-specific and change between page loads.
875
+
876
+ ## Interactions
877
+
878
+ ### click
879
+
880
+ Click an element.
881
+
882
+ \`\`\`bash
883
+ qa-use browser click <ref>
884
+ qa-use browser click --text "Button label"
885
+ \`\`\`
886
+
887
+ | Argument | Description |
888
+ |----------|-------------|
889
+ | \`<ref>\` | Element ref from snapshot (e.g., \`e3\`) |
890
+ | \`--text\` | Semantic description for AI selection |
891
+
892
+ ### fill
893
+
894
+ Fill an input field (clears existing content).
895
+
896
+ \`\`\`bash
897
+ qa-use browser fill <ref> "value"
898
+ qa-use browser fill --text "Email field" "user@example.com"
899
+ \`\`\`
900
+
901
+ ### type
902
+
903
+ Type text with keystroke delays (useful for autocomplete).
904
+
905
+ \`\`\`bash
906
+ qa-use browser type <ref> "text"
907
+ \`\`\`
908
+
909
+ ### press
910
+
911
+ Press a keyboard key.
912
+
913
+ \`\`\`bash
914
+ qa-use browser press Enter
915
+ qa-use browser press Tab
916
+ qa-use browser press Escape
917
+ \`\`\`
918
+
919
+ ### check / uncheck
920
+
921
+ Toggle checkboxes.
922
+
923
+ \`\`\`bash
924
+ qa-use browser check <ref>
925
+ qa-use browser uncheck <ref>
926
+ \`\`\`
927
+
928
+ ### select
929
+
930
+ Select dropdown option by value or label.
931
+
932
+ \`\`\`bash
933
+ qa-use browser select <ref> "option value"
934
+ \`\`\`
935
+
936
+ ### hover
937
+
938
+ Hover over an element.
939
+
940
+ \`\`\`bash
941
+ qa-use browser hover <ref>
942
+ \`\`\`
943
+
944
+ ### scroll
945
+
946
+ Scroll the page or viewport.
947
+
948
+ \`\`\`bash
949
+ qa-use browser scroll down 500 # Scroll down 500px
950
+ qa-use browser scroll up 300 # Scroll up 300px
951
+ qa-use browser scroll-into-view <ref> # Scroll element into viewport
952
+ \`\`\`
953
+
954
+ ### drag
955
+
956
+ Drag an element to a target element.
957
+
958
+ \`\`\`bash
959
+ qa-use browser drag <ref> --target <target-ref>
960
+ qa-use browser drag <ref> --target-selector ".drop-zone"
961
+ qa-use browser drag --text "Draggable item" --target <target-ref>
962
+ \`\`\`
963
+
964
+ | Argument | Description |
965
+ |----------|-------------|
966
+ | \`<ref>\` | Source element ref from snapshot |
967
+ | \`--text\` | Semantic source description for AI selection |
968
+ | \`--target <ref>\` | Target element ref |
969
+ | \`--target-selector <sel>\` | Target CSS selector |
970
+
971
+ **Examples:**
972
+ \`\`\`bash
973
+ qa-use browser drag e5 --target e10 # Drag by ref to ref
974
+ qa-use browser drag e5 --target-selector ".canvas" # Drag to CSS selector
975
+ qa-use browser drag --text "Process node" --target e10 # Drag by text
976
+ \`\`\`
977
+
978
+ **Note:** The browser CLI drag command uses element refs from snapshots. This is different from the test YAML format which uses locator chains. See test-format.md for YAML test syntax.
979
+
980
+ ### mfa-totp
981
+
982
+ Generate TOTP code and optionally fill into an input field.
983
+
984
+ \`\`\`bash
985
+ qa-use browser mfa-totp <secret> # Generate only
986
+ qa-use browser mfa-totp <ref> <secret> # Generate and fill by ref
987
+ qa-use browser mfa-totp --text "OTP input" <secret> # Generate and fill by text
988
+ \`\`\`
989
+
990
+ | Argument | Description |
991
+ |----------|-------------|
992
+ | \`<secret>\` | TOTP secret (base32 encoded) |
993
+ | \`<ref>\` | Element ref to fill (optional) |
994
+ | \`--text\` | Semantic element description for AI selection |
995
+
996
+ **Examples:**
997
+ \`\`\`bash
998
+ qa-use browser mfa-totp JBSWY3DPEHPK3PXP # Generate code only
999
+ qa-use browser mfa-totp e15 JBSWY3DPEHPK3PXP # Fill into element e15
1000
+ qa-use browser mfa-totp --text "verification code" JBSWY3DPEHPK3PXP
1001
+ \`\`\`
1002
+
1003
+ ### upload
1004
+
1005
+ Upload file(s) to a file input element.
1006
+
1007
+ \`\`\`bash
1008
+ qa-use browser upload <ref> <file>...
1009
+ qa-use browser upload --text "Choose file" <file>...
1010
+ \`\`\`
1011
+
1012
+ | Argument | Description |
1013
+ |----------|-------------|
1014
+ | \`<ref>\` | File input element ref from snapshot |
1015
+ | \`--text\` | Semantic element description for AI selection |
1016
+ | \`<file>...\` | One or more file paths to upload |
1017
+
1018
+ **Examples:**
1019
+ \`\`\`bash
1020
+ qa-use browser upload e8 /tmp/document.pdf # Single file
1021
+ qa-use browser upload e8 /tmp/file1.pdf /tmp/file2.pdf # Multiple files
1022
+ qa-use browser upload --text "Upload attachment" /tmp/doc.pdf # By text
1023
+ \`\`\`
1024
+
1025
+ **Upload encoding:** Files are read locally and sent as base64-encoded data. This works in both remote and tunnel modes — no need for the browser to have direct access to the file system.
1026
+
1027
+ ## Downloads
1028
+
1029
+ ### downloads
1030
+
1031
+ List or save files downloaded during the browser session.
1032
+
1033
+ \`\`\`bash
1034
+ qa-use browser downloads # List downloads
1035
+ qa-use browser downloads --json # Output as JSON
1036
+ qa-use browser downloads --save /tmp/dl # Save files to directory
1037
+ qa-use browser downloads -s <id> # Downloads from specific/closed session
1038
+ \`\`\`
1039
+
1040
+ | Flag | Description |
1041
+ |------|-------------|
1042
+ | \`--json\` | Output raw JSON with URLs and metadata |
1043
+ | \`--save <dir>\` | Download files to local directory |
1044
+ | \`-s, --session-id <id>\` | Specify session (default: auto-resolved) |
1045
+
1046
+ **Download detection:** When any browser action triggers a file download (e.g., clicking a download link), the action response automatically includes download info (filename, size, presigned URL). The \`downloads\` command retrieves the full list.
1047
+
1048
+ ## Inspection
1049
+
1050
+ ### url
1051
+
1052
+ Get current page URL.
1053
+
1054
+ \`\`\`bash
1055
+ qa-use browser url
1056
+ \`\`\`
1057
+
1058
+ ### screenshot
1059
+
1060
+ Capture a screenshot.
1061
+
1062
+ \`\`\`bash
1063
+ qa-use browser screenshot # Saves as screenshot.png
1064
+ qa-use browser screenshot myfile.png # Custom filename
1065
+ qa-use browser screenshot /path/to/file.png # Custom path
1066
+ qa-use browser screenshot --base64 # Output base64 to stdout
1067
+ \`\`\`
1068
+
1069
+ **Note:** Path is a positional argument, not a flag. Do NOT use \`--output\` or \`--path\`.
1070
+
1071
+ ### get-blocks
1072
+
1073
+ Get recorded interaction blocks from the session.
1074
+
1075
+ \`\`\`bash
1076
+ qa-use browser get-blocks
1077
+ \`\`\`
1078
+
1079
+ Returns structured data of interactions performed during the session.
1080
+
1081
+ ## Logs
1082
+
1083
+ ### logs console
1084
+
1085
+ View browser console logs.
1086
+
1087
+ \`\`\`bash
1088
+ qa-use browser logs console # Current session
1089
+ qa-use browser logs console -s <id> # Specific or closed session
1090
+ \`\`\`
1091
+
1092
+ Shows console.log, console.error, and other console output from the page.
1093
+
1094
+ ### logs network
1095
+
1096
+ View network request logs.
1097
+
1098
+ \`\`\`bash
1099
+ qa-use browser logs network # Current session
1100
+ qa-use browser logs network -s <id> # Specific or closed session
1101
+ \`\`\`
1102
+
1103
+ Shows HTTP requests, responses, and timing information.
1104
+
1105
+ ## Test Generation
1106
+
1107
+ ### generate-test
1108
+
1109
+ Generate a test YAML file from recorded session interactions.
1110
+
1111
+ \`\`\`bash
1112
+ qa-use browser generate-test # Current session
1113
+ qa-use browser generate-test -s <id> # Specific session
1114
+ qa-use browser generate-test --output my-test.yaml # Custom output path
1115
+ \`\`\`
1116
+
1117
+ Creates a test definition based on the interactions performed during the session.
1118
+
1119
+ ## Waiting
1120
+
1121
+ ### wait
1122
+
1123
+ Fixed time wait.
1124
+
1125
+ \`\`\`bash
1126
+ qa-use browser wait 2000 # Wait 2 seconds
1127
+ \`\`\`
1128
+
1129
+ ### wait-for-selector
1130
+
1131
+ Wait for an element to appear.
1132
+
1133
+ \`\`\`bash
1134
+ qa-use browser wait-for-selector ".content"
1135
+ qa-use browser wait-for-selector ".modal" --state visible
1136
+ qa-use browser wait-for-selector ".loading" --state hidden
1137
+ \`\`\`
1138
+
1139
+ | Flag | Description |
1140
+ |------|-------------|
1141
+ | \`--state\` | Wait for state: \`visible\`, \`hidden\`, \`attached\`, \`detached\` |
1142
+ | \`--timeout\` | Max wait time in ms (default: 30000) |
1143
+
1144
+ ### wait-for-load
1145
+
1146
+ Wait for page load state.
1147
+
1148
+ \`\`\`bash
1149
+ qa-use browser wait-for-load
1150
+ qa-use browser wait-for-load --state networkidle
1151
+ qa-use browser wait-for-load --state domcontentloaded
1152
+ \`\`\`
1153
+
1154
+ | State | Description |
1155
+ |-------|-------------|
1156
+ | \`load\` | Wait for load event (default) |
1157
+ | \`domcontentloaded\` | Wait for DOMContentLoaded |
1158
+ | \`networkidle\` | Wait for no network activity |
1159
+
1160
+ ## Session Flag Position
1161
+
1162
+ When working with multiple sessions, use \`-s <id>\` BEFORE the command:
1163
+
1164
+ \`\`\`bash
1165
+ qa-use browser -s abc123 goto https://example.com # ✅ Correct
1166
+ qa-use browser goto -s abc123 https://example.com # ❌ Wrong
1167
+ qa-use browser goto https://example.com -s abc123 # ❌ Wrong
1168
+ \`\`\`
1169
+
1170
+ ## Interactive Mode
1171
+
1172
+ For extended multi-command sessions:
1173
+
1174
+ \`\`\`bash
1175
+ qa-use browser run
1176
+ qa-use browser run --after-test-id <uuid> # Start REPL from post-test state
1177
+ \`\`\`
1178
+
1179
+ Opens interactive REPL for browser commands. Use \`--after-test-id\` to start the REPL in an authenticated or pre-configured state.
1180
+
1181
+ ## Local Browser with Tunnel
1182
+
1183
+ The \`--tunnel\` flag starts a real browser on your machine with a tunnel for API control:
1184
+
1185
+ 1. **Browser runs locally** - you can see it (with \`--no-headless\`)
1186
+ 2. **API controls via tunnel** - cloud API sends commands through the tunnel
1187
+ 3. **Auto-cleanup** - session closes when you press Ctrl+C or run \`browser close\`
1188
+
1189
+ **Use cases:**
1190
+ - Debugging tests visually
1191
+ - Testing localhost URLs
1192
+ - Developing tests interactively
1193
+
1194
+ \`\`\`bash
1195
+ # Start visible local browser
1196
+ qa-use browser create --tunnel --no-headless
1197
+
1198
+ # Now interact normally
1199
+ qa-use browser goto http://localhost:3000
1200
+ qa-use browser snapshot
1201
+ qa-use browser click e3
1202
+
1203
+ # Watch the browser respond in real-time
1204
+ \`\`\`
1205
+
1206
+ ---
1207
+
1208
+ > **Runtime access:** \`qa-use docs browser-commands\` | All topics: \`qa-use docs --list\`
1209
+ `,
1210
+ },
1211
+ ci: {
1212
+ title: 'CI Integration Guide',
1213
+ content: `# CI Integration Guide
1214
+
1215
+ Run qa-use verification in GitHub Actions and other CI environments.
1216
+
1217
+ ## GitHub Actions Setup
1218
+
1219
+ ### Basic Workflow
1220
+
1221
+ \`\`\`yaml
1222
+ # .github/workflows/pr-verify.yml
1223
+ name: PR Verification
1224
+
1225
+ on:
1226
+ pull_request:
1227
+ types: [opened, synchronize, reopened]
1228
+
1229
+ jobs:
1230
+ verify-pr:
1231
+ runs-on: ubuntu-latest
1232
+ # Optional: only run on PRs with frontend changes
1233
+ # if: contains(github.event.pull_request.labels.*.name, 'frontend')
1234
+
1235
+ steps:
1236
+ - name: Checkout repository
1237
+ uses: actions/checkout@v4
1238
+ with:
1239
+ fetch-depth: 0 # Full history for diff analysis
1240
+
1241
+ - name: Setup Node.js
1242
+ uses: actions/setup-node@v4
1243
+ with:
1244
+ node-version: '20'
1245
+
1246
+ - name: Install Claude Code CLI
1247
+ run: |
1248
+ curl -fsSL https://claude.ai/install.sh | bash
1249
+ echo "$HOME/.local/bin" >> $GITHUB_PATH
1250
+
1251
+ - name: Install qa-use plugin and CLI
1252
+ run: |
1253
+ claude mcp add-from-marketplace qa-use
1254
+ npm install -g @desplega.ai/qa-use
1255
+
1256
+ - name: Run PR Verification
1257
+ env:
1258
+ CLAUDE_CODE_OAUTH_TOKEN: \${{ secrets.CLAUDE_CODE_OAUTH_TOKEN }}
1259
+ QA_USE_API_KEY: \${{ secrets.QA_USE_API_KEY }}
1260
+ GITHUB_TOKEN: \${{ secrets.GITHUB_TOKEN }}
1261
+ CI: true
1262
+ run: |
1263
+ # Run Claude Code with the verify-pr command
1264
+ claude --print "/qa-use:verify-pr #\${{ github.event.pull_request.number }}"
1265
+
1266
+ - name: Post Report to PR
1267
+ if: always() # Post even if verification had warnings
1268
+ env:
1269
+ GITHUB_TOKEN: \${{ secrets.GITHUB_TOKEN }}
1270
+ run: |
1271
+ if [ -f /tmp/pr-verify-report-\${{ github.event.pull_request.number }}.md ]; then
1272
+ gh pr comment \${{ github.event.pull_request.number }} \\
1273
+ --body-file /tmp/pr-verify-report-\${{ github.event.pull_request.number }}.md
1274
+ fi
1275
+ \`\`\`
1276
+
1277
+ ### With Preview Deployment (Vercel/Netlify)
1278
+
1279
+ \`\`\`yaml
1280
+ # .github/workflows/pr-verify.yml
1281
+ name: PR Verification
1282
+
1283
+ on:
1284
+ pull_request:
1285
+ branches:
1286
+ - main
1287
+ types: [opened, synchronize, reopened, ready_for_review]
1288
+ workflow_dispatch:
1289
+ inputs:
1290
+ pr_number:
1291
+ description: "PR number to verify"
1292
+ required: true
1293
+ type: number
1294
+
1295
+ concurrency:
1296
+ group: pr-verify-\${{ github.event.pull_request.number || inputs.pr_number }}
1297
+ cancel-in-progress: true
1298
+
1299
+ jobs:
1300
+ verify-pr:
1301
+ if: github.event_name == 'workflow_dispatch' || github.event.pull_request.draft == false
1302
+ runs-on: ubuntu-latest
1303
+ permissions:
1304
+ contents: read
1305
+ deployments: read
1306
+ pull-requests: write
1307
+ statuses: read
1308
+
1309
+ steps:
1310
+ - name: Checkout repository
1311
+ uses: actions/checkout@v4
1312
+ with:
1313
+ fetch-depth: 0 # Full history for diff analysis
1314
+
1315
+ - name: Check PR approval status
1316
+ id: approval
1317
+ env:
1318
+ GITHUB_TOKEN: \${{ secrets.GITHUB_TOKEN }}
1319
+ run: |
1320
+ # REVIEW_DECISION=$(gh pr view \${{ github.event.pull_request.number || inputs.pr_number }} --json reviewDecision -q '.reviewDecision')
1321
+ # echo "Review decision: $REVIEW_DECISION"
1322
+ # if [ "$REVIEW_DECISION" != "APPROVED" ]; then
1323
+ # echo "PR is not approved yet. Skipping verification."
1324
+ # echo "approved=false" >> $GITHUB_OUTPUT
1325
+ # else
1326
+ # echo "approved=true" >> $GITHUB_OUTPUT
1327
+ # fi
1328
+ # For demonstration purposes, we will assume all PRs are approved.
1329
+ echo "approved=true" >> $GITHUB_OUTPUT
1330
+
1331
+ - name: Setup Node.js
1332
+ if: steps.approval.outputs.approved == 'true'
1333
+ uses: actions/setup-node@v4
1334
+ with:
1335
+ node-version: "20"
1336
+
1337
+ - name: Install Claude Code CLI
1338
+ if: steps.approval.outputs.approved == 'true'
1339
+ run: |
1340
+ curl -fsSL https://claude.ai/install.sh | bash
1341
+ echo "$HOME/.local/bin" >> $GITHUB_PATH
1342
+
1343
+ - name: Verify Claude CLI Installation
1344
+ if: steps.approval.outputs.approved == 'true'
1345
+ run: |
1346
+ claude --version || (echo "Claude CLI installation failed" && exit 1)
1347
+
1348
+ - name: Install qa-use plugin and CLI
1349
+ if: steps.approval.outputs.approved == 'true'
1350
+ run: |
1351
+ claude plugin marketplace add desplega-ai/qa-use
1352
+ claude plugin install qa-use@desplega.ai
1353
+ npm install -g @desplega.ai/qa-use
1354
+
1355
+ - name: Wait for Vercel Preview
1356
+ if: steps.approval.outputs.approved == 'true'
1357
+ uses: patrickedqvist/wait-for-vercel-preview@v1.3.1
1358
+ id: vercel
1359
+ with:
1360
+ token: \${{ secrets.GITHUB_TOKEN }}
1361
+ max_timeout: 300
1362
+
1363
+ - name: Run PR Verification
1364
+ if: steps.approval.outputs.approved == 'true'
1365
+ env:
1366
+ CLAUDE_CODE_OAUTH_TOKEN: \${{ secrets.CLAUDE_CODE_OAUTH_TOKEN }}
1367
+ QA_USE_API_KEY: \${{ secrets.QA_USE_API_KEY }}
1368
+ GITHUB_TOKEN: \${{ secrets.GITHUB_TOKEN }}
1369
+ CI: true
1370
+ run: |
1371
+ # Run Claude Code with the verify-pr command using Vercel preview URL
1372
+ claude --print --verbose --dangerously-skip-permissions --output-format stream-json --model haiku "/qa-use:verify-pr #\${{ github.event.pull_request.number || inputs.pr_number }} --base-url \${{ steps.vercel.outputs.url }}" 2>&1 | jq -c 'select(.type == "assistant" or .type == "tool_use" or .type == "result")'
1373
+
1374
+ - name: Post Report to PR
1375
+ if: always() && steps.approval.outputs.approved == 'true'
1376
+ env:
1377
+ GITHUB_TOKEN: \${{ secrets.GITHUB_TOKEN }}
1378
+ run: |
1379
+ if [ -f /tmp/pr-verify-report-\${{ github.event.pull_request.number || inputs.pr_number }}.md ]; then
1380
+ gh pr comment \${{ github.event.pull_request.number || inputs.pr_number }} \\
1381
+ --body-file /tmp/pr-verify-report-\${{ github.event.pull_request.number || inputs.pr_number }}.md
1382
+ fi
1383
+
1384
+ - name: Upload Verification Artifacts
1385
+ if: always() && steps.approval.outputs.approved == 'true'
1386
+ uses: actions/upload-artifact@v4
1387
+ with:
1388
+ name: pr-verification-\${{ github.event.pull_request.number || inputs.pr_number }}
1389
+ path: |
1390
+ /tmp/pr-verify-*.png
1391
+ /tmp/pr-verify-*.json
1392
+ /tmp/pr-verify-*.jsonl
1393
+ /tmp/pr-verify-*.log
1394
+ /tmp/pr-verify-report-*.md
1395
+ \`\`\`
1396
+
1397
+ ### Netlify Preview Deployment
1398
+
1399
+ \`\`\`yaml
1400
+ # Wait for Netlify preview deployment
1401
+ - name: Wait for Netlify Preview
1402
+ uses: jlevy-io/wait-for-netlify-deploy-with-headers@v1.0.1
1403
+ id: netlify
1404
+ with:
1405
+ site_name: 'your-netlify-site-name'
1406
+ max_timeout: 300
1407
+
1408
+ - name: Run PR Verification
1409
+ env:
1410
+ CLAUDE_CODE_OAUTH_TOKEN: \${{ secrets.CLAUDE_CODE_OAUTH_TOKEN }}
1411
+ QA_USE_API_KEY: \${{ secrets.QA_USE_API_KEY }}
1412
+ GITHUB_TOKEN: \${{ secrets.GITHUB_TOKEN }}
1413
+ CI: true
1414
+ run: |
1415
+ claude --print "/qa-use:verify-pr #\${{ github.event.pull_request.number }} --base-url \${{ steps.netlify.outputs.url }}"
1416
+ \`\`\`
1417
+
1418
+ ## Variable Overrides
1419
+
1420
+ When running tests against preview deployments, you can override app config variables using \`--var\`:
1421
+
1422
+ \`\`\`bash
1423
+ qa-use browser create --after-test-id <login-test-uuid> \\
1424
+ --var base_url=https://preview-123.example.com \\
1425
+ --var login_url=https://preview-123.example.com/auth/login
1426
+ \`\`\`
1427
+
1428
+ Common app config variables:
1429
+
1430
+ | Variable | Description |
1431
+ |----------|-------------|
1432
+ | \`base_url\` | Base URL for the app (e.g., preview deployment) |
1433
+ | \`login_url\` | Login page URL |
1434
+ | \`login_username\` | Username/email for authentication |
1435
+ | \`login_password\` | Password for authentication |
1436
+
1437
+ The \`/qa-use:verify-pr\` command handles this automatically when you pass \`--base-url\`.
1438
+
1439
+ ## Pre-installed Tools on GitHub Runners
1440
+
1441
+ GitHub-hosted runners include:
1442
+
1443
+ | Tool | Status | Notes |
1444
+ |------|--------|-------|
1445
+ | \`gh\` CLI | Pre-installed | Auto-authenticated via \`GITHUB_TOKEN\` |
1446
+ | Node.js | Available | Pin version for consistency |
1447
+ | git | Pre-installed | Full functionality |
1448
+ | curl | Pre-installed | For fallback API calls |
1449
+
1450
+ ## Required Secrets
1451
+
1452
+ | Secret | Description | How to Get |
1453
+ |--------|-------------|------------|
1454
+ | \`CLAUDE_CODE_OAUTH_TOKEN\` | OAuth token for Claude Code authentication | Run \`claude setup-token\` locally (see below) |
1455
+ | \`QA_USE_API_KEY\` | qa-use/desplega.ai API key | From [desplega.ai dashboard](https://desplega.ai) |
1456
+ | \`GITHUB_TOKEN\` | Auto-provided by GitHub Actions | No setup needed (automatic) |
1457
+
1458
+ ### Getting CLAUDE_CODE_OAUTH_TOKEN
1459
+
1460
+ Run locally to generate and retrieve your OAuth token:
1461
+
1462
+ \`\`\`bash
1463
+ # This will authenticate and store the token locally
1464
+ claude setup-token
1465
+
1466
+ # The token is stored in ~/.claude/.credentials.json
1467
+ # Copy the token value and add it as a GitHub secret
1468
+ \`\`\`
1469
+
1470
+ Claude Code automatically picks up \`CLAUDE_CODE_OAUTH_TOKEN\` from the environment when running in CI.
1471
+
1472
+ ## Headless/Autonomous Mode
1473
+
1474
+ When \`CI=true\` or \`GITHUB_ACTIONS=true\` is set, the verify-pr command operates in fully autonomous mode:
1475
+
1476
+ | Behavior | Description |
1477
+ |----------|-------------|
1478
+ | No user prompts | Makes autonomous decisions with sensible defaults |
1479
+ | Auto-select first match | When multiple options exist (e.g., login tests) |
1480
+ | Continue on soft failures | Reports issues but doesn't block execution |
1481
+ | Fail fast on hard failures | Missing API key, no PR context, etc. |
1482
+
1483
+ ## Exit Codes
1484
+
1485
+ | Code | Meaning |
1486
+ |------|---------|
1487
+ | 0 | Verification completed (even with warnings/partial results) |
1488
+ | 1 | Hard failure (no PR context, API key missing, session creation failed) |
1489
+
1490
+ The report is always generated regardless of exit code, allowing PR comments to be posted even on partial failures.
1491
+
1492
+ ## Filtering by Label
1493
+
1494
+ To only run verification on PRs with specific labels:
1495
+
1496
+ \`\`\`yaml
1497
+ jobs:
1498
+ verify-pr:
1499
+ runs-on: ubuntu-latest
1500
+ if: contains(github.event.pull_request.labels.*.name, 'needs-verification')
1501
+ \`\`\`
1502
+
1503
+ Or to only run on frontend changes:
1504
+
1505
+ \`\`\`yaml
1506
+ on:
1507
+ pull_request:
1508
+ paths:
1509
+ - 'src/**/*.tsx'
1510
+ - 'src/**/*.jsx'
1511
+ - 'src/**/*.ts'
1512
+ - 'src/**/*.js'
1513
+ - 'src/**/*.vue'
1514
+ - 'src/**/*.svelte'
1515
+ \`\`\`
1516
+
1517
+ ## Debugging
1518
+
1519
+ ### View Raw Output
1520
+
1521
+ The command outputs a markdown report to stdout. To see raw output:
1522
+
1523
+ \`\`\`yaml
1524
+ - name: Run PR Verification
1525
+ run: |
1526
+ claude --print "/qa-use:verify-pr #\${{ github.event.pull_request.number }}" 2>&1 | tee /tmp/verification-output.txt
1527
+ \`\`\`
1528
+
1529
+ ### Check Session Artifacts
1530
+
1531
+ After verification, session artifacts are available:
1532
+
1533
+ \`\`\`yaml
1534
+ - name: Upload Verification Artifacts
1535
+ uses: actions/upload-artifact@v4
1536
+ if: always()
1537
+ with:
1538
+ name: pr-verification-\${{ github.event.pull_request.number }}
1539
+ path: |
1540
+ /tmp/pr-verify-*.png
1541
+ /tmp/pr-verify-*.json
1542
+ /tmp/pr-verify-report-*.md
1543
+ \`\`\`
1544
+
1545
+ ### Common Issues
1546
+
1547
+ | Issue | Solution |
1548
+ |-------|----------|
1549
+ | "API key not configured" | Ensure \`QA_USE_API_KEY\` secret is set |
1550
+ | "No login test found" | Either upload a login test or the command will proceed without auth |
1551
+ | "Session creation failed" | Check if \`QA_USE_API_KEY\` is valid and not expired |
1552
+ | "gh: command not found" | \`gh\` should be pre-installed; ensure checkout step runs first |
1553
+
1554
+ ---
1555
+
1556
+ > **Runtime access:** \`qa-use docs ci\` | All topics: \`qa-use docs --list\`
1557
+ `,
1558
+ },
1559
+ 'failure-debugging': {
1560
+ title: 'Failure Debugging',
1561
+ content: `# Failure Debugging
1562
+
1563
+ Guide for analyzing E2E test failures and determining root causes.
1564
+
1565
+ ## Failure Classification
1566
+
1567
+ Every test failure falls into one of three categories:
1568
+
1569
+ | Category | Meaning | Who Fixes |
1570
+ |----------|---------|-----------|
1571
+ | **CODE BUG** | Feature doesn't work | Developer (fix application code) |
1572
+ | **TEST BUG** | Test is outdated | Developer/QA (update test) |
1573
+ | **ENVIRONMENT** | External issue | Ops (fix infrastructure) |
1574
+
1575
+ Getting the classification right determines the correct fix approach.
1576
+
1577
+ ## CODE BUG
1578
+
1579
+ **The feature doesn't work as expected. The application code is broken.**
1580
+
1581
+ ### Indicators
1582
+
1583
+ - Expected behavior doesn't happen (redirect doesn't occur, data isn't saved)
1584
+ - JavaScript errors in browser console
1585
+ - API calls returning error responses (4xx, 5xx)
1586
+ - Application crashes or shows error pages
1587
+ - Form submission has no effect
1588
+ - Data not persisting
1589
+
1590
+ ### Diagnostic Questions
1591
+
1592
+ 1. Does the feature work when tested manually in a browser?
1593
+ 2. Are there related recent code changes?
1594
+ 3. Is the backend API responding correctly?
1595
+ 4. Are there JavaScript errors in the console? (\`qa-use browser logs console\`)
1596
+ 5. Are API requests failing? (\`qa-use browser logs network\`)
1597
+
1598
+ ### Investigation Steps
1599
+
1600
+ \`\`\`bash
1601
+ # 1. Get console logs
1602
+ qa-use browser logs console -s <session-id>
1603
+
1604
+ # 2. Get network logs
1605
+ qa-use browser logs network -s <session-id>
1606
+
1607
+ # 3. Check for errors
1608
+ # Look for: console.error, failed requests, 4xx/5xx responses
1609
+ \`\`\`
1610
+
1611
+ ### Suggested Actions
1612
+
1613
+ - **Locate relevant code:**
1614
+ - URL \`/login\` → look for \`pages/login\`, \`routes/login\`, \`auth/\`
1615
+ - Component "dashboard" → look for \`Dashboard.tsx\`, \`components/dashboard\`
1616
+ - Form submission → look for \`handleSubmit\`, form handlers, API calls
1617
+
1618
+ - **Check recent changes:**
1619
+ \`\`\`bash
1620
+ git log --oneline -20 -- src/
1621
+ git diff HEAD~5 -- src/auth/
1622
+ \`\`\`
1623
+
1624
+ - **Debug manually** - reproduce the issue in a browser with DevTools open
1625
+
1626
+ ## TEST BUG
1627
+
1628
+ **The test definition is outdated or incorrect. The feature works, but the test doesn't match it.**
1629
+
1630
+ ### Indicators
1631
+
1632
+ - Element selector/target no longer matches
1633
+ - Timing issues (element appears with different delay)
1634
+ - Expected value changed (button text "Submit" → "Sign In")
1635
+ - Test assumes old workflow that was redesigned
1636
+ - Assertion expects outdated content
1637
+
1638
+ ### Diagnostic Questions
1639
+
1640
+ 1. Has the UI changed recently (button text, layout, element attributes)?
1641
+ 2. Is this a timing/race condition issue?
1642
+ 3. Does the test pass with \`--autofix\`?
1643
+ 4. Did someone refactor the component without updating tests?
1644
+
1645
+ ### Investigation Steps
1646
+
1647
+ \`\`\`bash
1648
+ # 1. Run with autofix to see if AI can fix it
1649
+ qa-use test run my-test --autofix
1650
+
1651
+ # 2. If autofix works, persist the fix
1652
+ qa-use test run my-test --autofix --update-local
1653
+
1654
+ # 3. Check what changed
1655
+ git diff qa-tests/my-test.yaml
1656
+ \`\`\`
1657
+
1658
+ ### Suggested Actions
1659
+
1660
+ - **Update target description** to match current UI
1661
+ - **Add wait steps** for timing issues
1662
+ - **Run with \`--autofix --update-local\`** to let AI fix and persist
1663
+ - **Review the diff** to understand what changed
1664
+
1665
+ ### Common Test Bug Patterns
1666
+
1667
+ | Symptom | Likely Cause | Fix |
1668
+ |---------|--------------|-----|
1669
+ | "Element not found: submit button" | Button text changed | Update target to new text |
1670
+ | "Timeout waiting for dashboard" | Slower load time | Add \`wait\` or increase timeout |
1671
+ | "Expected 'Welcome' but got 'Hello'" | Copy changed | Update assertion value |
1672
+ | "Element not interactable" | Overlay blocking | Add wait for overlay to close |
1673
+
1674
+ ## ENVIRONMENT
1675
+
1676
+ **External factors are causing the failure. The code and test are correct.**
1677
+
1678
+ ### Indicators
1679
+
1680
+ - Network timeouts or connection errors
1681
+ - Authentication failures (session expired, invalid credentials)
1682
+ - Missing test data (database not seeded, user doesn't exist)
1683
+ - Service unavailable (third-party API down)
1684
+ - Rate limiting errors
1685
+ - SSL/TLS certificate errors
1686
+
1687
+ ### Diagnostic Questions
1688
+
1689
+ 1. Does the app work when accessed manually?
1690
+ 2. Are API credentials valid and not expired?
1691
+ 3. Is test data in the expected state?
1692
+ 4. Are external services (APIs, databases) accessible?
1693
+ 5. Is this a transient network issue?
1694
+
1695
+ ### Investigation Steps
1696
+
1697
+ \`\`\`bash
1698
+ # 1. Check if app is accessible
1699
+ curl https://your-app.com/health
1700
+
1701
+ # 2. Check network logs for failed requests
1702
+ qa-use browser logs network -s <session-id>
1703
+
1704
+ # 3. Verify credentials haven't expired
1705
+ # Check .qa-use-tests.json or environment variables
1706
+ \`\`\`
1707
+
1708
+ ### Suggested Actions
1709
+
1710
+ - **Retry the test** - transient issues often resolve themselves
1711
+ - **Refresh credentials** - update expired API keys or tokens
1712
+ - **Reset test data** - re-seed database, recreate test user
1713
+ - **Check service status** - verify third-party services are up
1714
+ - **Wait and retry** - for rate limiting, wait before retrying
1715
+
1716
+ ## Debugging Workflow
1717
+
1718
+ \`\`\`
1719
+ Test Failed
1720
+
1721
+
1722
+ ┌──────────────────────────────────────┐
1723
+ │ 1. Get session logs │
1724
+ │ qa-use browser logs console -s ID │
1725
+ │ qa-use browser logs network -s ID │
1726
+ └──────────────────┬───────────────────┘
1727
+
1728
+
1729
+ ┌──────────────────────────────────────┐
1730
+ │ 2. Check for JS errors or API fails │
1731
+ │ - Console errors = CODE BUG │
1732
+ │ - 4xx/5xx responses = CODE BUG │
1733
+ │ - Network timeout = ENVIRONMENT │
1734
+ └──────────────────┬───────────────────┘
1735
+
1736
+
1737
+ ┌──────────────────────────────────────┐
1738
+ │ 3. Try --autofix │
1739
+ │ qa-use test run name --autofix │
1740
+ │ - Works = TEST BUG, use │
1741
+ │ --update-local to persist │
1742
+ │ - Still fails = probably CODE BUG │
1743
+ └──────────────────┬───────────────────┘
1744
+
1745
+
1746
+ ┌──────────────────────────────────────┐
1747
+ │ 4. Manual verification │
1748
+ │ - Open app in browser │
1749
+ │ - Try the same flow manually │
1750
+ │ - Works manually = TEST BUG │
1751
+ │ - Fails manually = CODE BUG │
1752
+ └──────────────────────────────────────┘
1753
+ \`\`\`
1754
+
1755
+ ## Error Message Reference
1756
+
1757
+ | Error Message | Category | Likely Fix |
1758
+ |---------------|----------|------------|
1759
+ | "Element not found: ..." | TEST BUG | Update target description |
1760
+ | "Timeout waiting for ..." | TEST BUG/ENV | Add wait or check service |
1761
+ | "Expected ... but got ..." | TEST BUG/CODE | Verify expected value |
1762
+ | "Navigation to ... failed" | TEST BUG/CODE | Check URL and redirects |
1763
+ | "Element not interactable" | TEST BUG | Wait for overlays |
1764
+ | "Network request failed" | ENVIRONMENT | Check service health |
1765
+ | "Unauthorized" / "401" | ENVIRONMENT | Refresh credentials |
1766
+ | "Internal Server Error" / "500" | CODE BUG | Check server logs |
1767
+ | "Not Found" / "404" | CODE BUG | Check routing |
1768
+ | "TypeError: Cannot read ..." | CODE BUG | Fix JavaScript error |
1769
+
1770
+ ## Using AI Self-Healing
1771
+
1772
+ The \`--autofix\` flag enables AI-powered test repair:
1773
+
1774
+ \`\`\`bash
1775
+ # Try autofix
1776
+ qa-use test run my-test --autofix
1777
+
1778
+ # If it works, persist the changes
1779
+ qa-use test run my-test --autofix --update-local
1780
+
1781
+ # Review what changed
1782
+ git diff qa-tests/my-test.yaml
1783
+ \`\`\`
1784
+
1785
+ **What autofix can fix:**
1786
+ - Selector/target changes
1787
+ - Timing issues (adds waits)
1788
+ - Minor assertion value changes
1789
+
1790
+ **What autofix cannot fix:**
1791
+ - Broken application code
1792
+ - Major workflow changes
1793
+ - Missing features
1794
+ - Authentication issues
1795
+
1796
+ ---
1797
+
1798
+ > **Runtime access:** \`qa-use docs failure-debugging\` | All topics: \`qa-use docs --list\`
1799
+ `,
1800
+ },
1801
+ 'localhost-testing': {
1802
+ title: 'Localhost Testing',
1803
+ content: `# Localhost Testing
1804
+
1805
+ Testing applications running on \`localhost\` requires a tunnel because the cloud-hosted browser cannot access your local machine.
1806
+
1807
+ ## Why Tunnels Are Needed
1808
+
1809
+ \`\`\`
1810
+ Your Machine Cloud
1811
+ ┌─────────────────┐ ┌─────────────────┐
1812
+ │ localhost:3000 │ ✗ │ Cloud Browser │
1813
+ │ (your app) │ ◄──────────│ (qa-use API) │
1814
+ └─────────────────┘ └─────────────────┘
1815
+
1816
+ Without tunnel: Cloud cannot reach localhost
1817
+ \`\`\`
1818
+
1819
+ \`\`\`
1820
+ Your Machine Cloud
1821
+ ┌─────────────────┐ ┌─────────────────┐
1822
+ │ localhost:3000 │ │ Cloud Browser │
1823
+ │ (your app) │ │ (qa-use API) │
1824
+ └────────┬────────┘ └────────┬────────┘
1825
+ │ │
1826
+ └──────────┐ ┌──────────────┘
1827
+ │ │
1828
+ ┌─────▼────▼─────┐
1829
+ │ Local Browser │
1830
+ │ + Tunnel │
1831
+ └────────────────┘
1832
+
1833
+ With tunnel: Local browser accesses localhost,
1834
+ API controls browser through tunnel
1835
+ \`\`\`
1836
+
1837
+ ## Using \`--tunnel\` Flag
1838
+
1839
+ The simplest approach - add \`--tunnel\` to your test run command:
1840
+
1841
+ \`\`\`bash
1842
+ qa-use test run my-test --tunnel
1843
+ \`\`\`
1844
+
1845
+ This:
1846
+ 1. Starts a local headless browser
1847
+ 2. Creates a tunnel for API control
1848
+ 3. Runs the test
1849
+ 4. Cleans up automatically
1850
+
1851
+ ### With Visible Browser
1852
+
1853
+ For debugging, add \`--headful\`:
1854
+
1855
+ \`\`\`bash
1856
+ qa-use test run my-test --tunnel --headful
1857
+ \`\`\`
1858
+
1859
+ ## Persistent Tunnel Session
1860
+
1861
+ For running multiple tests or interactive development, create a persistent tunnel session:
1862
+
1863
+ ### Terminal 1: Start Tunnel
1864
+
1865
+ \`\`\`bash
1866
+ qa-use browser create --tunnel --no-headless
1867
+ \`\`\`
1868
+
1869
+ Output:
1870
+ \`\`\`
1871
+ Session created: abc123
1872
+ WebSocket URL: wss://tunnel.desplega.ai/abc123
1873
+ Tunnel active. Press Ctrl+C to stop.
1874
+ \`\`\`
1875
+
1876
+ ### Terminal 2: Run Tests
1877
+
1878
+ \`\`\`bash
1879
+ # Run test against the tunneled browser
1880
+ qa-use test run my-test --ws-url wss://tunnel.desplega.ai/abc123
1881
+
1882
+ # Or run multiple tests
1883
+ qa-use test run login --ws-url wss://tunnel.desplega.ai/abc123
1884
+ qa-use test run checkout --ws-url wss://tunnel.desplega.ai/abc123
1885
+ \`\`\`
1886
+
1887
+ ### Benefits
1888
+
1889
+ - **Reuse browser session** - no startup time between tests
1890
+ - **Watch execution** - see what's happening in real-time
1891
+ - **Debug interactively** - use browser commands between test runs
1892
+ - **Inspect state** - check page state after failures
1893
+
1894
+ ## Browser Session Commands with Tunnel
1895
+
1896
+ You can also use browser commands directly for exploration:
1897
+
1898
+ \`\`\`bash
1899
+ # Create tunneled session
1900
+ qa-use browser create --tunnel --no-headless
1901
+
1902
+ # Navigate to your local app
1903
+ qa-use browser goto http://localhost:3000
1904
+
1905
+ # Explore
1906
+ qa-use browser snapshot
1907
+ qa-use browser click e3
1908
+ qa-use browser screenshot
1909
+
1910
+ # Close when done
1911
+ qa-use browser close
1912
+ \`\`\`
1913
+
1914
+ ## Environment-Specific URLs
1915
+
1916
+ If your app runs on different ports in different environments, use variables:
1917
+
1918
+ \`\`\`yaml
1919
+ # test.yaml
1920
+ name: Local Test
1921
+ app_config: my-app
1922
+ variables:
1923
+ base_url: http://localhost:3000
1924
+ steps:
1925
+ - action: goto
1926
+ url: $base_url/login
1927
+ \`\`\`
1928
+
1929
+ Override at runtime:
1930
+
1931
+ \`\`\`bash
1932
+ # Local development
1933
+ qa-use test run my-test --tunnel --var base_url=http://localhost:3000
1934
+
1935
+ # Staging
1936
+ qa-use test run my-test --var base_url=https://staging.example.com
1937
+ \`\`\`
1938
+
1939
+ ## Common Issues
1940
+
1941
+ ### "Connection refused" / "Network error"
1942
+
1943
+ Your local server isn't running or is on a different port.
1944
+
1945
+ **Fix:** Verify your app is running:
1946
+ \`\`\`bash
1947
+ curl http://localhost:3000
1948
+ \`\`\`
1949
+
1950
+ ### Tunnel disconnects
1951
+
1952
+ The tunnel process was interrupted.
1953
+
1954
+ **Fix:** Restart the tunnel:
1955
+ \`\`\`bash
1956
+ qa-use browser create --tunnel
1957
+ \`\`\`
1958
+
1959
+ ### "localhost" resolved differently
1960
+
1961
+ Some setups resolve \`localhost\` differently than \`127.0.0.1\`.
1962
+
1963
+ **Fix:** Try the explicit IP:
1964
+ \`\`\`bash
1965
+ qa-use browser goto http://127.0.0.1:3000
1966
+ \`\`\`
1967
+
1968
+ ### HTTPS localhost with self-signed cert
1969
+
1970
+ Local HTTPS with self-signed certificates may fail.
1971
+
1972
+ **Fix:** Use HTTP for local testing, or configure your browser to accept the cert:
1973
+ \`\`\`bash
1974
+ # Use HTTP locally
1975
+ qa-use browser goto http://localhost:3000
1976
+
1977
+ # Test HTTPS only in staging/prod environments
1978
+ \`\`\`
1979
+
1980
+ ## Best Practices
1981
+
1982
+ 1. **Use \`--tunnel\` for all localhost tests** - Don't forget, or tests will fail with confusing network errors
1983
+
1984
+ 2. **Keep tunnel running during development** - Create once, run many tests
1985
+
1986
+ 3. **Use \`--no-headless\` for debugging** - Watch what's happening
1987
+
1988
+ 4. **Save WebSocket URL** - Copy it from tunnel output for reuse in \`--ws-url\`
1989
+
1990
+ 5. **Clean up sessions** - Run \`qa-use browser close\` when done to free resources
1991
+
1992
+ ---
1993
+
1994
+ > **Runtime access:** \`qa-use docs localhost-testing\` | All topics: \`qa-use docs --list\`
1995
+ `,
1996
+ },
1997
+ 'test-format': {
1998
+ title: 'Test Format Reference',
1999
+ content: `# Test Format Reference
2000
+
2001
+ Complete specification for qa-use test YAML files.
2002
+
2003
+ ## Basic Structure
2004
+
2005
+ \`\`\`yaml
2006
+ name: Test Name
2007
+ description: Optional description of what this test verifies
2008
+ tags:
2009
+ - smoke
2010
+ - auth
2011
+ app_config: <app-config-id>
2012
+ variables:
2013
+ key: value
2014
+ depends_on: optional-prerequisite-test
2015
+ steps:
2016
+ - action: goto
2017
+ url: /path
2018
+ \`\`\`
2019
+
2020
+ ## Required Fields
2021
+
2022
+ | Field | Description |
2023
+ |-------|-------------|
2024
+ | \`name\` | Human-readable test name |
2025
+ | \`app_config\` | App configuration ID from desplega.ai (or use default from \`.qa-use-tests.json\`) |
2026
+ | \`steps\` | Array of test steps |
2027
+
2028
+ ## Optional Fields
2029
+
2030
+ | Field | Description |
2031
+ |-------|-------------|
2032
+ | \`description\` | What this test verifies |
2033
+ | \`tags\` | Array of strings for categorization (e.g., \`smoke\`, \`auth\`, \`critical\`) |
2034
+ | \`variables\` | Key-value pairs for parameterization |
2035
+ | \`depends_on\` | Name of test that must run first |
2036
+
2037
+ ## Variables
2038
+
2039
+ Define variables at the top level:
2040
+
2041
+ \`\`\`yaml
2042
+ variables:
2043
+ email: test@example.com
2044
+ password: secret123
2045
+ base_path: /app
2046
+ \`\`\`
2047
+
2048
+ Reference with \`$\` prefix:
2049
+
2050
+ \`\`\`yaml
2051
+ steps:
2052
+ - action: fill
2053
+ target: email input
2054
+ value: $email
2055
+ - action: goto
2056
+ url: $base_path/dashboard
2057
+ \`\`\`
2058
+
2059
+ Variables can be overridden at runtime:
2060
+
2061
+ \`\`\`bash
2062
+ qa-use test run my-test --var email=other@example.com
2063
+ \`\`\`
2064
+
2065
+ ## Dependencies
2066
+
2067
+ Run prerequisite tests first:
2068
+
2069
+ \`\`\`yaml
2070
+ name: Checkout Test
2071
+ depends_on: login-test
2072
+ steps:
2073
+ - action: goto
2074
+ url: /checkout
2075
+ \`\`\`
2076
+
2077
+ Dependencies are resolved recursively. If \`checkout-test\` depends on \`login-test\`, and \`login-test\` depends on \`setup-test\`, all three run in order.
2078
+
2079
+ ## Step Format
2080
+
2081
+ Each step has an \`action\` and action-specific fields:
2082
+
2083
+ \`\`\`yaml
2084
+ - action: <action-type>
2085
+ target: <element description> # For interactions
2086
+ value: <value> # For fill, type, assertions
2087
+ url: <path> # For navigation
2088
+ \`\`\`
2089
+
2090
+ ## Available Actions
2091
+
2092
+ ### Navigation
2093
+
2094
+ | Action | Fields | Description |
2095
+ |--------|--------|-------------|
2096
+ | \`goto\` | \`url\` | Navigate to URL (absolute or relative) |
2097
+ | \`back\` | - | Browser back |
2098
+ | \`forward\` | - | Browser forward |
2099
+ | \`reload\` | - | Reload page |
2100
+
2101
+ \`\`\`yaml
2102
+ - action: goto
2103
+ url: /login
2104
+
2105
+ - action: goto
2106
+ url: https://example.com/page
2107
+ \`\`\`
2108
+
2109
+ ### Interactions
2110
+
2111
+ | Action | Fields | Description |
2112
+ |--------|--------|-------------|
2113
+ | \`click\` | \`target\` | Click element |
2114
+ | \`fill\` | \`target\`, \`value\` | Fill input (clears first) |
2115
+ | \`type\` | \`target\`, \`value\` | Type with delays |
2116
+ | \`press\` | \`value\` | Press keyboard key |
2117
+ | \`check\` | \`target\` | Check checkbox |
2118
+ | \`uncheck\` | \`target\` | Uncheck checkbox |
2119
+ | \`select\` | \`target\`, \`value\` | Select dropdown option |
2120
+ | \`hover\` | \`target\` | Hover over element |
2121
+ | \`scroll\` | \`target\` or direction | Scroll page or element |
2122
+ | \`mfa_totp\` | \`target\` (optional), \`secret\` | Generate TOTP and optionally fill |
2123
+ | \`set_input_files\` | \`target\`, \`files\` | Upload files to input |
2124
+
2125
+ \`\`\`yaml
2126
+ - action: click
2127
+ target: submit button
2128
+
2129
+ - action: fill
2130
+ target: email input
2131
+ value: $email
2132
+
2133
+ - action: type
2134
+ target: search box
2135
+ value: search query
2136
+
2137
+ - action: press
2138
+ value: Enter
2139
+
2140
+ - action: select
2141
+ target: country dropdown
2142
+ value: United States
2143
+
2144
+ - action: mfa_totp
2145
+ target: OTP input field
2146
+ secret: $totp_secret
2147
+
2148
+ - action: set_input_files
2149
+ target: file upload button
2150
+ files:
2151
+ - /path/to/file1.pdf
2152
+ - /path/to/file2.pdf
2153
+ \`\`\`
2154
+
2155
+ ### Assertions
2156
+
2157
+ | Action | Fields | Description |
2158
+ |--------|--------|-------------|
2159
+ | \`to_be_visible\` | \`target\` | Assert element is visible |
2160
+ | \`to_be_hidden\` | \`target\` | Assert element is hidden |
2161
+ | \`to_have_text\` | \`target\`, \`value\` | Assert element has text |
2162
+ | \`to_have_value\` | \`target\`, \`value\` | Assert input has value |
2163
+ | \`to_be_checked\` | \`target\` | Assert checkbox is checked |
2164
+ | \`to_be_unchecked\` | \`target\` | Assert checkbox is unchecked |
2165
+
2166
+ \`\`\`yaml
2167
+ - action: to_be_visible
2168
+ target: success message
2169
+
2170
+ - action: to_have_text
2171
+ target: page heading
2172
+ value: Welcome
2173
+
2174
+ - action: to_be_checked
2175
+ target: remember me checkbox
2176
+ \`\`\`
2177
+
2178
+ ### Waiting
2179
+
2180
+ | Action | Fields | Description |
2181
+ |--------|--------|-------------|
2182
+ | \`wait\` | \`value\` | Wait fixed time (ms) |
2183
+ | \`wait_for_url\` | \`url\` | Wait for URL to match |
2184
+ | \`wait_for_selector\` | \`target\`, \`state\` | Wait for element state |
2185
+
2186
+ \`\`\`yaml
2187
+ - action: wait
2188
+ value: 2000
2189
+
2190
+ - action: wait_for_url
2191
+ url: /dashboard
2192
+
2193
+ - action: wait_for_selector
2194
+ target: .modal
2195
+ state: hidden
2196
+ \`\`\`
2197
+
2198
+ ### AI-Powered Actions
2199
+
2200
+ Use when human-readable selectors are insufficient:
2201
+
2202
+ | Action | Fields | Description |
2203
+ |--------|--------|-------------|
2204
+ | \`ai_action\` | \`value\` | AI performs action from description |
2205
+ | \`ai_assertion\` | \`value\` | AI verifies condition from description |
2206
+
2207
+ \`\`\`yaml
2208
+ - action: ai_action
2209
+ value: scroll to the pricing section
2210
+
2211
+ - action: ai_action
2212
+ value: dismiss the cookie banner if present
2213
+
2214
+ - action: ai_assertion
2215
+ value: verify the cart shows exactly 3 items
2216
+
2217
+ - action: ai_assertion
2218
+ value: confirm the total price is greater than $50
2219
+ \`\`\`
2220
+
2221
+ AI actions are more flexible but slower and less deterministic. Prefer explicit actions when possible.
2222
+
2223
+ ### Extended Step Format
2224
+
2225
+ For actions not available in simple format (like drag operations), use the extended format:
2226
+
2227
+ | Action | Description |
2228
+ |--------|-------------|
2229
+ | \`drag_and_drop\` | Drag source element to target |
2230
+ | \`relative_drag_and_drop\` | Drag with relative positioning |
2231
+ | \`mfa_totp\` | Generate and enter TOTP code |
2232
+ | \`set_input_files\` | Upload files |
2233
+
2234
+ #### Drag and Drop Example
2235
+
2236
+ \`\`\`yaml
2237
+ - type: extended
2238
+ name: Drag item to drop zone
2239
+ action:
2240
+ action: drag_and_drop
2241
+ value:
2242
+ target_locator: "#drop-zone" # Playwright locator string
2243
+ locator:
2244
+ chain:
2245
+ - method: get_by_text
2246
+ args: ["draggable item"]
2247
+ \`\`\`
2248
+
2249
+ The \`target_locator\` must be a valid Playwright locator string:
2250
+ - \`"#drop-zone"\` - CSS ID selector
2251
+ - \`".drop-area"\` - CSS class selector
2252
+ - \`"text=Drop here"\` - Text selector
2253
+ - \`"[data-testid='target']"\` - Attribute selector
2254
+
2255
+ #### TOTP Example
2256
+
2257
+ \`\`\`yaml
2258
+ - type: extended
2259
+ name: Enter MFA code
2260
+ action:
2261
+ action: mfa_totp
2262
+ value:
2263
+ target_locator: "#otp-input"
2264
+ locator:
2265
+ chain:
2266
+ - method: get_by_label
2267
+ args: ["Enter your code"]
2268
+ \`\`\`
2269
+
2270
+ **Tip:** Use \`qa-use test schema\` to explore all available actions and their schemas.
2271
+
2272
+ ## Target Descriptions
2273
+
2274
+ The \`target\` field uses natural language descriptions:
2275
+
2276
+ \`\`\`yaml
2277
+ # Good - specific and unambiguous
2278
+ target: submit button in the login form
2279
+ target: email input field
2280
+ target: first product card
2281
+ target: navigation menu item labeled "Settings"
2282
+
2283
+ # Avoid - too generic
2284
+ target: button
2285
+ target: input
2286
+ target: link
2287
+ \`\`\`
2288
+
2289
+ The AI matches your description against the page's ARIA accessibility tree. Be specific enough to uniquely identify the element.
2290
+
2291
+ ## Complete Example
2292
+
2293
+ \`\`\`yaml
2294
+ name: User Registration
2295
+ description: Tests the full user registration flow
2296
+ tags:
2297
+ - smoke
2298
+ - registration
2299
+ - critical
2300
+ app_config: my-app-config-id
2301
+ variables:
2302
+ email: newuser@example.com
2303
+ password: SecurePass123!
2304
+ name: Test User
2305
+ depends_on: clear-test-data
2306
+
2307
+ steps:
2308
+ # Navigate to registration
2309
+ - action: goto
2310
+ url: /register
2311
+
2312
+ # Fill registration form
2313
+ - action: fill
2314
+ target: name input
2315
+ value: $name
2316
+
2317
+ - action: fill
2318
+ target: email input
2319
+ value: $email
2320
+
2321
+ - action: fill
2322
+ target: password input
2323
+ value: $password
2324
+
2325
+ - action: fill
2326
+ target: confirm password input
2327
+ value: $password
2328
+
2329
+ # Accept terms
2330
+ - action: check
2331
+ target: terms and conditions checkbox
2332
+
2333
+ # Submit
2334
+ - action: click
2335
+ target: create account button
2336
+
2337
+ # Wait for redirect
2338
+ - action: wait_for_url
2339
+ url: /welcome
2340
+
2341
+ # Verify success
2342
+ - action: to_be_visible
2343
+ target: welcome message
2344
+
2345
+ - action: to_have_text
2346
+ target: user greeting
2347
+ value: Hello, Test User
2348
+ \`\`\`
2349
+
2350
+ ## File Location
2351
+
2352
+ Tests should be placed in the test directory (default: \`qa-tests/\`):
2353
+
2354
+ \`\`\`
2355
+ qa-tests/
2356
+ ├── login.yaml
2357
+ ├── registration.yaml
2358
+ ├── checkout.yaml
2359
+ └── setup/
2360
+ └── seed-data.yaml
2361
+ \`\`\`
2362
+
2363
+ Configure the test directory in \`.qa-use-tests.json\`:
2364
+
2365
+ \`\`\`json
2366
+ {
2367
+ "test_directory": "./qa-tests"
2368
+ }
2369
+ \`\`\`
2370
+
2371
+ ---
2372
+
2373
+ > **Runtime access:** \`qa-use docs test-format\` | All topics: \`qa-use docs --list\`
2374
+ `,
2375
+ },
2376
+ };
2377
+ export const TEMPLATES = {
2378
+ 'auth-flow': {
2379
+ title: 'Auth Flow Template',
2380
+ content: `# Authentication Flow Template
2381
+ # Login with credentials and verify dashboard access
2382
+
2383
+ name: Authentication Flow
2384
+ description: Login with credentials and verify successful authentication
2385
+
2386
+ # Replace with your app config ID from desplega.ai
2387
+ app_config: $APP_CONFIG_ID
2388
+
2389
+ # Variables for credentials
2390
+ # Override at runtime: qa-use test run auth-flow --var email=real@example.com
2391
+ variables:
2392
+ email: test@example.com
2393
+ password: "********"
2394
+
2395
+ steps:
2396
+ # Navigate to login page
2397
+ - action: goto
2398
+ url: /login
2399
+
2400
+ # Fill login form
2401
+ - action: fill
2402
+ target: email input
2403
+ value: $email
2404
+
2405
+ - action: fill
2406
+ target: password input
2407
+ value: $password
2408
+
2409
+ # Submit the form
2410
+ - action: click
2411
+ target: sign in button
2412
+
2413
+ # Wait for successful redirect
2414
+ - action: wait_for_url
2415
+ url: /dashboard
2416
+
2417
+ # Verify dashboard is visible
2418
+ - action: to_be_visible
2419
+ target: dashboard content
2420
+
2421
+ # Optional: verify user greeting
2422
+ # - action: to_be_visible
2423
+ # target: welcome message
2424
+ `,
2425
+ },
2426
+ 'basic-test': {
2427
+ title: 'Basic Test Template',
2428
+ content: `# Basic Test Template
2429
+ # A simple navigation and assertion test
2430
+
2431
+ name: Basic Test
2432
+ description: Navigate to a page and verify an element is visible
2433
+
2434
+ # Replace with your app config ID from desplega.ai
2435
+ # Or set default_app_config_id in .qa-use-tests.json
2436
+ app_config: $APP_CONFIG_ID
2437
+
2438
+ steps:
2439
+ # Navigate to the starting page
2440
+ - action: goto
2441
+ url: /
2442
+
2443
+ # Verify the main content is visible
2444
+ - action: to_be_visible
2445
+ target: main content area
2446
+
2447
+ # Optional: verify page heading
2448
+ # - action: to_have_text
2449
+ # target: page heading
2450
+ # value: Welcome
2451
+ `,
2452
+ },
2453
+ 'form-test': {
2454
+ title: 'Form Test Template',
2455
+ content: `# Form Submission Template
2456
+ # Fill out a form and verify successful submission
2457
+
2458
+ name: Form Submission
2459
+ description: Fill a contact form and verify submission success
2460
+
2461
+ # Replace with your app config ID from desplega.ai
2462
+ app_config: $APP_CONFIG_ID
2463
+
2464
+ # Variables for form data
2465
+ variables:
2466
+ name: Test User
2467
+ email: test@example.com
2468
+ message: This is a test message from automated testing.
2469
+
2470
+ steps:
2471
+ # Navigate to the form page
2472
+ - action: goto
2473
+ url: /contact
2474
+
2475
+ # Fill form fields
2476
+ - action: fill
2477
+ target: name input
2478
+ value: $name
2479
+
2480
+ - action: fill
2481
+ target: email input
2482
+ value: $email
2483
+
2484
+ - action: fill
2485
+ target: message textarea
2486
+ value: $message
2487
+
2488
+ # Optional: handle checkbox/consent
2489
+ # - action: check
2490
+ # target: consent checkbox
2491
+
2492
+ # Submit the form
2493
+ - action: click
2494
+ target: submit button
2495
+
2496
+ # Verify success
2497
+ - action: to_be_visible
2498
+ target: success message
2499
+
2500
+ # Optional: verify specific success text
2501
+ # - action: to_have_text
2502
+ # target: confirmation message
2503
+ # value: Thank you for your message
2504
+ `,
2505
+ },
2506
+ };
2507
+ //# sourceMappingURL=docs-content.js.map