npx vitest run. Each test starts its own cloud sandbox, and every run is recorded in the TestDriver console.
You need two things in CI:
- Authentication. On GitHub Actions, use the TestDriver action with OIDC. Elsewhere, store your API key as a secret named
TD_API_KEY. - Your test command,
npx vitest run.
GitHub Actions
Thetestdriverai/action authenticates with GitHub’s OIDC token, so you don’t store an API key in GitHub. It exchanges the token for your team’s key and exports TD_API_KEY for later steps. It doesn’t run tests itself.
1
Authorize the TestDriver GitHub app
Install the TestDriver GitHub app on your organization. This links the organization to your TestDriver team. If you authorized the app before OIDC support was added, authorize it again once.
2
Add the workflow
npx testdriverai init writes this file for you:.github/workflows/testdriver.yml
id-token: write, or the action can’t mint the OIDC token.
The api-key input is a fallback. The action uses it only when OIDC authentication fails, for example on a fork or before the app is authorized. Leave the secret unset if you don’t need it.
Action inputs
Action inputs
Use a stored key instead of OIDC
Use a stored key instead of OIDC
If OIDC isn’t available, skip the action and pass the key directly:
- Copy an API key from the API keys page.
- In your repository, go to Settings → Secrets and variables → Actions and add a secret named
TD_API_KEY. - Pass it to the test step:
Other CI providers
Copy an API key from the API keys page. Store it as a secret namedTD_API_KEY in your CI provider, then use the config for your provider.
- GitLab CI
- CircleCI
- Azure Pipelines
- Jenkins
Add
TD_API_KEY under Settings → CI/CD → Variables, with Mask variable checked. GitLab exposes project variables to every job..gitlab-ci.yml
Split tests across jobs
Vitest runs test files in parallel within one job. To spread a large suite across several jobs, use Vitest’s--shard flag:
.github/workflows/testdriver.yml
npx vitest run --shard=<index>/<total> in each parallel job.
Run on Linux and Windows
SetTD_OS to choose the sandbox’s operating system. TestDriver reads it when it creates the sandbox, so your tests don’t need any changes:
os option passed to TestDriver() takes priority over TD_OS. To branch on the platform inside a test, read process.env.TD_OS:
Concurrency limits
Your plan sets how many sandboxes can run at once. When a job asks for a sandbox at that limit, it waits for a free slot instead of failing.- The SDK retries every 10 seconds.
- By default, it gives up after 60 seconds with a concurrency-limit error.
- Set
TD_CONCURRENCY_MAX_WAIT(in seconds) to wait longer, or to0to fail on the first refusal.
--maxWorkers or add slots to your plan.
View results
Each run is recorded in the TestDriver console, with a video replay, logs, and pass or fail status. When a run finishes, the SDK prints a link to it:Next steps
Run tests
Run tests locally, in parallel, and watch them live.
Add TestDriver to GitHub
Get an AI code review on every pull request.
Hosted plans
Compare plans, testing minutes, and concurrency.
Speed up reruns with caching
Reuse element locations from passing runs.

