testdriver-agent
How the TestDriver agent behaves on GitHub issues, pull requests, and @mentions
Build TestDriver tests iteratively using MCP tools with visual feedback
$ npx -y skills add testdriverai/testdriverai --skill testdriver-mcp-workflow --agent claude-codeHow it fires
How this skill gets triggered: by you, by Claude, or both.
/testdriver-mcp-workflowContext preview
The summary Claude sees to decide when to auto-load this skill.
Build TestDriver tests iteratively using MCP tools with visual feedback
name: testdriver:mcp-workflow description: Build TestDriver tests iteratively using MCP tools with visual feedback
Build automated tests by directly controlling a sandbox through MCP tools. Every action returns a screenshot AND the generated code to add to your test file.
Use this skill when:
Use MCP tools to:
1. **Control the sandbox directly** - Click, type, scroll in real-time 2. **See visual feedback** - Every action shows a screenshot with overlays 3. **Get generated code** - Each successful action returns the code to add to your test file 4. **Build tests incrementally** - Append code to test files as you go
session_start({ type: "chrome", url: "https://your-app.com" })This provisions a sandbox with Chrome and navigates to your URL. You'll see a screenshot and the provision code:
Add to test file:
await testdriver.provision.chrome({ url: "https://your-app.com" });**For local development** (pointing to a custom API endpoint):
session_start({
type: "chrome",
url: "https://your-app.com",
apiRoot: "https://your-ngrok-url.ngrok.io"
})**For self-hosted AWS instances** (your own Windows EC2):
session_start({
type: "chrome",
url: "https://your-app.com",
os: "windows",
ip: "1.2.3.4" // IP from your AWS instance
})See [AWS Setup Guide](https://docs.testdriver.ai/v7/aws-setup) to deploy your own infrastructure.
Find elements and interact with them. Each action returns a screenshot AND generated code:
find_and_click({ description: "Sign In button" })
→ Returns: screenshot with element highlighted
→ Add to test file: await testdriver.find("Sign In button").click();
type({ text: "user@example.com" })
→ Returns: screenshot showing typed text
→ Add to test file: await testdriver.type("user@example.com");After performing actions, use `check` to verify they worked:
check({ task: "Was the text entered into the field?" })
→ Returns: AI analysis of whether the task completed, with screenshot
check({ task: "Did the button click navigate to a new page?" })
→ Returns: AI compares previous screenshot to current stateUse `assert` for boolean pass/fail conditions that get recorded in test files:
assert({ assertion: "the login form is visible" })
→ Returns: pass/fail with screenshot
→ Add to test file:
const assertResult = await testdriver.assert("the login form is visible");
expect(assertResult).toBeTruthy();As you perform actions, append the generated code to your test file:
/**
* Login Flow test
*/
import { describe, expect, it } from "vitest";
import { TestDriver } from "testdriverai/lib/vitest/hooks.mjs";
describe("Login Flow", () => {
it("should complete login", async (context) => {
const testdriver = TestDriver(context);
// Append generated code here as you go:
await testdriver.provision.chrome({ url: "https://app.example.com" });
await testdriver.find("email input field").click();
await testdriver.type("user@example.com");
// ... more code as you perform actions
});
});Run the test from scratch to validate it works:
verify({ testFile: "tests/login.test.mjs" })| Tool | Description | |------|-------------| | `session_start` | Start sandbox with browser/app, returns screenshot + provision code | | `session_status` | Check session health and time remaining | | `session_extend` | Add more time before session expires |
Each tool returns a screenshot AND the generated code to add to your test file.
| Tool | Description | |------|-------------| | `find` | Locate element by description, returns ref for later use | | `click` | Click on element ref | | `find_and_click` | Find and click in one action | | `type` | Type text into focused field | | `press_keys` | Press keyboard shortcuts (e.g., `["ctrl", "a"]`) | | `scroll` | Scroll page (up/down/left/right) |
| Tool | Description | |------|-------------| | `check` | **For AI to understand screen state.** Analyzes current screen and tells you (the AI) whether a task/condition is met. Use this after actions to verify they worked. | | `assert` | AI-powered boolean assertion for test files (pass/fail for CI). Returns generated code. | | `screenshot` | **For showing the user the screen.** Captures and displays a screenshot. Does NOT return analysis to you (the AI). | | `exec` | Execute JavaScript, shell, or PowerShell in sandbox. Returns generated code. |
| Tool | Description | |------|-------------| | `verify` | Run test file from scratch to validate it works |
Every tool returns a screenshot showing:
Don't try to build the entire test at once:
# Step 1: Get to login page
session_start({ url: "https://app.com" })
→ Add to test: await testdriver.provision.chrome({ url: "https://app.com" });
# Step 2: Verify you're on the right page
check({ task: "Is this the login page?" })
# Step 3: Fill in email
find_and_click({ description: "email input field" })
→ Add to test: await testdriver.find("email input field").click();
type({ text: "user@exRepo: testdriverai/testdriverai
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