mirror of
https://github.com/niklasvh/html2canvas.git
synced 2023-08-10 21:13:10 +03:00
Update webdriver configs to GruntFile
This commit is contained in:
parent
649cdd4e37
commit
d2bfb810d4
54
Gruntfile.js
54
Gruntfile.js
@ -1,4 +1,6 @@
|
|||||||
/*global module:false*/
|
/*global module:false*/
|
||||||
|
var _ = require('lodash');
|
||||||
|
|
||||||
module.exports = function(grunt) {
|
module.exports = function(grunt) {
|
||||||
|
|
||||||
var meta = {
|
var meta = {
|
||||||
@ -82,18 +84,56 @@ module.exports = function(grunt) {
|
|||||||
jshint: {
|
jshint: {
|
||||||
all: ['src/**/*.js', '!src/promise.js'],
|
all: ['src/**/*.js', '!src/promise.js'],
|
||||||
options: grunt.file.readJSON('./.jshintrc')
|
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 selenium = require("./tests/selenium.js");
|
||||||
var done = this.async();
|
var done = this.async();
|
||||||
|
var browsers = (this.args.length) ? [grunt.config.get(this.nameArgs.replace(":", "."))] : _.values(grunt.config.get(this.name));
|
||||||
if (arguments.length) {
|
selenium.tests(browsers).onValue(done);
|
||||||
selenium[arg1].apply(null, arguments);
|
|
||||||
} else {
|
|
||||||
selenium.tests().onValue(done);
|
|
||||||
}
|
|
||||||
});
|
});
|
||||||
|
|
||||||
// Load tasks
|
// Load tasks
|
||||||
|
11
package.json
11
package.json
@ -20,17 +20,18 @@
|
|||||||
"url": "https://github.com/niklasvh/html2canvas/issues"
|
"url": "https://github.com/niklasvh/html2canvas/issues"
|
||||||
},
|
},
|
||||||
"devDependencies": {
|
"devDependencies": {
|
||||||
|
"baconjs": "0.7.11",
|
||||||
|
"base64-arraybuffer": ">= 0.1.0",
|
||||||
"grunt": ">=0.4.0",
|
"grunt": ">=0.4.0",
|
||||||
"grunt-contrib-concat": "*",
|
"grunt-contrib-concat": "*",
|
||||||
"grunt-contrib-uglify": "*",
|
"grunt-contrib-connect": "0.7.1",
|
||||||
"grunt-contrib-jshint": "*",
|
"grunt-contrib-jshint": "*",
|
||||||
"grunt-contrib-qunit": "*",
|
"grunt-contrib-qunit": "*",
|
||||||
|
"grunt-contrib-uglify": "*",
|
||||||
"grunt-contrib-watch": "~0.5.1",
|
"grunt-contrib-watch": "~0.5.1",
|
||||||
"base64-arraybuffer": ">= 0.1.0",
|
"lodash": "^2.4.1",
|
||||||
"png-js": ">= 0.1.1",
|
"png-js": ">= 0.1.1",
|
||||||
"baconjs": "0.7.11",
|
"wd": "0.2.21"
|
||||||
"wd": "0.2.21",
|
|
||||||
"grunt-contrib-connect": "0.7.1"
|
|
||||||
},
|
},
|
||||||
"scripts": {
|
"scripts": {
|
||||||
"test": "grunt travis --verbose"
|
"test": "grunt travis --verbose"
|
||||||
|
@ -157,8 +157,9 @@
|
|||||||
}));
|
}));
|
||||||
|
|
||||||
resultStream.onError(function(error) {
|
resultStream.onError(function(error) {
|
||||||
console.log(colors.red, "ERROR", test.capabilities.browserName, error);
|
var name = formatResultName(test.capabilities);
|
||||||
browserStream.push(formatResultName(test.capabilities));
|
console.log(colors.red, "ERROR", name, error.message);
|
||||||
|
browserStream.push(name);
|
||||||
});
|
});
|
||||||
|
|
||||||
resultStream.onValue(function(result) {
|
resultStream.onValue(function(result) {
|
||||||
@ -192,43 +193,8 @@
|
|||||||
return array;
|
return array;
|
||||||
}
|
}
|
||||||
|
|
||||||
function runWebDriver(cases) {
|
function runWebDriver(browsers, cases) {
|
||||||
var availableBrowsers = new Bacon.Bus();
|
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({
|
var result = Bacon.combineTemplate({
|
||||||
capabilities: Bacon.fromArray(browsers).zip(availableBrowsers.take(browsers.length), function(first) { return first; }),
|
capabilities: Bacon.fromArray(browsers).zip(availableBrowsers.take(browsers.length), function(first) { return first; }),
|
||||||
cases: cases
|
cases: cases
|
||||||
@ -241,7 +207,7 @@
|
|||||||
return result.fold([], pushToArray);
|
return result.fold([], pushToArray);
|
||||||
}
|
}
|
||||||
|
|
||||||
exports.tests = function() {
|
exports.tests = function(browsers) {
|
||||||
return getTests("tests/cases").fold([], pushToArray).flatMap(runWebDriver).mapError(false);
|
return getTests("tests/cases").fold([], pushToArray).flatMap(runWebDriver.bind(null, browsers)).mapError(false);
|
||||||
};
|
};
|
||||||
})();
|
})();
|
||||||
|
Loading…
Reference in New Issue
Block a user