testdriver-agent
How the TestDriver agent behaves on GitHub issues, pull requests, and @mentions
Wait for the screen to stabilize after interactions
Claude Code
$ npx -y skills add testdriverai/testdriverai --skill testdriver-redraw --agent claude-code
Codex
$ npx skills add testdriverai/testdriverai --skill testdriver-redraw -a codex -y
Cursor
$ npx skills add testdriverai/testdriverai --skill testdriver-redraw -a cursor -y
Gemini CLI
$ npx skills add testdriverai/testdriverai --skill testdriver-redraw -a gemini-cli -y
GitHub Copilot
$ npx skills add testdriverai/testdriverai --skill testdriver-redraw -a github-copilot -y
OpenCode
$ npx skills add testdriverai/testdriverai --skill testdriver-redraw -a opencode -y
Windsurf
$ npx skills add testdriverai/testdriverai --skill testdriver-redraw -a windsurf -y
name: testdriver:redraw description: Wait for the screen to stabilize after interactions
<!-- Generated from redraw.mdx. DO NOT EDIT. -->
The redraw system waits for the screen to become stable after an interaction. Then it continues. It finds when animations, page loads, and network requests are complete. This stops actions on a screen that changes.
<Note> **Redraw is disabled by default from v7.3.** Enable it if your tests interact with applications that have many animations or load states. </Note>
Redraw uses a **two-phase detection** method:
1. **Change Detection**. TestDriver compares the present frame to the first screenshot from after the action. If the pixel diff is more than 0.1%, the screen changed. 2. **Stability Detection** — TestDriver compares frames that come after each other with z-score analysis. When the diff between frames is less than 0.1%, or the z-score is negative (the present diff is less than the average), the screen is complete.
The screen is **complete** when both phases finish: the screen changed from the first state AND the frames that come after each other are now stable.
flowchart TD
A[Action performed] --> B{Phase 1: Change Detection\ndiffFromInitial > 0.1%?}
B -- "Yes (screen changed)" --> C{Phase 2: Stability\nz-score < 0 or\ndiffPercent < 0.1%?}
C -- "Yes (frames stable)" --> D[Screen settled ✓]
B -- "No (waiting...)" --> B
C -- "No (waiting...)" --> CThe system polls at **500ms intervals**, comparing screenshot frames. This reduces WebSocket traffic while still providing responsive detection.
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.
Screen stability uses statistical analysis of the last **10 measurements**:
1. Calculate the mean and standard deviation of consecutive frame diffs 2. Compute the z-score: `(currentDiff - mean) / stddev` 3. Screen is stable when `diffPercent < 0.1%` or `z-score < 0` (current diff is below the average)
This approach adapts to the specific animation patterns of your application rather than using a fixed threshold.
Each command type has a specific redraw timeout:
| Command | Timeout | Reason | |---------|---------|--------| | `click` | 5000ms | Page navigations, modal openings | | `hover` (within click) | 5000ms | Same as click | | `hover` (standalone) | 2500ms | Tooltip animations | | `scroll` | 5000ms | Lazy-loaded content | | `type` | 5000ms | Autocomplete, validation | | `pressKeys` | 5000ms | Keyboard shortcuts may trigger changes | | `focusApplication` | 1000ms | Window focus animations |
If the timeout is reached before the screen settles, the command continues anyway. The timeout event is available via the `redraw:complete` event.
const testdriver = new TestDriver({
// Shorthand: enable/disable
redraw: true, // enable with defaults
redraw: false, // disable (default since v7.3)
// Full configuration
redraw: {
enabled: true,
screenRedraw: true, // enable screen pixel diff detection
networkMonitor: false, // enable network settling detection
},
});<ParamField path="redraw" type="RedrawConfig | boolean" default={false}> Redraw configuration. Pass `true`/`false` for shorthand, or an object for fine-grained control.
<Expandable title="properties"> <ParamField path="enabled" type="boolean" default={false}> Enable or disable the redraw system. Default changed to `false` in v7.3. </ParamField>
<ParamField path="screenRedraw" type="boolean" default={true}> Enable pixel-diff-based screen change detection. If both `screenRedraw` and `networkMonitor` are `false`, redraw auto-disables. </ParamField>
<ParamField path="networkMonitor" type="boolean" default={false}> Enable network traffic monitoring for settling detection. Monitors WebSocket traffic on the sandbox to detect when network activity subsides. </ParamField> </Expandable> </ParamField>
Override redraw settings for individual commands:
// Enable redraw for a specific click
await testdriver.find('load more').click({
redraw: { enabled: true },
});
// Disable redraw for a fast interaction
await testdriver.find('checkbox').click({
redraw: false,
});When `networkMonitor` is enabled, the system also monitors sandbox network traffic:
The final settling condition requires **both** screen AND network to be settled (when both are enabled).
The redraw system emits events through the SDK emitter. See [Events](/events) for the full event reference.
| Event | Description | |---|---| | `redraw:status` | Emitted on each poll with current screen diff, network stats, and timeout info | | `redraw:complete` | Emitted when redraw resolves (settled or timed out) |
testdriver.emitter.on('redraw:status', (status) => {
console.log(`Screen: ${status.redraw.text}`);
console.log(`Network: ${status.network.text}`);
console.log(`Timeout: ${status.timeout.text}`);
});
testdriver.emitter.on('redraw:complete', (result) => {
if (result.isTimeout) {
console.warn(`Redraw timed out after ${result.timeElapsed}ms`);
} else {
console.log(`Screen settled in ${result.timeElapsed}ms`);
}
});**Enable redraw when:**
How the TestDriver agent behaves on GitHub issues, pull requests, and @mentions
Deploy TestDriver on your AWS infrastructure using CloudFormation
How TestDriver learns your app and caches what it discovers for instant, deterministic replays
Produce the "Playwright 1.xx API Review" artifact for a range of commits - the public API additions and the breaking or behavior…
Write, refine, run, and QA promptfoo evaluation suites: promptfooconfig.yaml, prompts, providers, vars, tests, assertions,…
DeepEval evaluation workflow for AI agents and LLM applications. TRIGGER when the user wants to evaluate or improve an AI agent,…