desktop version phantom css tests
12
package.json
|
@ -3,7 +3,9 @@
|
||||||
"version": "1.3.0",
|
"version": "1.3.0",
|
||||||
"description": "Gentelella Admin is a free to use Bootstrap admin template",
|
"description": "Gentelella Admin is a free to use Bootstrap admin template",
|
||||||
"scripts": {
|
"scripts": {
|
||||||
"test": "echo \"Error: no test specified\" && exit 1"
|
"test": "(npm start > /dev/null &) && (npm run casper:desktop)",
|
||||||
|
"casper:desktop": "casperjs test test/desktop.js",
|
||||||
|
"start": "http-server -a localhost -p 8000 -c-1 ./"
|
||||||
},
|
},
|
||||||
"repository": {
|
"repository": {
|
||||||
"type": "git",
|
"type": "git",
|
||||||
|
@ -32,11 +34,17 @@
|
||||||
"homepage": "https://github.com/puikinsh/gentelella#readme",
|
"homepage": "https://github.com/puikinsh/gentelella#readme",
|
||||||
"devDependencies": {
|
"devDependencies": {
|
||||||
"browser-sync": "^2.12.10",
|
"browser-sync": "^2.12.10",
|
||||||
|
"casperjs": "^1.1.2",
|
||||||
"gulp": "^3.9.1",
|
"gulp": "^3.9.1",
|
||||||
"gulp-autoprefixer": "^3.1.0",
|
"gulp-autoprefixer": "^3.1.0",
|
||||||
"gulp-concat": "^2.6.0",
|
"gulp-concat": "^2.6.0",
|
||||||
"gulp-rename": "^1.2.2",
|
"gulp-rename": "^1.2.2",
|
||||||
"gulp-ruby-sass": "^2.0.6",
|
"gulp-ruby-sass": "^2.0.6",
|
||||||
"gulp-uglify": "^1.5.3"
|
"gulp-uglify": "^1.5.3",
|
||||||
|
"http-server": "^0.9.0",
|
||||||
|
"lodash": "^4.17.4",
|
||||||
|
"phantomcss": "^1.1.5",
|
||||||
|
"phantomjs-prebuilt": "^2.1.4",
|
||||||
|
"resemblejs": "^2.2.2"
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -0,0 +1 @@
|
||||||
|
<html><body>This blank HTML page is used for processing the images with Resemble.js</body></html>
|
|
@ -0,0 +1,66 @@
|
||||||
|
var phantomcss = require('phantomcss');
|
||||||
|
|
||||||
|
// http://phantomjs.org/api/fs/method/list.html
|
||||||
|
var fs = require('fs');
|
||||||
|
var _ = require('lodash');
|
||||||
|
|
||||||
|
casper.test.begin('Gentelella visual tests', function (test) {
|
||||||
|
|
||||||
|
phantomcss.init({
|
||||||
|
rebase: casper.cli.get("rebase"),
|
||||||
|
// SlimerJS needs explicit knowledge of this Casper, and lots of absolute paths
|
||||||
|
casper: casper,
|
||||||
|
libraryRoot: '',
|
||||||
|
screenshotRoot: './test/screenshots/desktop',
|
||||||
|
failedComparisonsRoot: './test/screenshots/desktop/failures',
|
||||||
|
addLabelToFailedImage: false
|
||||||
|
});
|
||||||
|
|
||||||
|
// casper.on('remote.message', function (msg) {
|
||||||
|
// this.echo(msg);
|
||||||
|
// });
|
||||||
|
//
|
||||||
|
// casper.on('error', function (err) {
|
||||||
|
// this.die("PhantomJS has errored: " + err);
|
||||||
|
// });
|
||||||
|
//
|
||||||
|
// casper.on('resource.error', function (err) {
|
||||||
|
// casper.log('Resource load error: ' + err, 'warning');
|
||||||
|
// });
|
||||||
|
|
||||||
|
/*
|
||||||
|
The test scenario
|
||||||
|
*/
|
||||||
|
casper.start('http://localhost:8000/production/');
|
||||||
|
casper.viewport(1920, 1080);
|
||||||
|
|
||||||
|
var pages = fs.list('./production');
|
||||||
|
pages = _.filter(pages, function (p) {
|
||||||
|
return _.includes(p, 'html');
|
||||||
|
});
|
||||||
|
|
||||||
|
pages.forEach(function (page) {
|
||||||
|
casper.thenOpen('http://localhost:8000/production/' + page, function () {
|
||||||
|
console.log('testing page: ' + page);
|
||||||
|
casper.wait(1000, function () {
|
||||||
|
phantomcss.screenshot('body', page.replace('.html', ''));
|
||||||
|
});
|
||||||
|
});
|
||||||
|
});
|
||||||
|
|
||||||
|
casper.thenOpen('http://localhost:8000/production/', function () {
|
||||||
|
casper.click('#menu_toggle');
|
||||||
|
casper.wait(1000, function () {
|
||||||
|
phantomcss.screenshot('body', 'index-small_menu');
|
||||||
|
});
|
||||||
|
});
|
||||||
|
|
||||||
|
casper.then(function () {
|
||||||
|
phantomcss.compareAll();
|
||||||
|
});
|
||||||
|
|
||||||
|
casper.run(function () {
|
||||||
|
phantomcss.getExitStatus(); // pass or fail?
|
||||||
|
casper.test.done();
|
||||||
|
});
|
||||||
|
});
|
After Width: | Height: | Size: 117 KiB |
After Width: | Height: | Size: 205 KiB |
After Width: | Height: | Size: 297 KiB |
After Width: | Height: | Size: 244 KiB |
After Width: | Height: | Size: 686 KiB |
After Width: | Height: | Size: 511 KiB |
After Width: | Height: | Size: 60 KiB |
After Width: | Height: | Size: 68 KiB |
After Width: | Height: | Size: 374 KiB |
After Width: | Height: | Size: 1.1 MiB |
After Width: | Height: | Size: 172 KiB |
After Width: | Height: | Size: 90 KiB |
After Width: | Height: | Size: 108 KiB |
After Width: | Height: | Size: 130 KiB |
After Width: | Height: | Size: 508 KiB |
After Width: | Height: | Size: 718 KiB |
After Width: | Height: | Size: 942 KiB |
After Width: | Height: | Size: 281 KiB |
After Width: | Height: | Size: 399 KiB |
After Width: | Height: | Size: 230 KiB |
After Width: | Height: | Size: 248 KiB |
After Width: | Height: | Size: 434 KiB |
After Width: | Height: | Size: 195 KiB |
After Width: | Height: | Size: 72 KiB |
After Width: | Height: | Size: 252 KiB |
After Width: | Height: | Size: 316 KiB |
After Width: | Height: | Size: 196 KiB |
After Width: | Height: | Size: 271 KiB |
After Width: | Height: | Size: 22 KiB |
After Width: | Height: | Size: 22 KiB |
After Width: | Height: | Size: 24 KiB |
After Width: | Height: | Size: 76 KiB |
After Width: | Height: | Size: 116 KiB |
After Width: | Height: | Size: 320 KiB |
After Width: | Height: | Size: 219 KiB |
After Width: | Height: | Size: 178 KiB |
After Width: | Height: | Size: 198 KiB |
After Width: | Height: | Size: 653 KiB |
After Width: | Height: | Size: 176 KiB |
After Width: | Height: | Size: 261 KiB |
After Width: | Height: | Size: 15 KiB |