You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
This is a collection of scripts for taking and comparing screenshots of WordPress admin pages. This is mostly a personal tool, where I create scripts to run through various pages while testing tickets.
Quickstart
cd grab-screenshots
npm install
npm run snap
Available scripts
The scripts use environment variables for configuration. Pass these in before the script command, ex:
WP_BASE_URL=https://localhost:8888 npm run snap
The following variables are used for index.js/npm run snap.
Env Variable
Default
Description
WP_USERNAME
admin
Username to log in with, should have access to all pages that are requested.
The URL to the running WordPress instance. Note, this does not have to be a local install.
IMAGE_PATH
screenshots
Where the screenshots will be saved. This directory needs to exist already.
index.js
Run this with npm run snap. It will loop over all core color schemes and take screenshots of an assortment of pages, sometimes with elements hovered or focused. Read through the script to see the steps it takes.
diff.js
Run this with npm run diff. Assuming you have two folders of matching screenshots, this will run blink-diff over each file-pair in the folders.
Env Variable
Default
Description
IMAGE_A_PATH
photos-a
First folder of screenshots.
IMAGE_B_PATH
photos-b
Second folder of screenshots.
DIFF_PATH
photos-diffs
Output folder for visual diffs.
Putting them together
If you want to check the difference between two branches of WordPress, you could…