@testdriverai/agent 7.11.229-test → 7.11.232-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/docs/_data/examples-manifest.json +16 -16
- package/docs/_scripts/generate-examples.js +38 -45
- package/docs/agent.mdx +174 -93
- package/docs/assert.mdx +73 -269
- package/docs/aws-setup.mdx +196 -314
- package/docs/bring-your-own-machine.mdx +139 -206
- package/docs/cache.mdx +144 -151
- package/docs/caching.mdx +99 -89
- package/docs/captcha.mdx +126 -111
- package/docs/ci-cd.mdx +154 -543
- package/docs/click.mdx +74 -229
- package/docs/client.mdx +177 -231
- package/docs/copilot/auto-healing.mdx +86 -370
- package/docs/copilot/running-tests.mdx +121 -930
- package/docs/customizing-devices.mdx +74 -251
- package/docs/dashcam.mdx +72 -405
- package/docs/debugging-with-screenshots.mdx +105 -371
- package/docs/docs.json +79 -22
- package/docs/double-click.mdx +48 -68
- package/docs/errors.mdx +102 -176
- package/docs/events.mdx +170 -327
- package/docs/examples/{hover-text-with-description.mdx → add-to-cart.mdx} +30 -35
- package/docs/examples/assert.mdx +28 -41
- package/docs/examples/click-button.mdx +71 -0
- package/docs/examples/{hover-image.mdx → click-icon.mdx} +32 -28
- package/docs/examples/element-not-found.mdx +27 -26
- package/docs/examples/findall-coffee-icons.mdx +28 -32
- package/docs/examples/installer.mdx +61 -25
- package/docs/examples/launch-vscode-linux.mdx +28 -51
- package/docs/examples/navigate-and-scroll.mdx +82 -0
- package/docs/examples/parse.mdx +24 -28
- package/docs/examples/press-keys.mdx +28 -25
- package/docs/examples/scroll.mdx +25 -27
- package/docs/examples/type.mdx +26 -21
- package/docs/exec.mdx +92 -256
- package/docs/extract.mdx +69 -170
- package/docs/find.mdx +140 -736
- package/docs/focus-application.mdx +69 -246
- package/docs/generating-tests.mdx +103 -137
- package/docs/guide/best-practices-polling.mdx +65 -141
- package/docs/hosted.mdx +80 -144
- package/docs/hover.mdx +62 -235
- package/docs/locating-elements.mdx +74 -369
- package/docs/making-assertions.mdx +116 -74
- package/docs/mcp-setup.mdx +80 -63
- package/docs/mouse-down.mdx +48 -125
- package/docs/mouse-up.mdx +47 -129
- package/docs/options.mdx +75 -48
- package/docs/parse.mdx +95 -184
- package/docs/performing-actions.mdx +104 -94
- package/docs/press-keys.mdx +59 -299
- package/docs/provision.mdx +137 -182
- package/docs/quickstart-claude.mdx +85 -0
- package/docs/quickstart-github.mdx +62 -32
- package/docs/quickstart-manual.mdx +60 -33
- package/docs/quickstart-vscode.mdx +97 -0
- package/docs/quickstart.mdx +26 -9
- package/docs/redraw.mdx +101 -165
- package/docs/reusable-code.mdx +97 -200
- package/docs/right-click.mdx +47 -89
- package/docs/screenshot.mdx +47 -201
- package/docs/screenshots.mdx +87 -137
- package/docs/scroll.mdx +71 -154
- package/docs/secrets.mdx +96 -91
- package/docs/self-hosted.mdx +83 -142
- package/docs/snippets/enterprise.mdx +15 -0
- package/docs/styles.css +68 -0
- package/docs/test-results-json.mdx +167 -204
- package/docs/type.mdx +56 -304
- package/docs/variables.mdx +121 -81
- package/docs/wait.mdx +33 -31
- package/docs/what-is-testdriver.mdx +80 -32
- package/examples/{hover-text-with-description.test.mjs → add-to-cart.test.mjs} +4 -5
- package/examples/assert.test.mjs +3 -20
- package/examples/{hover-text.test.mjs → click-button.test.mjs} +3 -4
- package/examples/{hover-image.test.mjs → click-icon.test.mjs} +5 -6
- package/examples/element-not-found.test.mjs +3 -5
- package/examples/findall-coffee-icons.test.mjs +3 -3
- package/examples/installer.test.mjs +1 -1
- package/examples/launch-vscode-linux.test.mjs +6 -33
- package/examples/{scroll-keyboard.test.mjs → navigate-and-scroll.test.mjs} +4 -5
- package/examples/parse.test.mjs +1 -2
- package/examples/press-keys.test.mjs +4 -4
- package/examples/scroll.test.mjs +3 -6
- package/examples/type.test.mjs +5 -2
- package/lib/provision.js +6 -2
- package/package.json +1 -1
- package/sdk.d.ts +4 -2
- package/sdk.js +1 -1
- package/docs/claude-mcp-plugin.mdx +0 -244
- package/docs/elements.mdx +0 -606
- package/docs/examples/ai.mdx +0 -78
- package/docs/examples/captcha-api.mdx +0 -92
- package/docs/examples/chrome-extension.mdx +0 -156
- package/docs/examples/drag-and-drop.mdx +0 -100
- package/docs/examples/formatted-logging.mdx +0 -74
- package/docs/examples/hover-text.mdx +0 -70
- package/docs/examples/match-image.mdx +0 -97
- package/docs/examples/scroll-keyboard.mdx +0 -80
- package/docs/examples/scroll-until-text.mdx +0 -109
package/docs/dashcam.mdx
CHANGED
|
@@ -1,452 +1,119 @@
|
|
|
1
1
|
---
|
|
2
|
-
title: "Dashcam"
|
|
2
|
+
title: "Record tests with Dashcam"
|
|
3
3
|
sidebarTitle: "Dashcam"
|
|
4
|
-
description: "
|
|
4
|
+
description: "Every test is recorded as a video replay with logs, linked when the test ends."
|
|
5
5
|
icon: "video"
|
|
6
6
|
---
|
|
7
7
|
|
|
8
|
-
|
|
8
|
+
Dashcam records the sandbox screen while your test runs and saves it as a replay you can watch in the TestDriver console.
|
|
9
9
|
|
|
10
|
-
|
|
10
|
+
- Recording is on by default. You don't need to configure anything.
|
|
11
|
+
- The replay includes the console output from your test and, for websites, the page's network traffic.
|
|
12
|
+
- When the test ends, TestDriver prints a link to the replay.
|
|
11
13
|
|
|
12
|
-
##
|
|
14
|
+
## How recording works
|
|
13
15
|
|
|
14
|
-
|
|
16
|
+
1. **A provision method starts it.** Every [provision method](/provision) starts Dashcam after it launches your app: `chrome()`, `chromeExtension()`, `vscode()`, `installer()`, `electron()`, and `dashcam()`.
|
|
17
|
+
2. **The test runs.** Everything on the sandbox screen is recorded.
|
|
18
|
+
3. **The test ends.** The [Vitest hook](/client#testdriver-context-options) stops the recording, uploads your test's console output to the replay, and prints the link:
|
|
15
19
|
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
```javascript
|
|
19
|
-
import { test } from 'vitest';
|
|
20
|
-
import { chrome } from 'testdriverai/presets';
|
|
21
|
-
|
|
22
|
-
test('my test', async (context) => {
|
|
23
|
-
const { testdriver, dashcam } = await chrome(context, {
|
|
24
|
-
url: 'https://example.com'
|
|
25
|
-
});
|
|
26
|
-
|
|
27
|
-
// Test executes with recording automatically
|
|
28
|
-
await testdriver.find('login button').then(el => el.click());
|
|
29
|
-
|
|
30
|
-
// Dashcam URL available after test
|
|
31
|
-
console.log('Replay:', dashcam.url);
|
|
32
|
-
});
|
|
33
|
-
```
|
|
34
|
-
|
|
35
|
-
### Manual Setup
|
|
36
|
-
|
|
37
|
-
For more control, make a Dashcam instance directly:
|
|
38
|
-
|
|
39
|
-
```javascript
|
|
40
|
-
import TestDriver from 'testdriverai';
|
|
41
|
-
import Dashcam from 'testdriverai/lib/core/Dashcam.js';
|
|
42
|
-
|
|
43
|
-
const client = await TestDriver.create({ os: 'linux' });
|
|
44
|
-
const dashcam = new Dashcam(client, {
|
|
45
|
-
apiKey: process.env.DASHCAM_API_KEY
|
|
46
|
-
});
|
|
47
|
-
|
|
48
|
-
await dashcam.auth();
|
|
49
|
-
await dashcam.start();
|
|
50
|
-
|
|
51
|
-
// Run your tests
|
|
52
|
-
|
|
53
|
-
const url = await dashcam.stop();
|
|
54
|
-
console.log('Replay URL:', url);
|
|
55
|
-
```
|
|
56
|
-
|
|
57
|
-
## Constructor
|
|
58
|
-
|
|
59
|
-
Create a new Dashcam instance:
|
|
60
|
-
|
|
61
|
-
```javascript
|
|
62
|
-
new Dashcam(client, options)
|
|
20
|
+
```text
|
|
21
|
+
🎥 Dashcam URL: https://console.testdriver.ai/replay/6789abcdef0123456789abcd
|
|
63
22
|
```
|
|
64
23
|
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
<ParamField path="client" type="TestDriver" required>
|
|
68
|
-
TestDriver client instance
|
|
69
|
-
</ParamField>
|
|
70
|
-
|
|
71
|
-
<ParamField path="options" type="object">
|
|
72
|
-
Configuration options
|
|
73
|
-
|
|
74
|
-
<Expandable title="options properties">
|
|
75
|
-
<ParamField path="apiKey" type="string">
|
|
76
|
-
Dashcam API key for authentication. Set via `TD_API_KEY` environment variable.
|
|
77
|
-
</ParamField>
|
|
24
|
+
`chrome()` also records the network traffic for the domain of the URL it opens.
|
|
78
25
|
|
|
79
|
-
|
|
80
|
-
Automatically start recording after authentication
|
|
81
|
-
</ParamField>
|
|
26
|
+
When Vitest retries a failed test, each attempt gets its own recording and link.
|
|
82
27
|
|
|
83
|
-
|
|
84
|
-
Log configurations to add automatically
|
|
85
|
-
</ParamField>
|
|
86
|
-
</Expandable>
|
|
87
|
-
</ParamField>
|
|
28
|
+
## Add a log file to the replay
|
|
88
29
|
|
|
89
|
-
|
|
30
|
+
Call `provision.dashcam()` to show a log file from the sandbox next to the video. Call it before the method that launches your app, so the log is set up before recording starts:
|
|
90
31
|
|
|
91
|
-
|
|
32
|
+
```javascript tests/checkout.test.mjs
|
|
33
|
+
import { describe, expect, it } from 'vitest';
|
|
34
|
+
import { TestDriver } from 'testdriverai/vitest/hooks';
|
|
92
35
|
|
|
93
|
-
|
|
36
|
+
describe('Checkout', () => {
|
|
37
|
+
it('records the app log', async (context) => {
|
|
38
|
+
const testdriver = TestDriver(context);
|
|
94
39
|
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
</ParamField>
|
|
102
|
-
|
|
103
|
-
**Returns:** `Promise<void>`
|
|
104
|
-
|
|
105
|
-
**Example:**
|
|
106
|
-
```javascript
|
|
107
|
-
await dashcam.auth('your-api-key');
|
|
108
|
-
```
|
|
109
|
-
|
|
110
|
-
### start()
|
|
111
|
-
|
|
112
|
-
Start recording:
|
|
113
|
-
|
|
114
|
-
```javascript
|
|
115
|
-
await dashcam.start()
|
|
116
|
-
```
|
|
40
|
+
await testdriver.provision.dashcam({
|
|
41
|
+
title: 'Checkout flow',
|
|
42
|
+
logPath: '/tmp/my-app.log',
|
|
43
|
+
logName: 'App log',
|
|
44
|
+
});
|
|
45
|
+
await testdriver.provision.chrome({ url: 'https://testdriver-sandbox.vercel.app/login' });
|
|
117
46
|
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
await dashcam.start();
|
|
123
|
-
console.log('Recording started');
|
|
124
|
-
```
|
|
125
|
-
|
|
126
|
-
### stop()
|
|
127
|
-
|
|
128
|
-
Stop recording and retrieve replay URL:
|
|
129
|
-
|
|
130
|
-
```javascript
|
|
131
|
-
await dashcam.stop()
|
|
132
|
-
```
|
|
133
|
-
|
|
134
|
-
**Returns:** `Promise<string|null>` - Replay URL if available
|
|
135
|
-
|
|
136
|
-
**Example:**
|
|
137
|
-
```javascript
|
|
138
|
-
const url = await dashcam.stop();
|
|
139
|
-
if (url) {
|
|
140
|
-
console.log('Watch replay:', url);
|
|
141
|
-
} else {
|
|
142
|
-
console.log('No replay URL available');
|
|
143
|
-
}
|
|
144
|
-
```
|
|
145
|
-
|
|
146
|
-
### addFileLog()
|
|
147
|
-
|
|
148
|
-
Track a log file in the recording:
|
|
149
|
-
|
|
150
|
-
```javascript
|
|
151
|
-
await dashcam.addFileLog(path, name)
|
|
152
|
-
```
|
|
153
|
-
|
|
154
|
-
<ParamField path="path" type="string" required>
|
|
155
|
-
Path to the log file
|
|
156
|
-
</ParamField>
|
|
157
|
-
|
|
158
|
-
<ParamField path="name" type="string" required>
|
|
159
|
-
Display name for the log in Dashcam
|
|
160
|
-
</ParamField>
|
|
161
|
-
|
|
162
|
-
**Returns:** `Promise<void>`
|
|
163
|
-
|
|
164
|
-
**Example:**
|
|
165
|
-
```javascript
|
|
166
|
-
// Linux/Mac
|
|
167
|
-
await dashcam.addFileLog('/tmp/app.log', 'Application Log');
|
|
168
|
-
|
|
169
|
-
// Windows
|
|
170
|
-
await dashcam.addFileLog('C:\\logs\\app.log', 'Application Log');
|
|
171
|
-
```
|
|
172
|
-
|
|
173
|
-
### addApplicationLog()
|
|
174
|
-
|
|
175
|
-
Track application-specific logs:
|
|
176
|
-
|
|
177
|
-
```javascript
|
|
178
|
-
await dashcam.addApplicationLog(application, name)
|
|
47
|
+
const result = await testdriver.assert('the login form is visible');
|
|
48
|
+
expect(result).toBe(true);
|
|
49
|
+
});
|
|
50
|
+
});
|
|
179
51
|
```
|
|
180
52
|
|
|
181
|
-
|
|
182
|
-
Application name to track
|
|
183
|
-
</ParamField>
|
|
53
|
+
TestDriver creates the file if it doesn't exist. Anything your app writes to it appears in the replay.
|
|
184
54
|
|
|
185
|
-
<ParamField path="
|
|
186
|
-
|
|
55
|
+
<ParamField path="logPath" type="string">
|
|
56
|
+
The log file in the sandbox. Defaults to `/tmp/testdriver.log` on Linux, or `C:\Users\testdriver\testdriver.log` on Windows.
|
|
187
57
|
</ParamField>
|
|
188
58
|
|
|
189
|
-
|
|
190
|
-
|
|
191
|
-
**Example:**
|
|
192
|
-
```javascript
|
|
193
|
-
await dashcam.addApplicationLog('Google Chrome', 'Browser Logs');
|
|
194
|
-
```
|
|
195
|
-
|
|
196
|
-
### addWebLog()
|
|
197
|
-
|
|
198
|
-
Track web request logs by URL pattern:
|
|
199
|
-
|
|
200
|
-
```javascript
|
|
201
|
-
await dashcam.addWebLog(pattern, name)
|
|
202
|
-
```
|
|
203
|
-
|
|
204
|
-
<ParamField path="pattern" type="string" required>
|
|
205
|
-
URL pattern to match (e.g., `"*example.com*"`)
|
|
59
|
+
<ParamField path="logName" type="string" default="TestDriver Log">
|
|
60
|
+
The log's name in the replay.
|
|
206
61
|
</ParamField>
|
|
207
62
|
|
|
208
|
-
<ParamField path="
|
|
209
|
-
|
|
63
|
+
<ParamField path="webLogs" type="boolean" default="true">
|
|
64
|
+
Also record network traffic. It covers the domain opened with `chrome()` if that ran first, or all traffic otherwise.
|
|
210
65
|
</ParamField>
|
|
211
66
|
|
|
212
|
-
|
|
213
|
-
|
|
214
|
-
**Example:**
|
|
215
|
-
```javascript
|
|
216
|
-
await dashcam.addWebLog('*example.com*', 'Web Logs');
|
|
217
|
-
```
|
|
218
|
-
|
|
219
|
-
### addLog()
|
|
220
|
-
|
|
221
|
-
Generic method to add any type of log:
|
|
222
|
-
|
|
223
|
-
```javascript
|
|
224
|
-
await dashcam.addLog(config)
|
|
225
|
-
```
|
|
226
|
-
|
|
227
|
-
<ParamField path="config" type="object" required>
|
|
228
|
-
Log configuration
|
|
229
|
-
|
|
230
|
-
<Expandable title="config properties">
|
|
231
|
-
<ParamField path="name" type="string" required>
|
|
232
|
-
Display name for the log
|
|
233
|
-
</ParamField>
|
|
234
|
-
|
|
235
|
-
<ParamField path="type" type="string" required>
|
|
236
|
-
Log type: `'file'`, `'application'`, or `'web'`
|
|
237
|
-
</ParamField>
|
|
238
|
-
|
|
239
|
-
<ParamField path="path" type="string">
|
|
240
|
-
File path (required for type='file')
|
|
241
|
-
</ParamField>
|
|
242
|
-
|
|
243
|
-
<ParamField path="application" type="string">
|
|
244
|
-
Application name (required for type='application')
|
|
245
|
-
</ParamField>
|
|
246
|
-
|
|
247
|
-
<ParamField path="pattern" type="string">
|
|
248
|
-
URL pattern to match (required for type='web', e.g., `"*example.com*"`)
|
|
249
|
-
</ParamField>
|
|
250
|
-
</Expandable>
|
|
67
|
+
<ParamField path="title" type="string">
|
|
68
|
+
The recording's title. Defaults to the test file's name and the test's name, such as `checkout - records the app log`.
|
|
251
69
|
</ParamField>
|
|
252
70
|
|
|
253
|
-
|
|
71
|
+
## Turn recording off
|
|
254
72
|
|
|
255
|
-
|
|
256
|
-
```javascript
|
|
257
|
-
await dashcam.addLog({
|
|
258
|
-
name: 'Test Output',
|
|
259
|
-
type: 'file',
|
|
260
|
-
path: '/tmp/test.log'
|
|
261
|
-
});
|
|
262
|
-
|
|
263
|
-
await dashcam.addLog({
|
|
264
|
-
name: 'Chrome Logs',
|
|
265
|
-
type: 'application',
|
|
266
|
-
application: 'Google Chrome'
|
|
267
|
-
});
|
|
268
|
-
|
|
269
|
-
await dashcam.addLog({
|
|
270
|
-
name: 'Web Logs',
|
|
271
|
-
type: 'web',
|
|
272
|
-
pattern: '*example.com*'
|
|
273
|
-
});
|
|
274
|
-
```
|
|
275
|
-
|
|
276
|
-
### isRecording()
|
|
277
|
-
|
|
278
|
-
Check if currently recording:
|
|
73
|
+
Pass `dashcam: false` when you create the client:
|
|
279
74
|
|
|
280
75
|
```javascript
|
|
281
|
-
|
|
76
|
+
const testdriver = TestDriver(context, { dashcam: false });
|
|
282
77
|
```
|
|
283
78
|
|
|
284
|
-
|
|
79
|
+
Provision methods then skip recording, and the test prints no replay link.
|
|
285
80
|
|
|
286
|
-
|
|
287
|
-
```javascript
|
|
288
|
-
if (await dashcam.isRecording()) {
|
|
289
|
-
console.log('Recording in progress');
|
|
290
|
-
}
|
|
291
|
-
```
|
|
292
|
-
|
|
293
|
-
## Properties
|
|
294
|
-
|
|
295
|
-
### recording
|
|
81
|
+
## Control the recording yourself
|
|
296
82
|
|
|
297
|
-
|
|
83
|
+
`testdriver.dashcam` gives you direct control of the recorder. Most tests don't need it, because the provision methods and the Vitest hook handle recording for you.
|
|
298
84
|
|
|
299
85
|
```javascript
|
|
300
|
-
dashcam.
|
|
301
|
-
|
|
302
|
-
|
|
303
|
-
### apiKey
|
|
86
|
+
await testdriver.dashcam.addApplicationLog('Google Chrome', 'Browser logs');
|
|
87
|
+
await testdriver.dashcam.start();
|
|
304
88
|
|
|
305
|
-
|
|
89
|
+
// ...test steps...
|
|
306
90
|
|
|
307
|
-
|
|
308
|
-
|
|
91
|
+
const replayUrl = await testdriver.dashcam.stop();
|
|
92
|
+
console.log(replayUrl);
|
|
309
93
|
```
|
|
310
94
|
|
|
311
|
-
|
|
95
|
+
| Method | What it does |
|
|
96
|
+
| --- | --- |
|
|
97
|
+
| `start()` | Starts recording. Does nothing if it's already recording. |
|
|
98
|
+
| `stop()` | Stops recording and resolves to the replay URL, or `null` if there isn't one. |
|
|
99
|
+
| `isRecording()` | Resolves to `true` while recording. |
|
|
100
|
+
| `setTitle(title)` | Sets the title. Call it before `start()`. |
|
|
101
|
+
| `addFileLog(path, name)` | Adds a log file from the sandbox to the replay. |
|
|
102
|
+
| `addApplicationLog(application, name)` | Adds an application's logs to the replay. |
|
|
103
|
+
| `addWebLog(pattern, name)` | Records network traffic for URLs matching `pattern`, such as `'*example.com*'`. |
|
|
104
|
+
| `getElapsedTime()` | Milliseconds since recording started, or `null` when not recording. |
|
|
312
105
|
|
|
313
|
-
|
|
106
|
+
Add logs before you call `start()`. If you call `stop()` yourself, the Vitest hook doesn't print the link, so log it as shown above.
|
|
314
107
|
|
|
315
|
-
|
|
316
|
-
dashcam.client // TestDriver instance
|
|
317
|
-
```
|
|
108
|
+
With `dashcam: false`, these methods do nothing and `stop()` resolves to `null`.
|
|
318
109
|
|
|
319
|
-
|
|
110
|
+
<Note>
|
|
111
|
+
Older tests may use `chrome()` from `testdriverai/presets` to get a `dashcam` object. Presets are deprecated. Use `TestDriver(context)` and a provision method instead.
|
|
112
|
+
</Note>
|
|
320
113
|
|
|
321
|
-
|
|
114
|
+
## Related
|
|
322
115
|
|
|
323
|
-
|
|
324
|
-
|
|
325
|
-
|
|
326
|
-
|
|
327
|
-
|
|
328
|
-
test('record test execution', async () => {
|
|
329
|
-
const client = await TestDriver.create({ os: 'linux' });
|
|
330
|
-
const dashcam = new Dashcam(client);
|
|
331
|
-
|
|
332
|
-
await dashcam.auth();
|
|
333
|
-
await dashcam.start();
|
|
334
|
-
|
|
335
|
-
// Run your test
|
|
336
|
-
await client.find('button').then(el => el.click());
|
|
337
|
-
|
|
338
|
-
const url = await dashcam.stop();
|
|
339
|
-
console.log('Replay:', url);
|
|
340
|
-
|
|
341
|
-
await client.cleanup();
|
|
342
|
-
});
|
|
343
|
-
```
|
|
344
|
-
|
|
345
|
-
### With Log Tracking
|
|
346
|
-
|
|
347
|
-
```javascript
|
|
348
|
-
test('record with logs', async () => {
|
|
349
|
-
const client = await TestDriver.create({ os: 'linux' });
|
|
350
|
-
const dashcam = new Dashcam(client);
|
|
351
|
-
|
|
352
|
-
await dashcam.auth();
|
|
353
|
-
|
|
354
|
-
// Add log files before starting
|
|
355
|
-
await dashcam.addFileLog('/tmp/testdriver.log', 'TestDriver Log');
|
|
356
|
-
await dashcam.addFileLog('/tmp/app.log', 'Application Log');
|
|
357
|
-
|
|
358
|
-
await dashcam.start();
|
|
359
|
-
|
|
360
|
-
// Test execution
|
|
361
|
-
await client.find('login button').then(el => el.click());
|
|
362
|
-
|
|
363
|
-
const url = await dashcam.stop();
|
|
364
|
-
console.log('Replay with logs:', url);
|
|
365
|
-
|
|
366
|
-
await client.cleanup();
|
|
367
|
-
});
|
|
368
|
-
```
|
|
369
|
-
|
|
370
|
-
### Auto-start Configuration
|
|
371
|
-
|
|
372
|
-
```javascript
|
|
373
|
-
test('auto-start recording', async () => {
|
|
374
|
-
const client = await TestDriver.create({ os: 'linux' });
|
|
375
|
-
const dashcam = new Dashcam(client, {
|
|
376
|
-
autoStart: true,
|
|
377
|
-
logs: [
|
|
378
|
-
{
|
|
379
|
-
name: 'App Log',
|
|
380
|
-
type: 'file',
|
|
381
|
-
path: '/tmp/app.log'
|
|
382
|
-
}
|
|
383
|
-
]
|
|
384
|
-
});
|
|
385
|
-
|
|
386
|
-
await dashcam.auth(); // Automatically starts recording
|
|
387
|
-
|
|
388
|
-
// Test execution
|
|
389
|
-
await client.find('submit button').then(el => el.click());
|
|
390
|
-
|
|
391
|
-
const url = await dashcam.stop();
|
|
392
|
-
console.log('Replay:', url);
|
|
393
|
-
|
|
394
|
-
await client.cleanup();
|
|
395
|
-
});
|
|
396
|
-
```
|
|
397
|
-
|
|
398
|
-
### Using with Presets
|
|
399
|
-
|
|
400
|
-
```javascript
|
|
401
|
-
import { chrome } from 'testdriverai/presets';
|
|
402
|
-
|
|
403
|
-
test('preset with dashcam', async (context) => {
|
|
404
|
-
const { testdriver, dashcam } = await chrome(context, {
|
|
405
|
-
url: 'https://example.com',
|
|
406
|
-
dashcam: true // Enabled by default
|
|
407
|
-
});
|
|
408
|
-
|
|
409
|
-
// Test runs with automatic recording
|
|
410
|
-
await testdriver.find('button').then(el => el.click());
|
|
411
|
-
|
|
412
|
-
// URL automatically available
|
|
413
|
-
console.log('Replay:', dashcam.url);
|
|
414
|
-
});
|
|
415
|
-
```
|
|
416
|
-
|
|
417
|
-
### Disabling Dashcam in Presets
|
|
418
|
-
|
|
419
|
-
```javascript
|
|
420
|
-
test('without dashcam', async (context) => {
|
|
421
|
-
const { testdriver } = await chrome(context, {
|
|
422
|
-
url: 'https://example.com',
|
|
423
|
-
dashcam: false // Disable recording
|
|
424
|
-
});
|
|
425
|
-
|
|
426
|
-
// Test runs without recording (faster)
|
|
427
|
-
await testdriver.find('button').then(el => el.click());
|
|
428
|
-
});
|
|
429
|
-
```
|
|
430
|
-
|
|
431
|
-
## Platform Differences
|
|
432
|
-
|
|
433
|
-
### Windows
|
|
434
|
-
|
|
435
|
-
On Windows, Dashcam uses PowerShell commands and installs via npm:
|
|
436
|
-
|
|
437
|
-
```javascript
|
|
438
|
-
// Windows-specific paths
|
|
439
|
-
await dashcam.addFileLog(
|
|
440
|
-
'C:\\Users\\testdriver\\Documents\\testdriver.log',
|
|
441
|
-
'TestDriver Log'
|
|
442
|
-
);
|
|
443
|
-
```
|
|
444
|
-
|
|
445
|
-
### Linux/Mac
|
|
446
|
-
|
|
447
|
-
On Linux/Mac, Dashcam uses shell commands:
|
|
448
|
-
|
|
449
|
-
```javascript
|
|
450
|
-
// Unix-specific paths
|
|
451
|
-
await dashcam.addFileLog('/tmp/testdriver.log', 'TestDriver Log');
|
|
452
|
-
```
|
|
116
|
+
- [Launch apps](/provision): the provision methods that start recording
|
|
117
|
+
- [Debug a failing test](/debugging-with-screenshots): use the replay to find out why a test failed
|
|
118
|
+
- [Test result JSON](/test-results-json): read the replay URL from a file after the run
|
|
119
|
+
- [Options](/options#preview-and-recording): every client option
|