X-Git-Url: http://git.indexdata.com/?a=blobdiff_plain;f=test%2Fphantom%2Fevaluate.js;h=0cf56f0d52a5fe74afb0c4914afb4d660bbefcaa;hb=f250e43f94ea55889cacd5986e2552b2199bfcb3;hp=52e044dfbed7c68aa4ce988575a64f76457d0691;hpb=c40451977ccc4a9759f53aae07bdb1a576b8e2e4;p=mkws-moved-to-github.git diff --git a/test/phantom/evaluate.js b/test/phantom/evaluate.js index 52e044d..0cf56f0 100644 --- a/test/phantom/evaluate.js +++ b/test/phantom/evaluate.js @@ -26,7 +26,10 @@ page.viewportSize = { // 0: silent, 1: some infos, 2: display console.log() output var debug = 2; - +if (typeof system.env['DEBUG'] != 'undefined' && parseInt(system.env['DEBUG']) != NaN) { + debug = system.env['DEBUG']; + if (debug > 0) console.log("reset debug level to: " + debug); +} /************************/ @@ -73,12 +76,18 @@ page.onAlert = function (msg) { console.log("Alert: " + msg); }; +// display HTTP errors +page.onResourceError = function (resourceError) { + // console.log('phantomjs error code: ' + resourceError.errorCode); + console.log(resourceError.errorString); + phantom.exit(3); +}; page.open(url, function (status) { if (debug >= 1) console.log("fetch " + url + " with status: " + status); if (status != 'success') { - console.log("Failed to fetch page, give up"); + console.log("Failed to fetch page, give up. Network error?"); phantom.exit(1); } @@ -90,11 +99,13 @@ page.open(url, function (status) { if (!window || !window.$ || !window.mkws) { return false; } else { + var passing = window.$(".passingAlert").text() || window.$(".failingAlert").text(); + return { mkws: window.mkws, html: window.$("html").html(), duration: window.$(".duration").text(), - passing: window.$(".passingAlert").text() + passing: passing }; } }) @@ -103,6 +114,7 @@ page.open(url, function (status) { function (result) { if (debug < 1) return; + console.log(""); console.log("MKWS tests are successfully done in " + result.time / 1000 + " seconds. Hooray!"); console.log("jasmine duration: " + result.duration); console.log("jasmine passing: " + result.passing);