Percy is designed to integrate with your tests and CI environment. To enable Percy, the token environment variable must be configured in your CI service:
PERCY_TOKEN: The Percy repo write-only API token. This is unique for each Percy repository.
Depending on how you have Jenkins configured, there are a few options for configuring environment variables.
You can use the EnvInject plugin to set the token environment variable for a build.
PERCY_TOKEN to the write-only token from your Percy repo. This token can be found in each Percy repo's settings.
Alternatively, you could export the variables as part of the build script:
export PERCY_TOKEN=aaabbbcccdddeeefff # Now run your tests (just an example, this depends on the client library used): bundle exec rspec
IMPORTANT: Keep your Percy token secret. Anyone with access to your token can consume your account quota, though they cannot read data.
If your code is public, do not commit the PERCY_TOKEN to your code.
You're done with setup---the last step is to integrate Percy into your tests and run them. Just choose your client library:
- Storybook for React
- Storybook for Angular
- Storybook for Vue.js
- Storybook for Ember
Updated over 4 years ago