diff --git a/bots/naughty/debian-stable/9641-xtermjs-dimensions-crash b/bots/naughty/debian-stable/9641-xtermjs-dimensions-crash index 086fd234110b..92d68521e068 100644 --- a/bots/naughty/debian-stable/9641-xtermjs-dimensions-crash +++ b/bots/naughty/debian-stable/9641-xtermjs-dimensions-crash @@ -1,5 +1,4 @@ Traceback (most recent call last): File "test/verify/check-machines", line *, in testSerialConsole - b.wait_not_present("div.terminal canvas.xterm-text-layer") * -Error: timeout +RuntimeError: TypeError: Cannot read property 'dimensions' of undefined diff --git a/bots/naughty/debian-testing/9641-xtermjs-dimensions-crash b/bots/naughty/debian-testing/9641-xtermjs-dimensions-crash index 086fd234110b..92d68521e068 100644 --- a/bots/naughty/debian-testing/9641-xtermjs-dimensions-crash +++ b/bots/naughty/debian-testing/9641-xtermjs-dimensions-crash @@ -1,5 +1,4 @@ Traceback (most recent call last): File "test/verify/check-machines", line *, in testSerialConsole - b.wait_not_present("div.terminal canvas.xterm-text-layer") * -Error: timeout +RuntimeError: TypeError: Cannot read property 'dimensions' of undefined diff --git a/bots/naughty/fedora-27/9641-xtermjs-dimensions-crash b/bots/naughty/fedora-27/9641-xtermjs-dimensions-crash index 086fd234110b..92d68521e068 100644 --- a/bots/naughty/fedora-27/9641-xtermjs-dimensions-crash +++ b/bots/naughty/fedora-27/9641-xtermjs-dimensions-crash @@ -1,5 +1,4 @@ Traceback (most recent call last): File "test/verify/check-machines", line *, in testSerialConsole - b.wait_not_present("div.terminal canvas.xterm-text-layer") * -Error: timeout +RuntimeError: TypeError: Cannot read property 'dimensions' of undefined diff --git a/bots/naughty/fedora-28/9641-xtermjs-dimensions-crash b/bots/naughty/fedora-28/9641-xtermjs-dimensions-crash index 086fd234110b..92d68521e068 100644 --- a/bots/naughty/fedora-28/9641-xtermjs-dimensions-crash +++ b/bots/naughty/fedora-28/9641-xtermjs-dimensions-crash @@ -1,5 +1,4 @@ Traceback (most recent call last): File "test/verify/check-machines", line *, in testSerialConsole - b.wait_not_present("div.terminal canvas.xterm-text-layer") * -Error: timeout +RuntimeError: TypeError: Cannot read property 'dimensions' of undefined diff --git a/bots/naughty/rhel-7/9641-xtermjs-dimensions-crash b/bots/naughty/rhel-7/9641-xtermjs-dimensions-crash index 086fd234110b..92d68521e068 100644 --- a/bots/naughty/rhel-7/9641-xtermjs-dimensions-crash +++ b/bots/naughty/rhel-7/9641-xtermjs-dimensions-crash @@ -1,5 +1,4 @@ Traceback (most recent call last): File "test/verify/check-machines", line *, in testSerialConsole - b.wait_not_present("div.terminal canvas.xterm-text-layer") * -Error: timeout +RuntimeError: TypeError: Cannot read property 'dimensions' of undefined diff --git a/bots/naughty/rhel-x/9641-xtermjs-dimensions-crash b/bots/naughty/rhel-x/9641-xtermjs-dimensions-crash index 086fd234110b..92d68521e068 100644 --- a/bots/naughty/rhel-x/9641-xtermjs-dimensions-crash +++ b/bots/naughty/rhel-x/9641-xtermjs-dimensions-crash @@ -1,5 +1,4 @@ Traceback (most recent call last): File "test/verify/check-machines", line *, in testSerialConsole - b.wait_not_present("div.terminal canvas.xterm-text-layer") * -Error: timeout +RuntimeError: TypeError: Cannot read property 'dimensions' of undefined diff --git a/bots/naughty/ubuntu-1604/9641-xtermjs-dimensions-crash b/bots/naughty/ubuntu-1604/9641-xtermjs-dimensions-crash index 086fd234110b..92d68521e068 100644 --- a/bots/naughty/ubuntu-1604/9641-xtermjs-dimensions-crash +++ b/bots/naughty/ubuntu-1604/9641-xtermjs-dimensions-crash @@ -1,5 +1,4 @@ Traceback (most recent call last): File "test/verify/check-machines", line *, in testSerialConsole - b.wait_not_present("div.terminal canvas.xterm-text-layer") * -Error: timeout +RuntimeError: TypeError: Cannot read property 'dimensions' of undefined diff --git a/bots/naughty/ubuntu-stable/9641-xtermjs-dimensions-crash b/bots/naughty/ubuntu-stable/9641-xtermjs-dimensions-crash index 086fd234110b..92d68521e068 100644 --- a/bots/naughty/ubuntu-stable/9641-xtermjs-dimensions-crash +++ b/bots/naughty/ubuntu-stable/9641-xtermjs-dimensions-crash @@ -1,5 +1,4 @@ Traceback (most recent call last): File "test/verify/check-machines", line *, in testSerialConsole - b.wait_not_present("div.terminal canvas.xterm-text-layer") * -Error: timeout +RuntimeError: TypeError: Cannot read property 'dimensions' of undefined diff --git a/test/common/cdp-driver.js b/test/common/cdp-driver.js index 72dfbd81d5ae..018fbe3ec73f 100755 --- a/test/common/cdp-driver.js +++ b/test/common/cdp-driver.js @@ -47,11 +47,15 @@ function fatal() { } function fail(err) { + if (typeof err === 'undefined') + err = null; process.stdout.write(JSON.stringify({"error": err}) + '\n'); } function success(result) { - process.stdout.write(JSON.stringify({"result": result === undefined ? null : result}) + '\n'); + if (typeof result === 'undefined') + result = null; + process.stdout.write(JSON.stringify({"result": result}) + '\n'); } /** @@ -61,6 +65,7 @@ function success(result) { var messages = []; var logPromiseResolver; var nReportedLogMessages = 0; +var unhandledExceptions = []; function setupLogging(client) { client.Runtime.enable(); @@ -72,6 +77,16 @@ function setupLogging(client) { resolveLogPromise(); }); + client.Runtime.exceptionThrown(info => { + let details = info.exceptionDetails; + // don't log test timeouts, they already get handled + if (details.exception && details.exception.className === "PhWaitCondTimeout") + return; + + unhandledExceptions.push(details) + process.stderr.write(details.description || JSON.stringify(details) + "\n"); + }); + client.Log.enable(); client.Log.entryAdded(entry => { let msg = entry["entry"]; @@ -288,7 +303,19 @@ CDP.New(options) pageLoadPromise = new Promise((resolve, reject) => { pageLoadResolve = resolve; pageLoadReject = reject; }); // run the command - eval(command).then(success, fail); + eval(command).then(reply => { + if (unhandledExceptions.length === 0) { + success(reply); + } else { + let details = unhandledExceptions[0]; + let message = details.exception.message || + details.exception.description || + details.exception.value || + JSON.stringify(details.exception); + fail(message.split("\n")[0]); + unhandledExceptions.length = 0; + } + }, fail); input_buf = input_buf.slice(i+1); } diff --git a/test/common/test-functions.js b/test/common/test-functions.js index 93d1caf4a4f1..0d5816cd9d67 100644 --- a/test/common/test-functions.js +++ b/test/common/test-functions.js @@ -184,6 +184,12 @@ function ph_focus(sel) ph_find(sel).focus(); } +class PhWaitCondTimeout extends Error { + constructor() { + super("condition did not become true"); + } +} + function ph_wait_cond(cond, timeout) { return new Promise((resolve, reject) => { // poll every 100 ms for now; FIXME: poll less often and re-check on mutations using @@ -192,7 +198,7 @@ function ph_wait_cond(cond, timeout) { let tm = window.setTimeout( () => { if (stepTimer) window.clearTimeout(stepTimer); - reject("condition did not become true"); + reject(new PhWaitCondTimeout()); }, timeout); function step() { try {