Add a functional test that runs in SauceLabs. closes #323
Showing
7 changed files
with
134 additions
and
10 deletions
... | @@ -3,7 +3,6 @@ node_js: | ... | @@ -3,7 +3,6 @@ node_js: |
3 | - '0.10' | 3 | - '0.10' |
4 | install: | 4 | install: |
5 | - npm install -g grunt-cli && npm install | 5 | - npm install -g grunt-cli && npm install |
6 | - if [ "${TRAVIS_PULL_REQUEST}" = "false" ]; then curl https://gist.githubusercontent.com/santiycr/5139565/raw/sauce_connect_setup.sh | bash; fi | ||
7 | notifications: | 6 | notifications: |
8 | hipchat: | 7 | hipchat: |
9 | rooms: | 8 | rooms: |
... | @@ -16,3 +15,5 @@ env: | ... | @@ -16,3 +15,5 @@ env: |
16 | global: | 15 | global: |
17 | - secure: dM7svnHPPu5IiUMeFWW5zg+iuWNpwt6SSDi3MmVvhSclNMRLesQoRB+7Qq5J/LiKhmjpv1/GlNVV0CTsHMRhZNwQ3fo38eEuTXv99aAflEITXwSEh/VntKViHbGFubn06EnVkJoH6MX3zJ6kbiwc2QdSQbywKzS6l6quUEpWpd0= | 16 | - secure: dM7svnHPPu5IiUMeFWW5zg+iuWNpwt6SSDi3MmVvhSclNMRLesQoRB+7Qq5J/LiKhmjpv1/GlNVV0CTsHMRhZNwQ3fo38eEuTXv99aAflEITXwSEh/VntKViHbGFubn06EnVkJoH6MX3zJ6kbiwc2QdSQbywKzS6l6quUEpWpd0= |
18 | - secure: AnduYGXka5ft1x7V3SuVYqvlKLvJGhUaRNFdy4UDJr3ZVuwpQjE4TMDG8REmJIJvXfHbh4qY4N1cFSGnXkZ4bH21Xk0v9DLhsxbarKz+X2BvPgXs+Af9EQ6vLEy/5S1vMLxfT5+y+Ec5bVNGOsdUZby8Y21CRzSg6ADN9kwPGlE= | 17 | - secure: AnduYGXka5ft1x7V3SuVYqvlKLvJGhUaRNFdy4UDJr3ZVuwpQjE4TMDG8REmJIJvXfHbh4qY4N1cFSGnXkZ4bH21Xk0v9DLhsxbarKz+X2BvPgXs+Af9EQ6vLEy/5S1vMLxfT5+y+Ec5bVNGOsdUZby8Y21CRzSg6ADN9kwPGlE= |
18 | addons: | ||
19 | sauce_connect: true | ... | ... |
... | @@ -5,6 +5,7 @@ CHANGELOG | ... | @@ -5,6 +5,7 @@ CHANGELOG |
5 | * @dmlap improved video duration calculation. ([view](https://github.com/videojs/videojs-contrib-hls/pull/321)) | 5 | * @dmlap improved video duration calculation. ([view](https://github.com/videojs/videojs-contrib-hls/pull/321)) |
6 | * Clamp seeks to the seekable range ([view](https://github.com/videojs/videojs-contrib-hls/pull/327)) | 6 | * Clamp seeks to the seekable range ([view](https://github.com/videojs/videojs-contrib-hls/pull/327)) |
7 | * Use getComputedStyle for player dimensions when filtering variants ([view](https://github.com/videojs/videojs-contrib-hls/pull/326)) | 7 | * Use getComputedStyle for player dimensions when filtering variants ([view](https://github.com/videojs/videojs-contrib-hls/pull/326)) |
8 | * Add a functional test that runs in SauceLabs ([view](https://github.com/videojs/videojs-contrib-hls/pull/323)) | ||
8 | 9 | ||
9 | -------------------- | 10 | -------------------- |
10 | 11 | ... | ... |
... | @@ -83,6 +83,12 @@ module.exports = function(grunt) { | ... | @@ -83,6 +83,12 @@ module.exports = function(grunt) { |
83 | port: 9999, | 83 | port: 9999, |
84 | keepalive: true | 84 | keepalive: true |
85 | } | 85 | } |
86 | }, | ||
87 | test: { | ||
88 | options: { | ||
89 | hostname: '*', | ||
90 | port: 9999 | ||
91 | } | ||
86 | } | 92 | } |
87 | }, | 93 | }, |
88 | open : { | 94 | open : { |
... | @@ -196,7 +202,53 @@ module.exports = function(grunt) { | ... | @@ -196,7 +202,53 @@ module.exports = function(grunt) { |
196 | autoWatch: false | 202 | autoWatch: false |
197 | } | 203 | } |
198 | }, | 204 | }, |
205 | protractor: { | ||
206 | options: { | ||
207 | configFile: 'test/functional/protractor.config.js' | ||
208 | }, | ||
199 | 209 | ||
210 | chrome: { | ||
211 | options: { | ||
212 | args: { | ||
213 | capabilities: { | ||
214 | browserName: 'chrome' | ||
215 | } | ||
216 | } | ||
217 | } | ||
218 | }, | ||
219 | |||
220 | firefox: { | ||
221 | options: { | ||
222 | args: { | ||
223 | capabilities: { | ||
224 | browserName: 'firefox' | ||
225 | } | ||
226 | } | ||
227 | } | ||
228 | }, | ||
229 | |||
230 | safari: { | ||
231 | options: { | ||
232 | args: { | ||
233 | capabilities: { | ||
234 | browserName: 'safari' | ||
235 | } | ||
236 | } | ||
237 | } | ||
238 | }, | ||
239 | |||
240 | ie: { | ||
241 | options: { | ||
242 | args: { | ||
243 | capabilities: { | ||
244 | browserName: 'internet explorer' | ||
245 | } | ||
246 | } | ||
247 | } | ||
248 | }, | ||
249 | |||
250 | saucelabs:{} | ||
251 | } | ||
200 | }); | 252 | }); |
201 | 253 | ||
202 | // These plugins provide necessary tasks. | 254 | // These plugins provide necessary tasks. |
... | @@ -212,6 +264,7 @@ module.exports = function(grunt) { | ... | @@ -212,6 +264,7 @@ module.exports = function(grunt) { |
212 | grunt.loadNpmTasks('grunt-contrib-watch'); | 264 | grunt.loadNpmTasks('grunt-contrib-watch'); |
213 | grunt.loadNpmTasks('grunt-github-releaser'); | 265 | grunt.loadNpmTasks('grunt-github-releaser'); |
214 | grunt.loadNpmTasks('grunt-version'); | 266 | grunt.loadNpmTasks('grunt-version'); |
267 | grunt.loadNpmTasks('grunt-protractor-runner'); | ||
215 | grunt.loadNpmTasks('chg'); | 268 | grunt.loadNpmTasks('chg'); |
216 | 269 | ||
217 | 270 | ||
... | @@ -284,6 +337,7 @@ module.exports = function(grunt) { | ... | @@ -284,6 +337,7 @@ module.exports = function(grunt) { |
284 | grunt.task.run(['karma:phantomjs']); | 337 | grunt.task.run(['karma:phantomjs']); |
285 | } else if (process.env.TRAVIS) { | 338 | } else if (process.env.TRAVIS) { |
286 | grunt.task.run(['karma:saucelabs']); | 339 | grunt.task.run(['karma:saucelabs']); |
340 | grunt.task.run(['connect:test', 'protractor:saucelabs']); | ||
287 | } else { | 341 | } else { |
288 | if (tasks.length === 0) { | 342 | if (tasks.length === 0) { |
289 | tasks.push('chrome'); | 343 | tasks.push('chrome'); |
... | @@ -291,9 +345,13 @@ module.exports = function(grunt) { | ... | @@ -291,9 +345,13 @@ module.exports = function(grunt) { |
291 | if (tasks.length === 1) { | 345 | if (tasks.length === 1) { |
292 | tasks = tasks[0].split(','); | 346 | tasks = tasks[0].split(','); |
293 | } | 347 | } |
294 | tasks = tasks.map(function(el) { | 348 | tasks = tasks.reduce(function(acc, el) { |
295 | return 'karma:' + el; | 349 | acc.push('karma:' + el); |
296 | }); | 350 | if (/chrome|firefox|safari|ie/.test(el)) { |
351 | acc.push('protractor:' + el); | ||
352 | } | ||
353 | return acc; | ||
354 | }, ['connect:test']); | ||
297 | 355 | ||
298 | grunt.task.run(tasks); | 356 | grunt.task.run(tasks); |
299 | } | 357 | } | ... | ... |
... | @@ -190,7 +190,7 @@ the web](http://www.html5rocks.com/en/tutorials/track/basics/). | ... | @@ -190,7 +190,7 @@ the web](http://www.html5rocks.com/en/tutorials/track/basics/). |
190 | ### Testing | 190 | ### Testing |
191 | 191 | ||
192 | For testing, you can either run `npm test` or use `grunt` directly. | 192 | For testing, you can either run `npm test` or use `grunt` directly. |
193 | If you use `npm test`, it will only run the karma tests using chrome. | 193 | If you use `npm test`, it will only run the karma and end-to-end tests using chrome. |
194 | You can specify which browsers you want the tests to run via grunt's `test` task. | 194 | You can specify which browsers you want the tests to run via grunt's `test` task. |
195 | You can use either grunt-style arguments or comma separated arguments: | 195 | You can use either grunt-style arguments or comma separated arguments: |
196 | ``` | 196 | ``` |
... | @@ -201,10 +201,14 @@ Possible options are: | ... | @@ -201,10 +201,14 @@ Possible options are: |
201 | * `chromecanary` | 201 | * `chromecanary` |
202 | * `phantomjs` | 202 | * `phantomjs` |
203 | * `opera` | 203 | * `opera` |
204 | * `chrome` | 204 | * `chrome`<sup>1</sup> |
205 | * `safari` | 205 | * `safari`<sup>1, 2</sup> |
206 | * `firefox` | 206 | * `firefox`<sup>1</sup> |
207 | * `ie` | 207 | * `ie`<sup>1</sup> |
208 | |||
209 | |||
210 | _<sup>1</sup>supported end-to-end browsers_<br /> | ||
211 | _<sup>2</sup>requires the [SafariDriver extension]( https://code.google.com/p/selenium/wiki/SafariDriver) to be installed_ | ||
208 | 212 | ||
209 | ## Hosting Considerations | 213 | ## Hosting Considerations |
210 | Unlike a native HLS implementation, the HLS tech has to comply with | 214 | Unlike a native HLS implementation, the HLS tech has to comply with | ... | ... |
... | @@ -19,7 +19,7 @@ | ... | @@ -19,7 +19,7 @@ |
19 | ], | 19 | ], |
20 | "devDependencies": { | 20 | "devDependencies": { |
21 | "chg": "^0.2.0", | 21 | "chg": "^0.2.0", |
22 | "grunt": "~0.4.1", | 22 | "grunt": "^0.4.5", |
23 | "grunt-concurrent": "0.4.3", | 23 | "grunt-concurrent": "0.4.3", |
24 | "grunt-contrib-clean": "~0.4.0", | 24 | "grunt-contrib-clean": "~0.4.0", |
25 | "grunt-contrib-concat": "~0.3.0", | 25 | "grunt-contrib-concat": "~0.3.0", |
... | @@ -30,6 +30,7 @@ | ... | @@ -30,6 +30,7 @@ |
30 | "grunt-github-releaser": "^0.1.17", | 30 | "grunt-github-releaser": "^0.1.17", |
31 | "grunt-karma": "~0.6.2", | 31 | "grunt-karma": "~0.6.2", |
32 | "grunt-open": "0.2.3", | 32 | "grunt-open": "0.2.3", |
33 | "grunt-protractor-runner": "git+https://github.com/forbesjo/grunt-protractor-runner.git#update-webdriver", | ||
33 | "grunt-shell": "0.6.1", | 34 | "grunt-shell": "0.6.1", |
34 | "grunt-version": "^1.0.0", | 35 | "grunt-version": "^1.0.0", |
35 | "karma": "~0.10.0", | 36 | "karma": "~0.10.0", | ... | ... |
test/functional/protractor.config.js
0 → 100644
1 | /* global browser */ | ||
2 | |||
3 | var config = {}; | ||
4 | |||
5 | if (process.env.SAUCE_USERNAME) { | ||
6 | config.multiCapabilities = [{ | ||
7 | browserName: 'chrome', | ||
8 | platform: 'Windows 8.1' | ||
9 | }, { | ||
10 | browserName: 'firefox', | ||
11 | platform: 'Windows 8.1' | ||
12 | }].map(function(caps) { | ||
13 | caps.name = process.env.TRAVIS_BUILD_NUMBER + process.env.TRAVIS_BRANCH; | ||
14 | caps.build = process.env.TRAVIS_BUILD_NUMBER; | ||
15 | caps['tunnel-identifier'] = process.env.TRAVIS_JOB_NUMBER; | ||
16 | caps.recordScreenshots = false; | ||
17 | return caps; | ||
18 | }); | ||
19 | |||
20 | config.sauceUser = process.env.SAUCE_USERNAME; | ||
21 | config.sauceKey = process.env.SAUCE_ACCESS_KEY; | ||
22 | config.maxSessions = 5; | ||
23 | config.maxDuration = 300; | ||
24 | } | ||
25 | |||
26 | config.baseUrl = 'http://localhost:9999/example.html'; | ||
27 | config.specs = ['spec.js']; | ||
28 | |||
29 | config.framework = 'jasmine2'; | ||
30 | config.onPrepare = function() { | ||
31 | browser.ignoreSynchronization = true; | ||
32 | }; | ||
33 | config.jasmineNodeOpts = { | ||
34 | showColors: true, | ||
35 | defaultTimeoutInterval: 60000 | ||
36 | }; | ||
37 | |||
38 | exports.config = config; |
test/functional/spec.js
0 → 100644
1 | /* global browser, $, describe, beforeEach, it, expect, player */ | ||
2 | |||
3 | describe('Player', function() { | ||
4 | beforeEach(function() { | ||
5 | browser.get(browser.baseUrl); | ||
6 | }); | ||
7 | |||
8 | it('should play', function() { | ||
9 | $('.vjs-big-play-button').click(); | ||
10 | browser.executeAsyncScript(function(done) { | ||
11 | player.one('timeupdate', function() { | ||
12 | var result = !player.paused() && | ||
13 | !player.ended() && | ||
14 | player.error() === null; | ||
15 | done(result); | ||
16 | }); | ||
17 | }).then(function(result) { | ||
18 | expect(result).toBe(true); | ||
19 | }); | ||
20 | }); | ||
21 | }); |
-
Please register or sign in to post a comment