take control over remote test run
This commit is contained in:
parent
0409ebb30b
commit
9712e66de5
2 changed files with 33 additions and 12 deletions
|
@ -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 srcFolder = "../../../src/node_modules/";
|
||||||
var log4js = require(srcFolder + "log4js");
|
var log4js = require(srcFolder + "log4js");
|
||||||
var wd = require(srcFolder + "wd");
|
var wd = require(srcFolder + "wd");
|
||||||
|
@ -27,10 +20,34 @@ var enviroment = {
|
||||||
}
|
}
|
||||||
|
|
||||||
browserChain.init(enviroment).get("http://localhost:9001/tests/frontend/", function(){
|
browserChain.init(enviroment).get("http://localhost:9001/tests/frontend/", function(){
|
||||||
setTimeout(function(){
|
var stopSauce = function(success){
|
||||||
|
getStatusInterval && clearInterval(getStatusInterval);
|
||||||
|
clearTimeout(timeout);
|
||||||
|
|
||||||
browserChain.quit();
|
browserChain.quit();
|
||||||
setTimeout(function(){
|
setTimeout(function(){
|
||||||
process.exit(0);
|
process.exit(success ? 0 : 1);
|
||||||
}, 1000);
|
}, 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);
|
||||||
});
|
});
|
||||||
|
|
|
@ -4,11 +4,15 @@
|
||||||
cd `dirname $0`
|
cd `dirname $0`
|
||||||
|
|
||||||
#start etherpad lite
|
#start etherpad lite
|
||||||
../../../bin/run.sh &
|
../../../bin/run.sh > /dev/null &
|
||||||
sleep 10
|
sleep 10
|
||||||
|
|
||||||
#start remote runner
|
#start remote runner
|
||||||
node remote_runner.js
|
node remote_runner.js
|
||||||
|
exit_code=$?
|
||||||
|
|
||||||
kill $!
|
kill $!
|
||||||
kill $(cat /tmp/sauce.pid)
|
kill $(cat /tmp/sauce.pid)
|
||||||
|
sleep 30
|
||||||
|
|
||||||
|
exit $exit_code
|
Loading…
Reference in a new issue