Skip to content

Commit

Permalink
Added cross-browser testing with SauceLabs, and added Karma as the de…
Browse files Browse the repository at this point in the history
…fault test runner. closes videojs#1187
  • Loading branch information
gkatsev authored and heff committed May 16, 2014
1 parent b8f525c commit 3189ec1
Show file tree
Hide file tree
Showing 13 changed files with 444 additions and 252 deletions.
21 changes: 0 additions & 21 deletions .bunyipconfig.js.example

This file was deleted.

3 changes: 0 additions & 3 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -15,9 +15,6 @@ npm-debug.log
sandbox/*
!sandbox/*.example

# ignore any Karma conf.js files in the test/ directory
test/*.conf.js

*.swp
*.swo

Expand Down
1 change: 1 addition & 0 deletions .jshintrc
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,7 @@
"define",
"module",
"exports",
"process",

"PlayerTest",
"asyncTest",
Expand Down
13 changes: 12 additions & 1 deletion .travis.yml
Original file line number Diff line number Diff line change
@@ -1,3 +1,14 @@
language: node_js
node_js:
- 0.8
- 0.10
before_script:
- if [ "${TRAVIS_PULL_REQUEST}" = "false" ]; then curl https://gist.githubusercontent.com/santiycr/5139565/raw/sauce_connect_setup.sh | bash; fi
notifications:
irc:
channels:
- "chat.freenode.net#videojs"
use_notice: true
env:
global:
- secure: K6JpKwMkfNaJix3Bb0tLjVMzHMJgtBXdd/dvfw1BMb9DCBpd81PqXbDs7yXCddUxnUPTBPxZCrQgWsw71Wn+qEoIG5MU3uOT5A2rBbx/yZonVAGv5ed/9w0xk0OzO383CmPMFqwqtp9YmdmqGjQBkYXVXJjTvNTOAExFSdhO+3U=
- secure: GIbhjUJapvC70nIZVlhVyK+3KAD2TVKpiY/q412OO7V2izbvcM1tvU3LBoMZbROzrt5TT84tCoJDvHnrpL0OvxPwrzL5CUU7h4UTxhTOyQkEinbYAnWlW9wdrvtdczsEvANkFPqBZ53B3hVHZHMLOG8QRWaTBicF68vSHEJFqb4=
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,7 @@ CHANGELOG
* Added support for playback rate switching [[view](https://github.com/videojs/video.js/pull/1132)]
* Fixed an issue with the loadstart event order that caused the big play button to not hide [[view](https://github.com/videojs/video.js/pull/1209)]
* Modernized the fullscreen API and added support for IE11 [[view](https://github.com/videojs/video.js/pull/1205)]
* Added cross-browser testing with SauceLabs, and added Karma as the default test runner ([view](https://github.com/videojs/video.js/pull/1187))

--------------------

Expand Down
150 changes: 143 additions & 7 deletions Gruntfile.js
Original file line number Diff line number Diff line change
Expand Up @@ -135,16 +135,97 @@ module.exports = function(grunt) {
}
},
karma: {
// this config file applies to all following configs except if overwritten
options: {
configFile: 'test/karma.conf.js'
},

// this only runs on PRs from the mainrepo on saucelabs
saucelabs: {
browsers: ['chrome_sl', 'ipad_sl']
},

// these are run locally on local browsers
dev: {
configFile: 'test/karma.conf.js',
autoWatch: true
browsers: ['Chrome', 'Firefox', 'Safari']
},
chromecanary: {
browsers: ['ChromeCanary']
},
chrome: {
browsers: ['Chrome']
},
firefox: {
browsers: ['Firefox']
},
safari: {
browsers: ['Safari']
},
ie: {
browsers: ['IE']
},
phantomjs: {
browsers: ['PhantomJS']
},

// This is all the minified tests run locally on local browsers
minified_dev: {
browsers: ['Chrome', 'Firefox', 'Safari'],
configFile: 'test/karma.minified.conf.js'
},
minified_chromecanary: {
browsers: ['ChromeCanary'],
configFile: 'test/karma.minified.conf.js'
},
minified_chrome: {
browsers: ['Chrome'],
configFile: 'test/karma.minified.conf.js'
},
minified_firefox: {
browsers: ['Firefox'],
configFile: 'test/karma.minified.conf.js'
},
minified_safari: {
browsers: ['Safari'],
configFile: 'test/karma.minified.conf.js'
},
minified_ie: {
browsers: ['IE'],
configFile: 'test/karma.minified.conf.js'
},
minified_phantomjs: {
browsers: ['PhantomJS'],
configFile: 'test/karma.minified.conf.js'
},

// This is all the minified api tests run locally on local browsers
minified_api_dev: {
browsers: ['Chrome', 'Firefox', 'Safari'],
configFile: 'test/karma.minified.api.conf.js'
},
ci: {
configFile: 'test/karma.conf.js',
autoWatch: false
minified_api_chromecanary: {
browsers: ['ChromeCanary'],
configFile: 'test/karma.minified.api.conf.js'
},
minified_api_chrome: {
browsers: ['Chrome'],
configFile: 'test/karma.minified.api.conf.js'
},
minified_api_firefox: {
browsers: ['Firefox'],
configFile: 'test/karma.minified.api.conf.js'
},
minified_api_safari: {
browsers: ['Safari'],
configFile: 'test/karma.minified.api.conf.js'
},
minified_api_ie: {
browsers: ['IE'],
configFile: 'test/karma.minified.api.conf.js'
},
minified_api_phantomjs: {
browsers: ['PhantomJS'],
configFile: 'test/karma.minified.api.conf.js'
}
},
vjsdocs: {
Expand Down Expand Up @@ -231,11 +312,66 @@ module.exports = function(grunt) {
// grunt.loadTasks('./docs/tasks/');
// grunt.loadTasks('../videojs-doc-generator/tasks/');

grunt.registerTask('pretask', ['jshint', 'less', 'build', 'minify', 'usebanner']);
// Default task.
grunt.registerTask('default', ['jshint', 'less', 'build', 'minify', 'usebanner', 'dist']);
grunt.registerTask('default', ['pretask', 'dist']);
// Development watch task
grunt.registerTask('dev', ['jshint', 'less', 'build', 'qunit:source']);
grunt.registerTask('test', ['jshint', 'less', 'build', 'minify', 'usebanner', 'qunit']);
grunt.registerTask('test-qunit', ['pretask', 'qunit']);

// The test task will run `karma:saucelabs` when running in travis,
// when running via a PR from a fork, it'll run qunit tests in phantom using
// karma otherwise, it'll run the tests in chrome via karma
// You can specify which browsers to build with by using grunt-style arguments
// or separating them with a comma:
// grunt test:chrome:firefox # grunt-style
// grunt test:chrome,firefox # comma-separated
grunt.registerTask('test', function() {
var tasks = this.args,
tasksMinified,
tasksMinifiedApi;

grunt.task.run(['pretask']);

if (process.env.TRAVIS_PULL_REQUEST) {
grunt.task.run(['karma:phantomjs', 'karma:minified_phantomjs', 'karma:minified_api_phantomjs']);
} else if (process.env.TRAVIS) {
grunt.task.run(['karma:saucelabs']);
} else {
// if we aren't running this in a CI, but running it manually, we can
// supply arguments to this task. These arguments are either colon (`:`)
// separated which is the default grunt separator for arguments, or they
// are comma (`,`) separated to make it easier.
// The arguments are the names of which browsers you want. It'll then
// make sure you have the `minified` and `minified_api` for those browsers
// as well.
if (tasks.length === 0) {
tasks.push('chrome');
}
if (tasks.length === 1) {
tasks = tasks[0].split(',');
}

tasksMinified = tasks.slice();
tasksMinifiedApi = tasks.slice();

tasksMinified = tasksMinified.map(function(task) {
return 'minified_' + task;
});

tasksMinifiedApi = tasksMinifiedApi.map(function(task) {
return 'minified_api_' + task;
});

tasks = tasks.concat(tasksMinified).concat(tasksMinifiedApi);
tasks = tasks.map(function(task) {
return 'karma:' + task;
});


grunt.task.run(tasks);
}
});

var fs = require('fs'),
gzip = require('zlib').gzip;
Expand Down
37 changes: 0 additions & 37 deletions browsers.json

This file was deleted.

60 changes: 31 additions & 29 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@
"homepage": "http://videojs.com",
"author": "Steve Heffernan",
"scripts": {
"test": "grunt test --verbose"
"test": "grunt test"
},
"repository": {
"type": "git",
Expand All @@ -24,40 +24,42 @@
"videojs-swf": "4.4.0"
},
"devDependencies": {
"grunt-cli": "~0.1.0",
"grunt": "0.4.2",
"grunt-contrib-connect": "~0.7.1",
"grunt-contrib-jshint": "~0.4.3",
"grunt-contrib-watch": "~0.1.4",
"grunt-contrib-qunit": "~0.2.1",
"calcdeps": "~0.1.7",
"chg": "~0.1.8",
"contribflow": "~0.2.0",
"github": "~0.1.14",
"grunt": "^0.4.4",
"grunt-banner": "~0.2.0",
"grunt-cli": "~0.1.0",
"grunt-contrib-clean": "~0.4.0a",
"grunt-contrib-connect": "~0.7.1",
"grunt-contrib-copy": "~0.3.2",
"mocha": "~1.8.1",
"contribflow": "~0.2.0",
"grunt-s3": "~0.2.0-alpha",
"semver": "~1.1.4",
"grunt-contrib-cssmin": "~0.6.0",
"uglify-js": "~2.3.6",
"grunt-contrib-jshint": "~0.4.3",
"grunt-contrib-less": "~0.6.4",
"grunt-karma": "~0.6.2",
"karma": "~0.10.0",
"karma-chrome-launcher": "~0.1.2",
"karma-firefox-launcher": "~0.1.3",
"karma-ie-launcher": "~0.1.1",
"karma-opera-launcher": "~0.1.0",
"karma-phantomjs-launcher": "~0.1.1",
"karma-safari-launcher": "~0.1.1",
"karma-qunit": "~0.1.1",
"videojs-doc-generator": "0.0.1",
"qunitjs": "~1.12.0",
"grunt-zip": "0.10.2",
"grunt-banner": "~0.2.0",
"chg": "~0.1.8",
"grunt-contrib-qunit": "~0.2.1",
"grunt-contrib-watch": "~0.1.4",
"grunt-karma": "^0.8.3",
"grunt-s3": "~0.2.0-alpha",
"grunt-tagrelease": "~0.3.3",
"github": "~0.1.14",
"open": "0.0.4",
"grunt-version": "~0.3.0",
"sinon": "~1.9.1"
"grunt-zip": "0.10.2",
"karma": "^0.12.14",
"karma-chrome-launcher": "^0.1.3",
"karma-firefox-launcher": "^0.1.3",
"karma-ie-launcher": "^0.1.5",
"karma-opera-launcher": "~0.1.0",
"karma-phantomjs-launcher": "^0.1.4",
"karma-qunit": "^0.1.1",
"karma-safari-launcher": "^0.1.1",
"karma-sauce-launcher": "^0.2.8",
"karma-sinon": "^1.0.3",
"mocha": "~1.8.1",
"open": "0.0.4",
"qunitjs": "~1.12.0",
"semver": "~1.1.4",
"sinon": "~1.9.1",
"uglify-js": "~2.3.6",
"videojs-doc-generator": "0.0.1"
}
}
Loading

0 comments on commit 3189ec1

Please sign in to comment.