diff --git a/.travis.yml b/.travis.yml
index 20ee6b752..acee1c0c0 100644
--- a/.travis.yml
+++ b/.travis.yml
@@ -3,7 +3,6 @@ node_js:
- '0.10'
install:
- npm install -g grunt-cli && npm install
-- if [ "${TRAVIS_PULL_REQUEST}" = "false" ]; then curl https://gist.githubusercontent.com/santiycr/5139565/raw/sauce_connect_setup.sh | bash; fi
notifications:
hipchat:
rooms:
@@ -16,3 +15,5 @@ env:
global:
- secure: dM7svnHPPu5IiUMeFWW5zg+iuWNpwt6SSDi3MmVvhSclNMRLesQoRB+7Qq5J/LiKhmjpv1/GlNVV0CTsHMRhZNwQ3fo38eEuTXv99aAflEITXwSEh/VntKViHbGFubn06EnVkJoH6MX3zJ6kbiwc2QdSQbywKzS6l6quUEpWpd0=
- secure: AnduYGXka5ft1x7V3SuVYqvlKLvJGhUaRNFdy4UDJr3ZVuwpQjE4TMDG8REmJIJvXfHbh4qY4N1cFSGnXkZ4bH21Xk0v9DLhsxbarKz+X2BvPgXs+Af9EQ6vLEy/5S1vMLxfT5+y+Ec5bVNGOsdUZby8Y21CRzSg6ADN9kwPGlE=
+addons:
+ sauce_connect: true
diff --git a/Gruntfile.js b/Gruntfile.js
index 6fe6706e2..07bc928c6 100644
--- a/Gruntfile.js
+++ b/Gruntfile.js
@@ -83,6 +83,12 @@ module.exports = function(grunt) {
port: 9999,
keepalive: true
}
+ },
+ test: {
+ options: {
+ hostname: '*',
+ port: 9999
+ }
}
},
open : {
@@ -196,7 +202,53 @@ module.exports = function(grunt) {
autoWatch: false
}
},
+ protractor: {
+ options: {
+ configFile: 'test/functional/protractor.config.js'
+ },
+ chrome: {
+ options: {
+ args: {
+ capabilities: {
+ browserName: 'chrome'
+ }
+ }
+ }
+ },
+
+ firefox: {
+ options: {
+ args: {
+ capabilities: {
+ browserName: 'firefox'
+ }
+ }
+ }
+ },
+
+ safari: {
+ options: {
+ args: {
+ capabilities: {
+ browserName: 'safari'
+ }
+ }
+ }
+ },
+
+ ie: {
+ options: {
+ args: {
+ capabilities: {
+ browserName: 'internet explorer'
+ }
+ }
+ }
+ },
+
+ saucelabs:{}
+ }
});
// These plugins provide necessary tasks.
@@ -212,6 +264,7 @@ module.exports = function(grunt) {
grunt.loadNpmTasks('grunt-contrib-watch');
grunt.loadNpmTasks('grunt-github-releaser');
grunt.loadNpmTasks('grunt-version');
+ grunt.loadNpmTasks('grunt-protractor-runner');
grunt.loadNpmTasks('chg');
@@ -284,6 +337,7 @@ module.exports = function(grunt) {
grunt.task.run(['karma:phantomjs']);
} else if (process.env.TRAVIS) {
grunt.task.run(['karma:saucelabs']);
+ grunt.task.run(['connect:test', 'protractor:saucelabs']);
} else {
if (tasks.length === 0) {
tasks.push('chrome');
@@ -291,9 +345,13 @@ module.exports = function(grunt) {
if (tasks.length === 1) {
tasks = tasks[0].split(',');
}
- tasks = tasks.map(function(el) {
- return 'karma:' + el;
- });
+ tasks = tasks.reduce(function(acc, el) {
+ acc.push('karma:' + el);
+ if (/chrome|firefox|safari|ie/.test(el)) {
+ acc.push('protractor:' + el);
+ }
+ return acc;
+ }, ['connect:test']);
grunt.task.run(tasks);
}
diff --git a/README.md b/README.md
index eea1adc42..dcd039b08 100644
--- a/README.md
+++ b/README.md
@@ -190,7 +190,7 @@ the web](http://www.html5rocks.com/en/tutorials/track/basics/).
### 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.
+If you use `npm test`, it will only run the karma and end-to-end 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:
```
@@ -201,10 +201,14 @@ Possible options are:
* `chromecanary`
* `phantomjs`
* `opera`
-* `chrome`
-* `safari`
-* `firefox`
-* `ie`
+* `chrome`1
+* `safari`1, 2
+* `firefox`1
+* `ie`1
+
+
+_1supported end-to-end browsers_
+_2requires the [SafariDriver extension]( https://code.google.com/p/selenium/wiki/SafariDriver) to be installed_
## Hosting Considerations
Unlike a native HLS implementation, the HLS tech has to comply with
diff --git a/package.json b/package.json
index 3b486e271..794911fa1 100644
--- a/package.json
+++ b/package.json
@@ -19,7 +19,7 @@
],
"devDependencies": {
"chg": "^0.2.0",
- "grunt": "~0.4.1",
+ "grunt": "^0.4.5",
"grunt-concurrent": "0.4.3",
"grunt-contrib-clean": "~0.4.0",
"grunt-contrib-concat": "~0.3.0",
@@ -30,6 +30,7 @@
"grunt-github-releaser": "^0.1.17",
"grunt-karma": "~0.6.2",
"grunt-open": "0.2.3",
+ "grunt-protractor-runner": "git+https://github.com/forbesjo/grunt-protractor-runner.git#update-webdriver",
"grunt-shell": "0.6.1",
"grunt-version": "^1.0.0",
"karma": "~0.10.0",
diff --git a/test/functional/protractor.config.js b/test/functional/protractor.config.js
new file mode 100644
index 000000000..1962b5dcb
--- /dev/null
+++ b/test/functional/protractor.config.js
@@ -0,0 +1,38 @@
+/* global browser */
+
+var config = {};
+
+if (process.env.SAUCE_USERNAME) {
+ config.multiCapabilities = [{
+ browserName: 'chrome',
+ platform: 'Windows 8.1'
+ }, {
+ browserName: 'firefox',
+ platform: 'Windows 8.1'
+ }].map(function(caps) {
+ caps.name = process.env.TRAVIS_BUILD_NUMBER + process.env.TRAVIS_BRANCH;
+ caps.build = process.env.TRAVIS_BUILD_NUMBER;
+ caps['tunnel-identifier'] = process.env.TRAVIS_JOB_NUMBER;
+ caps.recordScreenshots = false;
+ return caps;
+ });
+
+ config.sauceUser = process.env.SAUCE_USERNAME;
+ config.sauceKey = process.env.SAUCE_ACCESS_KEY;
+ config.maxSessions = 5;
+ config.maxDuration = 300;
+}
+
+config.baseUrl = 'http://localhost:9999/example.html';
+config.specs = ['spec.js'];
+
+config.framework = 'jasmine2';
+config.onPrepare = function() {
+ browser.ignoreSynchronization = true;
+};
+config.jasmineNodeOpts = {
+ showColors: true,
+ defaultTimeoutInterval: 60000
+};
+
+exports.config = config;
diff --git a/test/functional/spec.js b/test/functional/spec.js
new file mode 100644
index 000000000..65a65f744
--- /dev/null
+++ b/test/functional/spec.js
@@ -0,0 +1,21 @@
+/* global browser, $, describe, beforeEach, it, expect, player */
+
+describe('Player', function() {
+ beforeEach(function() {
+ browser.get(browser.baseUrl);
+ });
+
+ it('should play', function() {
+ $('.vjs-big-play-button').click();
+ browser.executeAsyncScript(function(done) {
+ player.one('timeupdate', function() {
+ var result = !player.paused() &&
+ !player.ended() &&
+ player.error() === null;
+ done(result);
+ });
+ }).then(function(result) {
+ expect(result).toBe(true);
+ });
+ });
+});