Update webdriver configs to GruntFile

This commit is contained in:
Niklas von Hertzen 2014-08-26 20:01:15 +03:00
parent 649cdd4e37
commit d2bfb810d4
3 changed files with 59 additions and 52 deletions

View File

@ -1,4 +1,6 @@
/*global module:false*/
var _ = require('lodash');
module.exports = function(grunt) {
var meta = {
@ -82,18 +84,56 @@ module.exports = function(grunt) {
jshint: {
all: ['src/**/*.js', '!src/promise.js'],
options: grunt.file.readJSON('./.jshintrc')
},
webdriver: {
chrome: {
browserName: "chrome",
platform: "Windows 7",
version: "34"
},
firefox: {
browserName: "firefox",
version: "15",
platform: "Windows 7"
},
ie9: {
browserName: "internet explorer",
version: "9",
platform: "Windows 7"
},
ie10: {
browserName: "internet explorer",
version: "10",
platform: "Windows 8"
},
ie11: {
browserName: "internet explorer",
version: "11",
platform: "Windows 8.1"
},
safari6: {
browserName: "safari",
version: "6",
platform: "OS X 10.8"
},
safari7:{
browserName: "safari",
platform: "OS X 10.9",
version: "7"
},
chromeOSX:{
browserName: "chrome",
platform: "OS X 10.8",
version: "34"
}
}
});
grunt.registerTask('webdriver', 'Browser render tests', function(arg1) {
grunt.registerTask('webdriver', 'Browser render tests', function() {
var selenium = require("./tests/selenium.js");
var done = this.async();
if (arguments.length) {
selenium[arg1].apply(null, arguments);
} else {
selenium.tests().onValue(done);
}
var browsers = (this.args.length) ? [grunt.config.get(this.nameArgs.replace(":", "."))] : _.values(grunt.config.get(this.name));
selenium.tests(browsers).onValue(done);
});
// Load tasks

View File

@ -20,17 +20,18 @@
"url": "https://github.com/niklasvh/html2canvas/issues"
},
"devDependencies": {
"baconjs": "0.7.11",
"base64-arraybuffer": ">= 0.1.0",
"grunt": ">=0.4.0",
"grunt-contrib-concat": "*",
"grunt-contrib-uglify": "*",
"grunt-contrib-connect": "0.7.1",
"grunt-contrib-jshint": "*",
"grunt-contrib-qunit": "*",
"grunt-contrib-uglify": "*",
"grunt-contrib-watch": "~0.5.1",
"base64-arraybuffer": ">= 0.1.0",
"lodash": "^2.4.1",
"png-js": ">= 0.1.1",
"baconjs": "0.7.11",
"wd": "0.2.21",
"grunt-contrib-connect": "0.7.1"
"wd": "0.2.21"
},
"scripts": {
"test": "grunt travis --verbose"

View File

@ -157,8 +157,9 @@
}));
resultStream.onError(function(error) {
console.log(colors.red, "ERROR", test.capabilities.browserName, error);
browserStream.push(formatResultName(test.capabilities));
var name = formatResultName(test.capabilities);
console.log(colors.red, "ERROR", name, error.message);
browserStream.push(name);
});
resultStream.onValue(function(result) {
@ -192,43 +193,8 @@
return array;
}
function runWebDriver(cases) {
function runWebDriver(browsers, cases) {
var availableBrowsers = new Bacon.Bus();
var browsers = [
{
browserName: "chrome",
platform: "Windows 7",
version: "34"
},{
browserName: "firefox",
version: "15",
platform: "Windows 7"
},{
browserName: "internet explorer",
version: "9",
platform: "Windows 7"
},{
browserName: "internet explorer",
version: "10",
platform: "Windows 8"
},{
browserName: "internet explorer",
version: "11",
platform: "Windows 8.1"
},{
browserName: "safari",
version: "6",
platform: "OS X 10.8"
},{
browserName: "safari",
platform: "OS X 10.9",
version: "7"
},{
browserName: "chrome",
platform: "OS X 10.8",
version: "34"
}
];
var result = Bacon.combineTemplate({
capabilities: Bacon.fromArray(browsers).zip(availableBrowsers.take(browsers.length), function(first) { return first; }),
cases: cases
@ -241,7 +207,7 @@
return result.fold([], pushToArray);
}
exports.tests = function() {
return getTests("tests/cases").fold([], pushToArray).flatMap(runWebDriver).mapError(false);
exports.tests = function(browsers) {
return getTests("tests/cases").fold([], pushToArray).flatMap(runWebDriver.bind(null, browsers)).mapError(false);
};
})();