CircleCI Orb Integration
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.
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.
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_allcommand 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.
Your CircleCI workflow configuration at a high level should look like this:
version: 2.1 orbs: percy: percy/[email protected] jobs: run_tests: parallelism: 3 steps: - attach_workspace: at: . - run: echo "your tests run here" workflows: test: jobs: - run_tests - percy/finalize_all: requires: - run_tests
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:
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.
Updated over 4 years ago