Skip to main content

testivai witness

Capture visual snapshots. Two modes, selected by the argument:

Standalone mode — testivai witness <url>

Captures a running app with no test suite. Built for AI-generated and vibe-coded apps.

npx testivai witness http://localhost:3000

What happens:

  1. Launches a headless Chrome (or reuses a debuggable one — see --port).
  2. Resolves pages: --pages / config pages when set, otherwise crawls same-origin links from the start page (capped by --max-pages, default 10).
  3. Per page: applies capture stabilization and ignoreSelectors, takes a full-page screenshot + DOM snapshot, writes to .testivai/temp/<name>/.
  4. Diffs against .testivai/baselines/ with your configured tolerances and writes the HTML report + results.json.

Snapshot names come from paths: /home, /pricing/planspricing-plans.

FlagMeaning
--pages "/,/pricing"Capture exactly these paths (disables crawling). Also settable as pages in .testivai/config.json
--max-pages <n>Crawl cap (default 10; config: maxPages)
--viewport 1280x800Capture viewport (default 1280x800; config: viewport)
-p, --port <n>Reuse an already-running Chrome with --remote-debugging-port instead of launching one

Chrome resolution: TESTIVAI_CHROME_PATH env var → standard install locations → PATH. A Playwright-downloaded Chromium works: npx playwright install chromium, then point the env var at the binary.

First run creates baselines — approve and commit them:

npx testivai approve --all
git add .testivai/baselines/

See the vibe-coded apps guide for the GitHub Actions workflow.

Sidecar mode — testivai witness <name>

Captures a single named snapshot from an already-running debuggable Chrome (used inside testivai run wrappers for frameworks without a first-class adapter):

npx testivai witness checkout-page --port 9222
FlagMeaning
-p, --port <n>Chrome remote debugging port
-o, --output <path>Output directory (default .testivai/witnesses)
-f, --format json|pngOutput format