Percy is a popular service that shows diffs between changes in the application. It integrates directly into your test suite, allowing for automated visual reviews on every push to Git – if only automated with Buddy.
In this example, we'll show you how to automate screenshot grabbing in Mocha/Chai tests of an Ember app.
If you haven't used Buddy before, sign up for free with your GitHub/Bitbucket account or email. Select the repository with your tests and create a new delivery pipeline.
Tip
Set the trigger mode to 'On every push' so that it's executed on every change to the assigned branch.
Step 2: Configure action
Now it's time to configure and add the Node.js action – a Docker container in which we'll run our script with Percy. However, to make it work, we'll need to install a couple of things first. Switch to the Environment tab and paste the following:
The last thing is adding PERCY_TOKEN and PERCY_PROJECT variables to the pipeline. You can find them in your Percy's Project Settings:
Image loading...
Add the variables to the pipeline's Variables tab:
Image loading...
Step 5: Run the pipeline
With everything in place, make a push to the selected branch and enjoy your changes immediately reflected on the screenshot.
Image loading...
Tip
You can add more actions to the pipeline, including conditional notifications that will let you know in case your tests have failed.
Jarek Dylewski
Customer Support
A journalist and an SEO specialist trying to find himself in the unforgiving world of coders. Gamer, a non-fiction literature fan and obsessive carnivore. Jarek uses his talents to convert the programming lingo into a cohesive and approachable narration.