Configure Percy
Percy is a service that recognizes UI changes between pull requests. Read more about it here
Create a new project on the Percy website.
- Ask wg-operations to add the project to Percy.
- Visit this link.
- Fill in the name with
[project-name]
and select the github repository of the project.
Setup the CI
- Add the PERCY_TOKEN and PERCY_PROJECT env variables to the CI.
They can be found under
https://percy.io/renuo/[project-name]/settings
. - Also add PERCY_TARGET_BRANCH and set it to
develop
. Like that Percy always compares the screenshots to the develop branch.
Setup the Rails application
- Add the gem
percy-capybara
to the test group in the Gemfile and runbundle install
. - Follow the setup instructions here
- If the application uses the gem
vcr
, follow the instructions here.
Start using Percy
Create a snapshot in any capybara spec by adding the following line:
Percy::Capybara.snapshot(page, name: 'name of your snapshot')
When to add screenshots
Usually it's enough to add one screenshot for each view. In special cases you may want to add more screenshots.
Encoding
For Percy to render all characters correctly, every page that has a screenshot needs to have
the header <meta charset="utf-8">
.