Brought to you by the folks at Pantheon
Developer Advocate at Pantheon
davidneedham on GitHub and Twitter
In my free time I like:
Intro and Setup |
Visual Regression Testing |
Using BackstopJS |
Continuous Integration |
Standalone Node App |
Q&A + Extracurricular |
npm install -g backstopjs
/rəˈɡreSH(ə)n/
noun
{
"id": "backstop_default",
"viewports": [
{
"label": "phone",
"width": 320,
"height": 480
},
{
"label": "tablet",
"width": 1024,
"height": 768
}
],
"scenarios": [
{
"label": "Homepage",
"url": "https://pantheonweeklydemosite.lndo.site/",
"referenceUrl": "https://www.pantheondemo.com/",
"readyEvent": "",
"readySelector": "",
"delay": 0,
"hideSelectors": [],
"removeSelectors": [],
"hoverSelector": "",
"clickSelector": "",
"postInteractionWait": 0,
"selectors": [],
"selectorExpansion": true,
"expect": 0,
"misMatchThreshold" : 0.1,
"requireSameDimensions": true
}
],
"paths": {
"bitmaps_reference": "backstop_data/bitmaps_reference",
"bitmaps_test": "backstop_data/bitmaps_test",
"engine_scripts": "backstop_data/engine_scripts",
"html_report": "backstop_data/html_report",
"ci_report": "backstop_data/ci_report"
},
"report": ["browser"],
"engine": "puppeteer",
"engineOptions": {
"args": ["--no-sandbox"]
},
"asyncCaptureLimit": 5,
"asyncCompareLimit": 50,
"debug": false,
"debugWindow": false
}
backstop init
backstop.json
file:
label
: name of your scenariourl
: local or development URLreferenceUrl
: production URLbackstop reference
backstop test
> It'll just be a quick fix
— I Am Devloper (@iamdevloper) August 9, 2018
Narrator: It wasn't.
viewports
or scenarios
?backstop reference
backstop test
We've created an example repo that we're going to clone to give you a jumpstart.
There are detailed instructions in the README to run through this on your own next time.
Today we're going to get started by cloning the repo:
git clone https://github.com/davidneedham/visual-regression-testing-workshop
cd visual-regression-testing-workshop
git checkout -b my-hacking-1
npm install
npm run start
inc/sitesToTest.js
is the list of sites to testnonProductionBaseUrl
is your local / development URLproductionBaseUrl
is your production site URLpathsToTest
is the array of URIs to test for each siteinc/backstopConfig.js
(the viewports, delay, etc)npm run start
WebOps is a set of practices that facilitates collaboration and automates processes to improve the productivity of the whole web team from developers and designers to content editors, stakeholders, and more.
The result is cross-functional web teams empowered to develop, test, and release website changes faster and more reliably.
Let's build something!