
Security News
Ruby's Bundler 4.0.18 Extends Cooldown to bundle lock and bundle cache
The supply chain control that delays freshly published gems now covers lockfile generation and gem vendoring in Ruby projects.
@testivai/witness-cli
Advanced tools
Universal visual regression testing CLI - Record visual tests without writing code, run them anywhere.
The TestivAI CLI enables visual regression testing for any test framework (Selenium, Cypress, etc.) using the Sidecar Pattern. Instead of building separate SDKs for each framework, this CLI runs alongside your existing tests and uses the testivai.witness() function to capture visual evidence.
# Install CLI globally
npm install -g @testivai/witness-cli
# Initialize your project (installs all dependencies)
testivai init
The TestivAI CLI requires:
Note: These dependencies are automatically installed when you run
testivai init. In CI/CD environments, browsers are not auto-installed - you'll need to runnpx playwright install chromium.
# 1. Initialize your project
testivai init
# 2. Authenticate
testivai auth <your-api-key>
# 3. Record a visual test (no code required!)
testivai record https://staging.myapp.com
# 4. Run tests
testivai run
testivai initInitialize TestivAI in your project.
testivai init
Options:
-f, --force - Overwrite existing configurationThis command will:
testivai.config.ts configuration filevisual-tests/ directorytestivai auth <api-key>Authenticate with your TestivAI API key.
testivai auth tstvai-abc123xyz
Or use environment variable:
export TESTIVAI_API_KEY=tstvai-abc123xyz
testivai auth
testivai record <url>Record a visual test by interacting with your app.
# Single page recording
testivai record https://staging.myapp.com/checkout
# Multi-page recording (mark pages during recording)
testivai record https://staging.myapp.com --multi-page
Options:
-o, --output <file> - Custom output filename--no-inject - Output raw Playwright code without TestivAI injection--multi-page - Enable multi-page capture modeWhen using --multi-page mode:
The CLI generates a test file with all marked pages:
test.describe('Multi-page visual test', () => {
test('captures marked pages', async ({ page }) => {
// Page 1: login-page
await page.goto('https://staging.myapp.com/login');
await testivai.witness(page, testInfo, 'login-page');
await page.waitForTimeout(1000);
// Page 2: dashboard
await page.goto('https://staging.myapp.com/dashboard');
await testivai.witness(page, testInfo, 'dashboard');
await page.waitForTimeout(1000);
// Page 3: checkout-form
await page.goto('https://staging.myapp.com/checkout');
await testivai.witness(page, testInfo, 'checkout-form');
await page.waitForTimeout(1000);
});
});
testivai run [files]Execute visual tests and upload results to TestivAI.
# Run all tests
testivai run
# Run specific test
testivai run visual-tests/checkout.spec.ts
# Run with verbose output
testivai run --verbose
# Run in CI/CD (quiet mode)
testivai run --quiet
Options:
--verbose - Show detailed Playwright output--quiet - Suppress output (ideal for CI/CD)--update-baselines - Auto-approve all visual diffs as new baselinesThe CLI automatically uploads all screenshots in a batch to TestivAI:
Example output:
🧪 Running 3 visual test(s)...
✅ All visual tests passed (3 passed, 12.3s)
📊 Batch ID: 123e4567-e89b-12d3-a456-426614174000
View results at: https://dashboard.testiv.ai
| Flag | Description |
|---|---|
-v, --version | Print CLI version |
-h, --help | Show help |
--verbose | Detailed output |
-q, --quiet | Suppress banner (for CI) |
--debug | Debug mode |
testivai.config.tsexport default {
// Base URL (optional)
baseUrl: 'https://staging.myapp.com',
// Output directory for tests
outputDir: './visual-tests',
// Viewport settings
viewport: {
width: 1280,
height: 720,
},
};
| Variable | Purpose |
|---|---|
TESTIVAI_API_KEY | API key for authentication |
SKIP_BROWSER_INSTALL | Set to 1 to skip automatic browser installation |
- name: Run Visual Tests
env:
TESTIVAI_API_KEY: ${{ secrets.TESTIVAI_API_KEY }}
run: testivai run --quiet
stage('Visual Tests') {
environment {
TESTIVAI_API_KEY = credentials('testivai-api-key')
SKIP_BROWSER_INSTALL = '1'
}
steps {
sh 'npm install @testivai/witness-cli'
sh 'npx playwright install chromium'
sh 'testivai run --quiet'
}
}
| Code | Meaning |
|---|---|
0 | Success - all tests passed |
1 | Test failed - visual diff detected |
2 | Configuration error |
3 | Network error |
4 | Runtime error |
If you see this error when running testivai run:
❌ Playwright not found!
Solution:
# Option 1: Use the init command (recommended)
testivai init
# Option 2: Manual installation
npm install --save-dev @playwright/test playwright
npx playwright install
Solution:
# Install globally
npm install -g @testivai/witness-cli
# Or use npx
npx @testivai/witness-cli run
Solution: Add this to your CI script:
npx playwright install chromium --with-deps
Solution:
# Check if API key is set
echo $TESTIVAI_API_KEY
# Or re-authenticate
testivai auth <your-api-key>
For more help, visit: https://docs.testiv.ai
Instead of rewriting your Selenium/Cypress tests, use TestivAI as a "sidecar":
This allows you to add visual regression testing to any framework without changing your existing tests.
MIT
FAQs
TestivAI CLI - Universal visual regression testing for any framework
We found that @testivai/witness-cli demonstrated a healthy version release cadence and project activity because the last version was released less than a year ago. It has 1 open source maintainer collaborating on the project.
Did you know?

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Security News
The supply chain control that delays freshly published gems now covers lockfile generation and gem vendoring in Ruby projects.

Security News
During a UK cyber test, a Mythos 5 agent used sockpuppets, social engineering, and prompt injection to try to get a maintainer to merge malware.

Company News
Socket is now in the AWS Security Hub Extended plan. Adopt it through AWS, apply committed spend, and block malicious open source packages.