testdriverai 7.8.0-test.4 → 7.8.0-test.41
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/CHANGELOG.md +18 -0
- package/agent/index.js +6 -5
- package/agent/lib/commands.js +3 -2
- package/agent/lib/http.js +144 -0
- package/agent/lib/sandbox.js +326 -164
- package/agent/lib/sdk.js +4 -2
- package/agent/lib/system.js +25 -65
- package/ai/skills/testdriver-cache/SKILL.md +221 -0
- package/ai/skills/testdriver-errors/SKILL.md +246 -0
- package/ai/skills/testdriver-events/SKILL.md +356 -0
- package/ai/skills/testdriver-mcp/SKILL.md +7 -0
- package/ai/skills/testdriver-provision/SKILL.md +331 -0
- package/ai/skills/testdriver-redraw/SKILL.md +214 -0
- package/ai/skills/testdriver-running-tests/SKILL.md +1 -1
- package/ai/skills/testdriver-screenshots/SKILL.md +184 -0
- package/docs/_data/examples-manifest.json +46 -46
- package/docs/changelog.mdx +155 -3
- package/docs/docs.json +44 -37
- package/docs/images/content/vscode/v7-chat.png +0 -0
- package/docs/images/content/vscode/v7-choose-agent.png +0 -0
- package/docs/images/content/vscode/v7-full.png +0 -0
- package/docs/images/content/vscode/v7-onboarding.png +0 -0
- package/docs/v7/cache.mdx +223 -0
- package/docs/v7/copilot/auto-healing.mdx +265 -0
- package/docs/v7/copilot/creating-tests.mdx +156 -0
- package/docs/v7/copilot/github.mdx +143 -0
- package/docs/v7/copilot/running-tests.mdx +149 -0
- package/docs/v7/copilot/setup.mdx +143 -0
- package/docs/v7/enterprise.mdx +3 -110
- package/docs/v7/errors.mdx +248 -0
- package/docs/v7/events.mdx +358 -0
- package/docs/v7/examples/ai.mdx +1 -1
- package/docs/v7/examples/assert.mdx +1 -1
- package/docs/v7/examples/captcha-api.mdx +1 -1
- package/docs/v7/examples/chrome-extension.mdx +1 -1
- package/docs/v7/examples/drag-and-drop.mdx +1 -1
- package/docs/v7/examples/element-not-found.mdx +1 -1
- package/docs/v7/examples/exec-output.mdx +85 -0
- package/docs/v7/examples/exec-pwsh.mdx +83 -0
- package/docs/v7/examples/focus-window.mdx +62 -0
- package/docs/v7/examples/hover-image.mdx +1 -1
- package/docs/v7/examples/hover-text.mdx +1 -1
- package/docs/v7/examples/installer.mdx +1 -1
- package/docs/v7/examples/launch-vscode-linux.mdx +1 -1
- package/docs/v7/examples/match-image.mdx +1 -1
- package/docs/v7/examples/press-keys.mdx +1 -1
- package/docs/v7/examples/scroll-keyboard.mdx +1 -1
- package/docs/v7/examples/scroll-until-image.mdx +1 -1
- package/docs/v7/examples/scroll-until-text.mdx +1 -1
- package/docs/v7/examples/scroll.mdx +1 -1
- package/docs/v7/examples/type.mdx +1 -1
- package/docs/v7/examples/windows-installer.mdx +1 -1
- package/docs/v7/{cloud.mdx → hosted.mdx} +43 -5
- package/docs/v7/mcp.mdx +9 -0
- package/docs/v7/provision.mdx +333 -0
- package/docs/v7/quickstart.mdx +30 -2
- package/docs/v7/redraw.mdx +216 -0
- package/docs/v7/running-tests.mdx +1 -1
- package/docs/v7/screenshots.mdx +186 -0
- package/docs/v7/self-hosted.mdx +127 -44
- package/interfaces/logger.js +0 -12
- package/interfaces/vitest-plugin.mjs +53 -43
- package/lib/core/Dashcam.js +30 -23
- package/lib/environments.json +18 -0
- package/lib/github-comment.mjs +58 -40
- package/lib/resolve-channel.js +4 -3
- package/lib/sentry.js +5 -0
- package/{examples → manual}/drag-and-drop.test.mjs +1 -1
- package/mcp-server/dist/server.mjs +4 -0
- package/mcp-server/src/server.ts +5 -0
- package/package.json +3 -3
- package/sdk.js +3 -3
- package/setup/aws/install-dev-runner.sh +79 -0
- package/setup/aws/spawn-runner.sh +134 -0
- package/vitest.config.mjs +20 -32
- package/vitest.runner.config.mjs +33 -0
- /package/{examples → manual}/flake-diffthreshold-001.test.mjs +0 -0
- /package/{examples → manual}/flake-diffthreshold-01.test.mjs +0 -0
- /package/{examples → manual}/flake-diffthreshold-05.test.mjs +0 -0
- /package/{examples → manual}/flake-noredraw-cache.test.mjs +0 -0
- /package/{examples → manual}/flake-noredraw-nocache.test.mjs +0 -0
- /package/{examples → manual}/flake-redraw-cache.test.mjs +0 -0
- /package/{examples → manual}/flake-redraw-nocache.test.mjs +0 -0
- /package/{examples → manual}/flake-rocket-match.test.mjs +0 -0
- /package/{examples → manual}/flake-shared.mjs +0 -0
- /package/{examples → manual}/no-provision.test.mjs +0 -0
- /package/{examples → manual}/scroll-until-text.test.mjs +0 -0
|
@@ -0,0 +1,214 @@
|
|
|
1
|
+
---
|
|
2
|
+
name: testdriver:redraw
|
|
3
|
+
description: Wait for the screen to stabilize after interactions
|
|
4
|
+
---
|
|
5
|
+
<!-- Generated from redraw.mdx. DO NOT EDIT. -->
|
|
6
|
+
|
|
7
|
+
## Overview
|
|
8
|
+
|
|
9
|
+
The redraw system waits for the screen to stabilize after an interaction before continuing. It detects when animations, page loads, and network requests have settled, preventing actions from being performed on a changing screen.
|
|
10
|
+
|
|
11
|
+
<Note>
|
|
12
|
+
**Redraw is disabled by default since v7.3.** Enable it explicitly if your tests interact with applications that have significant animations or loading states.
|
|
13
|
+
</Note>
|
|
14
|
+
|
|
15
|
+
## How It Works
|
|
16
|
+
|
|
17
|
+
Redraw uses a **two-phase detection** approach:
|
|
18
|
+
|
|
19
|
+
1. **Change Detection** — Compare the current frame to the initial screenshot taken right after the action. If the pixel diff exceeds 0.1%, the screen has changed.
|
|
20
|
+
2. **Stability Detection** — Compare consecutive frames using z-score analysis. When the diff between frames drops below 0.1% or the z-score is negative (current diff is below average), the screen has settled.
|
|
21
|
+
|
|
22
|
+
The screen is considered **settled** when both phases complete: the screen changed from the initial state AND consecutive frames are now stable.
|
|
23
|
+
|
|
24
|
+
```mermaid
|
|
25
|
+
flowchart TD
|
|
26
|
+
A[Action performed] --> B{Phase 1: Change Detection\ndiffFromInitial > 0.1%?}
|
|
27
|
+
B -- "Yes (screen changed)" --> C{Phase 2: Stability\nz-score < 0 or\ndiffPercent < 0.1%?}
|
|
28
|
+
C -- "Yes (frames stable)" --> D[Screen settled ✓]
|
|
29
|
+
B -- "No (waiting...)" --> B
|
|
30
|
+
C -- "No (waiting...)" --> C
|
|
31
|
+
```
|
|
32
|
+
|
|
33
|
+
### Polling
|
|
34
|
+
|
|
35
|
+
The system polls at **500ms intervals**, comparing screenshot frames. This reduces WebSocket traffic while still providing responsive detection.
|
|
36
|
+
|
|
37
|
+
### Pixel Comparison
|
|
38
|
+
|
|
39
|
+
Uses [pixelmatch](https://github.com/mapbox/pixelmatch) for per-pixel comparison with a threshold of `0.1` for pixel sensitivity. A frame diff above **0.1% of total pixels** indicates the screen has changed.
|
|
40
|
+
|
|
41
|
+
### Z-Score Analysis
|
|
42
|
+
|
|
43
|
+
Screen stability uses statistical analysis of the last **10 measurements**:
|
|
44
|
+
|
|
45
|
+
1. Calculate the mean and standard deviation of consecutive frame diffs
|
|
46
|
+
2. Compute the z-score: `(currentDiff - mean) / stddev`
|
|
47
|
+
3. Screen is stable when `diffPercent < 0.1%` or `z-score < 0` (current diff is below the average)
|
|
48
|
+
|
|
49
|
+
This approach adapts to the specific animation patterns of your application rather than using a fixed threshold.
|
|
50
|
+
|
|
51
|
+
## Per-Command Timeouts
|
|
52
|
+
|
|
53
|
+
Each command type has a specific redraw timeout:
|
|
54
|
+
|
|
55
|
+
| Command | Timeout | Reason |
|
|
56
|
+
|---------|---------|--------|
|
|
57
|
+
| `click` | 5000ms | Page navigations, modal openings |
|
|
58
|
+
| `hover` (within click) | 5000ms | Same as click |
|
|
59
|
+
| `hover` (standalone) | 2500ms | Tooltip animations |
|
|
60
|
+
| `scroll` | 5000ms | Lazy-loaded content |
|
|
61
|
+
| `type` | 5000ms | Autocomplete, validation |
|
|
62
|
+
| `pressKeys` | 5000ms | Keyboard shortcuts may trigger changes |
|
|
63
|
+
| `focusApplication` | 1000ms | Window focus animations |
|
|
64
|
+
|
|
65
|
+
If the timeout is reached before the screen settles, the command continues anyway. The timeout event is available via the `redraw:complete` event.
|
|
66
|
+
|
|
67
|
+
## Configuration
|
|
68
|
+
|
|
69
|
+
### Constructor Options
|
|
70
|
+
|
|
71
|
+
```javascript
|
|
72
|
+
const testdriver = new TestDriver({
|
|
73
|
+
// Shorthand: enable/disable
|
|
74
|
+
redraw: true, // enable with defaults
|
|
75
|
+
redraw: false, // disable (default since v7.3)
|
|
76
|
+
|
|
77
|
+
// Full configuration
|
|
78
|
+
redraw: {
|
|
79
|
+
enabled: true,
|
|
80
|
+
screenRedraw: true, // enable screen pixel diff detection
|
|
81
|
+
networkMonitor: false, // enable network settling detection
|
|
82
|
+
},
|
|
83
|
+
});
|
|
84
|
+
```
|
|
85
|
+
|
|
86
|
+
<ParamField path="redraw" type="RedrawConfig | boolean" default={false}>
|
|
87
|
+
Redraw configuration. Pass `true`/`false` for shorthand, or an object for fine-grained control.
|
|
88
|
+
|
|
89
|
+
<Expandable title="properties">
|
|
90
|
+
<ParamField path="enabled" type="boolean" default={false}>
|
|
91
|
+
Enable or disable the redraw system. Default changed to `false` in v7.3.
|
|
92
|
+
</ParamField>
|
|
93
|
+
|
|
94
|
+
<ParamField path="screenRedraw" type="boolean" default={true}>
|
|
95
|
+
Enable pixel-diff-based screen change detection. If both `screenRedraw` and `networkMonitor` are `false`, redraw auto-disables.
|
|
96
|
+
</ParamField>
|
|
97
|
+
|
|
98
|
+
<ParamField path="networkMonitor" type="boolean" default={false}>
|
|
99
|
+
Enable network traffic monitoring for settling detection. Monitors WebSocket traffic on the sandbox to detect when network activity subsides.
|
|
100
|
+
</ParamField>
|
|
101
|
+
</Expandable>
|
|
102
|
+
</ParamField>
|
|
103
|
+
|
|
104
|
+
### Per-Command Override
|
|
105
|
+
|
|
106
|
+
Override redraw settings for individual commands:
|
|
107
|
+
|
|
108
|
+
```javascript
|
|
109
|
+
// Enable redraw for a specific click
|
|
110
|
+
await testdriver.find('load more').click({
|
|
111
|
+
redraw: { enabled: true },
|
|
112
|
+
});
|
|
113
|
+
|
|
114
|
+
// Disable redraw for a fast interaction
|
|
115
|
+
await testdriver.find('checkbox').click({
|
|
116
|
+
redraw: false,
|
|
117
|
+
});
|
|
118
|
+
```
|
|
119
|
+
|
|
120
|
+
## Network Settling
|
|
121
|
+
|
|
122
|
+
When `networkMonitor` is enabled, the system also monitors sandbox network traffic:
|
|
123
|
+
|
|
124
|
+
- Polls for `totalBytesReceived` and `totalBytesSent` from the sandbox
|
|
125
|
+
- Keeps the last **60 measurements**
|
|
126
|
+
- Calculates z-scores for both RX and TX byte rates
|
|
127
|
+
- Network is **settled** when both RX and TX z-scores are negative (traffic is below average)
|
|
128
|
+
- Has a **10-second timeout** for network polling
|
|
129
|
+
- Non-critical: network errors are logged but never throw
|
|
130
|
+
|
|
131
|
+
The final settling condition requires **both** screen AND network to be settled (when both are enabled).
|
|
132
|
+
|
|
133
|
+
## Events
|
|
134
|
+
|
|
135
|
+
The redraw system emits events through the SDK emitter. See [Events](/v7/events) for the full event reference.
|
|
136
|
+
|
|
137
|
+
| Event | Description |
|
|
138
|
+
|---|---|
|
|
139
|
+
| `redraw:status` | Emitted on each poll with current screen diff, network stats, and timeout info |
|
|
140
|
+
| `redraw:complete` | Emitted when redraw resolves (settled or timed out) |
|
|
141
|
+
|
|
142
|
+
```javascript
|
|
143
|
+
testdriver.emitter.on('redraw:status', (status) => {
|
|
144
|
+
console.log(`Screen: ${status.redraw.text}`);
|
|
145
|
+
console.log(`Network: ${status.network.text}`);
|
|
146
|
+
console.log(`Timeout: ${status.timeout.text}`);
|
|
147
|
+
});
|
|
148
|
+
|
|
149
|
+
testdriver.emitter.on('redraw:complete', (result) => {
|
|
150
|
+
if (result.isTimeout) {
|
|
151
|
+
console.warn(`Redraw timed out after ${result.timeElapsed}ms`);
|
|
152
|
+
} else {
|
|
153
|
+
console.log(`Screen settled in ${result.timeElapsed}ms`);
|
|
154
|
+
}
|
|
155
|
+
});
|
|
156
|
+
```
|
|
157
|
+
|
|
158
|
+
## When to Use Redraw
|
|
159
|
+
|
|
160
|
+
**Enable redraw when:**
|
|
161
|
+
- Testing single-page applications (SPAs) with route transitions
|
|
162
|
+
- Interacting with pages that lazy-load content on scroll
|
|
163
|
+
- Clicking buttons that trigger animations or modals
|
|
164
|
+
- Testing apps with significant network-driven UI updates
|
|
165
|
+
|
|
166
|
+
**Keep redraw disabled when:**
|
|
167
|
+
- Tests are already stable without it
|
|
168
|
+
- You want faster test execution
|
|
169
|
+
- Your application has minimal animations
|
|
170
|
+
- You're using explicit waits or assertions instead
|
|
171
|
+
|
|
172
|
+
## Types
|
|
173
|
+
|
|
174
|
+
```typescript
|
|
175
|
+
interface RedrawConfig {
|
|
176
|
+
enabled?: boolean; // Default: false (since v7.3)
|
|
177
|
+
screenRedraw?: boolean; // Default: true
|
|
178
|
+
networkMonitor?: boolean; // Default: false
|
|
179
|
+
}
|
|
180
|
+
|
|
181
|
+
interface RedrawStatusEvent {
|
|
182
|
+
redraw: {
|
|
183
|
+
enabled: boolean;
|
|
184
|
+
settled: boolean;
|
|
185
|
+
hasChangedFromInitial: boolean;
|
|
186
|
+
consecutiveFramesStable: number;
|
|
187
|
+
diffFromInitial: number;
|
|
188
|
+
diffFromLast: number;
|
|
189
|
+
text: string;
|
|
190
|
+
};
|
|
191
|
+
network: {
|
|
192
|
+
enabled: boolean;
|
|
193
|
+
settled: boolean;
|
|
194
|
+
rxBytes: number;
|
|
195
|
+
txBytes: number;
|
|
196
|
+
text: string;
|
|
197
|
+
};
|
|
198
|
+
timeout: {
|
|
199
|
+
isTimeout: boolean;
|
|
200
|
+
elapsed: number;
|
|
201
|
+
max: number;
|
|
202
|
+
text: string;
|
|
203
|
+
};
|
|
204
|
+
}
|
|
205
|
+
|
|
206
|
+
interface RedrawCompleteEvent {
|
|
207
|
+
screenSettled: boolean;
|
|
208
|
+
hasChangedFromInitial: boolean;
|
|
209
|
+
consecutiveFramesStable: number;
|
|
210
|
+
networkSettled: boolean;
|
|
211
|
+
isTimeout: boolean;
|
|
212
|
+
timeElapsed: number;
|
|
213
|
+
}
|
|
214
|
+
```
|
|
@@ -0,0 +1,184 @@
|
|
|
1
|
+
---
|
|
2
|
+
name: testdriver:screenshots
|
|
3
|
+
description: Capture and manage screenshots during test execution
|
|
4
|
+
---
|
|
5
|
+
<!-- Generated from screenshots.mdx. DO NOT EDIT. -->
|
|
6
|
+
|
|
7
|
+
## Overview
|
|
8
|
+
|
|
9
|
+
TestDriver can capture screenshots manually at any point during a test, or automatically before and after every command. Screenshots are saved to a structured directory for easy debugging.
|
|
10
|
+
|
|
11
|
+
## Manual Screenshots
|
|
12
|
+
|
|
13
|
+
Use `testdriver.screenshot()` to capture the current screen:
|
|
14
|
+
|
|
15
|
+
```javascript
|
|
16
|
+
const path = await testdriver.screenshot();
|
|
17
|
+
console.log('Saved to:', path);
|
|
18
|
+
// .testdriver/screenshots/my-test/screenshot-1719849312345.png
|
|
19
|
+
```
|
|
20
|
+
|
|
21
|
+
### Options
|
|
22
|
+
|
|
23
|
+
```javascript
|
|
24
|
+
await testdriver.screenshot(filename?)
|
|
25
|
+
```
|
|
26
|
+
|
|
27
|
+
<ParamField path="filename" type="string">
|
|
28
|
+
Custom filename for the screenshot. `.png` is appended automatically if missing. If omitted, defaults to `screenshot-<timestamp>.png`.
|
|
29
|
+
</ParamField>
|
|
30
|
+
|
|
31
|
+
**Returns:** `Promise<string>` — the absolute file path of the saved screenshot.
|
|
32
|
+
|
|
33
|
+
```javascript
|
|
34
|
+
// Default filename
|
|
35
|
+
await testdriver.screenshot();
|
|
36
|
+
// → .testdriver/screenshots/my-test/screenshot-1719849312345.png
|
|
37
|
+
|
|
38
|
+
// Custom filename
|
|
39
|
+
await testdriver.screenshot('login-page');
|
|
40
|
+
// → .testdriver/screenshots/my-test/login-page.png
|
|
41
|
+
|
|
42
|
+
// With .png extension
|
|
43
|
+
await testdriver.screenshot('dashboard-loaded.png');
|
|
44
|
+
// → .testdriver/screenshots/my-test/dashboard-loaded.png
|
|
45
|
+
```
|
|
46
|
+
|
|
47
|
+
## Auto Screenshots
|
|
48
|
+
|
|
49
|
+
Enable automatic screenshots before and after every command:
|
|
50
|
+
|
|
51
|
+
```javascript
|
|
52
|
+
const testdriver = new TestDriver({
|
|
53
|
+
autoScreenshots: true,
|
|
54
|
+
});
|
|
55
|
+
```
|
|
56
|
+
|
|
57
|
+
<ParamField path="autoScreenshots" type="boolean" default={false}>
|
|
58
|
+
When `true`, captures a screenshot before and after every SDK command (`click`, `type`, `find`, `scroll`, `hover`, `pressKeys`, `assert`, `exec`, etc.). On error, an error-phase screenshot replaces the after-phase screenshot.
|
|
59
|
+
</ParamField>
|
|
60
|
+
|
|
61
|
+
### Filename Format
|
|
62
|
+
|
|
63
|
+
Auto-screenshots follow this naming convention:
|
|
64
|
+
|
|
65
|
+
```
|
|
66
|
+
<seq>-<action>-<phase>-L<line>-<description>.png
|
|
67
|
+
```
|
|
68
|
+
|
|
69
|
+
| Part | Description | Example |
|
|
70
|
+
|---|---|---|
|
|
71
|
+
| `seq` | 3-digit zero-padded sequence number | `001` |
|
|
72
|
+
| `action` | Command name | `click`, `type`, `find` |
|
|
73
|
+
| `phase` | `before`, `after`, or `error` | `before` |
|
|
74
|
+
| `L<line>` | Source line number from your test file | `L42` |
|
|
75
|
+
| `description` | Sanitized from command arguments (max 30 chars) | `submit-button` |
|
|
76
|
+
|
|
77
|
+
**Examples:**
|
|
78
|
+
```
|
|
79
|
+
001-find-before-L15-login-button.png
|
|
80
|
+
002-find-after-L15-login-button.png
|
|
81
|
+
003-click-before-L16-login-button.png
|
|
82
|
+
004-click-after-L16-login-button.png
|
|
83
|
+
005-type-before-L18-username-field.png
|
|
84
|
+
006-type-error-L18-username-field.png
|
|
85
|
+
```
|
|
86
|
+
|
|
87
|
+
### Phases
|
|
88
|
+
|
|
89
|
+
| Phase | When | Description |
|
|
90
|
+
|---|---|---|
|
|
91
|
+
| `before` | Before command executes | Captures the screen state before the action |
|
|
92
|
+
| `after` | After successful command | Captures the result of the action |
|
|
93
|
+
| `error` | After failed command | Captures the screen at the point of failure (replaces `after`) |
|
|
94
|
+
|
|
95
|
+
## Screenshot Directory
|
|
96
|
+
|
|
97
|
+
Screenshots are saved to:
|
|
98
|
+
|
|
99
|
+
```
|
|
100
|
+
<cwd>/.testdriver/screenshots/<testFileName>/
|
|
101
|
+
```
|
|
102
|
+
|
|
103
|
+
Where `<testFileName>` is the test file name without its extension. For example, a test at `tests/login.test.mjs` saves screenshots to `.testdriver/screenshots/login.test/`.
|
|
104
|
+
|
|
105
|
+
### Directory Cleanup
|
|
106
|
+
|
|
107
|
+
The screenshot directory for each test file is **automatically cleaned** at the start of a test run. This happens once per process per test file to prevent concurrent tests from the same file from interfering with each other.
|
|
108
|
+
|
|
109
|
+
## Debug Screenshots
|
|
110
|
+
|
|
111
|
+
Elements have a `saveDebugScreenshot()` method for debugging element detection:
|
|
112
|
+
|
|
113
|
+
```javascript
|
|
114
|
+
const el = await testdriver.find('submit button');
|
|
115
|
+
|
|
116
|
+
// Save the screenshot that was used to detect this element
|
|
117
|
+
const debugPath = await el.saveDebugScreenshot();
|
|
118
|
+
console.log('Debug screenshot:', debugPath);
|
|
119
|
+
// → ./debug-screenshot-1719849312345.png
|
|
120
|
+
|
|
121
|
+
// Custom path
|
|
122
|
+
await el.saveDebugScreenshot('./my-debug.png');
|
|
123
|
+
```
|
|
124
|
+
|
|
125
|
+
This saves the screenshot that was captured during the `find()` call, which can be useful for understanding what the AI "saw" when locating the element.
|
|
126
|
+
|
|
127
|
+
## Complete Example
|
|
128
|
+
|
|
129
|
+
```javascript
|
|
130
|
+
import { describe, it, beforeAll, afterAll } from 'vitest';
|
|
131
|
+
import TestDriver from 'testdriverai';
|
|
132
|
+
|
|
133
|
+
describe('Screenshot Example', () => {
|
|
134
|
+
let testdriver;
|
|
135
|
+
|
|
136
|
+
beforeAll(async () => {
|
|
137
|
+
testdriver = new TestDriver({
|
|
138
|
+
autoScreenshots: true, // capture every step
|
|
139
|
+
});
|
|
140
|
+
await testdriver.ready();
|
|
141
|
+
await testdriver.provision.chrome({ url: 'https://example.com' });
|
|
142
|
+
});
|
|
143
|
+
|
|
144
|
+
afterAll(async () => {
|
|
145
|
+
await testdriver.disconnect();
|
|
146
|
+
});
|
|
147
|
+
|
|
148
|
+
it('captures the login flow', async () => {
|
|
149
|
+
// Auto-screenshots capture before/after each command
|
|
150
|
+
|
|
151
|
+
// Manual screenshot for a specific moment
|
|
152
|
+
await testdriver.screenshot('initial-page-load');
|
|
153
|
+
|
|
154
|
+
const username = await testdriver.find('username input');
|
|
155
|
+
await username.click();
|
|
156
|
+
await testdriver.type('testuser@example.com');
|
|
157
|
+
|
|
158
|
+
await testdriver.screenshot('after-username-entry');
|
|
159
|
+
|
|
160
|
+
const password = await testdriver.find('password input');
|
|
161
|
+
await password.click();
|
|
162
|
+
await testdriver.type('password123');
|
|
163
|
+
|
|
164
|
+
await testdriver.find('login button').click();
|
|
165
|
+
|
|
166
|
+
await testdriver.screenshot('after-login-click');
|
|
167
|
+
});
|
|
168
|
+
});
|
|
169
|
+
```
|
|
170
|
+
|
|
171
|
+
After running, your screenshot directory will contain:
|
|
172
|
+
```
|
|
173
|
+
.testdriver/screenshots/login-flow.test/
|
|
174
|
+
├── initial-page-load.png
|
|
175
|
+
├── 001-find-before-L18-username-input.png
|
|
176
|
+
├── 002-find-after-L18-username-input.png
|
|
177
|
+
├── 003-click-before-L19-username-input.png
|
|
178
|
+
├── 004-click-after-L19-username-input.png
|
|
179
|
+
├── 005-type-before-L20-testuser-example-com.png
|
|
180
|
+
├── 006-type-after-L20-testuser-example-com.png
|
|
181
|
+
├── after-username-entry.png
|
|
182
|
+
├── 007-find-before-L24-password-input.png
|
|
183
|
+
├── ...
|
|
184
|
+
```
|
|
@@ -2,104 +2,104 @@
|
|
|
2
2
|
"$schema": "./examples-manifest.schema.json",
|
|
3
3
|
"examples": {
|
|
4
4
|
"assert.test.mjs": {
|
|
5
|
-
"url": "https://console.testdriver.ai/runs/
|
|
6
|
-
"lastUpdated": "2026-03-
|
|
5
|
+
"url": "https://console-test.testdriver.ai/runs/69bc950536864abb362f8579/69bc951f36864abb362f8584",
|
|
6
|
+
"lastUpdated": "2026-03-20T00:46:19.602Z"
|
|
7
7
|
},
|
|
8
8
|
"drag-and-drop.test.mjs": {
|
|
9
9
|
"url": "https://console.testdriver.ai/runs/69a62b3aaa712ecd3dea730a/69a62b42fc0ac3cc632a918b",
|
|
10
10
|
"lastUpdated": "2026-03-03T00:32:25.275Z"
|
|
11
11
|
},
|
|
12
12
|
"exec-pwsh.test.mjs": {
|
|
13
|
-
"url": "https://console.testdriver.ai/runs/
|
|
14
|
-
"lastUpdated": "2026-03-
|
|
13
|
+
"url": "https://console-test.testdriver.ai/runs/69bc950536864abb362f8579/69bc95088797a8a13f4cbfa2",
|
|
14
|
+
"lastUpdated": "2026-03-20T00:46:19.594Z"
|
|
15
15
|
},
|
|
16
16
|
"match-image.test.mjs": {
|
|
17
|
-
"url": "https://console.testdriver.ai/runs/
|
|
18
|
-
"lastUpdated": "2026-03-
|
|
17
|
+
"url": "https://console-test.testdriver.ai/runs/69bc950536864abb362f8579/69bc950af14c7f71c46d6b78",
|
|
18
|
+
"lastUpdated": "2026-03-20T00:46:19.594Z"
|
|
19
19
|
},
|
|
20
20
|
"scroll-until-text.test.mjs": {
|
|
21
21
|
"url": "https://console.testdriver.ai/runs/69a62b3aaa712ecd3dea730a/69a62b99dc33133fc0da9440",
|
|
22
22
|
"lastUpdated": "2026-03-03T00:32:25.282Z"
|
|
23
23
|
},
|
|
24
24
|
"hover-text-with-description.test.mjs": {
|
|
25
|
-
"url": "https://console.testdriver.ai/runs/
|
|
26
|
-
"lastUpdated": "2026-03-
|
|
25
|
+
"url": "https://console-test.testdriver.ai/runs/69bc950536864abb362f8579/69bc950c8797a8a13f4cbfa3",
|
|
26
|
+
"lastUpdated": "2026-03-20T00:46:19.594Z"
|
|
27
27
|
},
|
|
28
28
|
"windows-installer.test.mjs": {
|
|
29
|
-
"url": "https://console.testdriver.ai/runs/
|
|
30
|
-
"lastUpdated": "2026-03-
|
|
29
|
+
"url": "https://console-test.testdriver.ai/runs/69bc950536864abb362f8579/69bc9510f14c7f71c46d6b7a",
|
|
30
|
+
"lastUpdated": "2026-03-20T00:46:19.595Z"
|
|
31
31
|
},
|
|
32
32
|
"exec-output.test.mjs": {
|
|
33
|
-
"url": "https://console.testdriver.ai/runs/
|
|
34
|
-
"lastUpdated": "2026-03-
|
|
33
|
+
"url": "https://console-test.testdriver.ai/runs/69bc950536864abb362f8579/69bc95118797a8a13f4cbfa5",
|
|
34
|
+
"lastUpdated": "2026-03-20T00:46:19.595Z"
|
|
35
35
|
},
|
|
36
36
|
"chrome-extension.test.mjs": {
|
|
37
|
-
"url": "https://console.testdriver.ai/runs/
|
|
38
|
-
"lastUpdated": "2026-03-
|
|
37
|
+
"url": "https://console-test.testdriver.ai/runs/69bc950536864abb362f8579/69bc9507f14c7f71c46d6b77",
|
|
38
|
+
"lastUpdated": "2026-03-20T00:46:19.594Z"
|
|
39
39
|
},
|
|
40
40
|
"launch-vscode-linux.test.mjs": {
|
|
41
|
-
"url": "https://console.testdriver.ai/runs/
|
|
42
|
-
"lastUpdated": "2026-03-
|
|
41
|
+
"url": "https://console-test.testdriver.ai/runs/69bc950536864abb362f8579/69bc950e8797a8a13f4cbfa4",
|
|
42
|
+
"lastUpdated": "2026-03-20T00:46:19.595Z"
|
|
43
43
|
},
|
|
44
44
|
"hover-image.test.mjs": {
|
|
45
|
-
"url": "https://console.testdriver.ai/runs/
|
|
46
|
-
"lastUpdated": "2026-03-
|
|
45
|
+
"url": "https://console-test.testdriver.ai/runs/69bc950536864abb362f8579/69bc95138797a8a13f4cbfa6",
|
|
46
|
+
"lastUpdated": "2026-03-20T00:46:19.595Z"
|
|
47
47
|
},
|
|
48
48
|
"installer.test.mjs": {
|
|
49
|
-
"url": "https://console.testdriver.ai/runs/
|
|
50
|
-
"lastUpdated": "2026-03-
|
|
49
|
+
"url": "https://console-test.testdriver.ai/runs/69bc950536864abb362f8579/69bc951636864abb362f857c",
|
|
50
|
+
"lastUpdated": "2026-03-20T00:46:19.600Z"
|
|
51
51
|
},
|
|
52
52
|
"type.test.mjs": {
|
|
53
|
-
"url": "https://console.testdriver.ai/runs/
|
|
54
|
-
"lastUpdated": "2026-03-
|
|
53
|
+
"url": "https://console-test.testdriver.ai/runs/69bc950536864abb362f8579/69bc9517f14c7f71c46d6b7c",
|
|
54
|
+
"lastUpdated": "2026-03-20T00:46:19.600Z"
|
|
55
55
|
},
|
|
56
56
|
"press-keys.test.mjs": {
|
|
57
|
-
"url": "https://console.testdriver.ai/runs/
|
|
58
|
-
"lastUpdated": "2026-03-
|
|
57
|
+
"url": "https://console-test.testdriver.ai/runs/69bc950536864abb362f8579/69bc951df14c7f71c46d6b84",
|
|
58
|
+
"lastUpdated": "2026-03-20T00:46:19.602Z"
|
|
59
59
|
},
|
|
60
60
|
"scroll-keyboard.test.mjs": {
|
|
61
|
-
"url": "https://console.testdriver.ai/runs/
|
|
62
|
-
"lastUpdated": "2026-03-
|
|
61
|
+
"url": "https://console-test.testdriver.ai/runs/69bc950536864abb362f8579/69bc951b8797a8a13f4cbfa7",
|
|
62
|
+
"lastUpdated": "2026-03-20T00:46:19.601Z"
|
|
63
63
|
},
|
|
64
64
|
"scroll.test.mjs": {
|
|
65
|
-
"url": "https://console.testdriver.ai/runs/
|
|
66
|
-
"lastUpdated": "2026-03-
|
|
65
|
+
"url": "https://console-test.testdriver.ai/runs/69bc950536864abb362f8579/69bc9519f14c7f71c46d6b7f",
|
|
66
|
+
"lastUpdated": "2026-03-20T00:46:19.600Z"
|
|
67
67
|
},
|
|
68
68
|
"scroll-until-image.test.mjs": {
|
|
69
|
-
"url": "https://console.testdriver.ai/runs/
|
|
70
|
-
"lastUpdated": "2026-03-
|
|
69
|
+
"url": "https://console-test.testdriver.ai/runs/69bc950536864abb362f8579/69bc95238797a8a13f4cbfb3",
|
|
70
|
+
"lastUpdated": "2026-03-20T00:46:19.602Z"
|
|
71
71
|
},
|
|
72
72
|
"prompt.test.mjs": {
|
|
73
|
-
"url": "https://console.testdriver.ai/runs/
|
|
74
|
-
"lastUpdated": "2026-03-
|
|
73
|
+
"url": "https://console-test.testdriver.ai/runs/69bc950536864abb362f8579/69bc952436864abb362f8586",
|
|
74
|
+
"lastUpdated": "2026-03-20T00:46:19.602Z"
|
|
75
75
|
},
|
|
76
76
|
"focus-window.test.mjs": {
|
|
77
|
-
"url": "https://console.testdriver.ai/runs/
|
|
78
|
-
"lastUpdated": "2026-03-
|
|
77
|
+
"url": "https://console-test.testdriver.ai/runs/69bc950536864abb362f8579/69bc9526f14c7f71c46d6b85",
|
|
78
|
+
"lastUpdated": "2026-03-20T00:46:19.602Z"
|
|
79
79
|
},
|
|
80
80
|
"captcha-api.test.mjs": {
|
|
81
81
|
"url": "https://console.testdriver.ai/runs/698f7df69e27ce1528d7d087/698f7fb0d3b320ad547d9d44",
|
|
82
82
|
"lastUpdated": "2026-02-13T19:55:05.951Z"
|
|
83
83
|
},
|
|
84
84
|
"element-not-found.test.mjs": {
|
|
85
|
-
"url": "https://console.testdriver.ai/runs/
|
|
86
|
-
"lastUpdated": "2026-03-
|
|
85
|
+
"url": "https://console-test.testdriver.ai/runs/69bc950536864abb362f8579/69bc952af14c7f71c46d6b89",
|
|
86
|
+
"lastUpdated": "2026-03-20T00:46:19.602Z"
|
|
87
87
|
},
|
|
88
88
|
"formatted-logging.test.mjs": {
|
|
89
|
-
"url": "https://console.testdriver.ai/runs/
|
|
90
|
-
"lastUpdated": "2026-03-
|
|
89
|
+
"url": "https://console-test.testdriver.ai/runs/69bc950536864abb362f8579/69bc95288797a8a13f4cbfb7",
|
|
90
|
+
"lastUpdated": "2026-03-20T00:46:19.602Z"
|
|
91
91
|
},
|
|
92
92
|
"hover-text.test.mjs": {
|
|
93
|
-
"url": "https://console.testdriver.ai/runs/
|
|
94
|
-
"lastUpdated": "2026-03-
|
|
93
|
+
"url": "https://console-test.testdriver.ai/runs/69bc950536864abb362f8579/69bc952e8797a8a13f4cbfc1",
|
|
94
|
+
"lastUpdated": "2026-03-20T00:46:19.603Z"
|
|
95
95
|
},
|
|
96
96
|
"no-provision.test.mjs": {
|
|
97
97
|
"url": "https://console.testdriver.ai/runs/69a62b3aaa712ecd3dea730a/69a62b7706a177a05bccd1cf",
|
|
98
98
|
"lastUpdated": "2026-03-03T00:32:25.279Z"
|
|
99
99
|
},
|
|
100
100
|
"ai.test.mjs": {
|
|
101
|
-
"url": "https://console.testdriver.ai/runs/
|
|
102
|
-
"lastUpdated": "2026-03-
|
|
101
|
+
"url": "https://console-test.testdriver.ai/runs/69bc950536864abb362f8579/69bc952cf14c7f71c46d6b90",
|
|
102
|
+
"lastUpdated": "2026-03-20T00:46:19.603Z"
|
|
103
103
|
},
|
|
104
104
|
"popup-loading.test.mjs": {
|
|
105
105
|
"url": "https://console.testdriver.ai/runs/698bc89f7140c3fa7daaca8d/698bca7f7140c3fa7daacbf7",
|
|
@@ -134,12 +134,12 @@
|
|
|
134
134
|
"lastUpdated": "2026-02-13T19:55:05.953Z"
|
|
135
135
|
},
|
|
136
136
|
"findall-coffee-icons.test.mjs": {
|
|
137
|
-
"url": "https://console.testdriver.ai/runs/
|
|
138
|
-
"lastUpdated": "2026-03-
|
|
137
|
+
"url": "https://console-test.testdriver.ai/runs/69bc950536864abb362f8579/69bc95218797a8a13f4cbfb2",
|
|
138
|
+
"lastUpdated": "2026-03-20T00:46:19.602Z"
|
|
139
139
|
},
|
|
140
140
|
"parse.test.mjs": {
|
|
141
|
-
"url": "https://console.testdriver.ai/runs/
|
|
142
|
-
"lastUpdated": "2026-03-
|
|
141
|
+
"url": "https://console-test.testdriver.ai/runs/69bc950536864abb362f8579/69bc953036864abb362f858e",
|
|
142
|
+
"lastUpdated": "2026-03-20T00:46:19.603Z"
|
|
143
143
|
},
|
|
144
144
|
"flake-diffthreshold-001.test.mjs": {
|
|
145
145
|
"url": "https://console.testdriver.ai/runs/69a62b3aaa712ecd3dea730a/69a62bcafc0ac3cc632a91aa",
|