Record video automatically
Record every driver-based context end to end without adding explicit record steps. Automatic recording is useful for a video archive or for replaying exactly what happened when a test fails. New to recording? Start with Record video.
Before you begin
Make sure you have the following:
- Doc Detective installed.
- A directory where you can create a
.spec.jsonfile. - A visible display, or, on Linux and in CI, the
ffmpegengine’s Xvfb virtual display. Automatic recording uses theffmpegengine, which needs a display to capture (see Docker and headless).
The steps in this guide work the same in every authoring style. Write them in a standalone .spec.json, inline in a doc source file, or let Doc Detective detect them from prose.
Record video automatically
Turn on autoRecord to record every driver-based context from start to finish without explicit record steps. Doc Detective captures each context end to end, which is useful for a video archive or for replaying exactly what happened when a test fails.
Enable it at the config, spec, or test level. A test’s setting overrides a spec’s, which overrides the config’s:
The CLI flag does the same for a single run; use --no-auto-record to override a config file that enables it:
Desktop contexts capture with the ffmpeg engine. Doc Detective saves each video on a stable path in the per-run artifact tree. The same context therefore lands on the same relative path in every run:
An automatic recording coexists with any explicit record and stopRecord steps in the same context. An untargeted stopRecord never stops the automatic recording, so a stray stopRecord: true can’t cut the full-context video short. On Linux, each runner records its own virtual display with Xvfb, so concurrent automatic recordings stay isolated. On Windows and macOS, concurrent automatic recordings share the same physical display and overlap. Doc Detective warns when a run records concurrently on those platforms.
For where the artifacts land, see Automatic recordings, the config schema, and Reporters and artifacts.
Verify it works
- An automatic recording saves per driver-based context, on a stable path in the per-run artifact tree.
- A headless run with no display skips the automatic recording. Run headed, or on Linux use the
ffmpegengine’s Xvfb virtual display. See Docker and headless. - On Windows and macOS, Doc Detective warns when a run records concurrently, because the recordings share the same physical display and overlap. See Two concurrent recordings overlap on Windows or macOS.
What’s next
- Record video to record a flow, stop it, and choose an engine.
- Detect visual regressions with checkpoints to watch a recording for visual drift.
- Narrate a recording with annotations that stay up across the flow.
- Follow the worked recording example end to end.
- Look up automatic-recording fields in Automatic recordings and the
configschema.