desktop version phantom css tests

pull/407/head
Michał Siatkowski 2017-02-16 12:58:22 +01:00
parent a365458133
commit e8b9b79536
44 changed files with 77 additions and 2 deletions

View File

@ -3,7 +3,9 @@
"version": "1.3.0",
"description": "Gentelella Admin is a free to use Bootstrap admin template",
"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": {
"type": "git",
@ -32,11 +34,17 @@
"homepage": "https://github.com/puikinsh/gentelella#readme",
"devDependencies": {
"browser-sync": "^2.12.10",
"casperjs": "^1.1.2",
"gulp": "^3.9.1",
"gulp-autoprefixer": "^3.1.0",
"gulp-concat": "^2.6.0",
"gulp-rename": "^1.2.2",
"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"
}
}

1
resemblejscontainer.html Normal file
View File

@ -0,0 +1 @@
<html><body>This blank HTML page is used for processing the images with Resemble.js</body></html>

66
test/desktop.js Executable file
View File

@ -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();
});
});

Binary file not shown.

After

Width:  |  Height:  |  Size: 117 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 205 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 297 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 244 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 686 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 511 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 60 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 68 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 374 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.1 MiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 172 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 90 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 108 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 130 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 508 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 718 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 942 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 281 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 399 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 230 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 248 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 434 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 195 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 72 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 252 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 316 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 196 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 271 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 22 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 22 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 24 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 76 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 116 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 320 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 219 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 178 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 198 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 653 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 176 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 261 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 15 KiB