@testdriverai/agent 7.11.240-test → 7.11.241-canary
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.
- package/ai/skills/testdriver-agent/SKILL.md +174 -91
- package/ai/skills/testdriver-assert/SKILL.md +73 -269
- package/ai/skills/testdriver-aws-setup/SKILL.md +194 -312
- package/ai/skills/testdriver-bring-your-own-machine/SKILL.md +137 -204
- package/ai/skills/testdriver-cache/SKILL.md +142 -149
- package/ai/skills/testdriver-caching/SKILL.md +97 -87
- package/ai/skills/testdriver-captcha/SKILL.md +126 -111
- package/ai/skills/testdriver-ci-cd/SKILL.md +153 -542
- package/ai/skills/testdriver-click/SKILL.md +74 -229
- package/ai/skills/testdriver-client/SKILL.md +175 -229
- package/ai/skills/testdriver-customizing-devices/SKILL.md +72 -250
- package/ai/skills/testdriver-dashcam/SKILL.md +71 -404
- package/ai/skills/testdriver-debugging-with-screenshots/SKILL.md +103 -369
- package/ai/skills/testdriver-double-click/SKILL.md +46 -67
- package/ai/skills/testdriver-errors/SKILL.md +102 -176
- package/ai/skills/testdriver-events/SKILL.md +170 -327
- package/ai/skills/testdriver-exec/SKILL.md +92 -256
- package/ai/skills/testdriver-extract/SKILL.md +69 -170
- package/ai/skills/testdriver-find/SKILL.md +140 -736
- package/ai/skills/testdriver-focus-application/SKILL.md +69 -246
- package/ai/skills/testdriver-generating-tests/SKILL.md +102 -136
- package/ai/skills/testdriver-hosted/SKILL.md +79 -143
- package/ai/skills/testdriver-hover/SKILL.md +62 -235
- package/ai/skills/testdriver-locating-elements/SKILL.md +71 -366
- package/ai/skills/testdriver-making-assertions/SKILL.md +114 -72
- package/ai/skills/testdriver-mcp-setup/SKILL.md +79 -62
- package/ai/skills/testdriver-mouse-down/SKILL.md +46 -124
- package/ai/skills/testdriver-mouse-up/SKILL.md +45 -128
- package/ai/skills/testdriver-options/SKILL.md +73 -46
- package/ai/skills/testdriver-parse/SKILL.md +95 -184
- package/ai/skills/testdriver-performing-actions/SKILL.md +101 -91
- package/ai/skills/testdriver-press-keys/SKILL.md +59 -299
- package/ai/skills/testdriver-provision/SKILL.md +135 -179
- package/ai/skills/testdriver-quickstart/SKILL.md +24 -8
- package/ai/skills/testdriver-quickstart-claude/SKILL.md +84 -0
- package/ai/skills/testdriver-quickstart-github/SKILL.md +62 -32
- package/ai/skills/testdriver-quickstart-manual/SKILL.md +59 -32
- package/ai/skills/testdriver-quickstart-vscode/SKILL.md +96 -0
- package/ai/skills/testdriver-redraw/SKILL.md +100 -164
- package/ai/skills/testdriver-reusable-code/SKILL.md +95 -199
- package/ai/skills/testdriver-right-click/SKILL.md +45 -88
- package/ai/skills/testdriver-screenshot/SKILL.md +47 -201
- package/ai/skills/testdriver-screenshots/SKILL.md +86 -136
- package/ai/skills/testdriver-scroll/SKILL.md +71 -154
- package/ai/skills/testdriver-secrets/SKILL.md +94 -90
- package/ai/skills/testdriver-self-hosted/SKILL.md +82 -140
- package/ai/skills/testdriver-test-results-json/SKILL.md +165 -202
- package/ai/skills/testdriver-type/SKILL.md +56 -304
- package/ai/skills/testdriver-variables/SKILL.md +119 -80
- package/ai/skills/testdriver-wait/SKILL.md +31 -29
- package/ai/skills/testdriver-what-is-testdriver/SKILL.md +80 -32
- package/package.json +1 -1
|
@@ -1,321 +1,143 @@
|
|
|
1
1
|
---
|
|
2
2
|
name: testdriver:customizing-devices
|
|
3
|
-
description:
|
|
3
|
+
description: Choose the sandbox OS and resolution, preview mode, recording, and how long it stays alive.
|
|
4
4
|
---
|
|
5
5
|
<!-- Generated from customizing-devices.mdx. DO NOT EDIT. -->
|
|
6
6
|
|
|
7
|
-
|
|
7
|
+
import { EnterpriseBadge, EnterpriseCta } from '/snippets/enterprise.mdx';
|
|
8
8
|
|
|
9
|
-
|
|
9
|
+
Every test runs in a sandbox: a fresh virtual machine. Pass options to `TestDriver(context, options)` to change it.
|
|
10
10
|
|
|
11
11
|
```javascript
|
|
12
12
|
const testdriver = TestDriver(context, {
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
keepAlive: 60000, // Keep sandbox alive after disconnect in ms (default: 60000)
|
|
17
|
-
os: "linux", // 'linux' | 'windows' (default: 'linux')
|
|
18
|
-
resolution: "1366x768", // Sandbox resolution (e.g., '1920x1080')
|
|
19
|
-
ip: "203.0.113.42", // Direct IP for self-hosted sandbox
|
|
20
|
-
sandboxAmi: "ami-1234", // Custom AMI ID (AWS deployments)
|
|
21
|
-
sandboxInstance: "i3.metal", // EC2 instance type (AWS deployments)
|
|
22
|
-
|
|
23
|
-
// === Preview & Debugging ===
|
|
24
|
-
preview: "browser", // "browser" | "ide" | "none" (default: "browser")
|
|
25
|
-
headless: false, // @deprecated - use preview: "none" instead
|
|
26
|
-
debugOnFailure: false, // Keep sandbox alive on test failure for debugging
|
|
27
|
-
|
|
28
|
-
// === Caching ===
|
|
29
|
-
cache: true, // Enable element caching (default: true)
|
|
30
|
-
// Or use advanced caching config:
|
|
31
|
-
// cache: {
|
|
32
|
-
// enabled: true,
|
|
33
|
-
// thresholds: {
|
|
34
|
-
// find: { screen: 0.05, element: 0.8 },
|
|
35
|
-
// assert: 0.05
|
|
36
|
-
// }
|
|
37
|
-
// },
|
|
38
|
-
cacheKey: "my-test", // Cache key for element finding operations
|
|
39
|
-
|
|
40
|
-
// === Recording & Screenshots ===
|
|
41
|
-
dashcam: true, // Enable/disable Dashcam video recording (default: true)
|
|
42
|
-
autoScreenshots: true, // Capture screenshots before/after each command (default: false)
|
|
43
|
-
|
|
44
|
-
// === AI Configuration ===
|
|
45
|
-
ai: { // Global AI sampling configuration
|
|
46
|
-
temperature: 0, // 0 = deterministic, higher = more creative
|
|
47
|
-
top: {
|
|
48
|
-
p: 0.9, // Top-P nucleus sampling (0-1)
|
|
49
|
-
k: 40, // Top-K sampling (1 = most likely, 0 = disabled)
|
|
50
|
-
},
|
|
51
|
-
},
|
|
52
|
-
|
|
53
|
-
// === Screen Change Detection ===
|
|
54
|
-
redraw: true, // Enable redraw detection (default: true)
|
|
55
|
-
// Or use advanced redraw config:
|
|
56
|
-
// redraw: {
|
|
57
|
-
// enabled: true,
|
|
58
|
-
// thresholds: {
|
|
59
|
-
// screen: 0.05, // Pixel diff threshold (0-1), false to disable
|
|
60
|
-
// network: false, // Monitor network activity (default: false)
|
|
61
|
-
// }
|
|
62
|
-
// },
|
|
63
|
-
|
|
64
|
-
// === Logging & Analytics ===
|
|
65
|
-
logging: true, // Enable console logging output (default: true)
|
|
66
|
-
analytics: true, // Enable analytics tracking (default: true)
|
|
67
|
-
|
|
68
|
-
// === Advanced ===
|
|
69
|
-
apiRoot: "https://...", // API endpoint URL (for self-hosted deployments)
|
|
70
|
-
environment: {}, // Additional environment variables for the sandbox
|
|
13
|
+
os: 'windows',
|
|
14
|
+
preview: 'none',
|
|
15
|
+
keepAlive: 300000,
|
|
71
16
|
});
|
|
72
17
|
```
|
|
73
18
|
|
|
74
|
-
|
|
19
|
+
This page covers the common changes. For every option and its default, see [Options](/options).
|
|
75
20
|
|
|
76
|
-
|
|
21
|
+
## Choose the operating system
|
|
77
22
|
|
|
78
|
-
|
|
79
|
-
const testdriver = TestDriver(context, {
|
|
80
|
-
preview: "browser", // Opens in default browser (default)
|
|
81
|
-
});
|
|
82
|
-
```
|
|
83
|
-
|
|
84
|
-
| Value | Description |
|
|
85
|
-
|-------|-------------|
|
|
86
|
-
| `"browser"` | Opens debugger in default browser (default) |
|
|
87
|
-
| `"ide"` | Opens preview in IDE panel (VSCode, Cursor - requires TestDriver extension) |
|
|
88
|
-
| `"none"` | Headless mode, no visual preview |
|
|
89
|
-
|
|
90
|
-
**IDE Preview**
|
|
91
|
-
|
|
92
|
-
For the best development experience, use `preview: "ide"` with the TestDriver extension for VSCode or Cursor:
|
|
23
|
+
Sandboxes run Linux by default. Set `os` to run on Windows:
|
|
93
24
|
|
|
94
25
|
```javascript
|
|
95
|
-
const testdriver = TestDriver(context, {
|
|
96
|
-
preview: "ide", // Opens preview in IDE panel
|
|
97
|
-
});
|
|
26
|
+
const testdriver = TestDriver(context, { os: 'windows' });
|
|
98
27
|
```
|
|
99
28
|
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
Run tests without any visual preview. Useful for CI/CD pipelines:
|
|
103
|
-
|
|
104
|
-
```javascript
|
|
105
|
-
const testdriver = TestDriver(context, {
|
|
106
|
-
preview: "none", // No visual preview (headless)
|
|
107
|
-
});
|
|
108
|
-
```
|
|
109
|
-
|
|
110
|
-
<Note>
|
|
111
|
-
The legacy `headless: true` option still works for backward compatibility and maps to `preview: "none"`.
|
|
112
|
-
</Note>
|
|
113
|
-
|
|
114
|
-
### Debug on Failure
|
|
115
|
-
|
|
116
|
-
Keep the sandbox alive when a test fails so you can reconnect and debug interactively. The sandbox ID is printed to the console along with instructions for reconnecting via MCP.
|
|
117
|
-
|
|
118
|
-
```javascript
|
|
119
|
-
const testdriver = TestDriver(context, {
|
|
120
|
-
debugOnFailure: true,
|
|
121
|
-
});
|
|
122
|
-
```
|
|
29
|
+
<EnterpriseCta feature="Windows sandboxes" plural />
|
|
123
30
|
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
If self-hosting TestDriver, use `ip` to specify the device IP. See [Run on Your Own Machine](/bring-your-own-machine) for details.
|
|
127
|
-
|
|
128
|
-
```javascript
|
|
129
|
-
const testdriver = TestDriver(context, {
|
|
130
|
-
ip: "203.0.113.42", // Your allowlisted IP
|
|
131
|
-
});
|
|
132
|
-
```
|
|
133
|
-
|
|
134
|
-
### Operating System
|
|
135
|
-
|
|
136
|
-
Set the `os` property to run tests on a specific operating system. Available options are `linux` (default) and `windows`.
|
|
137
|
-
|
|
138
|
-
```javascript
|
|
139
|
-
const testdriver = TestDriver(context, {
|
|
140
|
-
os: "windows", // Run on Windows sandbox
|
|
141
|
-
});
|
|
142
|
-
```
|
|
143
|
-
|
|
144
|
-
#### Using Environment Variables
|
|
145
|
-
|
|
146
|
-
You can make the operating system configurable via environment variables. This requires adding code to read from `process.env` in your test:
|
|
147
|
-
|
|
148
|
-
```javascript
|
|
149
|
-
const testdriver = TestDriver(context, {
|
|
150
|
-
os: process.env.TD_OS || "linux", // Read from env, default to Linux
|
|
151
|
-
});
|
|
152
|
-
```
|
|
153
|
-
|
|
154
|
-
Then pass the variable when running tests:
|
|
31
|
+
The `TestDriver()` hook also reads the `TD_OS` environment variable when you don't pass `os`. That lets you run one suite on both systems without changing code:
|
|
155
32
|
|
|
156
33
|
```bash
|
|
157
|
-
|
|
158
|
-
TD_OS=windows vitest run
|
|
159
|
-
|
|
160
|
-
# Run tests on Linux (default)
|
|
161
|
-
TD_OS=linux vitest run
|
|
34
|
+
TD_OS=windows npx vitest run
|
|
162
35
|
```
|
|
163
36
|
|
|
164
|
-
|
|
37
|
+
In GitHub Actions, run the suite once per OS with a matrix:
|
|
165
38
|
|
|
166
|
-
```yaml
|
|
167
|
-
# Example GitHub Actions matrix
|
|
39
|
+
```yaml .github/workflows/testdriver.yml
|
|
168
40
|
strategy:
|
|
169
41
|
matrix:
|
|
170
|
-
os: [linux, windows]
|
|
42
|
+
td-os: [linux, windows]
|
|
171
43
|
steps:
|
|
172
|
-
|
|
44
|
+
# ...checkout, install, and authenticate steps
|
|
45
|
+
- name: Run tests on ${{ matrix.td-os }}
|
|
46
|
+
run: npx vitest run
|
|
47
|
+
env:
|
|
48
|
+
TD_OS: ${{ matrix.td-os }}
|
|
173
49
|
```
|
|
174
50
|
|
|
175
|
-
|
|
51
|
+
See [Run in CI/CD](/ci-cd) for the full workflow.
|
|
176
52
|
|
|
177
|
-
|
|
53
|
+
## Set the screen resolution
|
|
178
54
|
|
|
179
|
-
|
|
180
|
-
const testdriver = TestDriver(context, {
|
|
181
|
-
dashcam: false,
|
|
182
|
-
});
|
|
183
|
-
```
|
|
184
|
-
|
|
185
|
-
### Automatic Screenshots
|
|
186
|
-
|
|
187
|
-
Screenshots are automatically captured before and after every command (click, type, find, assert, etc.) by default. Each screenshot filename includes the line number from your test file.
|
|
188
|
-
|
|
189
|
-
Disable automatic screenshots:
|
|
55
|
+
The default resolution is `1366x768`. Set `resolution` to change it:
|
|
190
56
|
|
|
191
57
|
```javascript
|
|
192
|
-
const testdriver = TestDriver(context, {
|
|
193
|
-
autoScreenshots: false,
|
|
194
|
-
});
|
|
58
|
+
const testdriver = TestDriver(context, { resolution: '1920x1080' });
|
|
195
59
|
```
|
|
196
60
|
|
|
197
|
-
|
|
61
|
+
<EnterpriseCta feature="Custom screen resolution" />
|
|
198
62
|
|
|
199
|
-
|
|
63
|
+
## Choose how to watch the run
|
|
200
64
|
|
|
201
|
-
|
|
202
|
-
// Disable caching
|
|
203
|
-
const testdriver = TestDriver(context, {
|
|
204
|
-
cache: false,
|
|
205
|
-
});
|
|
206
|
-
|
|
207
|
-
// Advanced: custom thresholds
|
|
208
|
-
const testdriver = TestDriver(context, {
|
|
209
|
-
cache: {
|
|
210
|
-
enabled: true,
|
|
211
|
-
thresholds: {
|
|
212
|
-
find: { screen: 0.05, element: 0.8 },
|
|
213
|
-
assert: 0.05,
|
|
214
|
-
},
|
|
215
|
-
},
|
|
216
|
-
cacheKey: "my-test",
|
|
217
|
-
});
|
|
218
|
-
```
|
|
219
|
-
|
|
220
|
-
### Redraw Detection
|
|
65
|
+
`preview` sets where the live view of the sandbox opens:
|
|
221
66
|
|
|
222
|
-
|
|
67
|
+
- `"browser"` opens it in your default browser. This is the default.
|
|
68
|
+
- `"ide"` opens it in an editor panel. This needs the [TestDriver extension](/quickstart-vscode) for VS Code or Cursor.
|
|
69
|
+
- `"none"` turns the live view off. Use this in CI.
|
|
223
70
|
|
|
224
71
|
```javascript
|
|
225
|
-
// Disable redraw detection
|
|
226
72
|
const testdriver = TestDriver(context, {
|
|
227
|
-
|
|
228
|
-
});
|
|
229
|
-
|
|
230
|
-
// Advanced: custom thresholds with network monitoring
|
|
231
|
-
const testdriver = TestDriver(context, {
|
|
232
|
-
redraw: {
|
|
233
|
-
enabled: true,
|
|
234
|
-
thresholds: {
|
|
235
|
-
screen: 0.05,
|
|
236
|
-
network: true,
|
|
237
|
-
},
|
|
238
|
-
},
|
|
73
|
+
preview: process.env.CI ? 'none' : 'browser',
|
|
239
74
|
});
|
|
240
75
|
```
|
|
241
76
|
|
|
242
|
-
|
|
77
|
+
`headless: true` is deprecated. Use `preview: "none"` instead.
|
|
243
78
|
|
|
244
|
-
|
|
79
|
+
## Record the run
|
|
245
80
|
|
|
246
|
-
|
|
247
|
-
|
|
248
|
-
ai: {
|
|
249
|
-
temperature: 0, // 0 = deterministic
|
|
250
|
-
top: { p: 0.9, k: 40 },
|
|
251
|
-
},
|
|
252
|
-
});
|
|
253
|
-
```
|
|
254
|
-
|
|
255
|
-
### Environment Variables
|
|
256
|
-
|
|
257
|
-
Pass additional environment variables to the sandbox:
|
|
81
|
+
- **Video.** [Dashcam](/dashcam) records every test by default. Set `dashcam: false` to turn it off.
|
|
82
|
+
- **Screenshots.** Set `autoScreenshots: true` to save a screenshot before and after each command. They're off by default. See [Debug a failing test](/debugging-with-screenshots).
|
|
258
83
|
|
|
259
84
|
```javascript
|
|
260
85
|
const testdriver = TestDriver(context, {
|
|
261
|
-
|
|
262
|
-
|
|
263
|
-
DEBUG: "true",
|
|
264
|
-
},
|
|
86
|
+
dashcam: false,
|
|
87
|
+
autoScreenshots: true,
|
|
265
88
|
});
|
|
266
89
|
```
|
|
267
90
|
|
|
268
|
-
##
|
|
91
|
+
## Keep a sandbox alive
|
|
269
92
|
|
|
270
|
-
|
|
93
|
+
After a test ends, its sandbox keeps running for `keepAlive` milliseconds, so you can reconnect to it:
|
|
271
94
|
|
|
272
|
-
|
|
273
|
-
|
|
274
|
-
|
|
275
|
-
|
|
276
|
-
```
|
|
277
|
-
|
|
278
|
-
Set to `0` to terminate immediately:
|
|
95
|
+
- The default is `60000` (60 seconds).
|
|
96
|
+
- Values above 30 minutes are capped at 30 minutes.
|
|
97
|
+
- `0` uses the default. There's no value that ends the sandbox immediately.
|
|
98
|
+
- A sandbox never runs longer than 2 hours in total.
|
|
279
99
|
|
|
280
100
|
```javascript
|
|
281
101
|
const testdriver = TestDriver(context, {
|
|
282
|
-
keepAlive:
|
|
102
|
+
keepAlive: 10 * 60 * 1000, // 10 minutes
|
|
283
103
|
});
|
|
284
104
|
```
|
|
285
105
|
|
|
286
|
-
|
|
287
|
-
|
|
288
|
-
Speed up test development by connecting to an existing sandbox instead of starting fresh each time. This lets you iterate quickly on failing steps without re-running the entire test from the beginning.
|
|
106
|
+
To reconnect from another test file, set `reconnect: true`. TestDriver reattaches to the last sandbox it used and skips `provision` calls, because the app is already open. See [Reuse a sandbox while you iterate](/copilot/running-tests#reuse-a-sandbox-while-you-iterate).
|
|
289
107
|
|
|
290
|
-
|
|
108
|
+
To attach to a specific sandbox, pass its id as `sandboxId`. Unlike `reconnect`, `sandboxId` alone still runs `provision` calls.
|
|
291
109
|
|
|
292
|
-
|
|
293
|
-
const testdriver = TestDriver(context, {
|
|
294
|
-
keepAlive: 60000, // Keep sandbox alive for 60 seconds after test
|
|
295
|
-
});
|
|
296
|
-
```
|
|
110
|
+
### Keep the sandbox when a test fails
|
|
297
111
|
|
|
298
|
-
|
|
299
|
-
// Second test file: experiment.test.mjs (run within keepAlive window)
|
|
300
|
-
const testdriver = TestDriver(context, {
|
|
301
|
-
keepAlive: 60000,
|
|
302
|
-
});
|
|
112
|
+
Set `debugOnFailure: true` to keep the sandbox running when a test fails. TestDriver prints the sandbox id so you can connect to it and look around.
|
|
303
113
|
|
|
304
|
-
|
|
114
|
+
```javascript
|
|
115
|
+
const testdriver = TestDriver(context, { debugOnFailure: true });
|
|
305
116
|
```
|
|
306
117
|
|
|
307
|
-
|
|
118
|
+
## Run on your own machine
|
|
308
119
|
|
|
309
|
-
|
|
310
|
-
vitest run -t known-good.test.mjs -t work-in-progress.test.mjs
|
|
311
|
-
```
|
|
120
|
+
To run tests on a machine you manage, set `ip` to its address. See [Run on your own machine](/bring-your-own-machine).
|
|
312
121
|
|
|
313
|
-
|
|
122
|
+
<EnterpriseCta feature="Connecting to your own machines" />
|
|
314
123
|
|
|
315
|
-
```
|
|
316
|
-
|
|
124
|
+
```javascript
|
|
125
|
+
const testdriver = TestDriver(context, { ip: '203.0.113.42' });
|
|
317
126
|
```
|
|
318
127
|
|
|
319
|
-
|
|
320
|
-
|
|
321
|
-
|
|
128
|
+
## Next steps
|
|
129
|
+
|
|
130
|
+
<CardGroup cols={2}>
|
|
131
|
+
<Card title="Options" icon="sliders" href="/options">
|
|
132
|
+
Every client option, with its default.
|
|
133
|
+
</Card>
|
|
134
|
+
<Card title="Client & connection" icon="plug" href="/client">
|
|
135
|
+
Create, connect, and disconnect a client.
|
|
136
|
+
</Card>
|
|
137
|
+
<Card title="Run tests" icon="play" href="/copilot/running-tests">
|
|
138
|
+
Run tests locally and reuse a sandbox.
|
|
139
|
+
</Card>
|
|
140
|
+
<Card title="Run in CI/CD" icon="code-branch" href="/ci-cd">
|
|
141
|
+
Run tests on every pull request.
|
|
142
|
+
</Card>
|
|
143
|
+
</CardGroup>
|