Skip to main content
Dashcam records the sandbox screen while your test runs and saves it as a replay you can watch in the TestDriver console.
  • Recording is on by default. You don’t need to configure anything.
  • The replay includes the console output from your test and, for websites, the page’s network traffic.
  • When the test ends, TestDriver prints a link to the replay.

How recording works

  1. A provision method starts it. Every provision method starts Dashcam after it launches your app: chrome(), chromeExtension(), vscode(), installer(), electron(), and dashcam().
  2. The test runs. Everything on the sandbox screen is recorded.
  3. The test ends. The Vitest hook stops the recording, uploads your test’s console output to the replay, and prints the link:
chrome() also records the network traffic for the domain of the URL it opens. When Vitest retries a failed test, each attempt gets its own recording and link.

Add a log file to the replay

Call provision.dashcam() to show a log file from the sandbox next to the video. Call it before the method that launches your app, so the log is set up before recording starts:
tests/checkout.test.mjs
TestDriver creates the file if it doesn’t exist. Anything your app writes to it appears in the replay.
string
The log file in the sandbox. Defaults to /tmp/testdriver.log on Linux, or C:\Users\testdriver\testdriver.log on Windows.
string
default:"TestDriver Log"
The log’s name in the replay.
boolean
default:"true"
Also record network traffic. It covers the domain opened with chrome() if that ran first, or all traffic otherwise.
string
The recording’s title. Defaults to the test file’s name and the test’s name, such as checkout - records the app log.

Turn recording off

Pass dashcam: false when you create the client:
Provision methods then skip recording, and the test prints no replay link.

Control the recording yourself

testdriver.dashcam gives you direct control of the recorder. Most tests don’t need it, because the provision methods and the Vitest hook handle recording for you.
Add logs before you call start(). If you call stop() yourself, the Vitest hook doesn’t print the link, so log it as shown above. With dashcam: false, these methods do nothing and stop() resolves to null.
Older tests may use chrome() from testdriverai/presets to get a dashcam object. Presets are deprecated. Use TestDriver(context) and a provision method instead.