600ff0f1 by David LaPalomento

Merge pull request #53 from videojs/saucelabs-take2

Run tests on saucelabs
2 parents 0771cbac cdd56b95
......@@ -3,6 +3,8 @@ node_js:
- '0.10'
before_script:
- npm install -g grunt-cli
- curl https://gist.githubusercontent.com/santiycr/5139565/raw/sauce_connect_setup.sh
| bash
notifications:
hipchat:
rooms:
......@@ -11,9 +13,7 @@ notifications:
channels:
- "chat.freenode.net#videojs"
use_notice: true
#addons:
#sauce_connect:
#username:
#secure: "Y++AtTlMXkcPAx+K0cL6uzn4FlmfiIki5bkGCkowoYSCxq1X9tNta39JONSVSeZKBlP58GJwNJdB4Wq1CpJL4NriGc3UvpcgNcrILGOWLczX0zFvXkOIaLn0bUuierf4wzUjk3i6XOh83NrMaX+gBHXb8RVUEBf2z0/WM3zHrEM="
#access_key:
#secure: "bCan88WIWqm6jP4ZtDbLVrrGXe1a33otfQhi7SYp95wHFLemUHS1JyXv+HbbbsW5dNjatfdhzvc47bpw4LbccL6evVR9sb2Tld15TxW2a2WQtMPzvOfj55aP1YQtIxYwy14swifWGK/Lj/A0ZUCUNolCf7DjCK6hZGaWaDRtdIE="
env:
global:
- secure: dM7svnHPPu5IiUMeFWW5zg+iuWNpwt6SSDi3MmVvhSclNMRLesQoRB+7Qq5J/LiKhmjpv1/GlNVV0CTsHMRhZNwQ3fo38eEuTXv99aAflEITXwSEh/VntKViHbGFubn06EnVkJoH6MX3zJ6kbiwc2QdSQbywKzS6l6quUEpWpd0=
- secure: AnduYGXka5ft1x7V3SuVYqvlKLvJGhUaRNFdy4UDJr3ZVuwpQjE4TMDG8REmJIJvXfHbh4qY4N1cFSGnXkZ4bH21Xk0v9DLhsxbarKz+X2BvPgXs+Af9EQ6vLEy/5S1vMLxfT5+y+Ec5bVNGOsdUZby8Y21CRzSg6ADN9kwPGlE=
......
......@@ -258,10 +258,31 @@ module.exports = function(grunt) {
'concat',
'uglify']);
grunt.registerTask('test', ['jshint', 'manifests-to-js', 'karma:saucelabs']);
// The test task will run `karma:saucelabs` when running in travis,
// otherwise, it'll default to running karma in chrome.
// 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;
// travis build task
grunt.registerTask('test-local', ['jshint', 'manifests-to-js', 'qunit']);
grunt.task.run(['jshint', 'manifests-to-js']);
if (process.env.TRAVIS) {
grunt.task.run(['karma:saucelabs']);
} else {
if (tasks.length === 0) {
tasks.push('chrome');
}
if (tasks.length === 1) {
tasks = tasks[0].split(',');
}
tasks = tasks.map(function(el) {
return 'karma:' + el;
});
grunt.task.run(tasks);
}
});
};
......
......@@ -108,6 +108,25 @@ Fired immediately after a new master or media playlist has been
downloaded. By default, the plugin only downloads playlists as they
are needed.
### Testing
For testing, you can either run `npm test` or use `grunt` directly.
If you use `npm test`, it will only run the karma tests using chrome.
You can specify which browsers you want the tests to run via grunt's `test` task.
You can use either grunt-style arguments or comma separated arguments:
```
grunt test:chrome:firefox # grunt-style
grunt test:chrome,firefox # comma-separated
```
Possible options are:
* `chromecanary`
* `phantomjs`
* `opera`
* `chrome`
* `safari`
* `firefox`
* `ie`
## Hosting Considerations
Unlike a native HLS implementation, the HLS plugin has to comply with
the browser's security policies. That means that all the files that
......
......@@ -10,7 +10,7 @@
},
"license": "Apache 2",
"scripts": {
"test": "grunt test-local"
"test": "grunt test"
},
"devDependencies": {
"grunt": "~0.4.1",
......
......@@ -5,6 +5,45 @@
// 3. Run your tests
module.exports = function(config) {
var customLaunchers = {
chrome_sl: {
singleRun: true,
base: 'SauceLabs',
browserName: 'chrome',
platform: 'Windows 7',
version: '34'
},
firefox_sl: {
singleRun: true,
base: 'SauceLabs',
browserName: 'firefox',
platform: 'Windows 8'
},
safari_sl: {
singleRun: true,
base: 'SauceLabs',
browserName: 'safari',
platform: 'OS X 10.8'
},
ipad_sl: {
singleRun: true,
base: 'SauceLabs',
browserName: 'ipad',
platform:'OS X 10.9',
version: '7.1'
},
android_sl: {
singleRun: true,
base: 'SauceLabs',
browserName: 'android',
platform:'Linux'
}
};
config.set({
// base path, that will be used to resolve files and exclude
basePath: '',
......@@ -17,20 +56,12 @@ module.exports = function(config) {
// Setting singleRun to true here will start up your specified browsers, run tests, and then shut down the browsers. Helpful to have in a CI environment, where you don't want to leave browsers running continuously.
singleRun: true,
// Start these browsers, currently available:
// - Chrome
// - ChromeCanary
// - Firefox
// - Opera
// - Safari (only Mac)
// - PhantomJS
// - IE (only Windows)
// Example usage:
browsers: ['chrome_test'],
//'firefox_test',
//'safari_test',
//'ipad_test',
//'android_test'
// custom launchers for sauce labs
//define SL browsers
customLaunchers: customLaunchers,
// Start these browsers
browsers: ['chrome_sl', 'ipad_sl'], //Object.keys(customLaunchers),
// List of files / patterns to load in the browser
// Add any new src files to this list.
......@@ -39,22 +70,25 @@ module.exports = function(config) {
// add their paths to this list.
files: [
'../node_modules/sinon/lib/sinon.js',
'../node_modules/sinon/lib/sinon/util/event.js',
'../node_modules/sinon/lib/sinon/util/fake_xml_http_request.js',
'../node_modules/sinon/lib/sinon/util/xhr_ie.js',
'../node_modules/video.js/dist/video-js/video.js',
'../node_modules/videojs-contrib-media-sources/src/videojs-media-sources.js',
'../test/karma-qunit-shim.js',
"../src/videojs-hls.js",
"../src/flv-tag.js",
"../src/exp-golomb.js",
"../src/h264-stream.js",
"../src/aac-stream.js",
"../src/segment-parser.js",
"../src/stream.js",
"../src/m3u8/m3u8-parser.js",
"../tmp/manifests.js",
"../tmp/expected.js",
"tsSegment-bc.js",
"../src/bin-utils.js",
"../src/async-queue.js",
'../src/videojs-hls.js',
'../src/flv-tag.js',
'../src/exp-golomb.js',
'../src/h264-stream.js',
'../src/aac-stream.js',
'../src/segment-parser.js',
'../src/stream.js',
'../src/m3u8/m3u8-parser.js',
'../tmp/manifests.js',
'../tmp/expected.js',
'tsSegment-bc.js',
'../src/bin-utils.js',
'../test/*.js'
],
......@@ -69,16 +103,9 @@ module.exports = function(config) {
'karma-sauce-launcher'
],
// list of files to exclude
exclude: [
],
// test results reporter to use
// possible values: 'dots', 'progress', 'junit'
reporters: ['progress'],
reporters: ['dots', 'progress'],
// web server port
port: 9876,
......@@ -103,46 +130,6 @@ module.exports = function(config) {
build: process.env.TRAVIS_BUILD_NUMBER,
testName: process.env.TRAVIS_BUILD_NUMBER + process.env.TRAVIS_BRANCH,
recordScreenshots: false
},
//define SL browsers
customLaunchers: {
chrome_test: {
singleRun: true,
base: 'SauceLabs',
browserName: 'chrome',
platform: 'Windows XP'
},
firefox_test: {
singleRun: true,
base: 'SauceLabs',
browserName: 'firefox',
platform: 'Windows 8'
},
safari_test: {
singleRun: true,
base: 'SauceLabs',
browserName: 'safari',
platform: 'OS X 10.8'
},
ipad_test: {
singleRun: true,
base: 'SauceLabs',
browserName: 'ipad',
platform:'OS X 10.8'
},
android_test: {
singleRun: true,
base: 'SauceLabs',
browserName: 'android',
platform:'Linux'
}
}
});
};
......
......@@ -34,22 +34,25 @@ module.exports = function(config) {
// add their paths to this list.
files: [
'../node_modules/sinon/lib/sinon.js',
'../node_modules/sinon/lib/sinon/util/event.js',
'../node_modules/sinon/lib/sinon/util/fake_xml_http_request.js',
'../node_modules/sinon/lib/sinon/util/xhr_ie.js',
'../node_modules/video.js/dist/video-js/video.js',
'../node_modules/videojs-contrib-media-sources/src/videojs-media-sources.js',
'../test/karma-qunit-shim.js',
"../src/videojs-hls.js",
"../src/flv-tag.js",
"../src/exp-golomb.js",
"../src/h264-stream.js",
"../src/aac-stream.js",
"../src/segment-parser.js",
"../src/stream.js",
"../src/m3u8/m3u8-parser.js",
"../tmp/manifests.js",
"../tmp/expected.js",
"tsSegment-bc.js",
"../src/bin-utils.js",
"../src/async-queue.js",
'../src/videojs-hls.js',
'../src/flv-tag.js',
'../src/exp-golomb.js',
'../src/h264-stream.js',
'../src/aac-stream.js',
'../src/segment-parser.js',
'../src/stream.js',
'../src/m3u8/m3u8-parser.js',
'../tmp/manifests.js',
'../tmp/expected.js',
'tsSegment-bc.js',
'../src/bin-utils.js',
'../test/*.js'
],
......@@ -88,7 +91,7 @@ module.exports = function(config) {
// level of logging
// possible values: config.LOG_DISABLE || config.LOG_ERROR || config.LOG_WARN || config.LOG_INFO || config.LOG_DEBUG
//logLevel: config.LOG_INFO,
logLevel: config.LOG_DISABLE,
// If browser does not capture in given timeout [ms], kill it
captureTimeout: 60000
......
......@@ -6,8 +6,8 @@
<!-- Load sinon server for fakeXHR -->
<script src="../node_modules/sinon/lib/sinon.js"></script>
<script src="../node_modules/sinon/lib/sinon/util/event.js"></script>
<script src="../node_modules/sinon/lib/sinon/util/xhr_ie.js"></script>
<script src="../node_modules/sinon/lib/sinon/util/fake_xml_http_request.js"></script>
<script src="../node_modules/sinon/lib/sinon/util/xhr_ie.js"></script>
<!-- Load local QUnit. -->
<link rel="stylesheet" href="../libs/qunit/qunit.css" media="screen">
......