From: Wolfram Schneider Date: Fri, 31 Jan 2014 11:34:05 +0000 (+0000) Subject: in case of an test error dump the HTML DOM to a local file. X-Git-Tag: 1.0.0~1545 X-Git-Url: http://git.indexdata.com/?p=mkws-moved-to-github.git;a=commitdiff_plain;h=af744f72a162d46f45cb42bfec3e9028c3aa206d in case of an test error dump the HTML DOM to a local file. make poll time configurable --- diff --git a/test/phantom/evaluate.js b/test/phantom/evaluate.js index 9447ad8..309b9a8 100644 --- a/test/phantom/evaluate.js +++ b/test/phantom/evaluate.js @@ -20,6 +20,9 @@ page.viewportSize = { }; var run_time = 8; // poll up to seconds +if (system.args[2] && parseFloat(system.args[2]) > 0){ + run_time = parseFloat(system.args[2] ); +} /************************/ @@ -67,7 +70,7 @@ page.open(url, function (status) { phantom.exit(1); } - console.log("polling MKWS jasmine test status..."); + console.log("polling MKWS jasmine test status for " + run_time + " seconds"); var exit = wait_for_jasmine(function () { return page.evaluate(function () { @@ -76,6 +79,7 @@ page.open(url, function (status) { } else { return { mkws: window.mkws, + html: window.$("html").html(), duration: window.$(".duration").text(), passing: window.$(".passingAlert").text() }; @@ -90,9 +94,15 @@ page.open(url, function (status) { function (result) { var error_png = "./mkws-error.png"; + var error_html = "./mkws-error.html"; + console.log("MKWS tests failed after " + result.time/1000 + " seconds"); console.log("keep screenshot in '" + error_png + "'"); page.render(error_png); + + console.log("keep html DOM in '" + error_html + "'"); + var fs = require('fs'); + fs.write(error_html, result.html ? result.html : "Argh!", "wb"); }, run_time * 1000); });