Added visual regression test
This commit is contained in:
parent
527db9dfaf
commit
ba298be4ad
@ -47,11 +47,13 @@
|
|||||||
},
|
},
|
||||||
"devDependencies": {
|
"devDependencies": {
|
||||||
"autoprefixer": "^6.3.6",
|
"autoprefixer": "^6.3.6",
|
||||||
|
"backstopjs": "^1.3.5",
|
||||||
"browser-sync": "^2.13.0",
|
"browser-sync": "^2.13.0",
|
||||||
"node-sass": "^3.7.0",
|
"node-sass": "^3.7.0",
|
||||||
"npm-run-all": "^2.1.1",
|
"npm-run-all": "^2.1.1",
|
||||||
"onchange": "^2.4.0",
|
"onchange": "^2.4.0",
|
||||||
"postcss-cli": "^2.5.2"
|
"postcss-cli": "^2.5.2",
|
||||||
|
"slimerjs": "^0.906.2"
|
||||||
},
|
},
|
||||||
"engines": {
|
"engines": {
|
||||||
"node": "^6.0.0"
|
"node": "^6.0.0"
|
||||||
@ -63,6 +65,7 @@
|
|||||||
"build": "npm-run-all sass autoprefixer banner",
|
"build": "npm-run-all sass autoprefixer banner",
|
||||||
"watch": "onchange src -- npm run build",
|
"watch": "onchange src -- npm run build",
|
||||||
"serve": "browser-sync start -s test --ss dist -f dist",
|
"serve": "browser-sync start -s test --ss dist -f dist",
|
||||||
"start": "npm-run-all -p watch serve"
|
"start": "npm-run-all -p watch serve",
|
||||||
|
"test": "cd node_modules/backstopjs && npm run test -- --configPath=../../test/visual/backstop.config.js && cd ../../"
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
33
test/visual/backstop.config.js
Normal file
33
test/visual/backstop.config.js
Normal file
@ -0,0 +1,33 @@
|
|||||||
|
module.exports = {
|
||||||
|
viewports: [
|
||||||
|
{ name: 'phone_v', width: 320, height: 480 },
|
||||||
|
{ name: 'phone_h', width: 480, height: 320 },
|
||||||
|
{ name: 'tablet_v', width: 768, height: 1024 },
|
||||||
|
{ name: 'tablet_h', width: 1024, height: 768 },
|
||||||
|
{ name: 'laptop', width: 1280, height: 800 },
|
||||||
|
{ name: 'desktop', width: 1920, height: 1080 }
|
||||||
|
],
|
||||||
|
scenarios: [{
|
||||||
|
label: 'Milligram | A minimalist CSS framework.',
|
||||||
|
url: 'http://localhost:3000',
|
||||||
|
hideSelectors: [],
|
||||||
|
removeSelectors: ['.__bs_notify__'],
|
||||||
|
selectors: ['body'],
|
||||||
|
readyEvent: null,
|
||||||
|
delay: 500,
|
||||||
|
misMatchThreshold: 0.1,
|
||||||
|
onBeforeScript: 'onBefore.js',
|
||||||
|
onReadyScript: 'onReady.js'
|
||||||
|
}],
|
||||||
|
paths: {
|
||||||
|
bitmaps_reference: '../../test/visual/reference',
|
||||||
|
bitmaps_test: '.tmp',
|
||||||
|
casper_scripts: '../../test/visual/fixtures',
|
||||||
|
compare_data: '.tmp/compare.json'
|
||||||
|
},
|
||||||
|
engine: 'slimerjs',
|
||||||
|
report: ['browser'],
|
||||||
|
casperFlags: [],
|
||||||
|
debug: false,
|
||||||
|
port: 3002
|
||||||
|
}
|
4
test/visual/fixtures/onBefore.js
Normal file
4
test/visual/fixtures/onBefore.js
Normal file
@ -0,0 +1,4 @@
|
|||||||
|
module.exports = function(casper, scenario, vp) {
|
||||||
|
casper.echo('onBeforeEach.js', 'INFO');
|
||||||
|
casper.wait(50);
|
||||||
|
};
|
4
test/visual/fixtures/onReady.js
Normal file
4
test/visual/fixtures/onReady.js
Normal file
@ -0,0 +1,4 @@
|
|||||||
|
module.exports = function(casper, scenario, vp) {
|
||||||
|
casper.echo('onReady.js', 'INFO');
|
||||||
|
casper.wait(50);
|
||||||
|
};
|
BIN
test/visual/reference/0_0_body_0_phone_v.png
Normal file
BIN
test/visual/reference/0_0_body_0_phone_v.png
Normal file
Binary file not shown.
After Width: | Height: | Size: 144 KiB |
BIN
test/visual/reference/0_0_body_1_phone_h.png
Normal file
BIN
test/visual/reference/0_0_body_1_phone_h.png
Normal file
Binary file not shown.
After Width: | Height: | Size: 148 KiB |
BIN
test/visual/reference/0_0_body_2_tablet_v.png
Normal file
BIN
test/visual/reference/0_0_body_2_tablet_v.png
Normal file
Binary file not shown.
After Width: | Height: | Size: 153 KiB |
BIN
test/visual/reference/0_0_body_3_tablet_h.png
Normal file
BIN
test/visual/reference/0_0_body_3_tablet_h.png
Normal file
Binary file not shown.
After Width: | Height: | Size: 162 KiB |
BIN
test/visual/reference/0_0_body_4_laptop.png
Normal file
BIN
test/visual/reference/0_0_body_4_laptop.png
Normal file
Binary file not shown.
After Width: | Height: | Size: 167 KiB |
BIN
test/visual/reference/0_0_body_5_desktop.png
Normal file
BIN
test/visual/reference/0_0_body_5_desktop.png
Normal file
Binary file not shown.
After Width: | Height: | Size: 180 KiB |
Loading…
Reference in New Issue
Block a user