A docker image to use for Percy visual regression testing.
Example of .env
PERCY_IMAGE=systemseed/percy
PERCY_TAG=latest
PERCY_TOKEN=XxXxXxX
PROJECT_NAME=example
Example of docker-compose.yml
percy:
image: ${PERCY_IMAGE}:${PERCY_TAG}
container_name: "${PROJECT_NAME}_percy"
environment:
PERCY_TOKEN: $PERCY_TOKEN
PERCY_ENABLE: 1
PERCY_BRANCH: master
BACKEND_URL: http://$PROJECT_NAME.local
volumes:
- ../tests/snapshots.js:/project/snapshots.js
Use snapshots.js file (dynamic host):
module.exports = async () => {
// your method for building the urls/names
let urls = [
{ name: "Home page", path: "/" },
{ name: "Team page", path: "/team" }
]
return urls.map(({ name, path }) => ({
name, url: process.env.BACKEND_URL + path
}));
}
Use snapshots.yml file (static host):
snapshots:
- name: Home page
url: https://example.com/
- name: Team page
url: https://example.com/team
Run the tests:
docker-compose run -e --rm percy snapshot snapshots.js -v
Run tests with overriden url and branch:
docker-compose run -e BACKEND_URL=https://example.com -e PERCY_BRANCH=master --rm percy snapshot snapshots.js -v
Run tests with by providing git pull request and branch from CircleCI:
docker-compose run -e PERCY_PULL_REQUEST=${CIRCLE_PULL_REQUEST##*/} -e PERCY_BRANCH=$CIRCLE_BRANCH --rm percy snapshot snapshots.js -v
Content type
Image
Digest
sha256:45fcbe016…
Size
281.2 MB
Last updated
about 3 years ago
docker pull systemseed/percy