testdriverai 7.2.9 → 7.2.10

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 (124) hide show
  1. package/.github/workflows/testdriver.yml +127 -0
  2. package/.testdriver/last-sandbox +7 -0
  3. package/agent/events.js +1 -0
  4. package/agent/index.js +71 -54
  5. package/agent/lib/sandbox.js +11 -1
  6. package/agents.md +393 -0
  7. package/debug/01-table-initial.png +0 -0
  8. package/debug/02-after-ai-explore.png +0 -0
  9. package/debug/02-after-scroll.png +0 -0
  10. package/docs/docs.json +93 -125
  11. package/docs/v7/_drafts/caching.mdx +2 -2
  12. package/docs/v7/{getting-started → _drafts}/installation.mdx +0 -66
  13. package/docs/v7/{features/coverage.mdx → _drafts/powerful.mdx} +1 -90
  14. package/docs/v7/{features → _drafts}/scalable.mdx +126 -4
  15. package/docs/v7/_drafts/screenshot.mdx +155 -0
  16. package/docs/v7/_drafts/writing-tests.mdx +25 -0
  17. package/docs/v7/{api/act.mdx → ai.mdx} +27 -27
  18. package/docs/v7/{api/assert.mdx → assert.mdx} +3 -3
  19. package/docs/v7/aws-setup.mdx +338 -0
  20. package/docs/v7/caching.mdx +128 -0
  21. package/docs/v7/ci-cd.mdx +605 -0
  22. package/docs/v7/{api/click.mdx → click.mdx} +4 -4
  23. package/docs/v7/cloud.mdx +120 -0
  24. package/docs/v7/customizing-devices.mdx +129 -0
  25. package/docs/v7/{api/doubleClick.mdx → double-click.mdx} +5 -5
  26. package/docs/v7/enterprise.mdx +135 -0
  27. package/docs/v7/examples.mdx +5 -0
  28. package/docs/v7/{api/exec.mdx → exec.mdx} +3 -3
  29. package/docs/v7/{api/find.mdx → find.mdx} +17 -21
  30. package/docs/v7/{api/focusApplication.mdx → focus-application.mdx} +3 -3
  31. package/docs/v7/generating-tests.mdx +32 -0
  32. package/docs/v7/{api/hover.mdx → hover.mdx} +3 -3
  33. package/docs/v7/locating-elements.mdx +71 -0
  34. package/docs/v7/making-assertions.mdx +32 -0
  35. package/docs/v7/{api/mouseDown.mdx → mouse-down.mdx} +7 -7
  36. package/docs/v7/{api/mouseUp.mdx → mouse-up.mdx} +8 -8
  37. package/docs/v7/performing-actions.mdx +51 -0
  38. package/docs/v7/{api/pressKeys.mdx → press-keys.mdx} +3 -3
  39. package/docs/v7/quickstart.mdx +162 -0
  40. package/docs/v7/reusable-code.mdx +240 -0
  41. package/docs/v7/{api/rightClick.mdx → right-click.mdx} +5 -5
  42. package/docs/v7/running-tests.mdx +181 -0
  43. package/docs/v7/{api/scroll.mdx → scroll.mdx} +3 -3
  44. package/docs/v7/secrets.mdx +115 -0
  45. package/docs/v7/self-hosted.mdx +66 -0
  46. package/docs/v7/{api/type.mdx → type.mdx} +3 -3
  47. package/docs/v7/variables.mdx +111 -0
  48. package/docs/v7/waiting-for-elements.mdx +66 -0
  49. package/docs/v7/what-is-testdriver.mdx +54 -0
  50. package/lib/vitest/hooks.mjs +80 -68
  51. package/package.json +1 -1
  52. package/sdk.d.ts +22 -9
  53. package/sdk.js +177 -44
  54. package/test/manual/reconnect-provision.test.mjs +49 -0
  55. package/test/manual/reconnect-signin.test.mjs +41 -0
  56. package/test/testdriver/ai.test.mjs +30 -0
  57. package/test/testdriver/setup/testHelpers.mjs +0 -1
  58. package/test/testdriver/windows-installer.test.mjs +61 -0
  59. package/tests/table-sort-enrollments.test.mjs +72 -0
  60. package/tests/table-sort-experiment.test.mjs +42 -0
  61. package/tests/table-sort-setup.test.mjs +59 -0
  62. package/vitest.config.mjs +1 -0
  63. package/docs/v7/api/assertions.mdx +0 -403
  64. package/docs/v7/features/ai-native.mdx +0 -413
  65. package/docs/v7/features/application-logs.mdx +0 -353
  66. package/docs/v7/features/browser-logs.mdx +0 -414
  67. package/docs/v7/features/cache-management.mdx +0 -402
  68. package/docs/v7/features/continuous-testing.mdx +0 -346
  69. package/docs/v7/features/data-driven-testing.mdx +0 -441
  70. package/docs/v7/features/easy-to-write.mdx +0 -280
  71. package/docs/v7/features/enterprise.mdx +0 -656
  72. package/docs/v7/features/fast.mdx +0 -406
  73. package/docs/v7/features/managed-sandboxes.mdx +0 -384
  74. package/docs/v7/features/network-monitoring.mdx +0 -568
  75. package/docs/v7/features/parallel-execution.mdx +0 -381
  76. package/docs/v7/features/powerful.mdx +0 -531
  77. package/docs/v7/features/sandbox-customization.mdx +0 -229
  78. package/docs/v7/features/stable.mdx +0 -473
  79. package/docs/v7/features/system-performance.mdx +0 -616
  80. package/docs/v7/features/test-analytics.mdx +0 -373
  81. package/docs/v7/features/test-cases.mdx +0 -393
  82. package/docs/v7/features/test-replays.mdx +0 -408
  83. package/docs/v7/features/test-reports.mdx +0 -308
  84. package/docs/v7/getting-started/debugging-tests.mdx +0 -382
  85. package/docs/v7/getting-started/quickstart.mdx +0 -90
  86. package/docs/v7/getting-started/running-tests.mdx +0 -173
  87. package/docs/v7/getting-started/setting-up-in-ci.mdx +0 -612
  88. package/docs/v7/getting-started/writing-tests.mdx +0 -534
  89. package/docs/v7/overview/what-is-testdriver.mdx +0 -386
  90. package/docs/v7/presets/chrome-extension.mdx +0 -248
  91. package/docs/v7/presets/chrome.mdx +0 -300
  92. package/docs/v7/presets/electron.mdx +0 -460
  93. package/docs/v7/presets/vscode.mdx +0 -417
  94. package/docs/v7/presets/webapp.mdx +0 -393
  95. package/vitest.config.js +0 -18
  96. /package/docs/v7/{commands → _drafts/commands}/assert.mdx +0 -0
  97. /package/docs/v7/{commands → _drafts/commands}/exec.mdx +0 -0
  98. /package/docs/v7/{commands → _drafts/commands}/focus-application.mdx +0 -0
  99. /package/docs/v7/{commands → _drafts/commands}/hover-image.mdx +0 -0
  100. /package/docs/v7/{commands → _drafts/commands}/hover-text.mdx +0 -0
  101. /package/docs/v7/{commands → _drafts/commands}/if.mdx +0 -0
  102. /package/docs/v7/{commands → _drafts/commands}/match-image.mdx +0 -0
  103. /package/docs/v7/{commands → _drafts/commands}/press-keys.mdx +0 -0
  104. /package/docs/v7/{commands → _drafts/commands}/remember.mdx +0 -0
  105. /package/docs/v7/{commands → _drafts/commands}/run.mdx +0 -0
  106. /package/docs/v7/{commands → _drafts/commands}/scroll-until-image.mdx +0 -0
  107. /package/docs/v7/{commands → _drafts/commands}/scroll-until-text.mdx +0 -0
  108. /package/docs/v7/{commands → _drafts/commands}/scroll.mdx +0 -0
  109. /package/docs/v7/{commands → _drafts/commands}/type.mdx +0 -0
  110. /package/docs/v7/{commands → _drafts/commands}/wait-for-image.mdx +0 -0
  111. /package/docs/v7/{commands → _drafts/commands}/wait-for-text.mdx +0 -0
  112. /package/docs/v7/{commands → _drafts/commands}/wait.mdx +0 -0
  113. /package/docs/v7/{getting-started → _drafts}/configuration.mdx +0 -0
  114. /package/docs/v7/{features → _drafts}/observable.mdx +0 -0
  115. /package/docs/v7/{platforms → _drafts/platforms}/linux.mdx +0 -0
  116. /package/docs/v7/{platforms → _drafts/platforms}/macos.mdx +0 -0
  117. /package/docs/v7/{platforms → _drafts/platforms}/windows.mdx +0 -0
  118. /package/docs/v7/{playwright.mdx → _drafts/playwright.mdx} +0 -0
  119. /package/docs/v7/{overview → _drafts}/readme.mdx +0 -0
  120. /package/docs/v7/{features → _drafts}/reports.mdx +0 -0
  121. /package/docs/v7/{api/client.mdx → client.mdx} +0 -0
  122. /package/docs/v7/{api/dashcam.mdx → dashcam.mdx} +0 -0
  123. /package/docs/v7/{api/elements.mdx → elements.mdx} +0 -0
  124. /package/docs/v7/{api/sandbox.mdx → sandbox.mdx} +0 -0
@@ -1,382 +0,0 @@
1
- ---
2
- title: "Debugging Tests"
3
- description: "Debug test failures with Dashcam replays, logs, and error analysis"
4
- icon: "bug"
5
- ---
6
-
7
- Learn how to debug TestDriver test failures using video replays, logs, and rich error information.
8
-
9
- ## Debugging with Dashcam
10
-
11
- Every test automatically records a video replay:
12
-
13
- <Steps>
14
- <Step title="Get Replay URL">
15
- ```javascript
16
- test('my test', async (context) => {
17
- const testdriver = TestDriver(context, { headless: true });
18
- await testdriver.provision.chrome({ url });
19
-
20
- // Your test code
21
-
22
- console.log('Replay:', testdriver.dashcam.url);
23
- });
24
- ```
25
-
26
- Or find URLs in test output.
27
- </Step>
28
-
29
- <Step title="Open Replay">
30
- Visit [console.testdriver.ai](https://console.testdriver.ai) or click the URL directly.
31
- </Step>
32
-
33
- <Step title="Analyze Replay">
34
- Dashcam shows:
35
- - Full video of test execution
36
- - Timeline of all actions
37
- - Console logs synchronized
38
- - Network requests
39
- - Element highlights
40
- - Screenshots at key moments
41
- </Step>
42
- </Steps>
43
-
44
- <Card title="Dashcam Features" icon="video" href="/v7/features/observable">
45
- - Play/pause, speed control
46
- - Jump to any action via timeline
47
- - Frame-by-frame stepping
48
- - Download as MP4
49
- - Share with team
50
- - View network waterfall
51
- - See console logs
52
-
53
- [Complete observability guide](/v7/features/observable)
54
- </Card>
55
-
56
- ## Understanding Failures
57
-
58
- When a test fails, TestDriver provides rich debugging information:
59
-
60
- ```javascript
61
- try {
62
- await testdriver.find('submit button').click();
63
- } catch (error) {
64
- console.log('Error:', error.message);
65
- console.log('Type:', error.name); // 'ElementNotFoundError'
66
- console.log('Similarity:', error.similarity); // 0.72 (how close it got)
67
- console.log('Screenshot:', error.debugScreenshot); // Base64 image
68
- console.log('Cache info:', error.cacheInfo);
69
- }
70
- ```
71
-
72
- ### Typical Error Output
73
-
74
- ```
75
- ElementNotFoundError: Could not find 'submit button'
76
-
77
- Debug information:
78
- - Similarity: 0.72 (partial match found)
79
- - Timeout: 30000ms
80
- - Retry attempts: 60
81
- - Cache hit: false
82
-
83
- Screenshot saved: .testdriver/debug-screenshots/test-001.png
84
- Dashcam: https://console.testdriver.ai/dashcam/abc123
85
-
86
- Recent actions:
87
- 1. ✓ navigate to https://example.com (2.1s)
88
- 2. ✓ find('email input') (1.3s)
89
- 3. ✓ type('user@example.com') (0.8s)
90
- 4. ✗ find('submit button') (30.0s) FAILED
91
-
92
- Suggestions:
93
- - Try more specific selector: 'blue submit button in bottom right'
94
- - Check if button is visible on screen
95
- - Verify button loaded (check network tab)
96
- - View Dashcam replay to see what happened
97
- ```
98
-
99
- ## Common Debugging Scenarios
100
-
101
- <AccordionGroup>
102
- <Accordion title="Element Not Found">
103
- **Error:** `ElementNotFoundError: Could not find 'button'`
104
-
105
- **Debug steps:**
106
-
107
- 1. **Watch Dashcam replay** - See what's on screen
108
- 2. **Check similarity score:**
109
- - `> 0.8` - Close match, be more specific
110
- - `0.5-0.8` - Partial match, adjust selector
111
- - `< 0.5` - No match, element might not be present
112
-
113
- 3. **Try variations:**
114
- ```javascript
115
- const selectors = [
116
- 'submit button',
117
- 'blue submit button',
118
- 'button in bottom right',
119
- 'primary action button'
120
- ];
121
-
122
- for (const selector of selectors) {
123
- try {
124
- await testdriver.find(selector).click();
125
- break;
126
- } catch (error) {
127
- console.log(`Failed: ${selector} (${error.similarity})`);
128
- }
129
- }
130
- ```
131
-
132
- 4. **Check timing** - Element might load later:
133
- ```javascript
134
- await testdriver.find('submit button', { timeout: 60000 });
135
- ```
136
- </Accordion>
137
-
138
- <Accordion title="Assertion Failures">
139
- **Error:** `AssertionError: 'welcome message is visible' failed`
140
-
141
- **Debug steps:**
142
-
143
- 1. **Watch Dashcam** - Verify what's actually displayed
144
- 2. **Simplify assertion:**
145
- ```javascript
146
- // Instead of:
147
- await testdriver.assert('welcome message says "Hello John"');
148
-
149
- // Try:
150
- await testdriver.assert('welcome message is visible');
151
- ```
152
-
153
- 3. **Check timing:**
154
- ```javascript
155
- // Wait longer for async content
156
- await testdriver.assert('message is visible', { timeout: 60000 });
157
- ```
158
-
159
- 4. **Use find() instead:**
160
- ```javascript
161
- const element = await testdriver.find('welcome message');
162
- console.log('Message text:', element.text);
163
- ```
164
- </Accordion>
165
-
166
- <Accordion title="Test Timeout">
167
- **Error:** `Test timed out after 120000ms`
168
-
169
- **Debug steps:**
170
-
171
- 1. **Increase timeout:**
172
- ```javascript vitest.config.mjs
173
- export default defineConfig({
174
- test: {
175
- testTimeout: 180000, // 3 minutes
176
- },
177
- });
178
- ```
179
-
180
- 2. **Check sandbox logs** - Look for network issues
181
- 3. **Watch Dashcam** - See where test got stuck
182
- 4. **Add checkpoints:**
183
- ```javascript
184
- await testdriver.find('button').click();
185
- console.log('Clicked button');
186
-
187
- await testdriver.assert('page loaded');
188
- console.log('Page loaded');
189
- ```
190
- </Accordion>
191
-
192
- <Accordion title="Flaky Tests">
193
- **Issue:** Test passes sometimes, fails other times
194
-
195
- **Solutions:**
196
-
197
- 1. **Check Dashcam replays** - Compare passing vs failing runs
198
- 2. **Increase stability delay:**
199
- ```javascript
200
- await testdriver.find('element', {
201
- stabilityDelay: 500 // Wait 500ms for stability
202
- });
203
- ```
204
-
205
- 3. **Wait for network:**
206
- ```javascript
207
- await testdriver.find('button').click();
208
- // TestDriver automatically waits for network requests
209
- await testdriver.assert('content loaded');
210
- ```
211
-
212
- 4. **Disable animations in test mode:**
213
- ```javascript
214
- await testdriver.exec('js', `
215
- document.querySelectorAll('*').forEach(el => {
216
- el.style.transition = 'none';
217
- el.style.animation = 'none';
218
- });
219
- `, 5000);
220
- ```
221
-
222
- [Learn more about stability](/v7/features/stable)
223
- </Accordion>
224
- </AccordionGroup>
225
-
226
- ## Debugging Tools
227
-
228
- ### 1. Console Logging
229
-
230
- ```javascript
231
- test('debug test', async (context) => {
232
- const { testdriver } = await chrome(context, { url });
233
-
234
- console.log('Starting test...');
235
-
236
- const element = await testdriver.find('button');
237
- console.log('Found element:', {
238
- text: element.text,
239
- coordinates: element.coordinates,
240
- confidence: element.confidence,
241
- cacheHit: element.cacheHit
242
- });
243
-
244
- await element.click();
245
- console.log('Clicked element');
246
- });
247
- ```
248
-
249
- ### 2. Screenshots
250
-
251
- ```javascript
252
- // Capture debug screenshot
253
- try {
254
- await testdriver.find('element');
255
- } catch (error) {
256
- // Save debug screenshot
257
- const fs = require('fs');
258
- const buffer = Buffer.from(error.debugScreenshot, 'base64');
259
- fs.writeFileSync('debug.png', buffer);
260
- console.log('Screenshot saved to debug.png');
261
- }
262
- ```
263
-
264
- ### 3. Step-by-Step Execution
265
-
266
- ```javascript
267
- test('step by step', async (context) => {
268
- const { testdriver } = await chrome(context, { url });
269
-
270
- console.log('Step 1: Find email input');
271
- const email = await testdriver.find('email input');
272
- console.log('✓ Found:', email);
273
-
274
- console.log('Step 2: Type email');
275
- await email.type('user@example.com');
276
- console.log('✓ Typed');
277
-
278
- console.log('Step 3: Find button');
279
- const button = await testdriver.find('submit button');
280
- console.log('✓ Found:', button);
281
-
282
- console.log('Step 4: Click button');
283
- await button.click();
284
- console.log('✓ Clicked');
285
- });
286
- ```
287
-
288
- ### 4. Network Inspection
289
-
290
- ```javascript
291
- // View network activity in Dashcam replay
292
- test('check network', async (context) => {
293
- const { testdriver } = await chrome(context, {
294
- url,
295
- captureNetwork: true // Enable network capture
296
- });
297
-
298
- await testdriver.find('load data button').click();
299
-
300
- // Network requests appear in Dashcam replay
301
- // Filter by XHR, images, scripts, etc.
302
- });
303
- ```
304
-
305
- ## Debugging in CI/CD
306
-
307
- When tests fail in CI:
308
-
309
- <Steps>
310
- <Step title="Get Dashcam URL">
311
- CI output includes replay URLs:
312
-
313
- ```
314
- Tests failed!
315
- Dashcam replay: https://console.testdriver.ai/dashcam/abc123
316
- ```
317
- </Step>
318
-
319
- <Step title="Download Artifacts">
320
- Save debug screenshots and logs:
321
-
322
- ```yaml .github/workflows/test.yml
323
- - uses: actions/upload-artifact@v3
324
- if: failure()
325
- with:
326
- name: test-artifacts
327
- path: |
328
- .testdriver/debug-screenshots/
329
- .testdriver/dashcam-urls.txt
330
- ```
331
- </Step>
332
-
333
- <Step title="Reconnect to Sandbox">
334
- If test failed, reconnect to same sandbox to debug:
335
-
336
- ```bash
337
- # Get sandbox ID from CI logs
338
- export TESTDRIVER_SANDBOX_ID=i-abc123def
339
-
340
- # Run tests locally against same sandbox
341
- npx vitest run
342
- ```
343
-
344
- [Sandbox management guide](/agents.md#sandbox-management)
345
- </Step>
346
- </Steps>
347
-
348
- ## Next Steps
349
-
350
- <CardGroup cols={2}>
351
- <Card
352
- title="Running Tests"
353
- icon="play"
354
- href="/v7/getting-started/running-tests"
355
- >
356
- Learn how to run tests efficiently
357
- </Card>
358
-
359
- <Card
360
- title="Setting Up in CI"
361
- icon="arrows-spin"
362
- href="/v7/getting-started/setting-up-in-ci"
363
- >
364
- Run tests in CI/CD pipelines
365
- </Card>
366
-
367
- <Card
368
- title="Observable Features"
369
- icon="microscope"
370
- href="/v7/features/observable"
371
- >
372
- Complete observability guide
373
- </Card>
374
-
375
- <Card
376
- title="Troubleshooting"
377
- icon="wrench"
378
- href="/v7/guides/troubleshooting"
379
- >
380
- Common issues and solutions
381
- </Card>
382
- </CardGroup>
@@ -1,90 +0,0 @@
1
- ---
2
- title: "Quick Start"
3
- sidebarTitle: "Quickstart"
4
- description: "Run your first computer-use test in minutes."
5
- icon: "rocket"
6
- mode: "wide"
7
- ---
8
-
9
- TestDriver makes it easy to write automated computer-use tests for web browsers, desktop apps, and more. Follow the directions below to run your first TestDriver test.
10
-
11
- <Tip><a href="https://discord.com/invite/cWDFW8DzPm" target="_blank" rel="noreferrer">Join our Discord</a> if you have any questions or need help getting started!</Tip>
12
-
13
- ## Get Started in 3 Steps
14
-
15
- <Steps>
16
- <Step title="Create a TestDriver Account">
17
-
18
- You will need a TestDriver account to get an API key.
19
-
20
- <Card
21
- title="Sign Up for TestDriver"
22
- icon="user-plus"
23
- href="https://app.testdriver.ai/team"
24
- arrow
25
- horizontal
26
- >
27
- No credit-card required!
28
- </Card>
29
-
30
- </Step>
31
- <Step title="Install TestDriver">
32
-
33
- Use `npx` to quickly set up an example project:
34
-
35
- ```bash
36
- npx testdriverai@beta init
37
- ```
38
-
39
- This will walk you through creating a new project folder, installing dependencies, and setting up your API key.
40
-
41
- </Step>
42
-
43
- <Step title="Run Your Test">
44
-
45
- TestDriver uses Vitest as the test runner. To run your test, use:
46
-
47
- ```bash
48
- vitest run
49
- ```
50
-
51
- This will spawn a sandbox, launch Chrome, and run the example test!
52
-
53
- </Step>
54
- </Steps>
55
-
56
- ## Next Steps
57
-
58
- <CardGroup cols={2}>
59
- <Card
60
- title="Complete Vitest Guide"
61
- icon="flask-vial"
62
- href="/v7/guides/vitest"
63
- >
64
- Everything about TestDriver + Vitest integration
65
- </Card>
66
-
67
- <Card
68
- title="All Presets"
69
- icon="rocket"
70
- href="/v7/progressive-apis/PROVISION"
71
- >
72
- Chrome, VS Code, Electron, and more
73
- </Card>
74
-
75
- <Card
76
- title="API Reference"
77
- icon="book"
78
- href="/v7/api/client"
79
- >
80
- All available methods and options
81
- </Card>
82
-
83
- <Card
84
- title="Progressive APIs"
85
- icon="gauge-high"
86
- href="/v7/progressive-apis/PROGRESSIVE_DISCLOSURE"
87
- >
88
- Choose your complexity level
89
- </Card>
90
- </CardGroup>
@@ -1,173 +0,0 @@
1
- ---
2
- title: "Running Tests"
3
- description: "Run TestDriver tests with Vitest test runner"
4
- icon: "play"
5
- ---
6
-
7
- Learn how to run TestDriver tests efficiently with Vitest's powerful test runner.
8
-
9
- ## Running Tests
10
-
11
- TestDriver works with Vitest's powerful test runner:
12
-
13
- <Tabs>
14
- <Tab title="Run All Tests">
15
- ```bash
16
- # Run all tests once
17
- npx vitest run
18
-
19
- # Run in watch mode
20
- npx vitest
21
-
22
- # Run with coverage
23
- npx vitest run --coverage
24
- ```
25
- </Tab>
26
-
27
- <Tab title="Run Specific Tests">
28
- ```bash
29
- # Run specific file
30
- npx vitest run login.test.js
31
-
32
- # Run multiple files
33
- npx vitest run login.test.js checkout.test.js
34
-
35
- # Run tests matching pattern
36
- npx vitest run --grep "login"
37
-
38
- # Run tests in specific folder
39
- npx vitest run tests/e2e/
40
- ```
41
- </Tab>
42
-
43
- <Tab title="Watch Mode">
44
- ```bash
45
- # Watch mode - reruns on file changes
46
- npx vitest
47
-
48
- # Watch only changed tests
49
- npx vitest --changed
50
-
51
- # Watch specific file
52
- npx vitest login.test.js
53
- ```
54
- </Tab>
55
-
56
- <Tab title="Parallel Execution">
57
- ```bash
58
- # Control concurrency
59
- npx vitest run --maxConcurrency=5
60
-
61
- # Run with specific thread count
62
- npx vitest run --threads --minThreads=2 --maxThreads=8
63
- ```
64
- </Tab>
65
- </Tabs>
66
-
67
- ## Test Output
68
-
69
- Understanding test output:
70
-
71
- ```bash
72
- $ npx vitest run
73
-
74
- ✓ login.test.js (3) 23.4s
75
- ✓ user can login with valid credentials 12.3s
76
- ✓ shows error for invalid email 5.6s
77
- ✓ shows error for wrong password 5.5s
78
-
79
- ✓ checkout.test.js (2) 34.7s
80
- ✓ user can complete checkout 28.9s
81
- ✓ validates credit card format 5.8s
82
-
83
- Test Files 2 passed (2)
84
- Tests 5 passed (5)
85
- Duration 58.12s
86
-
87
- 📹 Dashcam Replays:
88
- - https://console.testdriver.ai/dashcam/abc123
89
- - https://console.testdriver.ai/dashcam/def456
90
- ```
91
-
92
- <Tip>
93
- Click the Dashcam URLs to watch video replays of your tests!
94
- </Tip>
95
-
96
- ## Performance Profiling
97
-
98
- Identify slow tests:
99
-
100
- ```bash
101
- # Run with reporter showing timing
102
- npx vitest run --reporter=verbose
103
-
104
- # Output shows duration per test:
105
- ✓ slow-test.test.js > user can checkout (34.7s)
106
- → find('product') (2.1s)
107
- → click() (0.4s)
108
- → find('add to cart') (1.8s)
109
- → click() (0.3s)
110
- → find('checkout') (28.9s) ← SLOW!
111
- → click() (0.5s)
112
- ```
113
-
114
- Optimize slow operations:
115
-
116
- 1. **Enable caching** - First run is slow, subsequent runs are fast
117
- 2. **Use parallel execution** - Run tests concurrently
118
- 3. **Check network delays** - Look for slow API calls in Dashcam
119
- 4. **Optimize selectors** - More specific = faster matching
120
-
121
- [Performance optimization guide](/v7/guides/performance)
122
-
123
- ## Vitest UI
124
-
125
- Use Vitest UI for interactive debugging:
126
-
127
- ```bash
128
- # Start Vitest UI
129
- npx vitest --ui
130
- ```
131
-
132
- Open http://localhost:51204 to see:
133
- - Test file tree
134
- - Test status and duration
135
- - Console output
136
- - Re-run individual tests
137
- - Filter and search tests
138
-
139
- ## Next Steps
140
-
141
- <CardGroup cols={2}>
142
- <Card
143
- title="Debugging Tests"
144
- icon="bug"
145
- href="/v7/getting-started/debugging-tests"
146
- >
147
- Debug test failures with Dashcam replays
148
- </Card>
149
-
150
- <Card
151
- title="Setting Up in CI"
152
- icon="arrows-spin"
153
- href="/v7/getting-started/setting-up-in-ci"
154
- >
155
- Run tests in CI/CD pipelines
156
- </Card>
157
-
158
- <Card
159
- title="Observable Features"
160
- icon="microscope"
161
- href="/v7/features/observable"
162
- >
163
- Complete observability guide
164
- </Card>
165
-
166
- <Card
167
- title="Performance Guide"
168
- icon="gauge-high"
169
- href="/v7/guides/performance"
170
- >
171
- Optimize test performance
172
- </Card>
173
- </CardGroup>