Convert test runner to headless

This commit is contained in:
toby 2017-02-24 18:50:17 -05:00
parent 04df7a51d2
commit 3a90244af0
14 changed files with 1466 additions and 318 deletions

38
test/TestRunner.js Normal file
View file

@ -0,0 +1,38 @@
/**
* TestRunner.js
*
* This is for actually running the tests in the test register.
*
* @author tlwr [toby@toby.codes
*
* @copyright Crown Copyright 2017
* @license Apache-2.0
*
*/
(function() {
document.addEventListener("DOMContentLoaded", function() {
TestRegister.runTests()
.then(function(results) {
results.forEach(function(testResult) {
if (typeof window.callPhantom === "function") {
window.callPhantom(
"testResult",
testResult
);
} else {
var output = [
"----------",
testResult.test.name,
testResult.status,
testResult.output,
].join("<br>");
document.body.innerHTML += "<div>" + output + "</div>";
}
});
if (typeof window.callPhantom === "function") {
window.callPhantom("exit");
}
});
});
})();