Skip to main content
TestDriver tests are ordinary Vitest files, so any CI provider can run them with 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

The testdriverai/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
The job needs 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.
If OIDC isn’t available, skip the action and pass the key directly:
  1. Copy an API key from the API keys page.
  2. In your repository, go to Settings → Secrets and variables → Actions and add a secret named TD_API_KEY.
  3. Pass it to the test step:

Other CI providers

Copy an API key from the API keys page. Store it as a secret named TD_API_KEY in your CI provider, then use the config for your provider.
Never commit your API key to the repository. Keep it in your CI provider’s secret store.
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
Other providers work the same way. Run npx vitest run --shard=<index>/<total> in each parallel job.

Run on Linux and Windows

Set TD_OS to choose the sandbox’s operating system. TestDriver reads it when it creates the sandbox, so your tests don’t need any changes:
Linux is the default. An 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 to 0 to fail on the first refusal.
Raise the wait when you run more parallel jobs than your plan has slots. If jobs regularly give up waiting, run fewer at once with --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.