Merge pull request #53 from videojs/saucelabs-take2
Run tests on saucelabs
Showing
7 changed files
with
132 additions
and
102 deletions
... | @@ -3,6 +3,8 @@ node_js: | ... | @@ -3,6 +3,8 @@ node_js: |
3 | - '0.10' | 3 | - '0.10' |
4 | before_script: | 4 | before_script: |
5 | - npm install -g grunt-cli | 5 | - npm install -g grunt-cli |
6 | - curl https://gist.githubusercontent.com/santiycr/5139565/raw/sauce_connect_setup.sh | ||
7 | | bash | ||
6 | notifications: | 8 | notifications: |
7 | hipchat: | 9 | hipchat: |
8 | rooms: | 10 | rooms: |
... | @@ -11,9 +13,7 @@ notifications: | ... | @@ -11,9 +13,7 @@ notifications: |
11 | channels: | 13 | channels: |
12 | - "chat.freenode.net#videojs" | 14 | - "chat.freenode.net#videojs" |
13 | use_notice: true | 15 | use_notice: true |
14 | #addons: | 16 | env: |
15 | #sauce_connect: | 17 | global: |
16 | #username: | 18 | - secure: dM7svnHPPu5IiUMeFWW5zg+iuWNpwt6SSDi3MmVvhSclNMRLesQoRB+7Qq5J/LiKhmjpv1/GlNVV0CTsHMRhZNwQ3fo38eEuTXv99aAflEITXwSEh/VntKViHbGFubn06EnVkJoH6MX3zJ6kbiwc2QdSQbywKzS6l6quUEpWpd0= |
17 | #secure: "Y++AtTlMXkcPAx+K0cL6uzn4FlmfiIki5bkGCkowoYSCxq1X9tNta39JONSVSeZKBlP58GJwNJdB4Wq1CpJL4NriGc3UvpcgNcrILGOWLczX0zFvXkOIaLn0bUuierf4wzUjk3i6XOh83NrMaX+gBHXb8RVUEBf2z0/WM3zHrEM=" | 19 | - secure: AnduYGXka5ft1x7V3SuVYqvlKLvJGhUaRNFdy4UDJr3ZVuwpQjE4TMDG8REmJIJvXfHbh4qY4N1cFSGnXkZ4bH21Xk0v9DLhsxbarKz+X2BvPgXs+Af9EQ6vLEy/5S1vMLxfT5+y+Ec5bVNGOsdUZby8Y21CRzSg6ADN9kwPGlE= |
18 | #access_key: | ||
19 | #secure: "bCan88WIWqm6jP4ZtDbLVrrGXe1a33otfQhi7SYp95wHFLemUHS1JyXv+HbbbsW5dNjatfdhzvc47bpw4LbccL6evVR9sb2Tld15TxW2a2WQtMPzvOfj55aP1YQtIxYwy14swifWGK/Lj/A0ZUCUNolCf7DjCK6hZGaWaDRtdIE=" | ... | ... |
... | @@ -258,10 +258,31 @@ module.exports = function(grunt) { | ... | @@ -258,10 +258,31 @@ module.exports = function(grunt) { |
258 | 'concat', | 258 | 'concat', |
259 | 'uglify']); | 259 | 'uglify']); |
260 | 260 | ||
261 | grunt.registerTask('test', ['jshint', 'manifests-to-js', 'karma:saucelabs']); | 261 | // The test task will run `karma:saucelabs` when running in travis, |
262 | // otherwise, it'll default to running karma in chrome. | ||
263 | // You can specify which browsers to build with by using grunt-style arguments | ||
264 | // or separating them with a comma: | ||
265 | // grunt test:chrome:firefox # grunt-style | ||
266 | // grunt test:chrome,firefox # comma-separated | ||
267 | grunt.registerTask('test', function() { | ||
268 | var tasks = this.args; | ||
262 | 269 | ||
263 | // travis build task | 270 | grunt.task.run(['jshint', 'manifests-to-js']); |
264 | grunt.registerTask('test-local', ['jshint', 'manifests-to-js', 'qunit']); | ||
265 | 271 | ||
272 | if (process.env.TRAVIS) { | ||
273 | grunt.task.run(['karma:saucelabs']); | ||
274 | } else { | ||
275 | if (tasks.length === 0) { | ||
276 | tasks.push('chrome'); | ||
277 | } | ||
278 | if (tasks.length === 1) { | ||
279 | tasks = tasks[0].split(','); | ||
280 | } | ||
281 | tasks = tasks.map(function(el) { | ||
282 | return 'karma:' + el; | ||
283 | }); | ||
266 | 284 | ||
285 | grunt.task.run(tasks); | ||
286 | } | ||
287 | }); | ||
267 | }; | 288 | }; | ... | ... |
... | @@ -108,6 +108,25 @@ Fired immediately after a new master or media playlist has been | ... | @@ -108,6 +108,25 @@ Fired immediately after a new master or media playlist has been |
108 | downloaded. By default, the plugin only downloads playlists as they | 108 | downloaded. By default, the plugin only downloads playlists as they |
109 | are needed. | 109 | are needed. |
110 | 110 | ||
111 | ### Testing | ||
112 | |||
113 | For testing, you can either run `npm test` or use `grunt` directly. | ||
114 | If you use `npm test`, it will only run the karma tests using chrome. | ||
115 | You can specify which browsers you want the tests to run via grunt's `test` task. | ||
116 | You can use either grunt-style arguments or comma separated arguments: | ||
117 | ``` | ||
118 | grunt test:chrome:firefox # grunt-style | ||
119 | grunt test:chrome,firefox # comma-separated | ||
120 | ``` | ||
121 | Possible options are: | ||
122 | * `chromecanary` | ||
123 | * `phantomjs` | ||
124 | * `opera` | ||
125 | * `chrome` | ||
126 | * `safari` | ||
127 | * `firefox` | ||
128 | * `ie` | ||
129 | |||
111 | ## Hosting Considerations | 130 | ## Hosting Considerations |
112 | Unlike a native HLS implementation, the HLS plugin has to comply with | 131 | Unlike a native HLS implementation, the HLS plugin has to comply with |
113 | the browser's security policies. That means that all the files that | 132 | the browser's security policies. That means that all the files that | ... | ... |
... | @@ -10,7 +10,7 @@ | ... | @@ -10,7 +10,7 @@ |
10 | }, | 10 | }, |
11 | "license": "Apache 2", | 11 | "license": "Apache 2", |
12 | "scripts": { | 12 | "scripts": { |
13 | "test": "grunt test-local" | 13 | "test": "grunt test" |
14 | }, | 14 | }, |
15 | "devDependencies": { | 15 | "devDependencies": { |
16 | "grunt": "~0.4.1", | 16 | "grunt": "~0.4.1", | ... | ... |
... | @@ -5,6 +5,45 @@ | ... | @@ -5,6 +5,45 @@ |
5 | // 3. Run your tests | 5 | // 3. Run your tests |
6 | 6 | ||
7 | module.exports = function(config) { | 7 | module.exports = function(config) { |
8 | var customLaunchers = { | ||
9 | chrome_sl: { | ||
10 | singleRun: true, | ||
11 | base: 'SauceLabs', | ||
12 | browserName: 'chrome', | ||
13 | platform: 'Windows 7', | ||
14 | version: '34' | ||
15 | }, | ||
16 | |||
17 | firefox_sl: { | ||
18 | singleRun: true, | ||
19 | base: 'SauceLabs', | ||
20 | browserName: 'firefox', | ||
21 | platform: 'Windows 8' | ||
22 | }, | ||
23 | |||
24 | safari_sl: { | ||
25 | singleRun: true, | ||
26 | base: 'SauceLabs', | ||
27 | browserName: 'safari', | ||
28 | platform: 'OS X 10.8' | ||
29 | }, | ||
30 | |||
31 | ipad_sl: { | ||
32 | singleRun: true, | ||
33 | base: 'SauceLabs', | ||
34 | browserName: 'ipad', | ||
35 | platform:'OS X 10.9', | ||
36 | version: '7.1' | ||
37 | }, | ||
38 | |||
39 | android_sl: { | ||
40 | singleRun: true, | ||
41 | base: 'SauceLabs', | ||
42 | browserName: 'android', | ||
43 | platform:'Linux' | ||
44 | } | ||
45 | }; | ||
46 | |||
8 | config.set({ | 47 | config.set({ |
9 | // base path, that will be used to resolve files and exclude | 48 | // base path, that will be used to resolve files and exclude |
10 | basePath: '', | 49 | basePath: '', |
... | @@ -17,20 +56,12 @@ module.exports = function(config) { | ... | @@ -17,20 +56,12 @@ module.exports = function(config) { |
17 | // 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. | 56 | // 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. |
18 | singleRun: true, | 57 | singleRun: true, |
19 | 58 | ||
20 | // Start these browsers, currently available: | 59 | // custom launchers for sauce labs |
21 | // - Chrome | 60 | //define SL browsers |
22 | // - ChromeCanary | 61 | customLaunchers: customLaunchers, |
23 | // - Firefox | 62 | |
24 | // - Opera | 63 | // Start these browsers |
25 | // - Safari (only Mac) | 64 | browsers: ['chrome_sl', 'ipad_sl'], //Object.keys(customLaunchers), |
26 | // - PhantomJS | ||
27 | // - IE (only Windows) | ||
28 | // Example usage: | ||
29 | browsers: ['chrome_test'], | ||
30 | //'firefox_test', | ||
31 | //'safari_test', | ||
32 | //'ipad_test', | ||
33 | //'android_test' | ||
34 | 65 | ||
35 | // List of files / patterns to load in the browser | 66 | // List of files / patterns to load in the browser |
36 | // Add any new src files to this list. | 67 | // Add any new src files to this list. |
... | @@ -39,23 +70,26 @@ module.exports = function(config) { | ... | @@ -39,23 +70,26 @@ module.exports = function(config) { |
39 | // add their paths to this list. | 70 | // add their paths to this list. |
40 | 71 | ||
41 | files: [ | 72 | files: [ |
73 | '../node_modules/sinon/lib/sinon.js', | ||
74 | '../node_modules/sinon/lib/sinon/util/event.js', | ||
75 | '../node_modules/sinon/lib/sinon/util/fake_xml_http_request.js', | ||
76 | '../node_modules/sinon/lib/sinon/util/xhr_ie.js', | ||
42 | '../node_modules/video.js/dist/video-js/video.js', | 77 | '../node_modules/video.js/dist/video-js/video.js', |
43 | '../node_modules/videojs-contrib-media-sources/src/videojs-media-sources.js', | 78 | '../node_modules/videojs-contrib-media-sources/src/videojs-media-sources.js', |
44 | '../test/karma-qunit-shim.js', | 79 | '../test/karma-qunit-shim.js', |
45 | "../src/videojs-hls.js", | 80 | '../src/videojs-hls.js', |
46 | "../src/flv-tag.js", | 81 | '../src/flv-tag.js', |
47 | "../src/exp-golomb.js", | 82 | '../src/exp-golomb.js', |
48 | "../src/h264-stream.js", | 83 | '../src/h264-stream.js', |
49 | "../src/aac-stream.js", | 84 | '../src/aac-stream.js', |
50 | "../src/segment-parser.js", | 85 | '../src/segment-parser.js', |
51 | "../src/stream.js", | 86 | '../src/stream.js', |
52 | "../src/m3u8/m3u8-parser.js", | 87 | '../src/m3u8/m3u8-parser.js', |
53 | "../tmp/manifests.js", | 88 | '../tmp/manifests.js', |
54 | "../tmp/expected.js", | 89 | '../tmp/expected.js', |
55 | "tsSegment-bc.js", | 90 | 'tsSegment-bc.js', |
56 | "../src/bin-utils.js", | 91 | '../src/bin-utils.js', |
57 | "../src/async-queue.js", | 92 | '../test/*.js' |
58 | '../test/*.js' | ||
59 | ], | 93 | ], |
60 | 94 | ||
61 | plugins: [ | 95 | plugins: [ |
... | @@ -69,16 +103,9 @@ module.exports = function(config) { | ... | @@ -69,16 +103,9 @@ module.exports = function(config) { |
69 | 'karma-sauce-launcher' | 103 | 'karma-sauce-launcher' |
70 | ], | 104 | ], |
71 | 105 | ||
72 | // list of files to exclude | ||
73 | exclude: [ | ||
74 | |||
75 | ], | ||
76 | |||
77 | |||
78 | // test results reporter to use | 106 | // test results reporter to use |
79 | // possible values: 'dots', 'progress', 'junit' | 107 | // possible values: 'dots', 'progress', 'junit' |
80 | reporters: ['progress'], | 108 | reporters: ['dots', 'progress'], |
81 | |||
82 | 109 | ||
83 | // web server port | 110 | // web server port |
84 | port: 9876, | 111 | port: 9876, |
... | @@ -103,46 +130,6 @@ module.exports = function(config) { | ... | @@ -103,46 +130,6 @@ module.exports = function(config) { |
103 | build: process.env.TRAVIS_BUILD_NUMBER, | 130 | build: process.env.TRAVIS_BUILD_NUMBER, |
104 | testName: process.env.TRAVIS_BUILD_NUMBER + process.env.TRAVIS_BRANCH, | 131 | testName: process.env.TRAVIS_BUILD_NUMBER + process.env.TRAVIS_BRANCH, |
105 | recordScreenshots: false | 132 | recordScreenshots: false |
106 | }, | ||
107 | |||
108 | //define SL browsers | ||
109 | customLaunchers: { | ||
110 | chrome_test: { | ||
111 | singleRun: true, | ||
112 | base: 'SauceLabs', | ||
113 | browserName: 'chrome', | ||
114 | platform: 'Windows XP' | ||
115 | }, | ||
116 | |||
117 | firefox_test: { | ||
118 | singleRun: true, | ||
119 | base: 'SauceLabs', | ||
120 | browserName: 'firefox', | ||
121 | platform: 'Windows 8' | ||
122 | }, | ||
123 | |||
124 | safari_test: { | ||
125 | singleRun: true, | ||
126 | base: 'SauceLabs', | ||
127 | browserName: 'safari', | ||
128 | platform: 'OS X 10.8' | ||
129 | }, | ||
130 | |||
131 | ipad_test: { | ||
132 | singleRun: true, | ||
133 | base: 'SauceLabs', | ||
134 | browserName: 'ipad', | ||
135 | platform:'OS X 10.8' | ||
136 | }, | ||
137 | |||
138 | android_test: { | ||
139 | singleRun: true, | ||
140 | base: 'SauceLabs', | ||
141 | browserName: 'android', | ||
142 | platform:'Linux' | ||
143 | } | ||
144 | |||
145 | } | 133 | } |
146 | |||
147 | }); | 134 | }); |
148 | }; | 135 | }; | ... | ... |
... | @@ -34,23 +34,26 @@ module.exports = function(config) { | ... | @@ -34,23 +34,26 @@ module.exports = function(config) { |
34 | // add their paths to this list. | 34 | // add their paths to this list. |
35 | 35 | ||
36 | files: [ | 36 | files: [ |
37 | '../node_modules/sinon/lib/sinon.js', | ||
38 | '../node_modules/sinon/lib/sinon/util/event.js', | ||
39 | '../node_modules/sinon/lib/sinon/util/fake_xml_http_request.js', | ||
40 | '../node_modules/sinon/lib/sinon/util/xhr_ie.js', | ||
37 | '../node_modules/video.js/dist/video-js/video.js', | 41 | '../node_modules/video.js/dist/video-js/video.js', |
38 | '../node_modules/videojs-contrib-media-sources/src/videojs-media-sources.js', | 42 | '../node_modules/videojs-contrib-media-sources/src/videojs-media-sources.js', |
39 | '../test/karma-qunit-shim.js', | 43 | '../test/karma-qunit-shim.js', |
40 | "../src/videojs-hls.js", | 44 | '../src/videojs-hls.js', |
41 | "../src/flv-tag.js", | 45 | '../src/flv-tag.js', |
42 | "../src/exp-golomb.js", | 46 | '../src/exp-golomb.js', |
43 | "../src/h264-stream.js", | 47 | '../src/h264-stream.js', |
44 | "../src/aac-stream.js", | 48 | '../src/aac-stream.js', |
45 | "../src/segment-parser.js", | 49 | '../src/segment-parser.js', |
46 | "../src/stream.js", | 50 | '../src/stream.js', |
47 | "../src/m3u8/m3u8-parser.js", | 51 | '../src/m3u8/m3u8-parser.js', |
48 | "../tmp/manifests.js", | 52 | '../tmp/manifests.js', |
49 | "../tmp/expected.js", | 53 | '../tmp/expected.js', |
50 | "tsSegment-bc.js", | 54 | 'tsSegment-bc.js', |
51 | "../src/bin-utils.js", | 55 | '../src/bin-utils.js', |
52 | "../src/async-queue.js", | 56 | '../test/*.js' |
53 | '../test/*.js' | ||
54 | ], | 57 | ], |
55 | 58 | ||
56 | plugins: [ | 59 | plugins: [ |
... | @@ -88,7 +91,7 @@ module.exports = function(config) { | ... | @@ -88,7 +91,7 @@ module.exports = function(config) { |
88 | 91 | ||
89 | // level of logging | 92 | // level of logging |
90 | // possible values: config.LOG_DISABLE || config.LOG_ERROR || config.LOG_WARN || config.LOG_INFO || config.LOG_DEBUG | 93 | // possible values: config.LOG_DISABLE || config.LOG_ERROR || config.LOG_WARN || config.LOG_INFO || config.LOG_DEBUG |
91 | //logLevel: config.LOG_INFO, | 94 | logLevel: config.LOG_DISABLE, |
92 | 95 | ||
93 | // If browser does not capture in given timeout [ms], kill it | 96 | // If browser does not capture in given timeout [ms], kill it |
94 | captureTimeout: 60000 | 97 | captureTimeout: 60000 | ... | ... |
... | @@ -6,8 +6,8 @@ | ... | @@ -6,8 +6,8 @@ |
6 | <!-- Load sinon server for fakeXHR --> | 6 | <!-- Load sinon server for fakeXHR --> |
7 | <script src="../node_modules/sinon/lib/sinon.js"></script> | 7 | <script src="../node_modules/sinon/lib/sinon.js"></script> |
8 | <script src="../node_modules/sinon/lib/sinon/util/event.js"></script> | 8 | <script src="../node_modules/sinon/lib/sinon/util/event.js"></script> |
9 | <script src="../node_modules/sinon/lib/sinon/util/xhr_ie.js"></script> | ||
10 | <script src="../node_modules/sinon/lib/sinon/util/fake_xml_http_request.js"></script> | 9 | <script src="../node_modules/sinon/lib/sinon/util/fake_xml_http_request.js"></script> |
10 | <script src="../node_modules/sinon/lib/sinon/util/xhr_ie.js"></script> | ||
11 | 11 | ||
12 | <!-- Load local QUnit. --> | 12 | <!-- Load local QUnit. --> |
13 | <link rel="stylesheet" href="../libs/qunit/qunit.css" media="screen"> | 13 | <link rel="stylesheet" href="../libs/qunit/qunit.css" media="screen"> | ... | ... |
-
Please register or sign in to post a comment