Created
July 9, 2015 08:50
-
-
Save dark4eg/f6a69d2933b00794ccd5 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
var page = require('webpage').create(); | |
var url; | |
if (phantom.args) { | |
url = phantom.args[0]; | |
} else { | |
url = require('system').args[1]; | |
} | |
page.onConsoleMessage = function (message) { | |
console.log(message); | |
}; | |
function exit(code) { | |
setTimeout(function(){ phantom.exit(code); }, 0); | |
phantom.onError = function(){}; | |
} | |
console.log("Loading URL: " + url); | |
page.open(url, function (status) { | |
if (status != "success") { | |
console.log('Failed to open ' + url); | |
phantom.exit(1); | |
} | |
console.log("Running test."); | |
var result = page.evaluate(function() { | |
return st_container.test_runner.runner(); | |
}); | |
if (result != 0) { | |
console.log("*** Test failed! ***"); | |
exit(1); | |
} | |
else { | |
console.log("Test succeeded."); | |
exit(0); | |
} | |
}); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment