testdriverai 7.11.264-test → 7.11.265-test

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 (67) hide show
  1. package/ai/skills/testdriver-quickstart/SKILL.md +1 -1
  2. package/ai/skills/testdriver-quickstart-claude/SKILL.md +47 -10
  3. package/docs/_scripts/generate-skills.js +76 -24
  4. package/docs/quickstart-claude.mdx +47 -10
  5. package/docs/quickstart.mdx +1 -1
  6. package/package.json +2 -2
  7. package/ai/skills/testdriver-ai/SKILL.md +0 -204
  8. package/ai/skills/testdriver-claude-mcp-plugin/SKILL.md +0 -245
  9. package/ai/skills/testdriver-cloud/SKILL.md +0 -119
  10. package/ai/skills/testdriver-device-config/SKILL.md +0 -317
  11. package/ai/skills/testdriver-elements/SKILL.md +0 -605
  12. package/ai/skills/testdriver-examples/SKILL.md +0 -7
  13. package/ai/skills/testdriver-machine-setup/SKILL.md +0 -331
  14. package/ai/skills/testdriver-running-tests/SKILL.md +0 -185
  15. package/ai/skills/testdriver-test-writer/SKILL.md +0 -446
  16. package/ai/skills/testdriver-waiting-for-elements/SKILL.md +0 -90
  17. package/ai/skills/testdriver:ai/SKILL.md +0 -204
  18. package/ai/skills/testdriver:assert/SKILL.md +0 -315
  19. package/ai/skills/testdriver:aws-setup/SKILL.md +0 -448
  20. package/ai/skills/testdriver:cache/SKILL.md +0 -221
  21. package/ai/skills/testdriver:caching/SKILL.md +0 -124
  22. package/ai/skills/testdriver:captcha/SKILL.md +0 -158
  23. package/ai/skills/testdriver:ci-cd/SKILL.md +0 -659
  24. package/ai/skills/testdriver:click/SKILL.md +0 -286
  25. package/ai/skills/testdriver:client/SKILL.md +0 -481
  26. package/ai/skills/testdriver:customizing-devices/SKILL.md +0 -319
  27. package/ai/skills/testdriver:dashcam/SKILL.md +0 -451
  28. package/ai/skills/testdriver:debugging-with-screenshots/SKILL.md +0 -415
  29. package/ai/skills/testdriver:device-config/SKILL.md +0 -317
  30. package/ai/skills/testdriver:double-click/SKILL.md +0 -102
  31. package/ai/skills/testdriver:elements/SKILL.md +0 -605
  32. package/ai/skills/testdriver:enterprise/SKILL.md +0 -7
  33. package/ai/skills/testdriver:errors/SKILL.md +0 -246
  34. package/ai/skills/testdriver:events/SKILL.md +0 -356
  35. package/ai/skills/testdriver:exec/SKILL.md +0 -317
  36. package/ai/skills/testdriver:find/SKILL.md +0 -856
  37. package/ai/skills/testdriver:focus-application/SKILL.md +0 -293
  38. package/ai/skills/testdriver:generating-tests/SKILL.md +0 -25
  39. package/ai/skills/testdriver:hosted/SKILL.md +0 -155
  40. package/ai/skills/testdriver:hover/SKILL.md +0 -278
  41. package/ai/skills/testdriver:locating-elements/SKILL.md +0 -71
  42. package/ai/skills/testdriver:making-assertions/SKILL.md +0 -32
  43. package/ai/skills/testdriver:mcp/SKILL.md +0 -7
  44. package/ai/skills/testdriver:mouse-down/SKILL.md +0 -161
  45. package/ai/skills/testdriver:mouse-up/SKILL.md +0 -164
  46. package/ai/skills/testdriver:parse/SKILL.md +0 -236
  47. package/ai/skills/testdriver:performing-actions/SKILL.md +0 -53
  48. package/ai/skills/testdriver:press-keys/SKILL.md +0 -348
  49. package/ai/skills/testdriver:provision/SKILL.md +0 -331
  50. package/ai/skills/testdriver:quickstart/SKILL.md +0 -172
  51. package/ai/skills/testdriver:redraw/SKILL.md +0 -214
  52. package/ai/skills/testdriver:reusable-code/SKILL.md +0 -249
  53. package/ai/skills/testdriver:right-click/SKILL.md +0 -123
  54. package/ai/skills/testdriver:running-tests/SKILL.md +0 -185
  55. package/ai/skills/testdriver:screenshot/SKILL.md +0 -248
  56. package/ai/skills/testdriver:screenshots/SKILL.md +0 -184
  57. package/ai/skills/testdriver:scroll/SKILL.md +0 -205
  58. package/ai/skills/testdriver:secrets/SKILL.md +0 -115
  59. package/ai/skills/testdriver:self-hosted/SKILL.md +0 -147
  60. package/ai/skills/testdriver:test-results-json/SKILL.md +0 -257
  61. package/ai/skills/testdriver:testdriver/SKILL.md +0 -624
  62. package/ai/skills/testdriver:type/SKILL.md +0 -357
  63. package/ai/skills/testdriver:variables/SKILL.md +0 -111
  64. package/ai/skills/testdriver:wait/SKILL.md +0 -50
  65. package/ai/skills/testdriver:waiting-for-elements/SKILL.md +0 -90
  66. package/ai/skills/testdriver:what-is-testdriver/SKILL.md +0 -54
  67. package/scripts/generate-skills.js +0 -94
@@ -1,481 +0,0 @@
1
- ---
2
- name: testdriver:client
3
- description: Initialize and configure the TestDriver SDK client
4
- ---
5
- <!-- Generated from client.mdx. DO NOT EDIT. -->
6
-
7
- ## Overview
8
-
9
- The `TestDriver` client is the main entry point for the SDK. It handles authentication, sandbox connection, and provides access to all testing methods.
10
-
11
- ## Constructor
12
-
13
- ```javascript
14
- const testdriver = new TestDriver(apiKey, options)
15
- ```
16
-
17
- ### Parameters
18
-
19
- <ParamField path="apiKey" type="string" required>
20
- Your TestDriver API key from the [dashboard](https://console.testdriver.ai/team)
21
- </ParamField>
22
-
23
- <ParamField path="options" type="object">
24
- Configuration options for the client
25
-
26
- <Expandable title="properties">
27
- <ParamField path="os" type="string" default="linux">
28
- Operating system for the sandbox: `'windows'` or `'linux'`
29
- </ParamField>
30
-
31
- <ParamField path="resolution" type="string" default="1366x768">
32
- Screen resolution for the sandbox (e.g., `'1920x1080'`, `'1366x768'`)
33
- </ParamField>
34
-
35
- <ParamField path="apiRoot" type="string">
36
- API endpoint URL (typically only changed for self-hosted deployments)
37
- </ParamField>
38
-
39
- <ParamField path="analytics" type="boolean" default="true">
40
- Enable or disable usage analytics
41
- </ParamField>
42
-
43
- <ParamField path="logging" type="boolean" default="true">
44
- Enable or disable console logging
45
- </ParamField>
46
-
47
- <ParamField path="autoScreenshots" type="boolean" default="false">
48
- Automatically capture screenshots before and after each command. Screenshots are saved to `.testdriver/screenshots/<test>/` with descriptive filenames that include the line number and action name. Format: `<seq>-<action>-<phase>-L<line>-<description>.png`
49
- </ParamField>
50
-
51
- <ParamField path="newSandbox" type="boolean" default="true">
52
- Force creation of a new sandbox instead of reusing an existing one
53
- </ParamField>
54
-
55
- <ParamField path="reconnect" type="boolean" default="false">
56
- Reconnect to the last used sandbox instead of creating a new one. When `true`, provision methods (`chrome`, `vscode`, `installer`, etc.) will be skipped since the application is already running. Throws error if no previous sandbox exists.
57
- </ParamField>
58
-
59
- <ParamField path="preview" type="string" default="browser">
60
- Preview mode for live test visualization:
61
- - `"browser"` — Opens debugger in default browser (default)
62
- - `"ide"` — Opens preview in IDE panel (VSCode, Cursor - requires TestDriver extension)
63
- - `"none"` — Headless mode, no visual preview
64
- </ParamField>
65
-
66
- <ParamField path="headless" type="boolean" default="false">
67
- **Deprecated**: Use `preview: "none"` instead. Run in headless mode without opening the debugger.
68
- </ParamField>
69
-
70
- <ParamField path="debugOnFailure" type="boolean" default="false">
71
- Keep the sandbox alive when a test fails so you can reconnect and debug interactively. The sandbox ID is printed to the console.
72
- </ParamField>
73
-
74
- <ParamField path="ip" type="string">
75
- Direct IP address to connect to a running sandbox instance (for self-hosted deployments)
76
- </ParamField>
77
-
78
- <ParamField path="sandboxAmi" type="string">
79
- Custom AMI ID for the sandbox instance (AWS deployments, e.g., `'ami-1234'`)
80
- </ParamField>
81
-
82
- <ParamField path="sandboxInstance" type="string">
83
- EC2 instance type for the sandbox (AWS deployments, e.g., `'i3.metal'`)
84
- </ParamField>
85
-
86
- <ParamField path="cache" type="boolean | object" default="true">
87
- Enable or disable element caching, or provide advanced threshold configuration.
88
-
89
- <Expandable title="advanced config">
90
- <ParamField path="enabled" type="boolean" default="true">
91
- Enable or disable caching
92
- </ParamField>
93
-
94
- <ParamField path="thresholds" type="object">
95
- Fine-tune cache matching
96
-
97
- <Expandable title="properties">
98
- <ParamField path="find" type="object">
99
- Thresholds for `find()` operations
100
-
101
- <Expandable title="properties">
102
- <ParamField path="screen" type="number" default="0.05">
103
- Pixel diff threshold for screen comparison (0-1). `0.05` = 5% diff allowed.
104
- </ParamField>
105
-
106
- <ParamField path="element" type="number" default="0.8">
107
- OpenCV template match threshold for element matching (0-1). `0.8` = 80% correlation.
108
- </ParamField>
109
- </Expandable>
110
- </ParamField>
111
-
112
- <ParamField path="assert" type="number" default="0.05">
113
- Pixel diff threshold for `assert()` operations (0-1). `0.05` = 5% diff allowed.
114
- </ParamField>
115
- </Expandable>
116
- </ParamField>
117
- </Expandable>
118
- </ParamField>
119
-
120
- <ParamField path="cacheKey" type="string">
121
- Cache key for element finding operations. If provided, enables caching tied to this key.
122
- </ParamField>
123
-
124
- <ParamField path="verify" type="boolean" default="false">
125
- Global default for AI verification of located elements. When `true`, every `find()` runs a second AI check to confirm the returned coordinates actually match the requested element (catching hallucinated or incorrect positions), at the cost of extra latency. Can be overridden per call via `find(description, { verify: true | false })`.
126
- </ParamField>
127
-
128
- <ParamField path="dashcam" type="boolean" default="true">
129
- Enable or disable Dashcam video recording
130
- </ParamField>
131
-
132
- <ParamField path="redraw" type="boolean | object" default="true">
133
- Enable or disable screen-change (redraw) detection, or provide advanced configuration.
134
-
135
- <Expandable title="advanced config">
136
- <ParamField path="enabled" type="boolean" default="true">
137
- Enable or disable redraw detection
138
- </ParamField>
139
-
140
- <ParamField path="thresholds" type="object">
141
- Threshold configuration
142
-
143
- <Expandable title="properties">
144
- <ParamField path="screen" type="number | false" default="0.05">
145
- Pixel diff threshold (0-1). Set to `false` to disable screen redraw detection.
146
- </ParamField>
147
-
148
- <ParamField path="network" type="boolean" default="false">
149
- Enable or disable network activity monitoring
150
- </ParamField>
151
- </Expandable>
152
- </ParamField>
153
- </Expandable>
154
- </ParamField>
155
-
156
- <ParamField path="environment" type="object">
157
- Additional environment variables to pass to the sandbox
158
- </ParamField>
159
-
160
- <ParamField path="ai" type="object">
161
- Global AI sampling configuration. Controls how the AI model generates responses for `find()` verification and `assert()` calls. Can be overridden per call.
162
-
163
- <Expandable title="properties">
164
- <ParamField path="temperature" type="number">
165
- Controls randomness in AI responses. `0` = deterministic (best for verification), higher values = more creative. Default: `0` for find verification, model default for assert.
166
- </ParamField>
167
-
168
- <ParamField path="top" type="object">
169
- Nucleus and top-k sampling parameters
170
-
171
- <Expandable title="properties">
172
- <ParamField path="p" type="number">
173
- Top-P (nucleus sampling). Limits token choices to the smallest set whose cumulative probability exceeds P. Lower values = more focused responses. Range: 0-1.
174
- </ParamField>
175
-
176
- <ParamField path="k" type="number">
177
- Top-K sampling. Limits token choices to the top K most likely tokens. `1` = always pick the most likely token. `0` = disabled (consider all tokens).
178
- </ParamField>
179
- </Expandable>
180
- </ParamField>
181
- </Expandable>
182
- </ParamField>
183
- </Expandable>
184
- </ParamField>
185
-
186
- ### Example
187
-
188
- ```javascript
189
- import TestDriver from 'testdriverai';
190
-
191
- // API key is automatically loaded from TD_API_KEY in .env
192
- const testdriver = new TestDriver({
193
- os: 'windows',
194
- resolution: '1920x1080',
195
- logging: true,
196
- analytics: true
197
- });
198
-
199
- // With AI config for stricter verification
200
- const testdriver = new TestDriver({
201
- ai: { temperature: 0, top: { p: 0.9, k: 40 } }
202
- });
203
-
204
- // Or pass API key explicitly
205
- const testdriver = new TestDriver('your-api-key', {
206
- os: 'windows'
207
- });
208
- ```
209
-
210
- ## Authentication
211
-
212
- ### auth()
213
-
214
- Authenticate with the TestDriver API.
215
-
216
- ```javascript
217
- await testdriver.auth()
218
- ```
219
-
220
- **Returns:** `Promise<string>` - Authentication token
221
-
222
- **Example:**
223
- ```javascript
224
- await testdriver.auth();
225
- ```
226
-
227
- <Note>
228
- You must call `auth()` before `connect()`. Most examples call both sequentially.
229
- </Note>
230
-
231
- ## Connection Management
232
-
233
- ### connect()
234
-
235
- Connect to a sandbox environment. This creates or reconnects to a virtual machine where your tests will run.
236
-
237
- ```javascript
238
- await testdriver.connect(options)
239
- ```
240
-
241
- #### Parameters
242
-
243
- <ParamField path="options" type="object">
244
- Connection options
245
-
246
- <Expandable title="properties">
247
- <ParamField path="newSandbox" type="boolean" default="false">
248
- Force creation of a new sandbox instead of reusing an existing one
249
- </ParamField>
250
-
251
- <ParamField path="sandboxId" type="string">
252
- Existing sandbox ID to reconnect to
253
- </ParamField>
254
-
255
- <ParamField path="ip" type="string">
256
- Direct IP address to connect to (for self-hosted sandboxes)
257
- </ParamField>
258
-
259
- <ParamField path="sandboxAmi" type="string">
260
- AMI to use for the sandbox (AWS deployments)
261
- </ParamField>
262
-
263
- <ParamField path="sandboxInstance" type="string">
264
- Instance type for the sandbox (AWS deployments)
265
- </ParamField>
266
-
267
- <ParamField path="preview" type="string" default="browser">
268
- Preview mode for live test visualization:
269
- - `"browser"` - Opens debugger in default browser (default)
270
- - `"ide"` - Opens preview in IDE panel (VSCode, Cursor - requires TestDriver extension)
271
- - `"none"` - Headless mode, no visual preview
272
- </ParamField>
273
-
274
- <ParamField path="headless" type="boolean" default="false">
275
- **Deprecated**: Use `preview: "none"` instead. Run in headless mode without opening the debugger.
276
- </ParamField>
277
-
278
- <ParamField path="keepAlive" type="number" default="60000">
279
- Keep sandbox alive for the specified number of milliseconds after disconnect. Set to `0` to terminate immediately on disconnect. Useful for debugging or reconnecting to the same sandbox.
280
- </ParamField>
281
- </Expandable>
282
- </ParamField>
283
-
284
- **Returns:** `Promise&lt;Object&gt;` - Sandbox instance details including `instanceId`, `ip`, `vncPort`, etc.
285
-
286
- #### Examples
287
-
288
- **Basic connection:**
289
- ```javascript
290
- await testdriver.connect();
291
- ```
292
-
293
- **Reconnect to existing sandbox:**
294
- ```javascript
295
- const instance = await testdriver.connect({
296
- sandboxId: 'existing-sandbox-id-123'
297
- });
298
- ```
299
-
300
- **Self-hosted sandbox:**
301
- ```javascript
302
- await testdriver.connect({
303
- ip: '192.168.1.100'
304
- });
305
- ```
306
-
307
- ### disconnect()
308
-
309
- Disconnect from the sandbox and clean up resources.
310
-
311
- ```javascript
312
- await testdriver.disconnect()
313
- ```
314
-
315
- **Returns:** `Promise<void>`
316
-
317
- **Example:**
318
- ```javascript
319
- afterAll(async () => {
320
- await testdriver.disconnect();
321
- });
322
- ```
323
-
324
- ## Instance Information
325
-
326
- ### getInstance()
327
-
328
- Get the current sandbox instance details.
329
-
330
- ```javascript
331
- const instance = testdriver.getInstance()
332
- ```
333
-
334
- **Returns:** `Object | null` - Sandbox instance information
335
-
336
- **Example:**
337
- ```javascript
338
- const instance = testdriver.getInstance();
339
- console.log('Instance ID:', instance.instanceId);
340
- console.log('IP Address:', instance.ip);
341
- ```
342
-
343
- ### getSessionId()
344
-
345
- Get the current session ID for tracking and debugging.
346
-
347
- ```javascript
348
- const sessionId = testdriver.getSessionId()
349
- ```
350
-
351
- **Returns:** `string | null` - Session ID
352
-
353
- **Example:**
354
- ```javascript
355
- const sessionId = testdriver.getSessionId();
356
- console.log('Session:', sessionId);
357
- ```
358
-
359
- ## Logging & Events
360
-
361
- ### setLogging()
362
-
363
- Enable or disable console logging at runtime.
364
-
365
- ```javascript
366
- testdriver.setLogging(enabled)
367
- ```
368
-
369
- **Parameters:**
370
- - `enabled` (boolean) - Whether to enable logging
371
-
372
- **Example:**
373
- ```javascript
374
- // Disable logging for cleanup operations
375
- testdriver.setLogging(false);
376
- await testdriver.disconnect();
377
- testdriver.setLogging(true);
378
- ```
379
-
380
- ### getEmitter()
381
-
382
- Get the event emitter for custom event handling.
383
-
384
- ```javascript
385
- const emitter = testdriver.getEmitter()
386
- ```
387
-
388
- **Returns:** `EventEmitter2` - Event emitter instance
389
-
390
- **Example:**
391
- ```javascript
392
- const emitter = testdriver.getEmitter();
393
-
394
- emitter.on('command:start', (data) => {
395
- console.log('Command started:', data);
396
- });
397
-
398
- emitter.on('command:success', (data) => {
399
- console.log('Command succeeded:', data);
400
- });
401
-
402
- emitter.on('command:error', (error) => {
403
- console.error('Command failed:', error);
404
- });
405
- ```
406
-
407
- ## Complete Example
408
-
409
- ```javascript
410
- import { beforeAll, afterAll, describe, it } from 'vitest';
411
- import TestDriver from 'testdriverai';
412
-
413
- describe('My Test Suite', () => {
414
- let testdriver;
415
-
416
- beforeAll(async () => {
417
- // Initialize client - API key loaded automatically from .env
418
- testdriver = new TestDriver({
419
- os: 'windows',
420
- resolution: '1366x768',
421
- logging: true
422
- });
423
-
424
- // Set up event listeners
425
- const emitter = testdriver.getEmitter();
426
- emitter.on('log:info', (msg) => console.log('[INFO]', msg));
427
-
428
- // Authenticate and connect
429
- await testdriver.auth();
430
- const instance = await testdriver.connect();
431
-
432
- console.log('Connected to sandbox:', instance.instanceId);
433
- });
434
-
435
- afterAll(async () => {
436
- await testdriver.disconnect();
437
- });
438
-
439
- it('runs a test', async () => {
440
- // Your test code here
441
- });
442
- });
443
- ```
444
-
445
- ## Best Practices
446
-
447
- <AccordionGroup>
448
- <Accordion title="Reuse sandboxes across tests">
449
- Use `beforeAll`/`afterAll` to create one sandbox per test suite rather than per test. This significantly reduces execution time.
450
- </Accordion>
451
-
452
- <Accordion title="Handle connection errors gracefully">
453
- Wrap `connect()` in a try-catch block to handle network issues or quota limits:
454
-
455
- ```javascript
456
- try {
457
- await testdriver.connect();
458
- } catch (error) {
459
- console.error('Failed to connect:', error.message);
460
- throw error;
461
- }
462
- ```
463
- </Accordion>
464
-
465
- <Accordion title="Always disconnect">
466
- Use `afterAll` or try-finally blocks to ensure `disconnect()` is called even if tests fail. This prevents orphaned sandboxes.
467
- </Accordion>
468
-
469
- <Accordion title="Use environment variables for API keys">
470
- Never hardcode API keys. The SDK automatically loads `TD_API_KEY` from your `.env` file:
471
-
472
- ```bash .env
473
- TD_API_KEY=your_api_key_here
474
- ```
475
-
476
- ```javascript
477
- // API key is loaded automatically - no need to pass it!
478
- const testdriver = new TestDriver();
479
- ```
480
- </Accordion>
481
- </AccordionGroup>