# Visual Testing

# Percy

TIP

Tests are described in snapshots.js.

# Local Testing

TIP

Percy works best when triggered automatically from your CI environment, but can also be run from your local development environment. This comes in helpful when you're first setting up Percy integration. To enable Percy locally, the PERCY_TOKEN environment variable must be configured:

  • PERCY_TOKEN: The Percy project's write-only API token. This is unique for each Percy project. (Token can be found at percy.io/patternlab/settings (opens new window))

  • When running in your local environment, we also recommend setting the PERCY_BRANCH environment variable to local to avoid unintentionally overwriting your project's master baseline in Percy. This isn't required but it's a step to make sure you're not throwing off any baselines that may have been set by CI.

  • You can set environment variables locally using export: export PERCY_TOKEN=aaabbbcccdddeeefff PERCY_BRANCH=local

  • Run npm run snapshots to execute the tests locally.

# Commands

percy exec
percy finalize
percy start
percy stop
percy help [COMMAND]
percy snapshot [SNAPSHOTDIRECTORY]
percy upload [UPLOADDIRECTORY]
1
2
3
4
5
6
7

# Bitbucket Pipeline