@testdriverai/agent 7.11.240-test → 7.11.241-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-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,425 +1,159 @@
|
|
|
1
1
|
---
|
|
2
2
|
name: testdriver:debugging-with-screenshots
|
|
3
|
-
description:
|
|
3
|
+
description: Find out why a test failed from its replay and step-by-step screenshots.
|
|
4
4
|
---
|
|
5
5
|
<!-- Generated from debugging-with-screenshots.mdx. DO NOT EDIT. -->
|
|
6
6
|
|
|
7
|
-
|
|
7
|
+
When a test fails, look at what the sandbox showed instead of guessing from the error.
|
|
8
8
|
|
|
9
|
-
|
|
9
|
+
- Every run records a replay you can step through.
|
|
10
|
+
- With automatic screenshots on, TestDriver also saves an image before and after each `testdriver` method call, named after the line of code that ran it.
|
|
10
11
|
|
|
11
|
-
|
|
12
|
-
**Automatic Screenshots (Default: Enabled)**: TestDriver captures screenshots automatically before and after each command. The screenshot name has the line number and the action. Thus it is easy to see which line of code made each screenshot. For example: `001-click-before-L42-submit-button.png`
|
|
13
|
-
</Note>
|
|
12
|
+
## Watch the replay
|
|
14
13
|
|
|
15
|
-
|
|
14
|
+
Every test run prints a link to its report when it finishes:
|
|
16
15
|
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
List and filter screenshots saved in the `.testdriver/screenshots/` directory:
|
|
20
|
-
|
|
21
|
-
```
|
|
22
|
-
list_local_screenshots()
|
|
23
|
-
```
|
|
24
|
-
|
|
25
|
-
**Filter Parameters:**
|
|
26
|
-
|
|
27
|
-
<ParamField path="directory" type="string" optional>
|
|
28
|
-
Filter the screenshots by test file or subdirectory (for example, "login.test", "mcp-screenshots"). If you do not give this, the tool lists all screenshots.
|
|
29
|
-
</ParamField>
|
|
30
|
-
|
|
31
|
-
<ParamField path="line" type="number" optional>
|
|
32
|
-
Filter by the exact line number from the test file (for example, 42 matches L42 in the filename).
|
|
33
|
-
</ParamField>
|
|
34
|
-
|
|
35
|
-
<ParamField path="lineRange" type="object" optional>
|
|
36
|
-
Filter by a line number range. Example: `{ start: 10, end: 20 }` matches screenshots from lines 10-20.
|
|
37
|
-
</ParamField>
|
|
38
|
-
|
|
39
|
-
<ParamField path="action" type="string" optional>
|
|
40
|
-
Filter by action type: `click`, `find`, `type`, `assert`, `provision`, `scroll`, `hover`, etc.
|
|
41
|
-
</ParamField>
|
|
42
|
-
|
|
43
|
-
<ParamField path="phase" type="string" optional>
|
|
44
|
-
Filter by phase: `"before"` (state before action) or `"after"` (state after action).
|
|
45
|
-
</ParamField>
|
|
46
|
-
|
|
47
|
-
<ParamField path="pattern" type="string" optional>
|
|
48
|
-
Regex pattern to match against filename. Example: `"login|signin"` or `"button.*click"`.
|
|
49
|
-
</ParamField>
|
|
50
|
-
|
|
51
|
-
<ParamField path="sequence" type="number" optional>
|
|
52
|
-
Filter by exact sequence number.
|
|
53
|
-
</ParamField>
|
|
54
|
-
|
|
55
|
-
<ParamField path="sequenceRange" type="object" optional>
|
|
56
|
-
Filter by sequence range. Example: `{ start: 1, end: 10 }` matches first 10 screenshots.
|
|
57
|
-
</ParamField>
|
|
58
|
-
|
|
59
|
-
<ParamField path="limit" type="number" optional>
|
|
60
|
-
Maximum number of results to return (default: 50).
|
|
61
|
-
</ParamField>
|
|
62
|
-
|
|
63
|
-
<ParamField path="sortBy" type="string" optional>
|
|
64
|
-
Sort results by: `"modified"` (newest first, default), `"sequence"` (execution order), or `"line"` (line number).
|
|
65
|
-
</ParamField>
|
|
66
|
-
|
|
67
|
-
**Returns:**
|
|
68
|
-
|
|
69
|
-
Array of screenshot metadata including:
|
|
70
|
-
- `path` - Full absolute path to the screenshot file
|
|
71
|
-
- `relativePath` - Path relative to `.testdriver/screenshots/`
|
|
72
|
-
- `name` - Screenshot filename
|
|
73
|
-
- `sizeBytes` - File size in bytes
|
|
74
|
-
- `modified` - Last modification timestamp
|
|
75
|
-
- `sequence` - Sequential number (from auto-screenshots)
|
|
76
|
-
- `action` - Action type (click, find, etc.)
|
|
77
|
-
- `phase` - Before/after phase
|
|
78
|
-
- `lineNumber` - Line number from test file
|
|
79
|
-
- `description` - Element or action description
|
|
80
|
-
|
|
81
|
-
**Example Responses:**
|
|
82
|
-
|
|
83
|
-
```json
|
|
84
|
-
// Basic listing
|
|
85
|
-
[
|
|
86
|
-
{
|
|
87
|
-
"path": "/Users/user/project/.testdriver/screenshots/login.test/001-click-before-L42-submit-button.png",
|
|
88
|
-
"relativePath": "login.test/001-click-before-L42-submit-button.png",
|
|
89
|
-
"name": "001-click-before-L42-submit-button.png",
|
|
90
|
-
"sizeBytes": 145632,
|
|
91
|
-
"modified": "2026-01-23T10:00:00.000Z",
|
|
92
|
-
"sequence": 1,
|
|
93
|
-
"action": "click",
|
|
94
|
-
"phase": "before",
|
|
95
|
-
"lineNumber": 42,
|
|
96
|
-
"description": "submit-button"
|
|
97
|
-
}
|
|
98
|
-
]
|
|
99
|
-
```
|
|
100
|
-
|
|
101
|
-
### view_local_screenshot
|
|
102
|
-
|
|
103
|
-
View a specific screenshot from the list:
|
|
104
|
-
|
|
105
|
-
```
|
|
106
|
-
view_local_screenshot({ path: "/full/path/to/screenshot.png" })
|
|
107
|
-
```
|
|
108
|
-
|
|
109
|
-
**Parameters:**
|
|
110
|
-
|
|
111
|
-
<ParamField path="path" type="string" required>
|
|
112
|
-
Full absolute path to the screenshot file (as returned by `list_local_screenshots`)
|
|
113
|
-
</ParamField>
|
|
114
|
-
|
|
115
|
-
**Returns:**
|
|
116
|
-
|
|
117
|
-
- Image content (displayed to both AI and user via MCP App)
|
|
118
|
-
- Screenshot metadata
|
|
119
|
-
- Success/error status
|
|
120
|
-
|
|
121
|
-
## Common Workflows
|
|
122
|
-
|
|
123
|
-
### Test Debugging After Failures
|
|
124
|
-
|
|
125
|
-
When a test fails, you don't have to wonder what went wrong — use powerful filtering to quickly find the screenshots that show exactly what happened:
|
|
126
|
-
|
|
127
|
-
**1. Find screenshots at the failing line:**
|
|
128
|
-
|
|
129
|
-
```
|
|
130
|
-
// If test failed at line 42
|
|
131
|
-
list_local_screenshots({ line: 42 })
|
|
132
|
-
|
|
133
|
-
// View before and after states at that line
|
|
134
|
-
view_local_screenshot({ path: ".testdriver/screenshots/login.test/005-click-before-L42-submit-button.png" })
|
|
135
|
-
view_local_screenshot({ path: ".testdriver/screenshots/login.test/006-click-after-L42-submit-button.png" })
|
|
16
|
+
```text
|
|
17
|
+
TESTDRIVER_RUN_URL=https://console.testdriver.ai/runs/abc123
|
|
136
18
|
```
|
|
137
19
|
|
|
138
|
-
|
|
20
|
+
The report plays a recording of the run next to a list of every command it ran, such as `find()`, `click()`, and `assert()`.
|
|
139
21
|
|
|
140
|
-
|
|
141
|
-
// Get screenshots from lines 35-45 to see context
|
|
142
|
-
list_local_screenshots({ directory: "login.test", lineRange: { start: 35, end: 45 } })
|
|
143
|
-
```
|
|
144
|
-
|
|
145
|
-
**3. Find all assertion screenshots:**
|
|
146
|
-
|
|
147
|
-
```
|
|
148
|
-
// See what the screen looked like during assertions
|
|
149
|
-
list_local_screenshots({ action: "assert" })
|
|
150
|
-
```
|
|
151
|
-
|
|
152
|
-
**4. View the final state before failure:**
|
|
153
|
-
|
|
154
|
-
```
|
|
155
|
-
// Get the last 5 screenshots in execution order
|
|
156
|
-
list_local_screenshots({ directory: "login.test", sortBy: "sequence", limit: 5 })
|
|
157
|
-
```
|
|
158
|
-
|
|
159
|
-
### Finding Specific Actions
|
|
22
|
+
Select a command to see the screen as it was when that command ran, and what the AI decided. This is the most reliable view of a failure. It shows what TestDriver saw, not what you expected on screen.
|
|
160
23
|
|
|
161
|
-
|
|
24
|
+
Use it to answer the usual questions:
|
|
162
25
|
|
|
163
|
-
|
|
164
|
-
|
|
165
|
-
|
|
26
|
+
- **Was the right page showing?** You see right away if a `find()` or `assert()` ran on the wrong page or before the page loaded.
|
|
27
|
+
- **Was the element on screen?** If `find()` couldn't locate an element, check whether it was hidden, scrolled out of view, or labelled differently.
|
|
28
|
+
- **Did the click land?** Compare the screen before and after a `click()` to see whether anything changed.
|
|
166
29
|
|
|
167
|
-
|
|
168
|
-
list_local_screenshots({ action: "click", phase: "before" })
|
|
30
|
+
## Save a screenshot at every step
|
|
169
31
|
|
|
170
|
-
|
|
171
|
-
list_local_screenshots({ pattern: "submit|button" })
|
|
32
|
+
To inspect a run locally, turn on automatic screenshots. TestDriver saves a screenshot before and after each `testdriver` method call and each `find()`, plus one when a call fails. Actions on an element, like `element.click()`, aren't captured:
|
|
172
33
|
|
|
173
|
-
|
|
174
|
-
|
|
34
|
+
```javascript
|
|
35
|
+
const testdriver = TestDriver(context, { autoScreenshots: true });
|
|
175
36
|
```
|
|
176
37
|
|
|
177
|
-
|
|
178
|
-
|
|
179
|
-
View screenshots in execution order to trace test behavior:
|
|
38
|
+
Screenshots are saved to `.testdriver/screenshots/<test file>/`. Each name records:
|
|
180
39
|
|
|
181
|
-
|
|
182
|
-
|
|
183
|
-
|
|
40
|
+
- The order.
|
|
41
|
+
- The command.
|
|
42
|
+
- The phase.
|
|
43
|
+
- The line of your test that ran it.
|
|
184
44
|
|
|
185
|
-
|
|
186
|
-
list_local_screenshots({ sequenceRange: { start: 1, end: 10 }, sortBy: "sequence" })
|
|
45
|
+
For example:
|
|
187
46
|
|
|
188
|
-
|
|
189
|
-
|
|
47
|
+
```text
|
|
48
|
+
.testdriver/screenshots/login.test/
|
|
49
|
+
001-find-before-L15-email-input.png
|
|
50
|
+
002-find-after-L15-email-input.png
|
|
51
|
+
003-type-before-L17-userexamplecom.png
|
|
52
|
+
004-assert-error-L20-the-dashboard-is-visible.png
|
|
190
53
|
```
|
|
191
54
|
|
|
192
|
-
|
|
55
|
+
Automatic screenshots are off by default. TestDriver clears each test file's folder at the start of its next run.
|
|
193
56
|
|
|
194
|
-
|
|
57
|
+
To save a screenshot at a specific point instead, call [`screenshot()`](/screenshot). For the full naming format, see [Screenshots](/screenshots).
|
|
195
58
|
|
|
196
|
-
|
|
59
|
+
## Inspect screenshots with your AI assistant
|
|
197
60
|
|
|
198
|
-
|
|
199
|
-
// See all assertions
|
|
200
|
-
list_local_screenshots({ action: "assert" })
|
|
61
|
+
With the [local TestDriver MCP server](/mcp-setup#run-the-server-locally), your AI assistant can list and view these screenshots. Ask in plain language:
|
|
201
62
|
|
|
202
|
-
|
|
203
|
-
|
|
63
|
+
```text
|
|
64
|
+
The login test failed at line 42. Show me the screenshots from just before and after that line.
|
|
204
65
|
```
|
|
205
66
|
|
|
206
|
-
|
|
207
|
-
|
|
208
|
-
```
|
|
209
|
-
view_local_screenshot({ path: ".testdriver/screenshots/my-test.test/after-login.png" })
|
|
210
|
-
```
|
|
211
|
-
|
|
212
|
-
3. **Verify element locations and states** before adding assertions
|
|
213
|
-
|
|
214
|
-
4. **Iterate** - adjust your test code based on what you see in the screenshots
|
|
215
|
-
|
|
216
|
-
### Comparison and Analysis
|
|
217
|
-
|
|
218
|
-
Compare screenshots to identify issues:
|
|
67
|
+
The assistant uses two MCP tools to answer:
|
|
219
68
|
|
|
220
|
-
|
|
69
|
+
- **`list_local_screenshots`** finds screenshots by test file, line or line range, command, phase (`before`, `after`, or `error`), sequence, or a filename pattern.
|
|
70
|
+
- **`view_local_screenshot`** opens one of the screenshots it found, so both you and the assistant can see it.
|
|
221
71
|
|
|
222
|
-
|
|
223
|
-
// See state before all clicks
|
|
224
|
-
list_local_screenshots({ action: "click", phase: "before" })
|
|
72
|
+
These tools read the `.testdriver/` folder on the machine running the MCP server. They don't work with the hosted server at `mcp.testdriver.ai`.
|
|
225
73
|
|
|
226
|
-
|
|
227
|
-
list_local_screenshots({ action: "click", phase: "after" })
|
|
228
|
-
```
|
|
74
|
+
<Accordion title="list_local_screenshots parameters">
|
|
229
75
|
|
|
230
|
-
|
|
76
|
+
<ParamField path="directory" type="string">
|
|
77
|
+
Test file folder or subfolder to search, such as `login.test`. Searches everything when omitted.
|
|
78
|
+
</ParamField>
|
|
79
|
+
<ParamField path="line" type="number">
|
|
80
|
+
Exact line number in the test file. `42` matches screenshots named `L42`.
|
|
81
|
+
</ParamField>
|
|
82
|
+
<ParamField path="lineRange" type="object">
|
|
83
|
+
Line range to match, inclusive: `{ start: 35, end: 45 }`.
|
|
84
|
+
</ParamField>
|
|
85
|
+
<ParamField path="action" type="string">
|
|
86
|
+
Command name, such as `click`, `find`, `type`, or `assert`.
|
|
87
|
+
</ParamField>
|
|
88
|
+
<ParamField path="phase" type="string">
|
|
89
|
+
`"before"`, `"after"`, or `"error"` (taken when a command fails).
|
|
90
|
+
</ParamField>
|
|
91
|
+
<ParamField path="pattern" type="string">
|
|
92
|
+
Regular expression to match against filenames, such as `"login|signin"`.
|
|
93
|
+
</ParamField>
|
|
94
|
+
<ParamField path="sequence" type="number">
|
|
95
|
+
Exact sequence number.
|
|
96
|
+
</ParamField>
|
|
97
|
+
<ParamField path="sequenceRange" type="object">
|
|
98
|
+
Sequence range to match, inclusive: `{ start: 1, end: 10 }`.
|
|
99
|
+
</ParamField>
|
|
100
|
+
<ParamField path="limit" type="number" default="50">
|
|
101
|
+
Maximum number of results.
|
|
102
|
+
</ParamField>
|
|
103
|
+
<ParamField path="sortBy" type="string" default="modified">
|
|
104
|
+
`"modified"` (newest first), `"sequence"` (execution order), or `"line"`.
|
|
105
|
+
</ParamField>
|
|
231
106
|
|
|
232
|
-
|
|
233
|
-
// Something went wrong around line 50
|
|
234
|
-
list_local_screenshots({ lineRange: { start: 45, end: 55 } })
|
|
235
|
-
```
|
|
107
|
+
`view_local_screenshot` takes one parameter, `path`: the full path of a screenshot returned by `list_local_screenshots`.
|
|
236
108
|
|
|
237
|
-
|
|
109
|
+
</Accordion>
|
|
238
110
|
|
|
239
|
-
|
|
240
|
-
// Find screenshots related to login functionality
|
|
241
|
-
list_local_screenshots({ pattern: "login|signin|email|password" })
|
|
242
|
-
```
|
|
243
|
-
|
|
244
|
-
## Best Practices
|
|
111
|
+
## Common causes
|
|
245
112
|
|
|
246
113
|
<AccordionGroup>
|
|
247
|
-
<Accordion title="
|
|
248
|
-
When saving screenshots in tests, use descriptive names to make them easier to identify:
|
|
249
|
-
|
|
250
|
-
```javascript
|
|
251
|
-
await testdriver.screenshot("initial-page-load");
|
|
252
|
-
await testdriver.screenshot("after-login-click");
|
|
253
|
-
await testdriver.screenshot("dashboard-loaded");
|
|
254
|
-
```
|
|
255
|
-
|
|
256
|
-
Then when listing screenshots, you can quickly identify key moments without viewing every image.
|
|
257
|
-
</Accordion>
|
|
258
|
-
|
|
259
|
-
<Accordion title="List before viewing">
|
|
260
|
-
Always call `list_local_screenshots` first to see what's available. The list is sorted by modification time (newest first), making it easy to find recent test runs.
|
|
261
|
-
</Accordion>
|
|
262
|
-
|
|
263
|
-
<Accordion title="Filter by test file">
|
|
264
|
-
When debugging a specific test, use the `directory` parameter to filter screenshots:
|
|
265
|
-
|
|
266
|
-
```
|
|
267
|
-
list_local_screenshots({ directory: "problematic-test.test" })
|
|
268
|
-
```
|
|
269
|
-
|
|
270
|
-
This avoids clutter from other tests.
|
|
271
|
-
</Accordion>
|
|
114
|
+
<Accordion title="find() acted before the page was ready">
|
|
272
115
|
|
|
273
|
-
|
|
274
|
-
When a test fails (especially with assertions), look at screenshots immediately before the failure. They show exactly what the AI or test "saw" at that moment, helping you understand why an assertion failed or why an element wasn't found.
|
|
275
|
-
</Accordion>
|
|
116
|
+
The screenshot shows a loading state or the previous page.
|
|
276
117
|
|
|
277
|
-
|
|
278
|
-
TestDriver test reports include screenshots in the timeline. Use MCP screenshot viewing for interactive debugging during development, and test reports for post-run analysis and team sharing.
|
|
279
|
-
</Accordion>
|
|
118
|
+
Pass a `timeout` so `find()` keeps checking the screen while the page loads, for example `testdriver.find('Dashboard heading', { timeout: 30000 })`. See [Waiting for elements](/guide/best-practices-polling).
|
|
280
119
|
|
|
281
|
-
<Accordion title="Archive important screenshots">
|
|
282
|
-
Remember that each test run clears its screenshot folder. If you need to preserve screenshots for comparison:
|
|
283
|
-
|
|
284
|
-
```bash
|
|
285
|
-
# Copy screenshots before next run
|
|
286
|
-
cp -r .testdriver/screenshots/my-test.test .testdriver/screenshots-backup/
|
|
287
|
-
```
|
|
288
120
|
</Accordion>
|
|
289
|
-
|
|
290
|
-
|
|
291
|
-
## Screenshot File Organization
|
|
292
|
-
|
|
293
|
-
Understanding the directory structure helps with efficient screenshot viewing:
|
|
294
|
-
|
|
295
|
-
```
|
|
296
|
-
.testdriver/
|
|
297
|
-
screenshots/
|
|
298
|
-
login.test/ # Test file name (without .mjs extension)
|
|
299
|
-
001-find-before-L15-email-input.png # Auto: before find() at line 15
|
|
300
|
-
002-find-after-L15-email-input.png # Auto: after find() at line 15
|
|
301
|
-
003-click-before-L16-email-input.png # Auto: before click() at line 16
|
|
302
|
-
004-click-after-L16-email-input.png # Auto: after click() at line 16
|
|
303
|
-
login-complete.png # Manual: screenshot("login-complete")
|
|
304
|
-
checkout.test/
|
|
305
|
-
001-find-before-L12-add-to-cart.png
|
|
306
|
-
002-find-after-L12-add-to-cart.png
|
|
307
|
-
...
|
|
308
|
-
```
|
|
309
|
-
|
|
310
|
-
### Automatic Screenshot Naming Format
|
|
311
|
-
|
|
312
|
-
`<seq>-<action>-<phase>-L<line>-<description>.png`
|
|
121
|
+
<Accordion title="find() picked the wrong element">
|
|
313
122
|
|
|
314
|
-
|
|
315
|
-
|-----------|-------------|---------|
|
|
316
|
-
| `seq` | Sequential number | `001`, `002` |
|
|
317
|
-
| `action` | Command name | `click`, `type`, `find` |
|
|
318
|
-
| `phase` | Before, after, or error | `before`, `after`, `error` |
|
|
319
|
-
| `L<line>` | Line number from test file | `L42` |
|
|
320
|
-
| `description` | Element/action description | `submit-button` |
|
|
123
|
+
The screenshot shows a click on a similar-looking element.
|
|
321
124
|
|
|
322
|
-
|
|
125
|
+
Add the element's visible label, position, or color to the description, such as "the blue Sign In button in the header". See [Locate elements](/locating-elements).
|
|
323
126
|
|
|
324
|
-
|
|
325
|
-
|
|
326
|
-
- Manual `screenshot()` calls use custom names you provide
|
|
327
|
-
- Folders are cleared at the start of each test run
|
|
328
|
-
- All screenshots are PNG format
|
|
329
|
-
- Disable automatic screenshots with `autoScreenshots: false` if needed
|
|
330
|
-
|
|
331
|
-
## Interaction List Sidebar (Source of Truth)
|
|
332
|
-
|
|
333
|
-
When viewing a test run in the TestDriver console, the **interaction list sidebar** displays a screenshot for each interaction call (find, click, type, assert, etc.). These screenshots show exactly what was on the screen at the time each interaction was executed.
|
|
334
|
-
|
|
335
|
-
<Note>
|
|
336
|
-
**The sidebar screenshots are the source of truth.** If a test is behaving unexpectedly, check the screenshot attached to the specific interaction in the sidebar — it shows precisely what the AI saw when making its decision. This is more reliable than inferring screen state from test logs or local screenshots alone.
|
|
337
|
-
</Note>
|
|
338
|
-
|
|
339
|
-
Use the interaction list to:
|
|
340
|
-
- **Verify what the AI saw** — confirm the correct page/state was visible when `find()` or `assert()` ran
|
|
341
|
-
- **Debug misclicks** — see whether the target element was actually on screen
|
|
342
|
-
- **Identify timing issues** — spot cases where the UI hadn't finished loading before an interaction fired
|
|
343
|
-
- **Compare runs** — review interaction screenshots across multiple runs to catch flaky behavior
|
|
344
|
-
|
|
345
|
-
## Integration with Test Development
|
|
346
|
-
|
|
347
|
-
### During MCP Interactive Development
|
|
348
|
-
|
|
349
|
-
When using TestDriver MCP tools (`session_start`, `find_and_click`, etc.), screenshots are automatically captured and displayed. Additionally, you can view previously saved screenshots:
|
|
350
|
-
|
|
351
|
-
```
|
|
352
|
-
# After test development session
|
|
353
|
-
list_local_screenshots({ directory: "my-new-test.test" })
|
|
354
|
-
view_local_screenshot({ path: ".testdriver/screenshots/my-new-test.test/login-page.png" })
|
|
355
|
-
```
|
|
356
|
-
|
|
357
|
-
This helps verify your test logic before running the full test file.
|
|
358
|
-
|
|
359
|
-
### After Test Runs
|
|
360
|
-
|
|
361
|
-
When tests fail or behave unexpectedly, replay what happened step by step:
|
|
127
|
+
</Accordion>
|
|
128
|
+
<Accordion title="An assertion failed even though the page looks right">
|
|
362
129
|
|
|
363
|
-
|
|
364
|
-
2. **List screenshots** using `list_local_screenshots`
|
|
365
|
-
3. **View relevant screenshots** to diagnose the issue
|
|
366
|
-
4. **Update test code** based on what you see
|
|
367
|
-
5. **Re-run and verify** the fix
|
|
130
|
+
Read the AI's reasoning for the assertion in the report.
|
|
368
131
|
|
|
369
|
-
|
|
132
|
+
Assertions that mention exact wording or several conditions at once fail more often. Check one thing at a time, in plain language. See [Make assertions](/making-assertions).
|
|
370
133
|
|
|
371
|
-
<AccordionGroup>
|
|
372
|
-
<Accordion title="No screenshots found">
|
|
373
|
-
If `list_local_screenshots` returns an empty array:
|
|
374
|
-
|
|
375
|
-
- Ensure your test includes `await testdriver.screenshot()` calls
|
|
376
|
-
- Verify the test actually ran (check test output)
|
|
377
|
-
- Check that `.testdriver/screenshots/` directory exists
|
|
378
|
-
- Confirm you're in the correct project directory
|
|
379
134
|
</Accordion>
|
|
135
|
+
<Accordion title="There are no screenshots in .testdriver/screenshots">
|
|
380
136
|
|
|
381
|
-
|
|
382
|
-
If `view_local_screenshot` returns an error:
|
|
383
|
-
|
|
384
|
-
- Verify the path is exactly as returned by `list_local_screenshots`
|
|
385
|
-
- Check file permissions - ensure the screenshot file is readable
|
|
386
|
-
- Confirm the file hasn't been deleted or moved
|
|
387
|
-
</Accordion>
|
|
137
|
+
Automatic screenshots are off by default. Set `autoScreenshots: true` when you create the client, or call `screenshot()` at the points you care about.
|
|
388
138
|
|
|
389
|
-
|
|
390
|
-
If you have hundreds of screenshots making it hard to find what you need, use filtering:
|
|
391
|
-
|
|
392
|
-
- Filter by test file: `list_local_screenshots({ directory: "my-test.test" })`
|
|
393
|
-
- Filter by line number: `list_local_screenshots({ line: 42 })` or `list_local_screenshots({ lineRange: { start: 40, end: 50 } })`
|
|
394
|
-
- Filter by action: `list_local_screenshots({ action: "click" })`
|
|
395
|
-
- Filter by phase: `list_local_screenshots({ phase: "before" })`
|
|
396
|
-
- Use regex: `list_local_screenshots({ pattern: "submit|login" })`
|
|
397
|
-
- Limit results: `list_local_screenshots({ limit: 10 })`
|
|
398
|
-
- Sort by line: `list_local_screenshots({ sortBy: "line" })`
|
|
399
|
-
- Clean up old folders: `rm -rf .testdriver/screenshots/*`
|
|
400
|
-
</Accordion>
|
|
139
|
+
Also check that you're looking in the project folder you ran the test from.
|
|
401
140
|
|
|
402
|
-
<Accordion title="Screenshots from old test runs">
|
|
403
|
-
Remember that screenshot folders are cleared at the start of each test run. If you see old screenshots:
|
|
404
|
-
|
|
405
|
-
- The test may not have run recently
|
|
406
|
-
- Or the test failed before reaching the clearing logic
|
|
407
|
-
- Manually clear: `rm -rf .testdriver/screenshots/<test-name>/`
|
|
408
141
|
</Accordion>
|
|
409
142
|
</AccordionGroup>
|
|
410
143
|
|
|
411
|
-
##
|
|
412
|
-
|
|
413
|
-
|
|
414
|
-
|
|
415
|
-
|
|
416
|
-
|
|
417
|
-
|
|
418
|
-
|
|
419
|
-
|
|
420
|
-
|
|
421
|
-
|
|
422
|
-
|
|
423
|
-
<Card title="
|
|
424
|
-
|
|
425
|
-
</Card>
|
|
144
|
+
## Next steps
|
|
145
|
+
|
|
146
|
+
<CardGroup cols={2}>
|
|
147
|
+
<Card title="Prevent regressions" icon="shield-check" href="/copilot/auto-healing">
|
|
148
|
+
Catch regressions in CI and repair tests when your UI changes.
|
|
149
|
+
</Card>
|
|
150
|
+
<Card title="Errors" icon="triangle-exclamation" href="/errors">
|
|
151
|
+
The errors TestDriver throws and how to handle them.
|
|
152
|
+
</Card>
|
|
153
|
+
<Card title="Screenshots" icon="camera" href="/screenshots">
|
|
154
|
+
Naming, folders, and options for saved screenshots.
|
|
155
|
+
</Card>
|
|
156
|
+
<Card title="Dashcam" icon="video" href="/dashcam">
|
|
157
|
+
How runs are recorded, and how to add your own logs.
|
|
158
|
+
</Card>
|
|
159
|
+
</CardGroup>
|