mirror of
https://github.com/piskelapp/piskel.git
synced 2023-08-10 21:12:52 +03:00
Drawing tests structure cleanup
This commit is contained in:
42
test/casperjs/DrawingTest.js
Normal file
42
test/casperjs/DrawingTest.js
Normal file
@@ -0,0 +1,42 @@
|
||||
(function () {
|
||||
var tests = require('./test/drawing/DrawingTests.casper.js').tests;
|
||||
|
||||
var baseUrl = casper.cli.get('baseUrl')+"?debug";
|
||||
var resultSelector = '#drawing-test-result';
|
||||
|
||||
casper.start();
|
||||
|
||||
var runTest = function (index) {
|
||||
var test = 'drawing/tests/' + tests[index];
|
||||
|
||||
casper.open(baseUrl + "&test-run=" + test);
|
||||
|
||||
casper.then(function () {
|
||||
this.echo('Running test : ' + test);
|
||||
this.wait(casper.cli.get('delay'));
|
||||
});
|
||||
|
||||
casper.then(function () {
|
||||
this.echo('Waiting for test result : ' + resultSelector);
|
||||
this.waitForSelector(resultSelector, function () {
|
||||
// then
|
||||
var result = this.getHTML(resultSelector);
|
||||
this.echo('Test finished : ' + result);
|
||||
this.test.assertEquals(result, 'OK');
|
||||
}, function () {
|
||||
// onTimeout
|
||||
this.test.fail('Test timed out');
|
||||
}, 60*1000);
|
||||
})
|
||||
.run(function () {
|
||||
if (tests[index+1]) {
|
||||
runTest(index+1);
|
||||
} else {
|
||||
this.test.done();
|
||||
}
|
||||
});
|
||||
};
|
||||
|
||||
runTest(0);
|
||||
|
||||
})();
|
||||
4
test/casperjs/LocalTestSuite.js
Normal file
4
test/casperjs/LocalTestSuite.js
Normal file
@@ -0,0 +1,4 @@
|
||||
(typeof exports != "undefined" ? exports : pskl_exports).tests = [
|
||||
'SmokeTest.js',
|
||||
'DrawingTest.js'
|
||||
];
|
||||
15
test/casperjs/SmokeTest.js
Normal file
15
test/casperjs/SmokeTest.js
Normal file
@@ -0,0 +1,15 @@
|
||||
casper
|
||||
.start(casper.cli.get('baseUrl')+"?debug")
|
||||
.then(function () {
|
||||
this.wait(casper.cli.get('delay'));
|
||||
})
|
||||
.then(function () {
|
||||
this.echo(casper.cli.get('baseUrl')+"?debug");
|
||||
// If there was a JS error after the page load, casper won't perform asserts
|
||||
this.test.assertExists('html', 'Casper JS cannot assert DOM elements. A JS error has probably occured.');
|
||||
|
||||
this.test.assertExists('#drawing-canvas-container canvas', 'Check if drawing canvas element is created');
|
||||
})
|
||||
.run(function () {
|
||||
this.test.done();
|
||||
});
|
||||
4
test/casperjs/TravisTestSuite.js
Normal file
4
test/casperjs/TravisTestSuite.js
Normal file
@@ -0,0 +1,4 @@
|
||||
(typeof exports != "undefined" ? exports : pskl_exports).tests = [
|
||||
// did not manage to successfully run drawing tests on travis yet ...
|
||||
'SmokeTest.js'
|
||||
];
|
||||
Reference in New Issue
Block a user