Skip to main content

Getting Started

Add visual regression testing to your existing test suite in under 5 minutes. TestivAI works with any framework that controls Chrome โ€” no framework-specific SDK required.

Prerequisitesโ€‹

  • Node.js 18+
  • Chrome browser (local or in CI)
  • Your existing test suite (Cypress, Selenium, WebdriverIO, pytest, JUnit, etc.)

1. Install the CLIโ€‹

npm install -g @testivai/witness-cdp

2. Run the Setup Wizardโ€‹

npx testivai init

The interactive wizard asks two questions and generates helper files for your framework:

  โ•”โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•—
โ•‘ TestivAI Visual Regression Setup โ•‘
โ•šโ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•

? Select your language: โ€บ JavaScript / TypeScript
? Select your test framework: โ€บ Cypress
? Where are your test files? โ€บ cypress/e2e

โœ“ Created: cypress/support/testivai-witness.js
โœ“ Created: cypress/support/testivai-plugin.js
โœ“ Created: cypress/e2e/visual-example.cy.js
โœ“ Created: testivai.config.ts
Playwright users

If Playwright is detected, testivai init will direct you to the dedicated Playwright SDK: @testivai/witness-playwright


3. Authenticateโ€‹

Get your API key from the TestivAI Dashboard.

npx testivai auth <your-api-key>

4. Add a Capture Callโ€‹

The wizard generates an example file. The key call is witness('name') โ€” add it anywhere in your test at the moment you want a snapshot:

it('homepage looks correct', () => {
cy.visit('/');
cy.witness('homepage');
});

5. Runโ€‹

Wrap your normal test command with testivai run:

# Cypress
testivai run "cypress run --browser chrome"

# pytest
testivai run "pytest tests/ -v"

# JUnit (Maven)
testivai run "mvn test"

That's it. TestivAI captures screenshots, DOM, CSS, layout, and performance metrics automatically โ€” then runs 5-layer Smart Match analysis in the cloud.


What Happens Nextโ€‹

First runBaselines are created โ€” no diff yet
Subsequent runsEach snapshot is compared against the baseline
Visual change detectedDashboard shows side-by-side diff with AI analysis
You approve/rejectBaseline is updated or the change is flagged

โ†’ See how it works under the hood