diff --git a/tests/frontend/travis/remote_runner.js b/tests/frontend/travis/remote_runner.js index 3b412a4b..6ff85c26 100644 --- a/tests/frontend/travis/remote_runner.js +++ b/tests/frontend/travis/remote_runner.js @@ -1,10 +1,3 @@ -/* - connect to sauce labs - run 2 tests in parrallel - - check in 5s interval for status - - print out result when finished - - exit with 0 when everything has passed, else with 1 -*/ var srcFolder = "../../../src/node_modules/"; var log4js = require(srcFolder + "log4js"); var wd = require(srcFolder + "wd"); @@ -27,10 +20,34 @@ var enviroment = { } browserChain.init(enviroment).get("http://localhost:9001/tests/frontend/", function(){ - setTimeout(function(){ + var stopSauce = function(success){ + getStatusInterval && clearInterval(getStatusInterval); + clearTimeout(timeout); + browserChain.quit(); setTimeout(function(){ - process.exit(0); + process.exit(success ? 0 : 1); }, 1000); - }, 60000); + } + + var timeout = setTimeout(function(){ + stopSauce(false); + }, 60000 * 10); + + var knownConsoleText = ""; + var getStatusInterval = setInterval(function(){ + browserChain.eval("$('#console').text()", function(err, consoleText){ + if(!consoleText || err){ + return; + } + var newText = consoleText.substr(knownConsoleText.length); + newText.length > 0 && console.log(newText.replace(/\n$/, "")); + knownConsoleText = consoleText; + + if(knownConsoleText.indexOf("FINISHED") > 0){ + var success = knownConsoleText.indexOf("FAILED") === -1; + stopSauce(success); + } + }); + }, 5000); }); diff --git a/tests/frontend/travis/runner.sh b/tests/frontend/travis/runner.sh index 06405b09..ae53e667 100755 --- a/tests/frontend/travis/runner.sh +++ b/tests/frontend/travis/runner.sh @@ -4,11 +4,15 @@ cd `dirname $0` #start etherpad lite -../../../bin/run.sh & +../../../bin/run.sh > /dev/null & sleep 10 #start remote runner node remote_runner.js +exit_code=$? kill $! -kill $(cat /tmp/sauce.pid) \ No newline at end of file +kill $(cat /tmp/sauce.pid) +sleep 30 + +exit $exit_code \ No newline at end of file