Integrating Codeship Pro And Docker With Percy Visual Testing

Source – documentation.codeship.com

What Is Percy?

Percy is a visual testing tool that lets you take screen shots, monitor visual changes and require team approval to these visual captures in an automated way as part of your CI/CD pipeline.

Setting Up Percy

Setting Your Percy Variables

You will need to add the two values Percy provides when you create a new project inside their application – PERCY_TOKEN and PERCY_PROJECT – to the encrypted environment variables that you define in your codeship-services.yml file.

Static Sites

To use Percy with static sites inside Docker images on Codeship Pro, you will need to install the percy-cli gem inside your images, either as part of a Gemfile or by adding the following command to the Dockerfile:

RUN gem install percy-cli

Note that this will require you to be building an image that contains both Ruby and Rubygems. If the image does not contain both of these, you will be unable to install the necessary percy-cli gem.

From there, you will need to add the following command a step or inside of a script in your codeship-steps.yml file:

- service: your_service
  command: percy snapshot directory_to_snapshot

Note that you can use multiple commands to take snapshots of multiple directories, and that the directories must contain HTML files.

Ruby

To integrate Percy with Codeship Pro on a Ruby and Docker project, you will want to install the you will need to install the percy-capybara gem inside your images, either as part of a Gemfile or by adding the following command to the Dockerfile:

RUN gem install percy-capybara

Note that this will require you to be building an image that contains both Ruby and Rubygems. If the image does not contain both of these, you will be unable to install the necessary percy-cli gem.

From there, you will need to add specific hooks to your Rspec, Capybara, Minitest, or any other test specs you may have. You can find specific integration integration for calling Percy from your test specs at the Percy documentation.

These test specs will be called via your codeship-steps.yml file.

Ember

To integrate Percy with Codeship Pro on an Ember and Docker project, you will want to install the ember-percy package inside your images by adding the following command to the Dockerfile:

RUN ember install ember-percy

From there, you will need to add specific hooks in to your project’s test specs. You can find specific integration integration for calling Percy from your test specs at the Percy documentation.

These test specs will be called via your codeship-steps.yml file.

Subscribe
Notify of
guest

This site uses Akismet to reduce spam. Learn how your comment data is processed.

0 Comments
Inline Feedbacks
View all comments
0
Would love your thoughts, please comment.x
()
x