diff options
author | Peter 'Pita' Martischka <petermartischka@googlemail.com> | 2012-11-01 23:21:10 +0000 |
---|---|---|
committer | Peter 'Pita' Martischka <petermartischka@googlemail.com> | 2012-11-01 23:21:10 +0000 |
commit | 9712e66de55dd03eb9db94a4919381da37ab0e7b (patch) | |
tree | 6270690123525438e0dcded3ff42e1e8254dc209 /tests | |
parent | 0409ebb30b98e427b9479d6db7fb37a602d10889 (diff) | |
download | etherpad-lite-9712e66de55dd03eb9db94a4919381da37ab0e7b.zip |
take control over remote test run
Diffstat (limited to 'tests')
-rw-r--r-- | tests/frontend/travis/remote_runner.js | 37 | ||||
-rwxr-xr-x | tests/frontend/travis/runner.sh | 8 |
2 files changed, 33 insertions, 12 deletions
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 |