X-Git-Url: http://sru.miketaylor.org.uk/?a=blobdiff_plain;f=test%2Fphantom%2Fevaluate.js;h=309b9a8b6c181bbcf119e95e79b160e6e013ff15;hb=af744f72a162d46f45cb42bfec3e9028c3aa206d;hp=9447ad8654c256356e886120c187040d775be560;hpb=f0c2826509c981f4f90727bffa3b2959ac3dfcad;p=mkws-moved-to-github.git 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); });