mirror of
https://github.com/ether/etherpad-lite.git
synced 2025-01-31 19:02:59 +01:00
test in different browsers
This commit is contained in:
parent
ab6adc7216
commit
0fd6051f52
2 changed files with 113 additions and 43 deletions
|
@ -4,6 +4,7 @@ node_js:
|
|||
- "0.6"
|
||||
install:
|
||||
- "bin/installDeps.sh"
|
||||
- "export GIT_HASH=$(cat .git/HEAD | head -c 7)"
|
||||
before_script:
|
||||
- "tests/frontend/travis/sauce_tunnel.sh"
|
||||
script:
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
var srcFolder = "../../../src/node_modules/";
|
||||
var log4js = require(srcFolder + "log4js");
|
||||
var wd = require(srcFolder + "wd");
|
||||
var async = require(srcFolder + "async");
|
||||
|
||||
var config = {
|
||||
host: "ondemand.saucelabs.com"
|
||||
|
@ -9,27 +9,40 @@ var config = {
|
|||
, accessKey: process.env.SAUCE_KEY
|
||||
}
|
||||
|
||||
var allTestsPassed = true;
|
||||
|
||||
var sauceTestWorker = async.queue(function (testSettings, callback) {
|
||||
var browser = wd.remote(config.host, config.port, config.username, config.accessKey);
|
||||
var browserChain = browser.chain();
|
||||
var name = process.env.GIT_HASH + " - " + testSettings.browserName + " " + testSettings.version + ", " + testSettings.platform;
|
||||
testSettings.name = name;
|
||||
console.log("Remote sauce test '" + name + "' started!");
|
||||
|
||||
var enviroment = {
|
||||
'platform' : 'Linux'
|
||||
, 'browserName' : 'firefox'
|
||||
, 'version' : ''
|
||||
, 'name' : 'Halloween test'
|
||||
}
|
||||
|
||||
browserChain.init(enviroment).get("http://localhost:9001/tests/frontend/", function(){
|
||||
browserChain.init(testSettings).get("http://localhost:9001/tests/frontend/", function(){
|
||||
//tear down the test excecution
|
||||
var stopSauce = function(success){
|
||||
getStatusInterval && clearInterval(getStatusInterval);
|
||||
clearTimeout(timeout);
|
||||
|
||||
browserChain.quit();
|
||||
setTimeout(function(){
|
||||
process.exit(success ? 0 : 1);
|
||||
}, 1000);
|
||||
|
||||
if(!success){
|
||||
allTestsPassed = false;
|
||||
}
|
||||
|
||||
var testResult = knownConsoleText.replace(/\[red\]/g,'\x1B[31m').replace(/\[yellow\]/g,'\x1B[33m')
|
||||
.replace(/\[green\]/g,'\x1B[32m').replace(/\[clear\]/g, '\x1B[39m');
|
||||
testResult = testResult.split("\n").map(function(line){
|
||||
var newLine = "[" + testSettings.browserName + (testSettings.version === "" ? '' : (" " + testSettings.version)) + "] ";
|
||||
}.join("\n"));
|
||||
|
||||
console.log(testResult);
|
||||
console.log("Remote sauce test '" + name + "' finished!");
|
||||
|
||||
callback();
|
||||
}
|
||||
|
||||
//timeout for the case the test hangs
|
||||
var timeout = setTimeout(function(){
|
||||
stopSauce(false);
|
||||
}, 60000 * 10);
|
||||
|
@ -40,13 +53,6 @@ browserChain.init(enviroment).get("http://localhost:9001/tests/frontend/", funct
|
|||
if(!consoleText || err){
|
||||
return;
|
||||
}
|
||||
var newText = consoleText.substr(knownConsoleText.length);
|
||||
newText = newText.replace(/\[red\]/g,'\x1B[31m').replace(/\[yellow\]/g,'\x1B[33m')
|
||||
.replace(/\[green\]/g,'\x1B[32m').replace(/\[clear\]/g, '\x1B[39m');
|
||||
|
||||
if(newText.length > 0){
|
||||
console.log(newText.replace(/\n$/, ""))
|
||||
}
|
||||
knownConsoleText = consoleText;
|
||||
|
||||
if(knownConsoleText.indexOf("FINISHED") > 0){
|
||||
|
@ -56,3 +62,66 @@ browserChain.init(enviroment).get("http://localhost:9001/tests/frontend/", funct
|
|||
});
|
||||
}, 5000);
|
||||
});
|
||||
}, 2); //run 2 tests in parrallel
|
||||
|
||||
// Firefox
|
||||
sauceTestWorker.push({
|
||||
'platform' : 'Linux'
|
||||
, 'browserName' : 'firefox'
|
||||
, 'version' : ''
|
||||
});
|
||||
|
||||
// Chrome
|
||||
sauceTestWorker.push({
|
||||
'platform' : 'Linux'
|
||||
, 'browserName' : 'googlechrome'
|
||||
, 'version' : ''
|
||||
});
|
||||
|
||||
// Opera
|
||||
sauceTestWorker.push({
|
||||
'platform' : 'Windows 2008'
|
||||
, 'browserName' : 'opera'
|
||||
, 'version' : ''
|
||||
});
|
||||
|
||||
//Safari
|
||||
sauceTestWorker.push({
|
||||
'platform' : 'Mac 10.6'
|
||||
, 'browserName' : 'safari'
|
||||
, 'version' : ''
|
||||
});
|
||||
|
||||
// IE 7
|
||||
sauceTestWorker.push({
|
||||
'platform' : 'Windows 2003'
|
||||
, 'browserName' : 'iexplore'
|
||||
, 'version' : '7'
|
||||
});
|
||||
|
||||
// IE 8
|
||||
sauceTestWorker.push({
|
||||
'platform' : 'Windows 2003'
|
||||
, 'browserName' : 'iexplore'
|
||||
, 'version' : '8'
|
||||
});
|
||||
|
||||
// IE 9
|
||||
sauceTestWorker.push({
|
||||
'platform' : 'Windows 2008'
|
||||
, 'browserName' : 'iexplore'
|
||||
, 'version' : '9'
|
||||
});
|
||||
|
||||
// IE 10
|
||||
sauceTestWorker.push({
|
||||
'platform' : 'Windows 2012'
|
||||
, 'browserName' : 'iexplore'
|
||||
, 'version' : '10'
|
||||
});
|
||||
|
||||
sauceTestWorker.drain = function() {
|
||||
setTimeout(function(){
|
||||
process.exit(allTestsPassed ? 0 : 1);
|
||||
}, 3000);
|
||||
}
|
Loading…
Reference in a new issue