2014-08-21 22:37:35 +00:00
|
|
|
(function () {
|
2014-08-26 06:21:58 +00:00
|
|
|
var tests = require('./test/drawing/DrawingTests.casper.js').tests;
|
2014-08-21 22:37:35 +00:00
|
|
|
|
|
|
|
var baseUrl = casper.cli.get('baseUrl')+"?debug";
|
|
|
|
var resultSelector = '#drawing-test-result';
|
|
|
|
|
|
|
|
casper.start();
|
|
|
|
|
|
|
|
var runTest = function (index) {
|
2014-08-26 06:21:58 +00:00
|
|
|
var test = 'drawing/tests/' + tests[index];
|
2014-08-21 22:37:35 +00:00
|
|
|
|
|
|
|
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);
|
2014-08-21 22:51:35 +00:00
|
|
|
this.waitForSelector(resultSelector, function () {
|
|
|
|
// then
|
2014-08-21 22:37:35 +00:00
|
|
|
var result = this.getHTML(resultSelector);
|
|
|
|
this.echo('Test finished : ' + result);
|
|
|
|
this.test.assertEquals(result, 'OK');
|
2014-08-21 22:51:35 +00:00
|
|
|
}, function () {
|
|
|
|
// onTimeout
|
|
|
|
this.test.fail('Test timed out');
|
2014-08-21 22:37:35 +00:00
|
|
|
}, 60*1000);
|
|
|
|
})
|
|
|
|
.run(function () {
|
|
|
|
if (tests[index+1]) {
|
|
|
|
runTest(index+1);
|
|
|
|
} else {
|
|
|
|
this.test.done();
|
|
|
|
}
|
|
|
|
});
|
|
|
|
};
|
|
|
|
|
|
|
|
runTest(0);
|
|
|
|
|
|
|
|
})();
|