testdriverai 7.2.9 → 7.2.11

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 +87 -126
  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/dashcam.mdx → dashcam.mdx} +0 -78
  26. package/docs/v7/{api/doubleClick.mdx → double-click.mdx} +5 -5
  27. package/docs/v7/{api/elements.mdx → elements.mdx} +1 -54
  28. package/docs/v7/enterprise.mdx +116 -0
  29. package/docs/v7/examples.mdx +5 -0
  30. package/docs/v7/{api/exec.mdx → exec.mdx} +3 -3
  31. package/docs/v7/{api/find.mdx → find.mdx} +17 -21
  32. package/docs/v7/{api/focusApplication.mdx → focus-application.mdx} +3 -3
  33. package/docs/v7/generating-tests.mdx +36 -0
  34. package/docs/v7/{api/hover.mdx → hover.mdx} +3 -3
  35. package/docs/v7/locating-elements.mdx +71 -0
  36. package/docs/v7/making-assertions.mdx +32 -0
  37. package/docs/v7/{api/mouseDown.mdx → mouse-down.mdx} +7 -7
  38. package/docs/v7/{api/mouseUp.mdx → mouse-up.mdx} +8 -8
  39. package/docs/v7/performing-actions.mdx +51 -0
  40. package/docs/v7/{api/pressKeys.mdx → press-keys.mdx} +3 -3
  41. package/docs/v7/quickstart.mdx +162 -0
  42. package/docs/v7/reusable-code.mdx +240 -0
  43. package/docs/v7/{api/rightClick.mdx → right-click.mdx} +5 -5
  44. package/docs/v7/running-tests.mdx +181 -0
  45. package/docs/v7/{api/scroll.mdx → scroll.mdx} +3 -3
  46. package/docs/v7/secrets.mdx +115 -0
  47. package/docs/v7/self-hosted.mdx +66 -0
  48. package/docs/v7/{api/type.mdx → type.mdx} +3 -3
  49. package/docs/v7/variables.mdx +111 -0
  50. package/docs/v7/waiting-for-elements.mdx +66 -0
  51. package/docs/v7/what-is-testdriver.mdx +54 -0
  52. package/lib/vitest/hooks.mjs +80 -68
  53. package/package.json +1 -1
  54. package/sdk.d.ts +22 -9
  55. package/sdk.js +177 -44
  56. package/test/manual/reconnect-provision.test.mjs +49 -0
  57. package/test/manual/reconnect-signin.test.mjs +41 -0
  58. package/test/testdriver/ai.test.mjs +30 -0
  59. package/test/testdriver/setup/testHelpers.mjs +0 -1
  60. package/test/testdriver/windows-installer.test.mjs +61 -0
  61. package/tests/table-sort-enrollments.test.mjs +72 -0
  62. package/tests/table-sort-experiment.test.mjs +42 -0
  63. package/tests/table-sort-setup.test.mjs +59 -0
  64. package/vitest.config.mjs +1 -0
  65. package/docs/v7/api/assertions.mdx +0 -403
  66. package/docs/v7/api/sandbox.mdx +0 -404
  67. package/docs/v7/features/ai-native.mdx +0 -413
  68. package/docs/v7/features/application-logs.mdx +0 -353
  69. package/docs/v7/features/browser-logs.mdx +0 -414
  70. package/docs/v7/features/cache-management.mdx +0 -402
  71. package/docs/v7/features/continuous-testing.mdx +0 -346
  72. package/docs/v7/features/data-driven-testing.mdx +0 -441
  73. package/docs/v7/features/easy-to-write.mdx +0 -280
  74. package/docs/v7/features/enterprise.mdx +0 -656
  75. package/docs/v7/features/fast.mdx +0 -406
  76. package/docs/v7/features/managed-sandboxes.mdx +0 -384
  77. package/docs/v7/features/network-monitoring.mdx +0 -568
  78. package/docs/v7/features/parallel-execution.mdx +0 -381
  79. package/docs/v7/features/powerful.mdx +0 -531
  80. package/docs/v7/features/sandbox-customization.mdx +0 -229
  81. package/docs/v7/features/stable.mdx +0 -473
  82. package/docs/v7/features/system-performance.mdx +0 -616
  83. package/docs/v7/features/test-analytics.mdx +0 -373
  84. package/docs/v7/features/test-cases.mdx +0 -393
  85. package/docs/v7/features/test-replays.mdx +0 -408
  86. package/docs/v7/features/test-reports.mdx +0 -308
  87. package/docs/v7/getting-started/debugging-tests.mdx +0 -382
  88. package/docs/v7/getting-started/quickstart.mdx +0 -90
  89. package/docs/v7/getting-started/running-tests.mdx +0 -173
  90. package/docs/v7/getting-started/setting-up-in-ci.mdx +0 -612
  91. package/docs/v7/getting-started/writing-tests.mdx +0 -534
  92. package/docs/v7/overview/what-is-testdriver.mdx +0 -386
  93. package/docs/v7/presets/chrome-extension.mdx +0 -248
  94. package/docs/v7/presets/chrome.mdx +0 -300
  95. package/docs/v7/presets/electron.mdx +0 -460
  96. package/docs/v7/presets/vscode.mdx +0 -417
  97. package/docs/v7/presets/webapp.mdx +0 -393
  98. package/vitest.config.js +0 -18
  99. /package/docs/v7/{commands → _drafts/commands}/assert.mdx +0 -0
  100. /package/docs/v7/{commands → _drafts/commands}/exec.mdx +0 -0
  101. /package/docs/v7/{commands → _drafts/commands}/focus-application.mdx +0 -0
  102. /package/docs/v7/{commands → _drafts/commands}/hover-image.mdx +0 -0
  103. /package/docs/v7/{commands → _drafts/commands}/hover-text.mdx +0 -0
  104. /package/docs/v7/{commands → _drafts/commands}/if.mdx +0 -0
  105. /package/docs/v7/{commands → _drafts/commands}/match-image.mdx +0 -0
  106. /package/docs/v7/{commands → _drafts/commands}/press-keys.mdx +0 -0
  107. /package/docs/v7/{commands → _drafts/commands}/remember.mdx +0 -0
  108. /package/docs/v7/{commands → _drafts/commands}/run.mdx +0 -0
  109. /package/docs/v7/{commands → _drafts/commands}/scroll-until-image.mdx +0 -0
  110. /package/docs/v7/{commands → _drafts/commands}/scroll-until-text.mdx +0 -0
  111. /package/docs/v7/{commands → _drafts/commands}/scroll.mdx +0 -0
  112. /package/docs/v7/{commands → _drafts/commands}/type.mdx +0 -0
  113. /package/docs/v7/{commands → _drafts/commands}/wait-for-image.mdx +0 -0
  114. /package/docs/v7/{commands → _drafts/commands}/wait-for-text.mdx +0 -0
  115. /package/docs/v7/{commands → _drafts/commands}/wait.mdx +0 -0
  116. /package/docs/v7/{getting-started → _drafts}/configuration.mdx +0 -0
  117. /package/docs/v7/{features → _drafts}/observable.mdx +0 -0
  118. /package/docs/v7/{platforms → _drafts/platforms}/linux.mdx +0 -0
  119. /package/docs/v7/{platforms → _drafts/platforms}/macos.mdx +0 -0
  120. /package/docs/v7/{platforms → _drafts/platforms}/windows.mdx +0 -0
  121. /package/docs/v7/{playwright.mdx → _drafts/playwright.mdx} +0 -0
  122. /package/docs/v7/{overview → _drafts}/readme.mdx +0 -0
  123. /package/docs/v7/{features → _drafts}/reports.mdx +0 -0
  124. /package/docs/v7/{api/client.mdx → client.mdx} +0 -0
@@ -1,417 +0,0 @@
1
- ---
2
- title: "VS Code Extensions"
3
- sidebarTitle: "VS Code Extensions"
4
- description: "Automatically launch and test Visual Studio Code extensions"
5
- icon: "code"
6
- ---
7
-
8
- ## Overview
9
-
10
- The `vscode()` preset automatically sets up Visual Studio Code with TestDriver and Dashcam recording. Perfect for testing VS Code extensions and IDE workflows.
11
-
12
- <Note>
13
- **Recommended Pattern (v7.1+):** Use `TestDriver()` hook + `provision.vscode()` for more flexibility:
14
-
15
- ```javascript
16
- import { TestDriver } from 'testdriverai/vitest/hooks';
17
-
18
- test('my test', async (context) => {
19
- const testdriver = TestDriver(context);
20
- await testdriver.provision.vscode({
21
- workspace: '/tmp/project',
22
- extensions: ['ms-python.python']
23
- });
24
- // ...
25
- });
26
- ```
27
-
28
- The `vscode()` preset is still supported but the direct API provides better control and clearer lifecycle management.
29
- </Note>
30
-
31
- ## Quick Start
32
-
33
- ```javascript
34
- import { test } from 'vitest';
35
- import { vscode } from 'testdriverai/presets';
36
-
37
- test('extension test', async (context) => {
38
- const { vscode } = await vscode(context, {
39
- workspace: '/tmp/test-project',
40
- extensions: ['ms-python.python']
41
- });
42
-
43
- await vscode.find('File menu').click();
44
- await vscode.find('New File').click();
45
- await vscode.find('Python file type').click();
46
- });
47
- ```
48
-
49
- ## Signature
50
-
51
- ```typescript
52
- vscode(context, options): Promise<VSCodeResult>
53
- ```
54
-
55
- ### Parameters
56
-
57
- <ParamField path="context" type="object" required>
58
- Vitest test context - automatically passed to your test function
59
- </ParamField>
60
-
61
- <ParamField path="options" type="object">
62
- Configuration options for VS Code
63
-
64
- <Expandable title="properties">
65
- <ParamField path="workspace" type="string">
66
- Path to workspace/folder to open in VS Code
67
- </ParamField>
68
-
69
- <ParamField path="extensions" type="string[]" default={[]}>
70
- Array of extension IDs to install before launching
71
- </ParamField>
72
-
73
- <ParamField path="dashcam" type="boolean" default={true}>
74
- Enable Dashcam test recording
75
- </ParamField>
76
-
77
- <ParamField path="os" type="'linux' | 'mac' | 'windows'" default="linux">
78
- Target operating system for the test
79
- </ParamField>
80
- </Expandable>
81
- </ParamField>
82
-
83
- ### Returns
84
-
85
- <ResponseField name="testdriver" type="TestDriver" required>
86
- TestDriver instance ready to use
87
- </ResponseField>
88
-
89
- <ResponseField name="vscode" type="TestDriver" required>
90
- Alias for testdriver (semantic clarity for VS Code testing)
91
- </ResponseField>
92
-
93
- <ResponseField name="dashcam" type="Dashcam">
94
- Dashcam instance for test recording (if enabled)
95
- </ResponseField>
96
-
97
- ## Examples
98
-
99
- ### Basic Extension Testing
100
-
101
- ```javascript
102
- import { test } from 'vitest';
103
- import { vscode } from 'testdriverai/presets';
104
-
105
- test('python extension creates new file', async (context) => {
106
- const { vscode } = await vscode(context, {
107
- workspace: '/tmp/python-project',
108
- extensions: ['ms-python.python']
109
- });
110
-
111
- // Open command palette
112
- await vscode.pressKeys(['cmd', 'shift', 'p']);
113
-
114
- // Create new Python file
115
- await vscode.type('Python: Create New File');
116
- await vscode.pressKeys(['enter']);
117
-
118
- // Verify file was created
119
- await vscode.assert('Untitled Python file is open');
120
- });
121
- ```
122
-
123
- ### Testing Multiple Extensions
124
-
125
- ```javascript
126
- import { test } from 'vitest';
127
- import { vscode } from 'testdriverai/presets';
128
-
129
- test('eslint and prettier integration', async (context) => {
130
- const { vscode } = await vscode(context, {
131
- workspace: '/tmp/js-project',
132
- extensions: [
133
- 'dbaeumer.vscode-eslint',
134
- 'esbenp.prettier-vscode'
135
- ]
136
- });
137
-
138
- // Open a JavaScript file
139
- await vscode.find('File').click();
140
- await vscode.find('Open File').click();
141
- await vscode.type('src/index.js');
142
- await vscode.pressKeys(['enter']);
143
-
144
- // Format document
145
- await vscode.pressKeys(['shift', 'alt', 'f']);
146
-
147
- await vscode.assert('Document is formatted');
148
- });
149
- ```
150
-
151
- ### Empty Workspace
152
-
153
- ```javascript
154
- import { test } from 'vitest';
155
- import { vscode } from 'testdriverai/presets';
156
-
157
- test('empty workspace welcome screen', async (context) => {
158
- const { vscode } = await vscode(context, {
159
- // No workspace specified - opens to welcome screen
160
- });
161
-
162
- await vscode.find('Open Folder button').click();
163
- await vscode.type('/tmp/my-project');
164
- await vscode.pressKeys(['enter']);
165
-
166
- await vscode.assert('Folder is opened');
167
- });
168
- ```
169
-
170
- ### Testing on Different Operating Systems
171
-
172
- ```javascript
173
- import { test } from 'vitest';
174
- import { vscode } from 'testdriverai/presets';
175
-
176
- test('windows vscode test', async (context) => {
177
- const { vscode } = await vscode(context, {
178
- workspace: 'C:\\Users\\TestUser\\project',
179
- os: 'windows'
180
- });
181
-
182
- await vscode.find('Explorer view').click();
183
- });
184
-
185
- test('mac vscode test', async (context) => {
186
- const { vscode } = await vscode(context, {
187
- workspace: '/Users/testuser/project',
188
- os: 'mac'
189
- });
190
-
191
- await vscode.find('Explorer view').click();
192
- });
193
- ```
194
-
195
- ### Extension Settings
196
-
197
- ```javascript
198
- import { test } from 'vitest';
199
- import { vscode } from 'testdriverai/presets';
200
-
201
- test('configure extension settings', async (context) => {
202
- const { vscode } = await vscode(context, {
203
- extensions: ['ms-python.python']
204
- });
205
-
206
- // Open settings
207
- await vscode.pressKeys(['cmd', ',']);
208
-
209
- // Search for Python settings
210
- await vscode.find('Search settings').type('python.linting');
211
-
212
- // Enable linting
213
- await vscode.find('Python > Linting: Enabled checkbox').click();
214
-
215
- await vscode.assert('Linting is enabled');
216
- });
217
- ```
218
-
219
- ### Debugging Workflow
220
-
221
- ```javascript
222
- import { test } from 'vitest';
223
- import { vscode } from 'testdriverai/presets';
224
-
225
- test('debug javascript file', async (context) => {
226
- const { vscode, dashcam } = await vscode(context, {
227
- workspace: '/tmp/debug-test',
228
- extensions: ['ms-vscode.js-debug']
229
- });
230
-
231
- // Open file
232
- await vscode.find('index.js in Explorer').click();
233
-
234
- // Set breakpoint
235
- await vscode.find('line 10 gutter').click();
236
-
237
- // Start debugging
238
- await vscode.pressKeys(['F5']);
239
-
240
- // Wait for breakpoint
241
- await vscode.assert('Debugger paused at breakpoint');
242
-
243
- // Step over
244
- await vscode.pressKeys(['F10']);
245
-
246
- await vscode.assert('Debugger moved to next line');
247
-
248
- // Dashcam captures entire debug session
249
- });
250
- ```
251
-
252
- ## What It Does
253
-
254
- When you call `vscode()`, it automatically:
255
-
256
- 1. **Initializes TestDriver** - Creates and connects to sandbox
257
- 2. **Sets up Dashcam** - Authenticates and starts recording (if enabled)
258
- 3. **Installs Extensions** - Downloads and installs specified extensions
259
- 4. **Launches VS Code** - Opens VS Code with your workspace
260
- 5. **Waits for Ready** - Ensures VS Code is focused and loaded
261
- 6. **Returns Instances** - Provides ready-to-use testdriver, vscode alias, and dashcam
262
-
263
- At test end:
264
- - Dashcam automatically stops and saves replay URL
265
- - TestDriver automatically disconnects
266
- - All cleanup is handled for you
267
-
268
- ## Common Patterns
269
-
270
- ### File Explorer Interaction
271
-
272
- ```javascript
273
- test('create new folder', async (context) => {
274
- const { vscode } = await vscode(context, {
275
- workspace: '/tmp/test-workspace'
276
- });
277
-
278
- // Right-click in Explorer
279
- await vscode.find('Explorer view').click({ button: 'right' });
280
- await vscode.find('New Folder').click();
281
- await vscode.type('src');
282
- await vscode.pressKeys(['enter']);
283
-
284
- await vscode.assert('src folder appears in Explorer');
285
- });
286
- ```
287
-
288
- ### Terminal Commands
289
-
290
- ```javascript
291
- test('run npm install', async (context) => {
292
- const { vscode } = await vscode(context, {
293
- workspace: '/tmp/node-project'
294
- });
295
-
296
- // Open integrated terminal
297
- await vscode.pressKeys(['ctrl', '`']);
298
-
299
- // Run command
300
- await vscode.type('npm install');
301
- await vscode.pressKeys(['enter']);
302
-
303
- // Wait for completion
304
- await vscode.assert('node_modules folder created');
305
- });
306
- ```
307
-
308
- ### Search and Replace
309
-
310
- ```javascript
311
- test('find and replace', async (context) => {
312
- const { vscode } = await vscode(context, {
313
- workspace: '/tmp/project'
314
- });
315
-
316
- // Open file
317
- await vscode.find('app.js').click();
318
-
319
- // Open find/replace
320
- await vscode.pressKeys(['cmd', 'h']);
321
-
322
- // Enter search term
323
- await vscode.find('Find input').type('oldFunction');
324
-
325
- // Enter replacement
326
- await vscode.find('Replace input').type('newFunction');
327
-
328
- // Replace all
329
- await vscode.find('Replace All button').click();
330
-
331
- await vscode.assert('All occurrences replaced');
332
- });
333
- ```
334
-
335
- ### Git Integration
336
-
337
- ```javascript
338
- test('commit changes', async (context) => {
339
- const { vscode } = await vscode(context, {
340
- workspace: '/tmp/git-project',
341
- extensions: ['vscode.git']
342
- });
343
-
344
- // Open Source Control
345
- await vscode.find('Source Control icon').click();
346
-
347
- // Stage changes
348
- await vscode.find('Stage All Changes button').click();
349
-
350
- // Enter commit message
351
- await vscode.find('Commit message input').type('Initial commit');
352
-
353
- // Commit
354
- await vscode.find('Commit button').click();
355
-
356
- await vscode.assert('Changes committed');
357
- });
358
- ```
359
-
360
- ## Extension ID Reference
361
-
362
- Common extension IDs for testing:
363
-
364
- | Extension | ID |
365
- |-----------|-----|
366
- | Python | `ms-python.python` |
367
- | ESLint | `dbaeumer.vscode-eslint` |
368
- | Prettier | `esbenp.prettier-vscode` |
369
- | GitLens | `eamodio.gitlens` |
370
- | Live Server | `ritwickdey.liveserver` |
371
- | Docker | `ms-azuretools.vscode-docker` |
372
- | REST Client | `humao.rest-client` |
373
- | Debugger for Chrome | `msjsdiag.debugger-for-chrome` |
374
-
375
- Find more extension IDs on the [VS Code Marketplace](https://marketplace.visualstudio.com/).
376
-
377
- ## Using with provision()
378
-
379
- The `vscode()` preset can also be called via the unified `provision()` function:
380
-
381
- ```javascript
382
- import { provision } from 'testdriverai/presets';
383
-
384
- test('using provision', async (context) => {
385
- const { vscode } = await provision('vscode', {
386
- workspace: '/tmp/project',
387
- extensions: ['ms-python.python']
388
- }, context);
389
-
390
- // Same functionality as vscode() directly
391
- });
392
- ```
393
-
394
- ## Error Handling
395
-
396
- ```javascript
397
- test('handles missing extension', async (context) => {
398
- try {
399
- const { vscode } = await vscode(context, {
400
- extensions: ['non.existent.extension']
401
- });
402
-
403
- // Will throw error if extension installation fails
404
- } catch (error) {
405
- // Cleanup still happens automatically
406
- expect(error.message).toContain('extension');
407
- }
408
- });
409
- ```
410
-
411
- ## See Also
412
-
413
- - [Provision API](/v7/progressive-apis/PROVISION) - Overview of all presets
414
- - [Chrome Preset](/v7/presets/chrome) - Testing web applications
415
- - [Electron Preset](/v7/presets/electron) - Testing Electron apps
416
- - [Vitest Integration](/v7/guides/vitest) - Complete Vitest setup guide
417
- - [Hooks API](/v7/progressive-apis/HOOKS) - Manual lifecycle control