mirror of
https://github.com/piskelapp/piskel.git
synced 2023-08-10 21:12:52 +03:00
add drawing tests to casper
This commit is contained in:
42
test/integration/casperjs/DrawingTest.js
Normal file
42
test/integration/casperjs/DrawingTest.js
Normal file
@@ -0,0 +1,42 @@
|
||||
(function () {
|
||||
var tests = [
|
||||
'SimplePenDrawing1.json',
|
||||
'ComplexDrawing1.json',
|
||||
'ComplexDrawing2.json'
|
||||
];
|
||||
|
||||
var baseUrl = casper.cli.get('baseUrl')+"?debug";
|
||||
var resultSelector = '#drawing-test-result';
|
||||
|
||||
casper.start();
|
||||
|
||||
var runTest = function (index) {
|
||||
var test = 'integration/casperjs/drawing-records/' + 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() {
|
||||
var result = this.getHTML(resultSelector);
|
||||
this.echo('Test finished : ' + result);
|
||||
this.test.assertEquals(result, 'OK');
|
||||
}, 60*1000);
|
||||
})
|
||||
.run(function () {
|
||||
if (tests[index+1]) {
|
||||
runTest(index+1);
|
||||
} else {
|
||||
this.test.done();
|
||||
}
|
||||
});
|
||||
};
|
||||
|
||||
runTest(0);
|
||||
|
||||
})();
|
||||
Reference in New Issue
Block a user