@testdriverai/mcp 7.11.136-test → 7.11.138-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.
- package/ai/skills/testdriver-assert/SKILL.md +5 -5
- package/ai/skills/testdriver-caching/SKILL.md +2 -2
- package/ai/skills/testdriver-changelog/SKILL.md +186 -0
- package/ai/skills/testdriver-claude-mcp-plugin/SKILL.md +208 -0
- package/ai/skills/testdriver-click/SKILL.md +13 -13
- package/ai/skills/testdriver-client/SKILL.md +1 -1
- package/ai/skills/testdriver-debugging-with-screenshots/SKILL.md +5 -5
- package/ai/skills/testdriver-double-click/SKILL.md +7 -7
- package/ai/skills/testdriver-enterprise/SKILL.md +1 -1
- package/ai/skills/testdriver-events/SKILL.md +1 -1
- package/ai/skills/testdriver-exec/SKILL.md +10 -10
- package/ai/skills/testdriver-extract/SKILL.md +6 -6
- package/ai/skills/testdriver-find/SKILL.md +61 -61
- package/ai/skills/testdriver-focus-application/SKILL.md +6 -6
- package/ai/skills/testdriver-generating-tests/SKILL.md +3 -3
- package/ai/skills/testdriver-hosted/SKILL.md +3 -3
- package/ai/skills/testdriver-hover/SKILL.md +6 -6
- package/ai/skills/testdriver-making-assertions/SKILL.md +2 -2
- package/ai/skills/testdriver-mouse-down/SKILL.md +9 -9
- package/ai/skills/testdriver-mouse-up/SKILL.md +9 -9
- package/ai/skills/testdriver-parse/SKILL.md +4 -4
- package/ai/skills/testdriver-performing-actions/SKILL.md +4 -4
- package/ai/skills/testdriver-press-keys/SKILL.md +5 -5
- package/ai/skills/testdriver-quickstart/SKILL.md +51 -54
- package/ai/skills/testdriver-redraw/SKILL.md +1 -1
- package/ai/skills/testdriver-right-click/SKILL.md +7 -7
- package/ai/skills/testdriver-screenshot/SKILL.md +9 -9
- package/ai/skills/testdriver-scroll/SKILL.md +13 -13
- package/ai/skills/testdriver-self-hosted/SKILL.md +1 -1
- package/ai/skills/testdriver-type/SKILL.md +7 -7
- package/ai/skills/testdriver-wait/SKILL.md +5 -5
- package/ai/skills/testdriver-what-is-testdriver/SKILL.md +11 -11
- package/docs/{v7/_drafts → _drafts}/agents.mdx +1 -1
- package/docs/{v7/_drafts → _drafts}/best-practices.mdx +4 -4
- package/docs/{v7/_drafts → _drafts}/caching-selectors.mdx +3 -3
- package/docs/{v7/_drafts → _drafts}/configuration.mdx +4 -4
- package/docs/{v7/_drafts → _drafts}/debugging.mdx +4 -4
- package/docs/{v7/_drafts → _drafts}/error-handling.mdx +4 -4
- package/docs/{v7/_drafts → _drafts}/faq.mdx +7 -7
- package/docs/{v7/_drafts → _drafts}/installation.mdx +2 -2
- package/docs/{v7/_drafts → _drafts}/migration.mdx +4 -4
- package/docs/{v7/_drafts → _drafts}/observable.mdx +3 -3
- package/docs/{v7/_drafts → _drafts}/powerful.mdx +4 -4
- package/docs/{v7/_drafts → _drafts}/readme.mdx +11 -11
- package/docs/{v7/_drafts → _drafts}/reports.mdx +4 -4
- package/docs/{v7/_drafts → _drafts}/scalable.mdx +10 -10
- package/docs/{v7/_drafts → _drafts}/troubleshooting.mdx +4 -4
- package/docs/{v7/_drafts → _drafts}/vitest-plugin.mdx +2 -2
- package/docs/{v7/_drafts → _drafts}/vitest.mdx +9 -9
- package/docs/_scripts/generate-examples.js +9 -10
- package/docs/_scripts/generate-skills.js +4 -4
- package/docs/{v7/agent.mdx → agent.mdx} +17 -17
- package/docs/{v7/assert.mdx → assert.mdx} +5 -5
- package/docs/{v7/aws-setup.mdx → aws-setup.mdx} +6 -6
- package/docs/{v7/cache.mdx → cache.mdx} +9 -9
- package/docs/{v7/caching.mdx → caching.mdx} +13 -12
- package/docs/{v7/captcha.mdx → captcha.mdx} +7 -7
- package/docs/changelog.mdx +13 -13
- package/docs/{v7/ci-cd.mdx → ci-cd.mdx} +10 -10
- package/docs/{v7/click.mdx → click.mdx} +13 -13
- package/docs/client.mdx +323 -0
- package/docs/{v7/copilot → copilot}/auto-healing.mdx +2 -2
- package/docs/{v7/copilot → copilot}/running-tests.mdx +8 -8
- package/docs/{v7/customizing-devices.mdx → customizing-devices.mdx} +1 -1
- package/docs/{v7/dashcam.mdx → dashcam.mdx} +3 -3
- package/docs/{v7/debugging-with-screenshots.mdx → debugging-with-screenshots.mdx} +12 -12
- package/docs/docs.json +429 -288
- package/docs/{v7/double-click.mdx → double-click.mdx} +7 -7
- package/docs/{v7/elements.mdx → elements.mdx} +7 -7
- package/docs/{v7/enterprise.mdx → enterprise.mdx} +2 -2
- package/docs/{v7/errors.mdx → errors.mdx} +3 -3
- package/docs/{v7/events.mdx → events.mdx} +4 -4
- package/docs/{v7/exec.mdx → exec.mdx} +10 -10
- package/docs/{v7/extract.mdx → extract.mdx} +10 -10
- package/docs/{v7/find.mdx → find.mdx} +61 -61
- package/docs/{v7/focus-application.mdx → focus-application.mdx} +6 -6
- package/docs/{v7/generating-tests.mdx → generating-tests.mdx} +10 -10
- package/docs/guide/best-practices-polling.mdx +6 -1
- package/docs/{v7/hosted.mdx → hosted.mdx} +7 -7
- package/docs/{v7/hover.mdx → hover.mdx} +6 -6
- package/docs/interacting-with-your-app.mdx +198 -0
- package/docs/locating-elements.mdx +423 -0
- package/docs/{v7/making-assertions.mdx → making-assertions.mdx} +7 -7
- package/docs/{v7/mouse-down.mdx → mouse-down.mdx} +9 -9
- package/docs/{v7/mouse-up.mdx → mouse-up.mdx} +9 -9
- package/docs/options.mdx +320 -0
- package/docs/{v7/parse.mdx → parse.mdx} +12 -12
- package/docs/{v7/performing-actions.mdx → performing-actions.mdx} +11 -11
- package/docs/{v7/press-keys.mdx → press-keys.mdx} +5 -5
- package/docs/{v7/provision.mdx → provision.mdx} +9 -9
- package/docs/quickstart-cli.mdx +437 -0
- package/docs/quickstart-github.mdx +54 -0
- package/docs/quickstart-manual.mdx +135 -0
- package/docs/quickstart.mdx +22 -0
- package/docs/{v7/redraw.mdx → redraw.mdx} +7 -7
- package/docs/{v7/reusable-code.mdx → reusable-code.mdx} +3 -3
- package/docs/{v7/right-click.mdx → right-click.mdx} +7 -7
- package/docs/{v7/screenshot.mdx → screenshot.mdx} +9 -9
- package/docs/{v7/screenshots.mdx → screenshots.mdx} +3 -3
- package/docs/{v7/scroll.mdx → scroll.mdx} +13 -13
- package/docs/{v7/secrets.mdx → secrets.mdx} +4 -4
- package/docs/{v7/self-hosted.mdx → self-hosted.mdx} +7 -7
- package/docs/{v7/test-results-json.mdx → test-results-json.mdx} +4 -4
- package/docs/{v7/type.mdx → type.mdx} +7 -7
- package/docs/{v7/variables.mdx → variables.mdx} +2 -2
- package/docs/{v7/wait.mdx → wait.mdx} +5 -5
- package/docs/what-is-testdriver.mdx +54 -0
- package/lib/environments.json +1 -1
- package/lib/github-comment.mjs +2 -3
- package/package.json +1 -1
- package/scripts/generate-skills.js +1 -1
- package/docs/v7/client.mdx +0 -486
- package/docs/v7/quickstart.mdx +0 -451
- package/docs/v7/what-is-testdriver.mdx +0 -54
- /package/docs/{v7/_drafts → _drafts}/architecture.mdx +0 -0
- /package/docs/{v7/_drafts → _drafts}/auto-cache-key.mdx +0 -0
- /package/docs/{v7/_drafts → _drafts}/awesome-logs-quick-ref.mdx +0 -0
- /package/docs/{v7/_drafts → _drafts}/cli-to-sdk-migration.mdx +0 -0
- /package/docs/{v7/_drafts → _drafts}/commands/assert.mdx +0 -0
- /package/docs/{v7/_drafts → _drafts}/commands/exec.mdx +0 -0
- /package/docs/{v7/_drafts → _drafts}/commands/focus-application.mdx +0 -0
- /package/docs/{v7/_drafts → _drafts}/commands/hover-image.mdx +0 -0
- /package/docs/{v7/_drafts → _drafts}/commands/hover-text.mdx +0 -0
- /package/docs/{v7/_drafts → _drafts}/commands/if.mdx +0 -0
- /package/docs/{v7/_drafts → _drafts}/commands/match-image.mdx +0 -0
- /package/docs/{v7/_drafts → _drafts}/commands/press-keys.mdx +0 -0
- /package/docs/{v7/_drafts → _drafts}/commands/remember.mdx +0 -0
- /package/docs/{v7/_drafts → _drafts}/commands/run.mdx +0 -0
- /package/docs/{v7/_drafts → _drafts}/commands/scroll-until-image.mdx +0 -0
- /package/docs/{v7/_drafts → _drafts}/commands/scroll-until-text.mdx +0 -0
- /package/docs/{v7/_drafts → _drafts}/commands/scroll.mdx +0 -0
- /package/docs/{v7/_drafts → _drafts}/commands/type.mdx +0 -0
- /package/docs/{v7/_drafts → _drafts}/commands/wait-for-image.mdx +0 -0
- /package/docs/{v7/_drafts → _drafts}/commands/wait-for-text.mdx +0 -0
- /package/docs/{v7/_drafts → _drafts}/commands/wait.mdx +0 -0
- /package/docs/{v7/_drafts → _drafts}/contributing.mdx +0 -0
- /package/docs/{v7/_drafts → _drafts}/dashcam-title-feature.mdx +0 -0
- /package/docs/{v7/_drafts → _drafts}/hooks.mdx +0 -0
- /package/docs/{v7/_drafts → _drafts}/init-command.mdx +0 -0
- /package/docs/{v7/_drafts → _drafts}/playwright.mdx +0 -0
- /package/docs/{v7/_drafts → _drafts}/plugin-migration.mdx +0 -0
- /package/docs/{v7/_drafts → _drafts}/presets.mdx +0 -0
- /package/docs/{v7/_drafts → _drafts}/progressive-disclosure.mdx +0 -0
- /package/docs/{v7/_drafts → _drafts}/provision.mdx +0 -0
- /package/docs/{v7/_drafts → _drafts}/quick-start-test-recording.mdx +0 -0
- /package/docs/{v7/_drafts → _drafts}/screenshot.mdx +0 -0
- /package/docs/{v7/_drafts → _drafts}/sdk-awesome-logs.mdx +0 -0
- /package/docs/{v7/_drafts → _drafts}/sdk-browser-rendering.mdx +0 -0
- /package/docs/{v7/_drafts → _drafts}/sdk-migration.mdx +0 -0
- /package/docs/{v7/_drafts → _drafts}/sdk-v7-complete.mdx +0 -0
- /package/docs/{v7/_drafts → _drafts}/self-hosting.mdx +0 -0
- /package/docs/{v7/_drafts → _drafts}/test-recording.mdx +0 -0
- /package/docs/{v7/_drafts → _drafts}/writing-tests.mdx +0 -0
- /package/docs/{v7/examples → examples}/ai.mdx +0 -0
- /package/docs/{v7/examples → examples}/assert.mdx +0 -0
- /package/docs/{v7/examples → examples}/captcha-api.mdx +0 -0
- /package/docs/{v7/examples → examples}/chrome-extension.mdx +0 -0
- /package/docs/{v7/examples → examples}/drag-and-drop.mdx +0 -0
- /package/docs/{v7/examples → examples}/element-not-found.mdx +0 -0
- /package/docs/{v7/examples → examples}/findall-coffee-icons.mdx +0 -0
- /package/docs/{v7/examples → examples}/formatted-logging.mdx +0 -0
- /package/docs/{v7/examples → examples}/hover-image.mdx +0 -0
- /package/docs/{v7/examples → examples}/hover-text-with-description.mdx +0 -0
- /package/docs/{v7/examples → examples}/hover-text.mdx +0 -0
- /package/docs/{v7/examples → examples}/installer.mdx +0 -0
- /package/docs/{v7/examples → examples}/launch-vscode-linux.mdx +0 -0
- /package/docs/{v7/examples → examples}/match-image.mdx +0 -0
- /package/docs/{v7/examples → examples}/parse.mdx +0 -0
- /package/docs/{v7/examples → examples}/press-keys.mdx +0 -0
- /package/docs/{v7/examples → examples}/scroll-keyboard.mdx +0 -0
- /package/docs/{v7/examples → examples}/scroll-until-text.mdx +0 -0
- /package/docs/{v7/examples → examples}/scroll.mdx +0 -0
- /package/docs/{v7/examples → examples}/type.mdx +0 -0
- /package/docs/{v7/mcp.mdx → mcp.mdx} +0 -0
package/docs/options.mdx
ADDED
|
@@ -0,0 +1,320 @@
|
|
|
1
|
+
---
|
|
2
|
+
title: "Options Reference"
|
|
3
|
+
sidebarTitle: "Options Reference"
|
|
4
|
+
description: "Every option you can pass to the TestDriver client, with defaults and examples"
|
|
5
|
+
icon: "sliders"
|
|
6
|
+
---
|
|
7
|
+
|
|
8
|
+
## Overview
|
|
9
|
+
|
|
10
|
+
You configure the SDK with an options object. You can pass the object in three places:
|
|
11
|
+
|
|
12
|
+
```javascript
|
|
13
|
+
// 1. Vitest hook (most common)
|
|
14
|
+
const testdriver = TestDriver(context, { os: "windows" });
|
|
15
|
+
|
|
16
|
+
// 2. Constructor
|
|
17
|
+
const testdriver = new TestDriver(apiKey, { os: "windows" });
|
|
18
|
+
|
|
19
|
+
// 3. Global plugin options in vitest.config.mjs
|
|
20
|
+
testdriver({ os: "windows" })
|
|
21
|
+
```
|
|
22
|
+
|
|
23
|
+
The hook merges the options in this order. A later source replaces an earlier source:
|
|
24
|
+
|
|
25
|
+
1. Default values
|
|
26
|
+
2. Environment variables (`TD_OS`, `TD_API_ROOT`, `TD_E2B_TEMPLATE_ID`)
|
|
27
|
+
3. Global plugin options
|
|
28
|
+
4. Options that you pass to the hook or the constructor
|
|
29
|
+
|
|
30
|
+
Options that you pass to [`connect()`](/client#connect) replace the constructor values for that connection only.
|
|
31
|
+
|
|
32
|
+
## Sandbox
|
|
33
|
+
|
|
34
|
+
These options control the virtual machine that runs your test.
|
|
35
|
+
|
|
36
|
+
<ParamField path="os" type="'linux' | 'windows'" default="linux">
|
|
37
|
+
The operating system of the sandbox. You can also set this with the `TD_OS` environment variable.
|
|
38
|
+
</ParamField>
|
|
39
|
+
|
|
40
|
+
<ParamField path="resolution" type="string" default="1366x768">
|
|
41
|
+
The screen resolution of the sandbox. Example: `'1920x1080'`. Custom resolutions are available only on Enterprise plans.
|
|
42
|
+
</ParamField>
|
|
43
|
+
|
|
44
|
+
<ParamField path="newSandbox" type="boolean" default="true">
|
|
45
|
+
Create a new sandbox for this run. Set to `false` to reuse a recent sandbox when one is available.
|
|
46
|
+
</ParamField>
|
|
47
|
+
|
|
48
|
+
<ParamField path="reconnect" type="boolean" default="false">
|
|
49
|
+
Reattach to the last used sandbox. The SDK reads the sandbox id from `.testdriver/last-sandbox`. The SDK writes this file on every successful connect.
|
|
50
|
+
|
|
51
|
+
When `reconnect` is `true`, the SDK skips provision methods (`chrome`, `vscode`, `installer`, and others). The application is already running. The previous sandbox must still be alive. See [`keepAlive`](#keepalive) and the [Run guide](/copilot/running-tests#keeping-machines-alive-between-runs).
|
|
52
|
+
</ParamField>
|
|
53
|
+
|
|
54
|
+
<ParamField path="sandboxId" type="string">
|
|
55
|
+
Reattach to a specific sandbox id. Use this for CI matrices or to pin a chain of tests to a known VM. This option implies `reconnect: true`. The SDK skips provision calls.
|
|
56
|
+
</ParamField>
|
|
57
|
+
|
|
58
|
+
<ParamField path="keepAlive" type="number" default="60000">
|
|
59
|
+
The number of milliseconds to keep the sandbox alive after `disconnect()`. Set to `0` to end the sandbox at once. A longer value lets you reconnect to the same sandbox for debugging.
|
|
60
|
+
</ParamField>
|
|
61
|
+
|
|
62
|
+
<ParamField path="debugOnFailure" type="boolean" default="false">
|
|
63
|
+
Keep the sandbox alive when a test fails. The SDK prints the sandbox id to the console. You can then reconnect with `sandboxId` and debug the failure. This option is available only in the Vitest hook.
|
|
64
|
+
</ParamField>
|
|
65
|
+
|
|
66
|
+
<ParamField path="environment" type="object">
|
|
67
|
+
Additional environment variables to pass to the sandbox.
|
|
68
|
+
</ParamField>
|
|
69
|
+
|
|
70
|
+
### Example
|
|
71
|
+
|
|
72
|
+
```javascript
|
|
73
|
+
const testdriver = TestDriver(context, {
|
|
74
|
+
os: "windows",
|
|
75
|
+
resolution: "1920x1080",
|
|
76
|
+
keepAlive: 300000,
|
|
77
|
+
debugOnFailure: true,
|
|
78
|
+
});
|
|
79
|
+
```
|
|
80
|
+
|
|
81
|
+
## Preview and recording
|
|
82
|
+
|
|
83
|
+
These options control what you see while the test runs.
|
|
84
|
+
|
|
85
|
+
<ParamField path="preview" type="'browser' | 'ide' | 'none'" default="browser">
|
|
86
|
+
The preview mode for live test visualization.
|
|
87
|
+
|
|
88
|
+
- `"browser"` opens the debugger in your default browser.
|
|
89
|
+
- `"ide"` opens the preview in the IDE panel. This mode needs the TestDriver extension for VS Code or Cursor.
|
|
90
|
+
- `"none"` runs without a visual preview. Use this in CI.
|
|
91
|
+
</ParamField>
|
|
92
|
+
|
|
93
|
+
<ParamField path="headless" type="boolean" default="false">
|
|
94
|
+
**Deprecated.** Use `preview: "none"` instead. `headless: true` maps to `preview: "none"`.
|
|
95
|
+
</ParamField>
|
|
96
|
+
|
|
97
|
+
<ParamField path="dashcam" type="boolean" default="true">
|
|
98
|
+
Record a Dashcam video of the test. See [Dashcam](/dashcam).
|
|
99
|
+
</ParamField>
|
|
100
|
+
|
|
101
|
+
<ParamField path="autoScreenshots" type="boolean" default="false">
|
|
102
|
+
Capture a screenshot before and after each command. The SDK saves the screenshots to `.testdriver/screenshots/<test>/`.
|
|
103
|
+
|
|
104
|
+
The file name format is `<seq>-<action>-<phase>-L<line>-<description>.png`. Example: `001-click-before-L42-submit-button.png`. See [Debugging with screenshots](/debugging-with-screenshots).
|
|
105
|
+
</ParamField>
|
|
106
|
+
|
|
107
|
+
<ParamField path="logging" type="boolean" default="true">
|
|
108
|
+
Write SDK logs to the console. You can change this at runtime with [`setLogging()`](/client#setlogging).
|
|
109
|
+
</ParamField>
|
|
110
|
+
|
|
111
|
+
<ParamField path="analytics" type="boolean" default="true">
|
|
112
|
+
Send usage analytics to TestDriver.
|
|
113
|
+
</ParamField>
|
|
114
|
+
|
|
115
|
+
### Example
|
|
116
|
+
|
|
117
|
+
```javascript
|
|
118
|
+
const testdriver = TestDriver(context, {
|
|
119
|
+
preview: process.env.CI ? "none" : "browser",
|
|
120
|
+
autoScreenshots: true,
|
|
121
|
+
});
|
|
122
|
+
```
|
|
123
|
+
|
|
124
|
+
## AI and element location
|
|
125
|
+
|
|
126
|
+
These options control how the AI locates elements and checks assertions.
|
|
127
|
+
|
|
128
|
+
<ParamField path="verify" type="boolean" default="false">
|
|
129
|
+
Run a second AI check on every `find()` result. The check confirms that the coordinates match the requested element. This catches incorrect positions. It adds latency to each call.
|
|
130
|
+
|
|
131
|
+
You can replace this value for one call with `find(description, { verify: true })`. See [find](/find).
|
|
132
|
+
</ParamField>
|
|
133
|
+
|
|
134
|
+
<ParamField path="ai" type="object">
|
|
135
|
+
Global AI sampling configuration. These values apply to `find()` verification and to `assert()`. You can replace them for one call with the `ai` option on that call.
|
|
136
|
+
|
|
137
|
+
<Expandable title="properties">
|
|
138
|
+
<ParamField path="temperature" type="number">
|
|
139
|
+
Controls randomness in AI responses. `0` is deterministic and is best for verification. Higher values give more varied responses. The default is `0` for find verification and the model default for assert.
|
|
140
|
+
</ParamField>
|
|
141
|
+
|
|
142
|
+
<ParamField path="top" type="object">
|
|
143
|
+
Nucleus and top-k sampling parameters.
|
|
144
|
+
|
|
145
|
+
<Expandable title="properties">
|
|
146
|
+
<ParamField path="p" type="number">
|
|
147
|
+
Top-P (nucleus sampling). Limits token choices to the smallest set whose total probability is more than P. Lower values give more focused responses. Range: 0 to 1.
|
|
148
|
+
</ParamField>
|
|
149
|
+
|
|
150
|
+
<ParamField path="k" type="number">
|
|
151
|
+
Top-K sampling. Limits token choices to the K most likely tokens. `1` always picks the most likely token. `0` disables the limit.
|
|
152
|
+
</ParamField>
|
|
153
|
+
</Expandable>
|
|
154
|
+
</ParamField>
|
|
155
|
+
</Expandable>
|
|
156
|
+
</ParamField>
|
|
157
|
+
|
|
158
|
+
### Example
|
|
159
|
+
|
|
160
|
+
```javascript
|
|
161
|
+
const testdriver = TestDriver(context, {
|
|
162
|
+
verify: true,
|
|
163
|
+
ai: { temperature: 0, top: { p: 0.9, k: 40 } },
|
|
164
|
+
});
|
|
165
|
+
```
|
|
166
|
+
|
|
167
|
+
## Caching
|
|
168
|
+
|
|
169
|
+
These options control the element cache. The cache stores the position of an element after the first `find()`. Later runs reuse the position when the screen has not changed. See [Caching](/caching).
|
|
170
|
+
|
|
171
|
+
<ParamField path="cache" type="boolean | object" default="true">
|
|
172
|
+
Enable or disable the cache. Pass an object to set the match thresholds.
|
|
173
|
+
|
|
174
|
+
<Expandable title="advanced config">
|
|
175
|
+
<ParamField path="enabled" type="boolean" default="true">
|
|
176
|
+
Enable or disable the cache.
|
|
177
|
+
</ParamField>
|
|
178
|
+
|
|
179
|
+
<ParamField path="thresholds" type="object">
|
|
180
|
+
Fine-tune the cache matching.
|
|
181
|
+
|
|
182
|
+
<Expandable title="properties">
|
|
183
|
+
<ParamField path="find" type="object">
|
|
184
|
+
Thresholds for `find()` operations.
|
|
185
|
+
|
|
186
|
+
<Expandable title="properties">
|
|
187
|
+
<ParamField path="screen" type="number" default="0.05">
|
|
188
|
+
The pixel diff threshold for the screen comparison (0 to 1). `0.05` allows a 5% difference.
|
|
189
|
+
</ParamField>
|
|
190
|
+
|
|
191
|
+
<ParamField path="element" type="number" default="0.8">
|
|
192
|
+
The OpenCV template match threshold for the element (0 to 1). `0.8` requires an 80% correlation.
|
|
193
|
+
</ParamField>
|
|
194
|
+
</Expandable>
|
|
195
|
+
</ParamField>
|
|
196
|
+
|
|
197
|
+
<ParamField path="assert" type="number" default="0.05">
|
|
198
|
+
The pixel diff threshold for `assert()` operations (0 to 1). `0.05` allows a 5% difference.
|
|
199
|
+
</ParamField>
|
|
200
|
+
</Expandable>
|
|
201
|
+
</ParamField>
|
|
202
|
+
</Expandable>
|
|
203
|
+
</ParamField>
|
|
204
|
+
|
|
205
|
+
<ParamField path="cacheKey" type="string">
|
|
206
|
+
The cache key for element location. When you set a key, the SDK ties the cache to that key. Use a different key for each test to keep the caches separate.
|
|
207
|
+
</ParamField>
|
|
208
|
+
|
|
209
|
+
<ParamField path="cacheThreshold" type="object">
|
|
210
|
+
**Deprecated.** Use `cache.thresholds` instead.
|
|
211
|
+
</ParamField>
|
|
212
|
+
|
|
213
|
+
### Example
|
|
214
|
+
|
|
215
|
+
```javascript
|
|
216
|
+
const testdriver = TestDriver(context, {
|
|
217
|
+
cache: {
|
|
218
|
+
enabled: true,
|
|
219
|
+
thresholds: {
|
|
220
|
+
find: { screen: 0.05, element: 0.8 },
|
|
221
|
+
assert: 0.05,
|
|
222
|
+
},
|
|
223
|
+
},
|
|
224
|
+
cacheKey: "login-test",
|
|
225
|
+
});
|
|
226
|
+
```
|
|
227
|
+
|
|
228
|
+
## Redraw detection
|
|
229
|
+
|
|
230
|
+
These options control how the SDK waits for the screen to settle after an action. See [Redraw](/redraw).
|
|
231
|
+
|
|
232
|
+
<ParamField path="redraw" type="boolean | object" default="true">
|
|
233
|
+
Enable or disable screen-change detection. Pass an object to set the thresholds.
|
|
234
|
+
|
|
235
|
+
<Expandable title="advanced config">
|
|
236
|
+
<ParamField path="enabled" type="boolean" default="true">
|
|
237
|
+
Enable or disable redraw detection.
|
|
238
|
+
</ParamField>
|
|
239
|
+
|
|
240
|
+
<ParamField path="thresholds" type="object">
|
|
241
|
+
Threshold configuration.
|
|
242
|
+
|
|
243
|
+
<Expandable title="properties">
|
|
244
|
+
<ParamField path="screen" type="number | false" default="0.05">
|
|
245
|
+
The pixel diff threshold (0 to 1). Set to `false` to disable screen redraw detection.
|
|
246
|
+
</ParamField>
|
|
247
|
+
|
|
248
|
+
<ParamField path="network" type="boolean" default="false">
|
|
249
|
+
Wait for network activity to stop.
|
|
250
|
+
</ParamField>
|
|
251
|
+
</Expandable>
|
|
252
|
+
</ParamField>
|
|
253
|
+
</Expandable>
|
|
254
|
+
</ParamField>
|
|
255
|
+
|
|
256
|
+
<ParamField path="redrawThreshold" type="number | object">
|
|
257
|
+
**Deprecated.** Use `redraw` instead.
|
|
258
|
+
</ParamField>
|
|
259
|
+
|
|
260
|
+
### Example
|
|
261
|
+
|
|
262
|
+
```javascript
|
|
263
|
+
const testdriver = TestDriver(context, {
|
|
264
|
+
redraw: {
|
|
265
|
+
thresholds: { screen: 0.1, network: true },
|
|
266
|
+
},
|
|
267
|
+
});
|
|
268
|
+
```
|
|
269
|
+
|
|
270
|
+
## Self-hosted and infrastructure
|
|
271
|
+
|
|
272
|
+
Most users do not need these options. Use them for self-hosted or custom deployments.
|
|
273
|
+
|
|
274
|
+
<ParamField path="apiRoot" type="string">
|
|
275
|
+
The API endpoint URL. The default depends on the release channel. You can also set this with the `TD_API_ROOT` environment variable.
|
|
276
|
+
</ParamField>
|
|
277
|
+
|
|
278
|
+
<ParamField path="ip" type="string">
|
|
279
|
+
The IP address of a running sandbox. The SDK connects to this address directly.
|
|
280
|
+
</ParamField>
|
|
281
|
+
|
|
282
|
+
<ParamField path="sandboxAmi" type="string">
|
|
283
|
+
A custom AMI id for the sandbox instance (AWS deployments). Example: `'ami-1234'`.
|
|
284
|
+
</ParamField>
|
|
285
|
+
|
|
286
|
+
<ParamField path="sandboxInstance" type="string">
|
|
287
|
+
The EC2 instance type for the sandbox (AWS deployments). Example: `'i3.metal'`.
|
|
288
|
+
</ParamField>
|
|
289
|
+
|
|
290
|
+
<ParamField path="e2bTemplateId" type="string">
|
|
291
|
+
The E2B template id to use when the SDK creates the sandbox. You can also set this with the `TD_E2B_TEMPLATE_ID` environment variable.
|
|
292
|
+
</ParamField>
|
|
293
|
+
|
|
294
|
+
## Quick reference
|
|
295
|
+
|
|
296
|
+
| Option | Type | Default |
|
|
297
|
+
|---|---|---|
|
|
298
|
+
| `os` | `'linux' \| 'windows'` | `'linux'` |
|
|
299
|
+
| `resolution` | `string` | `'1366x768'` |
|
|
300
|
+
| `newSandbox` | `boolean` | `true` |
|
|
301
|
+
| `reconnect` | `boolean` | `false` |
|
|
302
|
+
| `sandboxId` | `string` | — |
|
|
303
|
+
| `keepAlive` | `number` | `60000` |
|
|
304
|
+
| `debugOnFailure` | `boolean` | `false` |
|
|
305
|
+
| `environment` | `object` | — |
|
|
306
|
+
| `preview` | `'browser' \| 'ide' \| 'none'` | `'browser'` |
|
|
307
|
+
| `dashcam` | `boolean` | `true` |
|
|
308
|
+
| `autoScreenshots` | `boolean` | `false` |
|
|
309
|
+
| `logging` | `boolean` | `true` |
|
|
310
|
+
| `analytics` | `boolean` | `true` |
|
|
311
|
+
| `verify` | `boolean` | `false` |
|
|
312
|
+
| `ai` | `object` | — |
|
|
313
|
+
| `cache` | `boolean \| object` | `true` |
|
|
314
|
+
| `cacheKey` | `string` | — |
|
|
315
|
+
| `redraw` | `boolean \| object` | `true` |
|
|
316
|
+
| `apiRoot` | `string` | channel default |
|
|
317
|
+
| `ip` | `string` | — |
|
|
318
|
+
| `sandboxAmi` | `string` | — |
|
|
319
|
+
| `sandboxInstance` | `string` | — |
|
|
320
|
+
| `e2bTemplateId` | `string` | — |
|
|
@@ -7,17 +7,17 @@ icon: "diagram-project"
|
|
|
7
7
|
|
|
8
8
|
## Overview
|
|
9
9
|
|
|
10
|
-
Parse the
|
|
10
|
+
Parse the screen with OmniParser v2 to find all visible UI elements. TestDriver returns structured data. This includes element types, text content, interactivity levels, and bounding box coordinates.
|
|
11
11
|
|
|
12
|
-
This method
|
|
13
|
-
-
|
|
14
|
-
-
|
|
15
|
-
-
|
|
16
|
-
-
|
|
17
|
-
-
|
|
12
|
+
This method examines all of the screen and returns each element that it finds. Use it for these:
|
|
13
|
+
- To understand the full UI layout of a screen
|
|
14
|
+
- To find all clickable or interactive elements
|
|
15
|
+
- To build custom element logic
|
|
16
|
+
- To debug which elements TestDriver can find
|
|
17
|
+
- To do an accessibility audit
|
|
18
18
|
|
|
19
19
|
<Note>
|
|
20
|
-
**Availability**: `parse()`
|
|
20
|
+
**Availability**: `parse()` needs an enterprise plan or a self-hosted plan. It uses OmniParser v2 on the server for element detection.
|
|
21
21
|
</Note>
|
|
22
22
|
|
|
23
23
|
## Syntax
|
|
@@ -231,7 +231,7 @@ console.log(`Image dimensions: ${result.imageWidth}x${result.imageHeight}`);
|
|
|
231
231
|
|
|
232
232
|
## Related
|
|
233
233
|
|
|
234
|
-
- [find()](/
|
|
235
|
-
- [assert()](/
|
|
236
|
-
- [screenshot()](/
|
|
237
|
-
- [Elements Reference](/
|
|
234
|
+
- [find()](/find) - AI-powered element location
|
|
235
|
+
- [assert()](/assert) - Make AI-powered assertions about screen state
|
|
236
|
+
- [screenshot()](/screenshot) - Capture screenshots
|
|
237
|
+
- [Elements Reference](/elements) - Complete Element API
|
|
@@ -1,17 +1,17 @@
|
|
|
1
1
|
---
|
|
2
|
-
title: "
|
|
3
|
-
sidebarTitle: "
|
|
2
|
+
title: "Self-Healing"
|
|
3
|
+
sidebarTitle: "Self-Healing"
|
|
4
4
|
description: "Perform actions and handle dynamic, async UI so tests adapt to change"
|
|
5
5
|
icon: "arrows-rotate"
|
|
6
6
|
---
|
|
7
7
|
|
|
8
|
-
Real apps move, load, and change. Adapt your tests to
|
|
8
|
+
Real apps move, load, and change. Adapt your tests to these conditions.
|
|
9
9
|
|
|
10
|
-
|
|
10
|
+
You [generated](/generating-tests) and [learned](/caching) your tests. Then you got them to [run](/copilot/running-tests). Now the challenge is the real world: buttons show after a spinner, pages navigate, animations play, and content comes in over the network. To keep the tests reliable, do the correct actions and control the timing. Then your tests adapt to the true behavior of the UI. They do not break.
|
|
11
11
|
|
|
12
12
|
## Performing Actions
|
|
13
13
|
|
|
14
|
-
TestDriver
|
|
14
|
+
TestDriver gives you many actions. You can [click](/click), [type](/type), [hover](/hover), and [scroll](/scroll). For a full list, read the [API Reference](/click).
|
|
15
15
|
|
|
16
16
|
```javascript
|
|
17
17
|
// Clicking
|
|
@@ -43,14 +43,14 @@ const orderNumber = await testdriver.extract('the order confirmation number');
|
|
|
43
43
|
|
|
44
44
|
### Chaining Actions
|
|
45
45
|
|
|
46
|
-
TestDriver
|
|
46
|
+
TestDriver lets you chain methods for cleaner code:
|
|
47
47
|
|
|
48
48
|
```javascript
|
|
49
49
|
// Chain find() with actions
|
|
50
50
|
const button = await testdriver.find('submit button').click();
|
|
51
51
|
```
|
|
52
52
|
|
|
53
|
-
Or
|
|
53
|
+
Or keep the element reference for later use:
|
|
54
54
|
|
|
55
55
|
```javascript
|
|
56
56
|
const button = await testdriver.find('submit button');
|
|
@@ -59,9 +59,9 @@ await button.click();
|
|
|
59
59
|
|
|
60
60
|
## Waiting for Dynamic Content
|
|
61
61
|
|
|
62
|
-
By default, `find()` automatically
|
|
62
|
+
By default, `find()` polls automatically for a maximum of 10 seconds. It tries again each 5 seconds until it finds the element. Thus TestDriver finds most elements that show after short async operations. You do not need more configuration.
|
|
63
63
|
|
|
64
|
-
For longer operations,
|
|
64
|
+
For longer operations, make the `timeout` larger:
|
|
65
65
|
|
|
66
66
|
```javascript
|
|
67
67
|
// Default behavior - polls for up to 10 seconds automatically
|
|
@@ -142,8 +142,8 @@ await testdriver.wait(1000);
|
|
|
142
142
|
For waiting for specific **elements** to appear, prefer `find()` with a `timeout` option. Use `wait()` only for simple time-based pauses.
|
|
143
143
|
</Note>
|
|
144
144
|
|
|
145
|
-
Once your tests can reliably act on a changing UI and [assert](/
|
|
145
|
+
Once your tests can reliably act on a changing UI and [assert](/making-assertions) the results, the next step is figuring out what happened when something does go wrong.
|
|
146
146
|
|
|
147
|
-
<Card title="Next: Debug" icon="bug" href="/
|
|
147
|
+
<Card title="Next: Debug" icon="bug" href="/debugging-with-screenshots">
|
|
148
148
|
Use screenshots and run output to see exactly what your test saw and pinpoint failures.
|
|
149
149
|
</Card>
|
|
@@ -7,7 +7,7 @@ icon: "keyboard"
|
|
|
7
7
|
|
|
8
8
|
## Overview
|
|
9
9
|
|
|
10
|
-
|
|
10
|
+
Push one or more keyboard keys at the same time. Use this for keyboard shortcuts, navigation, and special keys.
|
|
11
11
|
|
|
12
12
|
## Syntax
|
|
13
13
|
|
|
@@ -18,7 +18,7 @@ await testdriver.pressKeys(keys)
|
|
|
18
18
|
## Parameters
|
|
19
19
|
|
|
20
20
|
<ParamField path="keys" type="Array<string>" required>
|
|
21
|
-
|
|
21
|
+
An array of the keys to push at the same time
|
|
22
22
|
</ParamField>
|
|
23
23
|
|
|
24
24
|
## Returns
|
|
@@ -344,6 +344,6 @@ describe('Keyboard Navigation', () => {
|
|
|
344
344
|
|
|
345
345
|
## Related Methods
|
|
346
346
|
|
|
347
|
-
- [`type()`](/
|
|
348
|
-
- [`click()`](/
|
|
349
|
-
- [`scroll()`](/
|
|
347
|
+
- [`type()`](/type) - Type text
|
|
348
|
+
- [`click()`](/click) - Click elements
|
|
349
|
+
- [`scroll()`](/scroll) - Scroll pages
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
---
|
|
2
|
-
title: "
|
|
3
|
-
sidebarTitle: "
|
|
2
|
+
title: "Spawning a sandbox"
|
|
3
|
+
sidebarTitle: "Spawning a sandbox"
|
|
4
4
|
description: "Launch browsers, desktop apps, and extensions in your sandbox"
|
|
5
5
|
icon: "rocket"
|
|
6
6
|
mode: "wide"
|
|
@@ -8,9 +8,9 @@ mode: "wide"
|
|
|
8
8
|
|
|
9
9
|
## Overview
|
|
10
10
|
|
|
11
|
-
The Provision API sets up applications in your sandbox before tests run. It
|
|
11
|
+
The Provision API sets up applications in your sandbox before the tests run. It downloads, installs, and starts browsers, desktop apps, VS Code, Chrome extensions, and more.
|
|
12
12
|
|
|
13
|
-
|
|
13
|
+
Use the provision methods through `testdriver.provision.*`:
|
|
14
14
|
|
|
15
15
|
```javascript
|
|
16
16
|
await testdriver.provision.chrome({ url: 'https://example.com' });
|
|
@@ -20,7 +20,7 @@ await testdriver.provision.chrome({ url: 'https://example.com' });
|
|
|
20
20
|
|
|
21
21
|
### chrome()
|
|
22
22
|
|
|
23
|
-
|
|
23
|
+
Start Google Chrome with an optional URL.
|
|
24
24
|
|
|
25
25
|
```javascript
|
|
26
26
|
await testdriver.provision.chrome(options?)
|
|
@@ -29,15 +29,15 @@ await testdriver.provision.chrome(options?)
|
|
|
29
29
|
<ParamField path="options" type="ProvisionChromeOptions">
|
|
30
30
|
<Expandable title="properties">
|
|
31
31
|
<ParamField path="url" type="string" default="http://testdriver-sandbox.vercel.app/">
|
|
32
|
-
URL to
|
|
32
|
+
The URL to go to after Chrome starts.
|
|
33
33
|
</ParamField>
|
|
34
34
|
|
|
35
35
|
<ParamField path="maximized" type="boolean" default={true}>
|
|
36
|
-
|
|
36
|
+
Start Chrome with the window at the maximum size.
|
|
37
37
|
</ParamField>
|
|
38
38
|
|
|
39
39
|
<ParamField path="guest" type="boolean" default={false}>
|
|
40
|
-
|
|
40
|
+
Start Chrome in the guest profile mode.
|
|
41
41
|
</ParamField>
|
|
42
42
|
</Expandable>
|
|
43
43
|
</ParamField>
|
|
@@ -56,7 +56,7 @@ await testdriver.provision.chrome({
|
|
|
56
56
|
|
|
57
57
|
### chromeExtension()
|
|
58
58
|
|
|
59
|
-
Install and
|
|
59
|
+
Install and start a Chrome extension. You can install it from a local unpacked directory. Or you can install it from the Chrome Web Store by the extension ID.
|
|
60
60
|
|
|
61
61
|
```javascript
|
|
62
62
|
await testdriver.provision.chromeExtension(options)
|