testdriverai 7.2.3 → 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 (142) hide show
  1. package/.github/workflows/publish.yaml +15 -7
  2. package/.github/workflows/testdriver.yml +163 -0
  3. package/.testdriver/last-sandbox +7 -0
  4. package/agent/events.js +1 -0
  5. package/agent/index.js +99 -163
  6. package/agent/lib/sandbox.js +11 -1
  7. package/agents.md +393 -0
  8. package/bin/testdriverai.js +8 -0
  9. package/debug/01-table-initial.png +0 -0
  10. package/debug/02-after-ai-explore.png +0 -0
  11. package/debug/02-after-scroll.png +0 -0
  12. package/debugger/index.html +37 -0
  13. package/docs/docs.json +93 -125
  14. package/docs/v7/_drafts/architecture.mdx +1 -26
  15. package/docs/v7/_drafts/caching.mdx +2 -2
  16. package/docs/v7/{getting-started → _drafts}/installation.mdx +0 -66
  17. package/docs/v7/{features/coverage.mdx → _drafts/powerful.mdx} +1 -90
  18. package/docs/v7/_drafts/quick-start-test-recording.mdx +0 -1
  19. package/docs/v7/{features → _drafts}/scalable.mdx +126 -4
  20. package/docs/v7/_drafts/screenshot.mdx +155 -0
  21. package/docs/v7/_drafts/test-recording.mdx +0 -6
  22. package/docs/v7/_drafts/writing-tests.mdx +25 -0
  23. package/docs/v7/{api/act.mdx → ai.mdx} +28 -27
  24. package/docs/v7/{api/assert.mdx → assert.mdx} +3 -3
  25. package/docs/v7/aws-setup.mdx +338 -0
  26. package/docs/v7/caching.mdx +128 -0
  27. package/docs/v7/ci-cd.mdx +605 -0
  28. package/docs/v7/{api/click.mdx → click.mdx} +4 -4
  29. package/docs/v7/cloud.mdx +120 -0
  30. package/docs/v7/customizing-devices.mdx +129 -0
  31. package/docs/v7/{api/doubleClick.mdx → double-click.mdx} +5 -5
  32. package/docs/v7/enterprise.mdx +135 -0
  33. package/docs/v7/examples.mdx +5 -0
  34. package/docs/v7/{api/exec.mdx → exec.mdx} +3 -3
  35. package/docs/v7/{api/find.mdx → find.mdx} +17 -21
  36. package/docs/v7/{api/focusApplication.mdx → focus-application.mdx} +3 -3
  37. package/docs/v7/generating-tests.mdx +32 -0
  38. package/docs/v7/{api/hover.mdx → hover.mdx} +3 -3
  39. package/docs/v7/locating-elements.mdx +71 -0
  40. package/docs/v7/making-assertions.mdx +32 -0
  41. package/docs/v7/{api/mouseDown.mdx → mouse-down.mdx} +7 -7
  42. package/docs/v7/{api/mouseUp.mdx → mouse-up.mdx} +8 -8
  43. package/docs/v7/performing-actions.mdx +51 -0
  44. package/docs/v7/{api/pressKeys.mdx → press-keys.mdx} +3 -3
  45. package/docs/v7/quickstart.mdx +162 -0
  46. package/docs/v7/reusable-code.mdx +240 -0
  47. package/docs/v7/{api/rightClick.mdx → right-click.mdx} +5 -5
  48. package/docs/v7/running-tests.mdx +181 -0
  49. package/docs/v7/{api/scroll.mdx → scroll.mdx} +3 -3
  50. package/docs/v7/secrets.mdx +115 -0
  51. package/docs/v7/self-hosted.mdx +66 -0
  52. package/docs/v7/{api/type.mdx → type.mdx} +3 -3
  53. package/docs/v7/variables.mdx +111 -0
  54. package/docs/v7/waiting-for-elements.mdx +66 -0
  55. package/docs/v7/what-is-testdriver.mdx +54 -0
  56. package/interfaces/cli/commands/init.js +33 -19
  57. package/interfaces/cli/lib/base.js +24 -0
  58. package/interfaces/cli.js +8 -1
  59. package/interfaces/logger.js +8 -3
  60. package/interfaces/vitest-plugin.mjs +16 -71
  61. package/lib/sentry.js +343 -0
  62. package/lib/vitest/hooks.mjs +81 -81
  63. package/package.json +4 -3
  64. package/sdk-log-formatter.js +41 -0
  65. package/sdk.d.ts +22 -9
  66. package/sdk.js +344 -100
  67. package/test/manual/reconnect-provision.test.mjs +49 -0
  68. package/test/manual/reconnect-signin.test.mjs +41 -0
  69. package/test/testdriver/act.test.mjs +30 -0
  70. package/test/testdriver/ai.test.mjs +30 -0
  71. package/test/testdriver/assert.test.mjs +1 -1
  72. package/test/testdriver/hover-text.test.mjs +1 -1
  73. package/test/testdriver/setup/testHelpers.mjs +8 -119
  74. package/test/testdriver/windows-installer.test.mjs +61 -0
  75. package/tests/example.test.js +33 -0
  76. package/tests/login.js +28 -0
  77. package/tests/table-sort-enrollments.test.mjs +72 -0
  78. package/tests/table-sort-experiment.test.mjs +42 -0
  79. package/tests/table-sort-setup.test.mjs +59 -0
  80. package/vitest.config.mjs +3 -1
  81. package/agent/lib/cache.js +0 -142
  82. package/docs/v7/api/assertions.mdx +0 -403
  83. package/docs/v7/features/ai-native.mdx +0 -413
  84. package/docs/v7/features/application-logs.mdx +0 -353
  85. package/docs/v7/features/browser-logs.mdx +0 -414
  86. package/docs/v7/features/cache-management.mdx +0 -402
  87. package/docs/v7/features/continuous-testing.mdx +0 -346
  88. package/docs/v7/features/data-driven-testing.mdx +0 -441
  89. package/docs/v7/features/easy-to-write.mdx +0 -280
  90. package/docs/v7/features/enterprise.mdx +0 -656
  91. package/docs/v7/features/fast.mdx +0 -406
  92. package/docs/v7/features/managed-sandboxes.mdx +0 -384
  93. package/docs/v7/features/network-monitoring.mdx +0 -568
  94. package/docs/v7/features/parallel-execution.mdx +0 -381
  95. package/docs/v7/features/powerful.mdx +0 -531
  96. package/docs/v7/features/sandbox-customization.mdx +0 -229
  97. package/docs/v7/features/stable.mdx +0 -473
  98. package/docs/v7/features/system-performance.mdx +0 -616
  99. package/docs/v7/features/test-analytics.mdx +0 -373
  100. package/docs/v7/features/test-cases.mdx +0 -393
  101. package/docs/v7/features/test-replays.mdx +0 -408
  102. package/docs/v7/features/test-reports.mdx +0 -308
  103. package/docs/v7/getting-started/debugging-tests.mdx +0 -382
  104. package/docs/v7/getting-started/quickstart.mdx +0 -90
  105. package/docs/v7/getting-started/running-tests.mdx +0 -173
  106. package/docs/v7/getting-started/setting-up-in-ci.mdx +0 -612
  107. package/docs/v7/getting-started/writing-tests.mdx +0 -534
  108. package/docs/v7/overview/what-is-testdriver.mdx +0 -386
  109. package/docs/v7/presets/chrome-extension.mdx +0 -248
  110. package/docs/v7/presets/chrome.mdx +0 -300
  111. package/docs/v7/presets/electron.mdx +0 -460
  112. package/docs/v7/presets/vscode.mdx +0 -417
  113. package/docs/v7/presets/webapp.mdx +0 -393
  114. /package/docs/v7/{commands → _drafts/commands}/assert.mdx +0 -0
  115. /package/docs/v7/{commands → _drafts/commands}/exec.mdx +0 -0
  116. /package/docs/v7/{commands → _drafts/commands}/focus-application.mdx +0 -0
  117. /package/docs/v7/{commands → _drafts/commands}/hover-image.mdx +0 -0
  118. /package/docs/v7/{commands → _drafts/commands}/hover-text.mdx +0 -0
  119. /package/docs/v7/{commands → _drafts/commands}/if.mdx +0 -0
  120. /package/docs/v7/{commands → _drafts/commands}/match-image.mdx +0 -0
  121. /package/docs/v7/{commands → _drafts/commands}/press-keys.mdx +0 -0
  122. /package/docs/v7/{commands → _drafts/commands}/remember.mdx +0 -0
  123. /package/docs/v7/{commands → _drafts/commands}/run.mdx +0 -0
  124. /package/docs/v7/{commands → _drafts/commands}/scroll-until-image.mdx +0 -0
  125. /package/docs/v7/{commands → _drafts/commands}/scroll-until-text.mdx +0 -0
  126. /package/docs/v7/{commands → _drafts/commands}/scroll.mdx +0 -0
  127. /package/docs/v7/{commands → _drafts/commands}/type.mdx +0 -0
  128. /package/docs/v7/{commands → _drafts/commands}/wait-for-image.mdx +0 -0
  129. /package/docs/v7/{commands → _drafts/commands}/wait-for-text.mdx +0 -0
  130. /package/docs/v7/{commands → _drafts/commands}/wait.mdx +0 -0
  131. /package/docs/v7/{getting-started → _drafts}/configuration.mdx +0 -0
  132. /package/docs/v7/{features → _drafts}/observable.mdx +0 -0
  133. /package/docs/v7/{platforms → _drafts/platforms}/linux.mdx +0 -0
  134. /package/docs/v7/{platforms → _drafts/platforms}/macos.mdx +0 -0
  135. /package/docs/v7/{platforms → _drafts/platforms}/windows.mdx +0 -0
  136. /package/docs/v7/{playwright.mdx → _drafts/playwright.mdx} +0 -0
  137. /package/docs/v7/{overview → _drafts}/readme.mdx +0 -0
  138. /package/docs/v7/{features → _drafts}/reports.mdx +0 -0
  139. /package/docs/v7/{api/client.mdx → client.mdx} +0 -0
  140. /package/docs/v7/{api/dashcam.mdx → dashcam.mdx} +0 -0
  141. /package/docs/v7/{api/elements.mdx → elements.mdx} +0 -0
  142. /package/docs/v7/{api/sandbox.mdx → sandbox.mdx} +0 -0
@@ -1,381 +0,0 @@
1
- ---
2
- title: "Parallel Execution"
3
- description: "Run tests concurrently for maximum throughput and faster CI pipelines"
4
- icon: "layer-group"
5
- ---
6
-
7
- Speed up your test suite by running multiple tests simultaneously. TestDriver's parallel execution capabilities let you maximize throughput and reduce overall test duration.
8
-
9
- ## Quick Start
10
-
11
- Enable parallel execution in your Vitest configuration:
12
-
13
- ```javascript vitest.config.mjs
14
- import { defineConfig } from 'vitest/config';
15
-
16
- export default defineConfig({
17
- test: {
18
- testTimeout: 120000,
19
- maxConcurrency: 10, // Run 10 tests simultaneously
20
- },
21
- });
22
- ```
23
-
24
- ## Performance Comparison
25
-
26
- See the dramatic difference parallel execution makes:
27
-
28
- <CardGroup cols={2}>
29
- <Card title="Sequential Execution" icon="chevron-right">
30
- ```mermaid
31
- gantt
32
- title Sequential: 90s total
33
- dateFormat s
34
- axisFormat %Ss
35
- Test 1 :done, t1, 0, 30s
36
- Test 2 :done, t2, after t1, 30s
37
- Test 3 :done, t3, after t2, 30s
38
- ```
39
- </Card>
40
-
41
- <Card title="Parallel Execution (3x)" icon="chevrons-right">
42
- ```mermaid
43
- gantt
44
- title Parallel: 30s total
45
- dateFormat s
46
- axisFormat %Ss
47
- Test 1 :done, t1, 0, 30s
48
- Test 2 :done, t2, 0, 30s
49
- Test 3 :done, t3, 0, 30s
50
- ```
51
- </Card>
52
- </CardGroup>
53
-
54
- <Check>
55
- **3x faster** - Run tests in parallel to dramatically reduce total execution time.
56
- </Check>
57
-
58
- ## Real-World Example
59
-
60
- Here's how parallel execution impacts a real test suite:
61
-
62
- <CodeGroup>
63
- ```bash Sequential (1 test at a time)
64
- $ npx vitest run --maxConcurrency=1
65
-
66
- ✓ test/login.test.js (3 tests) 87.4s
67
- ✓ test/checkout.test.js (5 tests) 142.6s
68
- ✓ test/profile.test.js (4 tests) 98.2s
69
-
70
- Test Files: 3 passed (3)
71
- Tests: 12 passed (12)
72
- Duration: 328.2s
73
- ```
74
-
75
- ```bash Parallel (10 tests at a time)
76
- $ npx vitest run --maxConcurrency=10
77
-
78
- ✓ test/login.test.js (3 tests) 31.2s
79
- ✓ test/checkout.test.js (5 tests) 58.7s
80
- ✓ test/profile.test.js (4 tests) 35.1s
81
-
82
- Test Files: 3 passed (3)
83
- Tests: 12 passed (12)
84
- Duration: 58.7s (5.6x faster ⚡)
85
- ```
86
- </CodeGroup>
87
-
88
- ## Configuration Options
89
-
90
- Fine-tune parallel execution for your needs:
91
-
92
- <Tabs>
93
- <Tab title="Basic Concurrency">
94
- ```javascript vitest.config.mjs
95
- export default defineConfig({
96
- test: {
97
- maxConcurrency: 10, // Max parallel tests
98
- },
99
- });
100
- ```
101
-
102
- Control how many tests run simultaneously.
103
- </Tab>
104
-
105
- <Tab title="Thread Control">
106
- ```javascript vitest.config.mjs
107
- export default defineConfig({
108
- test: {
109
- pool: 'threads',
110
- poolOptions: {
111
- threads: {
112
- minThreads: 2,
113
- maxThreads: 8
114
- }
115
- }
116
- },
117
- });
118
- ```
119
-
120
- Manage worker thread pool for optimal performance.
121
- </Tab>
122
-
123
- <Tab title="File-Level Parallelism">
124
- ```javascript vitest.config.mjs
125
- export default defineConfig({
126
- test: {
127
- fileParallelism: true, // Default
128
- maxConcurrency: 5, // Tests per file
129
- },
130
- });
131
- ```
132
-
133
- Run test files in parallel, with concurrent tests within each file.
134
- </Tab>
135
-
136
- <Tab title="CI Optimization">
137
- ```javascript vitest.config.mjs
138
- export default defineConfig({
139
- test: {
140
- maxConcurrency: process.env.CI ? 20 : 5,
141
- pool: 'threads',
142
- poolOptions: {
143
- threads: {
144
- maxThreads: process.env.CI ? 16 : 4
145
- }
146
- }
147
- },
148
- });
149
- ```
150
-
151
- Use more parallelism in CI where resources are abundant.
152
- </Tab>
153
- </Tabs>
154
-
155
- ## Best Practices
156
-
157
- <AccordionGroup>
158
- <Accordion title="1. Choose Appropriate Concurrency">
159
- ```javascript
160
- // Development: Lower concurrency for easier debugging
161
- maxConcurrency: 3
162
-
163
- // CI: Higher concurrency for speed
164
- maxConcurrency: 20
165
- ```
166
-
167
- Balance speed with resource usage. Too many concurrent tests can overwhelm your system or CI runner.
168
-
169
- **Guidelines:**
170
- - **Local development:** 3-5 concurrent tests
171
- - **CI with 2 CPUs:** 5-10 concurrent tests
172
- - **CI with 4+ CPUs:** 10-20 concurrent tests
173
- </Accordion>
174
-
175
- <Accordion title="2. Ensure Test Isolation">
176
- ```javascript
177
- // ✅ Good - each test is isolated
178
- test('login test 1', async (context) => {
179
- const { testdriver } = await chrome(context, {
180
- url: 'https://example.com'
181
- });
182
- // Test runs in its own sandbox
183
- });
184
-
185
- test('login test 2', async (context) => {
186
- const { testdriver } = await chrome(context, {
187
- url: 'https://example.com'
188
- });
189
- // Different sandbox, no interference
190
- });
191
- ```
192
-
193
- TestDriver automatically provisions isolated sandboxes for each test, preventing interference.
194
- </Accordion>
195
-
196
- <Accordion title="3. Monitor Resource Usage">
197
- ```bash
198
- # Watch CPU and memory during test runs
199
- # macOS
200
- top -l 1 | grep -E "(CPU|PhysMem)"
201
-
202
- # Linux
203
- top -bn1 | grep "Cpu(s)"
204
-
205
- # Adjust maxConcurrency if system is overwhelmed
206
- ```
207
-
208
- Keep an eye on system resources to find the optimal concurrency level.
209
- </Accordion>
210
-
211
- <Accordion title="4. Use Sharding for Large Suites">
212
- ```yaml .github/workflows/test.yml
213
- strategy:
214
- matrix:
215
- shard: [1, 2, 3, 4]
216
- steps:
217
- - run: npx vitest run --shard=${{ matrix.shard }}/4
218
- ```
219
-
220
- Split tests across multiple CI jobs for massive test suites.
221
- </Accordion>
222
- </AccordionGroup>
223
-
224
- ## Combining with Caching
225
-
226
- Parallel execution + intelligent caching = maximum speed:
227
-
228
- ```javascript
229
- // With both parallelization and caching enabled:
230
- ✅ Cache-accelerated parallel execution:
231
- Total: 15s (6x faster than sequential, no cache)
232
- ```
233
-
234
- When you combine:
235
- - **Parallel execution:** Run multiple tests at once
236
- - **Intelligent caching:** Skip redundant AI analysis
237
-
238
- You get exponential performance improvements.
239
-
240
- [Learn about Intelligent Caching](/v7/features/fast)
241
-
242
- ## Troubleshooting
243
-
244
- <AccordionGroup>
245
- <Accordion title="Tests Failing in Parallel but Pass Sequentially">
246
- **Cause:** Tests may have hidden dependencies or shared state.
247
-
248
- **Solution:**
249
- ```javascript
250
- // Check for shared resources
251
- test.sequential('sequential test group', () => {
252
- test('test 1', async () => { /* ... */ });
253
- test('test 2', async () => { /* ... */ });
254
- });
255
- ```
256
-
257
- Or run with lower concurrency to identify the issue:
258
- ```bash
259
- npx vitest run --maxConcurrency=1
260
- ```
261
- </Accordion>
262
-
263
- <Accordion title="CI Runner Running Out of Memory">
264
- **Cause:** Too many concurrent tests for available resources.
265
-
266
- **Solution:**
267
- ```javascript vitest.config.mjs
268
- export default defineConfig({
269
- test: {
270
- maxConcurrency: process.env.CI ? 10 : 5, // Reduce CI concurrency
271
- },
272
- });
273
- ```
274
- </Accordion>
275
-
276
- <Accordion title="Slower Performance with Parallelism">
277
- **Cause:** System overhead from too many workers.
278
-
279
- **Solution:**
280
- ```javascript
281
- // Try different concurrency levels
282
- maxConcurrency: 3 // Start low
283
- maxConcurrency: 5
284
- maxConcurrency: 10 // Increase until performance degrades
285
- ```
286
-
287
- Find the sweet spot for your system.
288
- </Accordion>
289
- </AccordionGroup>
290
-
291
- ## CI/CD Configuration
292
-
293
- <Tabs>
294
- <Tab title="GitHub Actions">
295
- ```yaml .github/workflows/test.yml
296
- jobs:
297
- test:
298
- runs-on: ubuntu-latest
299
- strategy:
300
- matrix:
301
- shard: [1, 2, 3, 4]
302
-
303
- steps:
304
- - uses: actions/checkout@v3
305
-
306
- - name: Setup Node.js
307
- uses: actions/setup-node@v3
308
- with:
309
- node-version: '20'
310
-
311
- - name: Install dependencies
312
- run: npm install
313
-
314
- - name: Run tests (shard ${{ matrix.shard }}/4)
315
- run: npx vitest run --shard=${{ matrix.shard }}/4
316
- env:
317
- TD_API_KEY: ${{ secrets.TD_API_KEY }}
318
- ```
319
- </Tab>
320
-
321
- <Tab title="GitLab CI">
322
- ```yaml .gitlab-ci.yml
323
- test:
324
- parallel: 4
325
- script:
326
- - npm install
327
- - npx vitest run --shard=$CI_NODE_INDEX/$CI_NODE_TOTAL
328
- variables:
329
- TD_API_KEY: $TD_API_KEY
330
- ```
331
- </Tab>
332
-
333
- <Tab title="CircleCI">
334
- ```yaml .circleci/config.yml
335
- jobs:
336
- test:
337
- parallelism: 4
338
- steps:
339
- - checkout
340
- - run: npm install
341
- - run: |
342
- npx vitest run --shard=$CIRCLE_NODE_INDEX/$CIRCLE_NODE_TOTAL
343
- ```
344
- </Tab>
345
- </Tabs>
346
-
347
- ## Next Steps
348
-
349
- <CardGroup cols={2}>
350
- <Card
351
- title="Intelligent Caching"
352
- icon="bolt"
353
- href="/v7/features/fast"
354
- >
355
- Speed up tests with smart caching
356
- </Card>
357
-
358
- <Card
359
- title="Running Tests"
360
- icon="play"
361
- href="/v7/getting-started/running-tests"
362
- >
363
- Learn how to run your test suite
364
- </Card>
365
-
366
- <Card
367
- title="Setting Up in CI"
368
- icon="arrows-spin"
369
- href="/v7/getting-started/setting-up-in-ci"
370
- >
371
- Configure CI/CD pipelines
372
- </Card>
373
-
374
- <Card
375
- title="Performance Guide"
376
- icon="gauge-high"
377
- href="/v7/guides/performance"
378
- >
379
- Optimize test performance
380
- </Card>
381
- </CardGroup>