@testdriverai/agent 7.11.239-test → 7.11.241-canary
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/ai/skills/testdriver-agent/SKILL.md +174 -91
- package/ai/skills/testdriver-assert/SKILL.md +73 -269
- package/ai/skills/testdriver-aws-setup/SKILL.md +194 -312
- package/ai/skills/testdriver-bring-your-own-machine/SKILL.md +137 -204
- package/ai/skills/testdriver-cache/SKILL.md +142 -149
- package/ai/skills/testdriver-caching/SKILL.md +97 -87
- package/ai/skills/testdriver-captcha/SKILL.md +126 -111
- package/ai/skills/testdriver-ci-cd/SKILL.md +153 -542
- package/ai/skills/testdriver-click/SKILL.md +74 -229
- package/ai/skills/testdriver-client/SKILL.md +175 -229
- package/ai/skills/testdriver-customizing-devices/SKILL.md +72 -250
- package/ai/skills/testdriver-dashcam/SKILL.md +71 -404
- package/ai/skills/testdriver-debugging-with-screenshots/SKILL.md +103 -369
- package/ai/skills/testdriver-double-click/SKILL.md +46 -67
- package/ai/skills/testdriver-errors/SKILL.md +102 -176
- package/ai/skills/testdriver-events/SKILL.md +170 -327
- package/ai/skills/testdriver-exec/SKILL.md +92 -256
- package/ai/skills/testdriver-extract/SKILL.md +69 -170
- package/ai/skills/testdriver-find/SKILL.md +140 -736
- package/ai/skills/testdriver-focus-application/SKILL.md +69 -246
- package/ai/skills/testdriver-generating-tests/SKILL.md +102 -136
- package/ai/skills/testdriver-hosted/SKILL.md +79 -143
- package/ai/skills/testdriver-hover/SKILL.md +62 -235
- package/ai/skills/testdriver-locating-elements/SKILL.md +71 -366
- package/ai/skills/testdriver-making-assertions/SKILL.md +114 -72
- package/ai/skills/testdriver-mcp-setup/SKILL.md +79 -62
- package/ai/skills/testdriver-mouse-down/SKILL.md +46 -124
- package/ai/skills/testdriver-mouse-up/SKILL.md +45 -128
- package/ai/skills/testdriver-options/SKILL.md +73 -46
- package/ai/skills/testdriver-parse/SKILL.md +95 -184
- package/ai/skills/testdriver-performing-actions/SKILL.md +101 -91
- package/ai/skills/testdriver-press-keys/SKILL.md +59 -299
- package/ai/skills/testdriver-provision/SKILL.md +135 -179
- package/ai/skills/testdriver-quickstart/SKILL.md +24 -8
- package/ai/skills/testdriver-quickstart-claude/SKILL.md +84 -0
- package/ai/skills/testdriver-quickstart-github/SKILL.md +62 -32
- package/ai/skills/testdriver-quickstart-manual/SKILL.md +59 -32
- package/ai/skills/testdriver-quickstart-vscode/SKILL.md +96 -0
- package/ai/skills/testdriver-redraw/SKILL.md +100 -164
- package/ai/skills/testdriver-reusable-code/SKILL.md +95 -199
- package/ai/skills/testdriver-right-click/SKILL.md +45 -88
- package/ai/skills/testdriver-screenshot/SKILL.md +47 -201
- package/ai/skills/testdriver-screenshots/SKILL.md +86 -136
- package/ai/skills/testdriver-scroll/SKILL.md +71 -154
- package/ai/skills/testdriver-secrets/SKILL.md +94 -90
- package/ai/skills/testdriver-self-hosted/SKILL.md +82 -140
- package/ai/skills/testdriver-test-results-json/SKILL.md +165 -202
- package/ai/skills/testdriver-type/SKILL.md +56 -304
- package/ai/skills/testdriver-variables/SKILL.md +119 -80
- package/ai/skills/testdriver-wait/SKILL.md +31 -29
- package/ai/skills/testdriver-what-is-testdriver/SKILL.md +80 -32
- package/package.json +1 -1
|
@@ -1,214 +1,150 @@
|
|
|
1
1
|
---
|
|
2
2
|
name: testdriver:redraw
|
|
3
|
-
description:
|
|
3
|
+
description: Make actions wait until the screen stops changing before the next step runs.
|
|
4
4
|
---
|
|
5
5
|
<!-- Generated from redraw.mdx. DO NOT EDIT. -->
|
|
6
6
|
|
|
7
|
-
|
|
7
|
+
Redraw detection makes each action wait until the screen has changed and then stopped changing.
|
|
8
8
|
|
|
9
|
-
|
|
9
|
+
- Use it for apps with animations, page transitions, or content that loads after a click.
|
|
10
|
+
- It's off by default. Without it, the next command runs as soon as the action is sent.
|
|
11
|
+
- It can also wait for network traffic in the sandbox to die down.
|
|
10
12
|
|
|
11
|
-
|
|
12
|
-
**Redraw is disabled by default from v7.3.** Enable it if your tests interact with applications that have many animations or load states.
|
|
13
|
-
</Note>
|
|
13
|
+
## Turn it on
|
|
14
14
|
|
|
15
|
-
|
|
15
|
+
Pass `redraw: true` when you create the client:
|
|
16
16
|
|
|
17
|
-
|
|
17
|
+
```javascript tests/search.test.mjs
|
|
18
|
+
import { describe, expect, it } from 'vitest';
|
|
19
|
+
import { TestDriver } from 'testdriverai/vitest/hooks';
|
|
18
20
|
|
|
19
|
-
|
|
20
|
-
|
|
21
|
+
describe('Search', () => {
|
|
22
|
+
it('shows results after searching', async (context) => {
|
|
23
|
+
const testdriver = TestDriver(context, { redraw: true });
|
|
24
|
+
await testdriver.provision.chrome({ url: 'https://testdriver-sandbox.vercel.app/login' });
|
|
21
25
|
|
|
22
|
-
|
|
26
|
+
// With redraw on, click() returns once the error message has finished drawing
|
|
27
|
+
await testdriver.find('Sign in button below the password field').click();
|
|
23
28
|
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
C -- "Yes (frames stable)" --> D[Screen settled ✓]
|
|
29
|
-
B -- "No (waiting...)" --> B
|
|
30
|
-
C -- "No (waiting...)" --> C
|
|
29
|
+
const result = await testdriver.assert('an error says the fields are required');
|
|
30
|
+
expect(result).toBe(true);
|
|
31
|
+
});
|
|
32
|
+
});
|
|
31
33
|
```
|
|
32
34
|
|
|
33
|
-
|
|
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
|
|
35
|
+
Every click, hover, type, key press, scroll, and `focusApplication()` call now waits for the screen to settle.
|
|
42
36
|
|
|
43
|
-
|
|
37
|
+
## What it waits for
|
|
44
38
|
|
|
45
|
-
|
|
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)
|
|
39
|
+
TestDriver takes a small screenshot right before the action, then one every 500 ms after it. The screen counts as settled when both of these are true:
|
|
48
40
|
|
|
49
|
-
|
|
41
|
+
1. **The screen changed.** A frame differs from the "before" screenshot by more than 0.1% of its pixels.
|
|
42
|
+
2. **The screen stopped changing.** The latest frame differs from the previous one by less than 0.1%, or by less than the average of the last 10 frames.
|
|
50
43
|
|
|
51
|
-
|
|
44
|
+
If the screen doesn't settle in time, the command carries on anyway. It doesn't throw.
|
|
52
45
|
|
|
53
|
-
|
|
46
|
+
| Command | Waits at most |
|
|
47
|
+
| --- | --- |
|
|
48
|
+
| `click()`, `doubleClick()`, `rightClick()`, `mouseDown()`, `mouseUp()` | 5 s |
|
|
49
|
+
| `hover()` | 2.5 s |
|
|
50
|
+
| `type()` | 5 s |
|
|
51
|
+
| `pressKeys()` | 5 s |
|
|
52
|
+
| `scroll()` | 5 s |
|
|
53
|
+
| `focusApplication()` | 1 s |
|
|
54
54
|
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
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 |
|
|
55
|
+
<Warning>
|
|
56
|
+
An action that doesn't change the screen never meets the first condition. It waits the full timeout, such as 5 seconds for a click. Turn redraw off for those commands (see below) or leave it off and use [`wait()`](/wait) where you need it.
|
|
57
|
+
</Warning>
|
|
64
58
|
|
|
65
|
-
|
|
59
|
+
## Wait for network traffic too
|
|
66
60
|
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
### Constructor Options
|
|
61
|
+
Set `thresholds.network` to also wait until the sandbox's network traffic drops below its recent average:
|
|
70
62
|
|
|
71
63
|
```javascript
|
|
72
|
-
const testdriver =
|
|
73
|
-
|
|
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
|
-
},
|
|
64
|
+
const testdriver = TestDriver(context, {
|
|
65
|
+
redraw: { thresholds: { network: true } },
|
|
83
66
|
});
|
|
84
67
|
```
|
|
85
68
|
|
|
86
|
-
|
|
87
|
-
|
|
69
|
+
TestDriver then waits for both the screen and the network to settle, within the same timeouts.
|
|
70
|
+
|
|
71
|
+
To wait for the network only, turn off the screen check with `thresholds: { screen: false, network: true }`.
|
|
72
|
+
|
|
73
|
+
## Options
|
|
74
|
+
|
|
75
|
+
<ParamField path="redraw" type="boolean | object" default="false">
|
|
76
|
+
`true` turns on screen detection. Pass an object to choose what to wait for.
|
|
88
77
|
|
|
89
78
|
<Expandable title="properties">
|
|
90
|
-
<ParamField path="enabled" type="boolean" default=
|
|
91
|
-
|
|
79
|
+
<ParamField path="enabled" type="boolean" default="true">
|
|
80
|
+
Whether redraw detection is on when you pass an object.
|
|
92
81
|
</ParamField>
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
82
|
+
<ParamField path="thresholds" type="object">
|
|
83
|
+
<Expandable title="properties">
|
|
84
|
+
<ParamField path="screen" type="number | false">
|
|
85
|
+
Set to `false` to skip the screen check. Any other value leaves it on. The 0.1% change threshold is fixed.
|
|
86
|
+
</ParamField>
|
|
87
|
+
<ParamField path="network" type="boolean" default="false">
|
|
88
|
+
Also wait for network traffic in the sandbox to settle.
|
|
89
|
+
</ParamField>
|
|
90
|
+
</Expandable>
|
|
100
91
|
</ParamField>
|
|
101
92
|
</Expandable>
|
|
102
93
|
</ParamField>
|
|
103
94
|
|
|
104
|
-
|
|
95
|
+
<Note>
|
|
96
|
+
Older tests may use `redrawThreshold`, or `diffThreshold`, `screenRedraw`, and `networkMonitor` inside `redraw`. They still work, but are deprecated. Use `redraw` with `thresholds` instead.
|
|
97
|
+
</Note>
|
|
98
|
+
|
|
99
|
+
## Override it for one command
|
|
105
100
|
|
|
106
|
-
|
|
101
|
+
The client's action methods accept a `redraw` object as an option. It applies to that call only:
|
|
107
102
|
|
|
108
103
|
```javascript
|
|
109
|
-
//
|
|
110
|
-
await testdriver.
|
|
111
|
-
redraw: { enabled: true },
|
|
112
|
-
});
|
|
104
|
+
// Wait for this key press even though redraw is off for the client
|
|
105
|
+
await testdriver.pressKeys(['enter'], { redraw: { enabled: true } });
|
|
113
106
|
|
|
114
|
-
//
|
|
115
|
-
await testdriver.
|
|
116
|
-
redraw: false,
|
|
117
|
-
});
|
|
107
|
+
// Skip the wait for a click you know changes nothing on screen
|
|
108
|
+
await testdriver.click({ x: 640, y: 360, redraw: { enabled: false } });
|
|
118
109
|
```
|
|
119
110
|
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
When `networkMonitor` is enabled, the system also monitors sandbox network traffic:
|
|
111
|
+
This works on `testdriver.click()`, `hover()`, `type()`, `pressKeys()`, `scroll()`, and `focusApplication()`.
|
|
123
112
|
|
|
124
|
-
-
|
|
125
|
-
-
|
|
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
|
|
113
|
+
- Pass an object. A per-command `redraw: true` or `redraw: false` is ignored.
|
|
114
|
+
- Element methods such as `element.click()` don't take options. They always use the client's setting.
|
|
130
115
|
|
|
131
|
-
|
|
116
|
+
## Watch it work
|
|
132
117
|
|
|
133
|
-
|
|
118
|
+
Redraw emits two events on the client's [event emitter](/events#redraw-events):
|
|
134
119
|
|
|
135
|
-
|
|
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) |
|
|
120
|
+
- `redraw:status` on every check, with the current screen and network state.
|
|
121
|
+
- `redraw:complete` when the wait ends, with `isTimeout` and `timeElapsed`.
|
|
141
122
|
|
|
142
123
|
```javascript
|
|
143
|
-
testdriver.
|
|
144
|
-
|
|
145
|
-
|
|
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`);
|
|
124
|
+
testdriver.getEmitter().on('redraw:complete', ({ isTimeout, timeElapsed }) => {
|
|
125
|
+
if (isTimeout) {
|
|
126
|
+
console.warn(`Screen didn't settle within ${timeElapsed} ms`);
|
|
154
127
|
}
|
|
155
128
|
});
|
|
156
129
|
```
|
|
157
130
|
|
|
158
|
-
## When to
|
|
159
|
-
|
|
160
|
-
|
|
161
|
-
|
|
162
|
-
-
|
|
163
|
-
-
|
|
164
|
-
-
|
|
165
|
-
|
|
166
|
-
|
|
167
|
-
|
|
168
|
-
-
|
|
169
|
-
-
|
|
170
|
-
- You
|
|
171
|
-
|
|
172
|
-
##
|
|
173
|
-
|
|
174
|
-
|
|
175
|
-
|
|
176
|
-
|
|
177
|
-
|
|
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
|
-
```
|
|
131
|
+
## When to use it
|
|
132
|
+
|
|
133
|
+
Turn redraw on when:
|
|
134
|
+
|
|
135
|
+
- Clicks open pages, modals, or menus that animate in.
|
|
136
|
+
- Scrolling loads more content.
|
|
137
|
+
- Typing triggers autocomplete or validation messages.
|
|
138
|
+
|
|
139
|
+
Leave it off when:
|
|
140
|
+
|
|
141
|
+
- Your tests already pass reliably without it. Each action takes longer with it on.
|
|
142
|
+
- Many actions don't visibly change the screen.
|
|
143
|
+
- You already wait with `find()` and a `timeout`, which keeps looking until the element appears.
|
|
144
|
+
|
|
145
|
+
## Related
|
|
146
|
+
|
|
147
|
+
- [Options](/options#redraw-detection): every client option
|
|
148
|
+
- [Events](/events): the full list of events
|
|
149
|
+
- [wait()](/wait): pause for a fixed time
|
|
150
|
+
- [Locate elements](/locating-elements): wait for an element to appear with `find()`
|