new webdriver-jasmine task and config

This commit is contained in:
Thomas Aylott
2013-11-06 15:30:51 -05:00
parent e086cbb44b
commit 0f274e5b22
5 changed files with 108 additions and 47 deletions
+6 -4
View File
@@ -5,6 +5,7 @@ var jsxTask = require('./grunt/tasks/jsx');
var browserifyTask = require('./grunt/tasks/browserify');
var populistTask = require('./grunt/tasks/populist');
var phantomTask = require('./grunt/tasks/phantom');
var webdriverJasmineTasks = require('./grunt/tasks/webdriver-jasmine.js');
var npmTask = require('./grunt/tasks/npm');
var releaseTasks = require('./grunt/tasks/release');
@@ -18,7 +19,7 @@ module.exports = function(grunt) {
populist: require('./grunt/config/populist'),
phantom: require('./grunt/config/phantom'),
connect: require('./grunt/config/server')(grunt),
"saucelabs-jasmine": require('./grunt/config/saucelabs-jasmine'),
"webdriver-jasmine": require('./grunt/config/webdriver-jasmine.js'),
npm: require('./grunt/config/npm'),
clean: ['./build', './*.gem', './docs/_site', './examples/shared/*.js'],
jshint: require('./grunt/config/jshint'),
@@ -44,6 +45,8 @@ module.exports = function(grunt) {
grunt.registerMultiTask('phantom', phantomTask);
grunt.registerMultiTask('webdriver-jasmine', webdriverJasmineTasks);
grunt.registerMultiTask('npm', npmTask);
// Check that the version we're exporting is the same one we expect in the
@@ -73,10 +76,9 @@ module.exports = function(grunt) {
'populist:test'
]);
grunt.registerTask('test:browser', [
'build:test',
grunt.registerTask('test:webdriver', [
'connect',
'saucelabs-jasmine'
'webdriver-jasmine:local'
]);
grunt.registerTask('test', ['build:test', 'build:basic', 'phantom:run']);
grunt.registerTask('npm:test', ['build', 'npm:pack']);
-42
View File
@@ -1,42 +0,0 @@
// https://saucelabs.com/docs/platforms
var browsers = [
{ browserName: 'chrome', platform: 'linux' },
{ browserName: 'android', platform: 'Linux', version: '4.0', 'device-type': 'tablet', 'device-orientation': 'portrait' },
{ browserName: 'android', platform: 'Linux', version: '4.0' },
{ browserName: 'ipad', platform: 'OS X 10.6', version: '4' },
{ browserName: 'ipad', platform: 'OS X 10.8', version: '5.1' },
{ browserName: 'iphone', platform: 'OS X 10.8', version: '6.1' },
{ browserName: 'firefox', version: '24', platform: 'Windows 7' },
{ browserName: 'firefox', version: '19', platform: 'Windows XP' },
{ browserName: 'firefox', version: '3', platform: 'Linux' },
{ browserName: 'opera', platform: 'Windows 2008', version: '12' },
{ browserName: 'internet explorer', platform: 'Windows 8', version: '10' },
{ browserName: 'internet explorer', platform: 'Windows 7', version: '9' },
{ browserName: 'internet explorer', platform: 'Windows 7', version: '8' },
{ browserName: 'internet explorer', platform: 'Windows XP', version: '8' },
{ browserName: 'internet explorer', platform: 'Windows XP', version: '7' },
{ browserName: 'internet explorer', platform: 'Windows XP', version: '6' },
{ browserName: 'safari', platform: 'OS X 10.8', version: '6' },
{ browserName: 'safari', platform: 'OS X 10.6', version: '5' },
];
module.exports = {
all: {
options: {
urls: ["http://127.0.0.1:9999/test/sauce-harness.html"],
tunnelTimeout: 5,
build: process.env.TRAVIS_JOB_ID || 'dev' + Date.now(),
concurrency: 3,
browsers: browsers,
testname: "React",
tags: ["master"]
}
}
}
+66
View File
@@ -0,0 +1,66 @@
// https://saucelabs.com/docs/platforms
var browsers = [
{ browserName: 'chrome', platform: 'linux' },
// { browserName: 'android', platform: 'Linux', version: '4.0', 'device-type': 'tablet', 'device-orientation': 'portrait' },
// { browserName: 'android', platform: 'Linux', version: '4.0' },
//
// { browserName: 'ipad', platform: 'OS X 10.6', version: '4' },
// { browserName: 'ipad', platform: 'OS X 10.8', version: '5.1' },
// { browserName: 'iphone', platform: 'OS X 10.8', version: '6.1' },
//
// { browserName: 'firefox', version: '24', platform: 'Windows 7' },
// { browserName: 'firefox', version: '19', platform: 'Windows XP' },
// { browserName: 'firefox', version: '3', platform: 'Linux' },
//
// { browserName: 'opera', platform: 'Windows 2008', version: '12' },
//
// { browserName: 'internet explorer', platform: 'Windows 8', version: '10' },
// { browserName: 'internet explorer', platform: 'Windows 7', version: '9' },
// { browserName: 'internet explorer', platform: 'Windows 7', version: '8' },
// { browserName: 'internet explorer', platform: 'Windows XP', version: '8' },
// { browserName: 'internet explorer', platform: 'Windows XP', version: '7' },
// { browserName: 'internet explorer', platform: 'Windows XP', version: '6' },
//
// { browserName: 'safari', platform: 'OS X 10.8', version: '6' },
// { browserName: 'safari', platform: 'OS X 10.6', version: '5' },
];
exports.local = {
webdriver: {
remote: {
protocol: 'http:',
hostname: '127.0.0.1',
port: '9515',
path: '/'
}
},
browser:{browserName:'chrome'},
url: "http://127.0.0.1:9999/test/sauce-harness.html",
onComplete: function(report){
var browser = this;
console.log('report.passed', report.passed)
}
}
if (false)
exports.saucelabs = {
webdriver: {
remote:{
// https://github.com/admc/wd/blob/master/README.md#named-parameters
user: process.env.SAUCE_USERNAME,
pwd: process.env.SAUCE_ACCESS_KEY,
protocol: 'http:',
hostname: 'ondemand.saucelabs.com',
port: '80',
path: '/wd/hub'
}
},
url: "http://127.0.0.1:9999/test/sauce-harness.html",
onComplete: function(report){
var browser = this;
// .then(function(report){return browser.sauceJobStatus(report.passed);})
}
}
+33
View File
@@ -0,0 +1,33 @@
var grunt = require("grunt");
var wd = require('wd');
module.exports = function(){
var taskSucceeded = this.async();
var browser = wd.promiseChainRemote(this.data.webdriver.remote);
browser.on('status', function(info) {
grunt.verbose.writeln(info);
});
browser.on('command', function(meth, path, data) {
grunt.verbose.writeln(' > ' + meth, path, data || '');
});
browser
.init(this.data.browser)
.get(this.data.url)
.then(function(){return browser;})
.then(getJSReport)
.then(this.data.onComplete.bind(browser), this.data.onError.bind(browser))
.fin(browser.quit.bind(browser))
.done(taskSucceeded.bind(null,true), taskSucceeded.bind(null,false))
;
}
function getJSReport(browser){
return browser
.waitForCondition("typeof window.jasmine != 'undefined'", 500)
.waitForCondition("typeof window.jasmine.getJSReport != 'undefined'", 10e3)
.eval("jasmine.getJSReport()")
;
}
+3 -1
View File
@@ -60,7 +60,9 @@
"jasmine-tapreporter": "~0.2.2",
"grunt-saucelabs": "~4.1.2",
"grunt-contrib-connect": "~0.5.0",
"es5-shim": "~2.1.0"
"es5-shim": "~2.1.0",
"sauce-tunnel": "~1.0.2",
"wd": "~0.2.2"
},
"engines": {
"node": ">=0.10.0"