CI/CD Integration
Add Vizzly to your CI pipeline to catch visual regressions before they reach production.
Quick Setup
- Add
VIZZLY_TOKENto your CI environment variables - Run
vizzly run "your-test-command"in your pipeline - Use
--waitto fail the build on visual differences
All examples assume you’ve installed the CLI in your project.
Core Commands
vizzly run
Runs your tests with Vizzly screenshot capture:
# Basic - uploads screenshots, doesn't block on resultsvizzly run "npm test"
# With --wait - fails build if visual differences detectedvizzly run "npm test" --wait
# Custom build metadatavizzly run "npm test" \ --build-name "PR-${PR_NUMBER}" \ --environment "staging" \ --waitvizzly upload
Upload screenshots directly:
# Upload existing screenshotsvizzly upload ./screenshots --wait
# With metadatavizzly upload ./screenshots \ --build-name "Release v2.1.0" \ --environment "production"Exit Codes
When using --wait, commands exit with:
- 0 - Success (no visual changes or all approved)
- 1 - Visual differences detected (requires review)
- 2 - Build failed or configuration error
Without --wait, the command exits with your test command’s exit code.
CI Provider Examples
GitHub Actions
name: Visual Testson: [push, pull_request]
jobs: visual-tests: runs-on: ubuntu-latest steps: - uses: actions/checkout@v4 - uses: actions/setup-node@v4 with: node-version: '20'
- name: Install dependencies run: npm ci
- name: Run visual tests run: npx vizzly run "npm test" --wait env: VIZZLY_TOKEN: ${{ secrets.VIZZLY_TOKEN }}Enhanced Git Information
GitHub Actions provides limited git info by default. Override with GitHub context:
- name: Run visual tests run: npx vizzly run "npm test" --wait env: VIZZLY_TOKEN: ${{ secrets.VIZZLY_TOKEN }} VIZZLY_COMMIT_MESSAGE: ${{ github.event.pull_request.head.commit.message || github.event.head_commit.message }} VIZZLY_COMMIT_SHA: ${{ github.event.pull_request.head.sha || github.event.head_commit.id }} VIZZLY_BRANCH: ${{ github.head_ref || github.ref_name }} VIZZLY_PR_NUMBER: ${{ github.event.pull_request.number }}GitLab CI
stages: - test
visual-tests: stage: test image: node:20 script: - npm ci - npx vizzly run "npm test" --wait variables: VIZZLY_TOKEN: $VIZZLY_TOKENCircleCI
version: 2.1
jobs: visual-tests: docker: - image: cimg/node:20.16 steps: - checkout - run: npm ci - run: npx vizzly run "npm test" --wait environment: VIZZLY_TOKEN: $VIZZLY_TOKEN
workflows: test: jobs: - visual-testsJenkins
pipeline { agent any stages { stage('Visual Tests') { steps { sh 'npm ci' sh 'npx vizzly run "npm test" --wait' } } } environment { VIZZLY_TOKEN = credentials('vizzly-token') }}Azure DevOps
trigger: - main
pool: vmImage: 'ubuntu-latest'
steps: - task: NodeTool@0 inputs: versionSpec: '20.x' - script: npm ci displayName: 'Install dependencies' - script: npx vizzly run "npm test" --wait displayName: 'Run visual tests' env: VIZZLY_TOKEN: $(VIZZLY_TOKEN)Bitbucket Pipelines
pipelines: default: - step: name: Visual Tests image: node:20 script: - npm ci - npx vizzly run "npm test" --waitTravis CI
language: node_jsnode_js: - '20'
script: - npx vizzly run "npm test" --wait
env: secure: # encrypted VIZZLY_TOKENFor parallel builds, see the Parallel Builds guide.
Parallel Testing
Split large test suites across multiple CI jobs. Each job uses the same --parallel-id, then you finalize after all jobs complete:
# In parallel jobs (use same parallel-id for all)vizzly run "npm test -- --shard=1/4" --parallel-id="${{ github.run_id }}"vizzly run "npm test -- --shard=2/4" --parallel-id="${{ github.run_id }}"
# After all jobs completevizzly finalize "${{ github.run_id }}"See the Parallel Builds guide for complete setup.
Environment Variables
Authentication
Required:
VIZZLY_TOKEN- API authentication token (project token from dashboard)
Configuration
Optional:
VIZZLY_API_URL- Override API base URL (default:https://app.vizzly.dev)VIZZLY_LOG_LEVEL- Logging level:debug,info,warn,error(default:info)
Parallel Builds
VIZZLY_PARALLEL_ID- Unique identifier for parallel test execution (same as--parallel-id)
Git Information Overrides
The CLI auto-detects git info from your CI provider. Override when needed:
VIZZLY_COMMIT_SHA- Commit SHAVIZZLY_COMMIT_MESSAGE- Commit messageVIZZLY_BRANCH- Branch nameVIZZLY_PR_NUMBER- Pull request number
Auto-Detection
Vizzly detects these CI providers automatically:
GITHUB_ACTIONS- GitHub ActionsGITLAB_CI- GitLab CICIRCLECI- CircleCITRAVIS- Travis CIJENKINS_URL- JenkinsTF_BUILD- Azure DevOpsCODEBUILD_BUILD_ID- AWS CodeBuildAPPVEYOR- AppVeyorBUILDKITE- BuildkiteDRONE- Drone CIBITBUCKET_BUILD_NUMBER- Bitbucket PipelinesSEMAPHORE- SemaphoreWERCKER- WerckerHEROKU_TEST_RUN_ID- Heroku CI
Next Steps
- CLI Commands - Complete command reference
- Parallel Builds - Advanced parallel execution
- Configuration - Project setup and options
- GitHub Integration - Connect GitHub for PR status checks