Automate website screenshot uploads to Percy.io for visual regression testing with this parameterized Docker container. Designed to work locally or in remote clusters. Enable Slack notifications to get pinged when a site changes.
Set environment variables and run:
docker run -d \
-e PERCY_TOKEN=xxx \
-e PERCY_TARGET_URL=https://google.com \
-e CRON_TIME=daily \
--name percysnap
docker logs -f percysnap
Create .env
from the sample, then run with Docker Compose:
docker pull emcniece/percysnap:latest
cp .env.sample .env
# ... edit .env
docker-compose up
- Runs a snapshot on container start
- Reads
CRON_TIME
env for job scheduling CRON_TIME
can be set to"daily"
for a random time- Scheduled runs are managed by node-cron
npm install
node index.js
The new-project.js
script uses Puppeteer to automate the bulk creation of projects. Dumps a list of project names and PERCY_TOKEN
s.
Populate the email, password, and org variables in .env
and execute. Requires a Percy account that has the email/password login method enabled.
node new-project.js project1 project2 ...
# { 'project1': 'xxx', 'project2': 'yyy' }
- Optimize image, reduce size
- Split
PERCY_WAIT
on comma to allow multiple ready conditions - Log waits for visibility
- Epic: Handle multiple projects
- Parse optional JSON config file
projects: [{"percy_token": "xxx", "percy_target_url": "xxx", "percy_wait": "1000"}]
- Parse optional ENV vars
PERCY_TOKEN1
...PERCY_TOKEN(N)
PERCY_TARGET_URL1
...PERCY_TARGET_URL(N)
PERCY_WAIT1
...PERCY_WAIT(N)
- Deep-merge ENV with JSON config
- Parse optional JSON config file