How the TestDriver agent behaves on GitHub issues, pull requests, and @mentions
한국어 요약은 준비 중입니다. 원문 설명을 표시하고 있습니다.
Configure Linux and Windows sandboxes, persist machines between runs, and install custom software
한국어 요약은 준비 중입니다. 원문 설명을 표시하고 있습니다.
설치 방법 보기설치하기 전에 에이전트에게 전달되는 지시 내용을 확인할 수 있습니다.
TestDriver provisions a fresh cloud VM for every test by default. This guide covers how to configure Linux and Windows machines, reduce startup time by keeping machines alive between runs, use provision scripts for repeatable setup, and install custom software on the fly.
Linux is the default operating system. No extra configuration is required.
import { describe, expect, it } from "vitest";
import { TestDriver } from "testdriverai/vitest/hooks";
describe("My Test", () => {
it("runs on Linux", async (context) => {
const testdriver = TestDriver(context);
await testdriver.provision.chrome({ url: "https://example.com" });
const result = await testdriver.assert("the page loaded successfully");
expect(result).toBeTruthy();
});
});
| Option | Type | Default | Description |
|---|---|---|---|
os | string | "linux" | Operating system |
resolution | string | "1366x768" | Screen resolution (Enterprise only) |
e2bTemplateId | string | — | Custom E2B template ID (see Self-Hosted) |
keepAlive | number | 60000 | Ms to keep VM alive after disconnect |
reconnect | boolean | false | Reconnect to last used sandbox |
const testdriver = TestDriver(context, {
os: "linux",
resolution: "1920x1080",
keepAlive: 5 * 60 * 1000, // keep alive 5 minutes
});
Set os: "windows" to provision a Windows VM instead. Everything else works the same way.
const testdriver = TestDriver(context, {
os: "windows",
});
await testdriver.provision.chrome({ url: "https://example.com" });
Windows sandboxes use EC2 instances and take longer to boot than Linux (E2B) sandboxes — typically 1–3 minutes for a cold start. See Keeping Machines Alive below to avoid this cost on repeated runs.
| Option | Type | Default | Description |
|---|---|---|---|
os | string | — | Set to "windows" |
resolution | string | "1366x768" | Screen resolution (Enterprise only) |
sandboxAmi | string | — | Custom AMI ID (self-hosted) |
sandboxInstance | string | — | EC2 instance type (self-hosted) |
keepAlive | number | 60000 | Ms to keep VM alive after disconnect |
reconnect | boolean | false | Reconnect to last used sandbox |
const testdriver = TestDriver(context, {
os: "windows",
resolution: "1920x1080",
keepAlive: 10 * 60 * 1000, // keep alive 10 minutes
});
Windows (and Linux) cold starts can be expensive if you're iterating quickly. Use keepAlive + reconnect to reuse the same VM across multiple test runs.
Every time the SDK successfully connects to a sandbox, it records the sandbox id in .testdriver/last-sandbox inside your project directory. The next test that opts in with reconnect: true reads that file and reattaches automatically — no manual id tracking required.
Provision calls (testdriver.provision.chrome(...), vscode(...), etc.) are skipped when reconnecting, because the application is already running inside the sandbox from the previous run.
keepAlive// first.test.mjs
const testdriver = TestDriver(context, {
os: "windows",
keepAlive: 30 * 60 * 1000, // keep alive 30 minutes after this test ends
});
await testdriver.provision.chrome({ url: "https://example.com" });
// ... your test steps
When this test finishes, the sandbox stays running for 30 minutes instead of being terminated immediately.
reconnect: true// second.test.mjs
const testdriver = TestDriver(context, {
os: "windows",
reconnect: true, // ← reads .testdriver/last-sandbox
keepAlive: 30 * 60 * 1000,
});
// No provision call — Chrome is already open from the previous run.
await testdriver.find("Sign In button").click();
If you need to pin to a specific sandbox (CI matrix, multiple chains in parallel, etc.) pass the id directly:
await testdriver.connect({ sandboxId: "sandbox-abc123" });
When reattaching to a sandbox:
keepAlive windowA common pattern is to break a long flow into focused describe blocks that share one sandbox — the first block provisions and signs in, later blocks reconnect and continue:
import { describe, expect, it } from "vitest";
import { TestDriver } from "testdriverai/vitest/hooks";
const KEEP_ALIVE_MS = 5 * 60 * 1000;
describe("step 1 — log in", () => {
it("signs in and lands on the dashboard", async (context) => {
const testdriver = TestDriver(context, { keepAlive: KEEP_ALIVE_MS });
await testdriver.provision.chrome({ url: "https://example.com/login" });
await testdriver.find("username input").click();
await testdriver.type("standard_user");
await testdriver.pressKeys(["tab"]);
await testdriver.type("secret_sauce", { secret: true });
await testdriver.pressKeys(["enter"]);
expect(await testdriver.assert("the dashboard is visible")).toBeTruthy();
});
});
describe("step 2 — add to cart", () => {
it("reuses the logged-in sandbox", async (context) => {
const testdriver = TestDriver(context, {
reconnect: true, // ← skip provisioning, reattach
keepAlive: KEEP_ALIVE_MS,
});
await testdriver.find("Add to cart").click();
await testdriver.find("cart icon").click();
expect(await testdriver.assert("the cart has an item")).toBeTruthy();
});
});
describe("step 3 — check out", () => {
it("continues from the cart state", async (context) => {
const testdriver = TestDriver(context, { reconnect: true, keepAlive: 30_000 });
await testdriver.find("Checkout").click();
expect(await testdriver.assert("the checkout form is visible")).toBeTruthy();
});
});
A runnable copy of this pattern lives at examples/reconnect-sequential.test.mjs.
keepAlive workskeepAlive is a duration in milliseconds. After the SDK disconnects, the server keeps the VM running for that long before terminating it. The default is 60000 (1 minute). Note: keepAlive: 0 currently falls back to the default disconnect grace period rather than terminating immediately, so use a positive duration when you want to control the grace window explicitly.
const testdriver = TestDriver(context, {
keepAlive: 0, // currently uses the default 1 minute grace period
// keepAlive: 60000, // default — 1 minute
// keepAlive: 600000, // 10 minutes
// keepAlive: 3600000, // 1 hour
});
<Warning>
Machines kept alive beyond your test session continue to consume credits. Always set a `keepAlive` value appropriate for your workflow.
</Warning>
Provision scripts let you run arbitrary setup steps before your test starts — downloading fixtures, seeding a database, configuring environment variables, and more. Use testdriver.exec() to run shell or PowerShell commands directly in the sandbox.
<Card title="exec() Reference" icon="terminal" href="/v7/exec"
Full reference for running shell and PowerShell commands in the sandbox. </Card>
await testdriver.provision.chrome({ url: "https://myapp.com" });
// Run a setup script from your repo
await testdriver.exec("sh", `
curl -s https://myapp.com/api/reset-test-db -X POST
echo "Test DB reset"
`, 30000);
await testdriver.provision.chrome({ url: "https://myapp.com" });
await testdriver.exec("pwsh", `
$env:API_URL = "https://staging.myapp.com"
Write-Host "Environment configured"
`, 15000);
await testdriver.exec("sh", `
git clone https://github.com/myorg/test-fixtures.git /tmp/fixtures
bash /tmp/fixtures/seed.sh
`, 120000);
You can install software at the start of a test using exec(). This works for any package available via apt, brew, choco, winget, npm, pip, or direct download.
await testdriver.exec("sh", `
sudo apt-get update -qq
sudo apt-get install -y ffmpeg imagemagick
`, 120000);
await testdriver.exec("sh", "npm install -g @playwright/test", 60000);
await testdriver.exec("pwsh", `
winget install --id=7zip.7zip -e --silent
`, 120000);
await testdriver.exec("pwsh", `
choco install googlechrome --yes --no-progress
`, 180000);
// Linux
await testdriver.exec("sh", `
curl -L https://example.com/installer.sh -o /tmp/installer.sh
chmod +x /tmp/installer.sh
/tmp/installer.sh --silent
`, 300000);
// Windows
await testdriver.exec("pwsh", `
Invoke-WebRequest -Uri "https://example.com/installer.exe" -OutFile "$env:TEMP\\installer.exe"
Start-Process "$env:TEMP\\installer.exe" -ArgumentList "/S" -Wait
`, 300000);
<Note>
Installing software at test start adds to your test duration. For software you use in every test, consider preloading it into a custom VM image via the Enterprise self-hosted plan.
</Note>
Installing packages at runtime works well for occasional or lightweight dependencies. But if you're installing the same 5-minute setup on every test run, you're wasting time and credits.
With the Self-Hosted Enterprise plan you get access to our golden VM base image and Packer scripts, so you can bake your applications, dependencies, and configuration directly into a custom AMI. Tests spin up with everything already installed — zero setup time.
<Card title="Self-Hosted Enterprise" icon="server" href="/v7/self-hosted"
Preload software, configure custom hardware, and run unlimited tests with a flat license fee. Our team assists with deployment and setup. </Card>
아직 리뷰가 없습니다. 사용해 본 소감을 남겨 주세요.
로그인 없이 쓸 수 있습니다. 사용 후기, 질문, 작동하지 않은 환경 등을 편하게 남겨 주세요.
아직 댓글이 없습니다. 첫 댓글을 남겨 보세요.
How the TestDriver agent behaves on GitHub issues, pull requests, and @mentions
한국어 요약은 준비 중입니다. 원문 설명을 표시하고 있습니다.
Execute natural language tasks using AI
한국어 요약은 준비 중입니다. 원문 설명을 표시하고 있습니다.
Make AI-powered assertions about screen state
한국어 요약은 준비 중입니다. 원문 설명을 표시하고 있습니다.
Deploy TestDriver on your AWS infrastructure using CloudFormation
한국어 요약은 준비 중입니다. 원문 설명을 표시하고 있습니다.
Speed up tests with screenshot-based caching
한국어 요약은 준비 중입니다. 원문 설명을 표시하고 있습니다.
How TestDriver learns your app and caches what it discovers for instant, deterministic replays
한국어 요약은 준비 중입니다. 원문 설명을 표시하고 있습니다.