Files
blockly/tests/jsunit/test_runner.js
shirletan 7a2c01e1cf Work around timing issue with travis osx issue (#1092)
* add more wait time for test setup

* increase selenium wait time

* add more wait
2017-05-09 16:39:39 -07:00

36 lines
1.0 KiB
JavaScript

var webdriverio = require('webdriverio');
var options = {
desiredCapabilities: {
browserName: 'chrome'
}
};
var path = process.cwd();
//TODO: change pause to waitunitl
var browser = webdriverio
.remote(options)
.init()
.url("file://" + path + "/tests/jsunit/index.html").pause(5000);
browser
.getHTML('#closureTestRunnerLog')
.then(function(result) {
// call js to parse html
var regex = /[\d]+\spassed,\s([\d]+)\sfailed./i;
var numOfFailure = regex.exec(result)[1];
var regex2 = /Unit Tests for Blockly .*]/;
var testStatus = regex2.exec(result)[0];
console.log("============Blockly Unit Test Summary=================");
console.log(testStatus);
var regex3 = /\d+ passed,\s\d+ failed/;
var detail = regex3.exec(result)[0];
console.log(detail);
console.log("============Blockly Unit Test Summary=================");
if ( parseInt(numOfFailure) !== 0) {
console.log(result);
process.exit(1);
}
})
.catch(function(err) { console.log(err); process.exit(1); });