aboutsummaryrefslogtreecommitdiff
path: root/testlib
diff options
context:
space:
mode:
authorFlorian Dold <florian.dold@gmail.com>2016-11-13 17:37:48 +0100
committerFlorian Dold <florian.dold@gmail.com>2016-11-13 17:37:48 +0100
commitf5a1a26368ad2539f8c81331dbcb2a6260814c1a (patch)
treeec6ee4b3898d3d18ce74fc5515150dfc2812238e /testlib
parent35e7e1f46474da63d49ba1a632c9f0e0b45c8e86 (diff)
downloadwallet-core-f5a1a26368ad2539f8c81331dbcb2a6260814c1a.tar.xz
test output for the browser
Diffstat (limited to 'testlib')
-rw-r--r--testlib/selenium/runtime.js6
-rw-r--r--testlib/talertest.ts5
2 files changed, 9 insertions, 2 deletions
diff --git a/testlib/selenium/runtime.js b/testlib/selenium/runtime.js
index 06597b984..58a6e45c1 100644
--- a/testlib/selenium/runtime.js
+++ b/testlib/selenium/runtime.js
@@ -69,6 +69,10 @@ try {
var script = `
+ function onStatus(s) {
+ document.body.appendChild(document.createTextNode(s));
+ document.body.appendChild(document.createElement("br"));
+ }
function f() {
if ("undefined" == typeof System) {
console.log("can't access module loader");
@@ -78,7 +82,7 @@ var script = `
.then(tt => {
SystemJS.import("http://localhost:${httpPort}/${testScript}")
.then(() => {
- return tt.run();
+ return tt.run(onStatus);
})
.then(() => {
window.__test_over = true;
diff --git a/testlib/talertest.ts b/testlib/talertest.ts
index 097f65b98..6012eb657 100644
--- a/testlib/talertest.ts
+++ b/testlib/talertest.ts
@@ -47,7 +47,7 @@ export function test(name: string, testFn: TestFn) {
/**
* Run all registered test case, producing a TAP stream.
*/
-export async function run() {
+export async function run(statusCallback?: (m: string) => void) {
console.log(`1..${tests.length}`);
for (let i in tests) {
let t = tests[i];
@@ -81,6 +81,7 @@ export async function run() {
});
console.log(`# ${t.name}`);
+ statusCallback && statusCallback(`starting test ${t.name}`);
if (!lastMsg) {
lastMsg = "-";
@@ -92,9 +93,11 @@ export async function run() {
throw Error("test did not call 'pass'");
}
console.log(`ok ${Number(i) + 1} ${lastMsg || "-"}`);
+ statusCallback && statusCallback(`finished test ${t.name}`);
} catch (e) {
console.error(e);
console.log(`not ok ${Number(i) + 1} ${lastMsg || "-"}`);
+ statusCallback && statusCallback(`failed test ${t.name}`);
}
}
}