Hey! These docs are for version 1, which is no longer officially supported. Click here for the latest version, 2-web!

Integrating Percy with CircleCI is made easy with our [`percy/agent` CircleCI orb](🔗). If you run your [tests in parallel](🔗), this document will guide you through how to setup Percy with ease on CircleCI.

CircleCI Orbs require CircleCI configuration version 2.1 or higher.

## Workflow Architecture

The workflow you'll be aiming for is the following:


Your test suite kicks off and if you have a parallel test workflow, it will divide the work of running the tests into multiple test runners. Those test runners will finish at different times. Once they have all finished you will run the `percy/finalize_all` command from the Orb. This final step tells Percy the build is completely finished at this point and no new snapshots for this build will arrive.

## Environment Variables

  • `PERCY_PARALLEL_TOTAL`: this must be set to `-1`. This tells Percy we don't know how parallelized this run is, but we'll consider your Percy build fully wrapped up when we hear the `percy/finalize_all` command from the Orb.

  • `PERCY_TOKEN`: This is the token obtained from your project settings in Percy.

There are a number of different ways you can set these environment variables to be available on each step. See CircleCI's ["Environment Variable Usage Options"](🔗) documentation for more information.

## Workflow Configuration

Your CircleCI workflow configuration at a high level should look like this:

We first import the `percy/agent` orb and then once all tests have finished, execute `percy/finalize_all` command from the Orb. [Make sure you use the latest version of the orb from CircleCI's registry](🔗).

Here's a sample of what this looks like integrated into the [percy-web](🔗) project:


# Additional resource

We teamed up with the CircleCI team for a live demo of our integrated workflow. Watch the recording of the session below to learn more about our [CircleCI orb](🔗), and see a live visual testing demo.