Browse Source

test in Chrome Canary(#16)

Add Chrome Canary to tests
Shut off the autoplay policy to allow playback tests to run
pull/22/head
ishita12 8 years ago
committed by Joe Forbes
parent
commit
308efa497d
  1. 3
      README.md
  2. 5
      package.json
  3. 30
      test/karma.conf.js

3
README.md

@ -672,8 +672,7 @@ will stall. Fragmented MP4s are only supported on browser that have
## Testing
For testing, you run `npm run test`. This will run tests using any of the
browsers that karma-detect-browsers detects on your machine.
For testing, you run `npm run test`. You will need Chrome, Chrome Canary and Firefox for running the tests.
## Debugging

5
package.json

@ -35,10 +35,6 @@
"start:serve": "babel-node scripts/server.js",
"pretest": "npm-run-all lint build",
"test": "karma start test/karma.conf.js",
"test:chrome": "npm run pretest && karma start test/karma.conf.js --browsers Chrome",
"test:firefox": "npm run pretest && karma start test/karma.conf.js --browsers Firefox",
"test:ie": "npm run pretest && karma start test/karma.conf.js --browsers IE",
"test:safari": "npm run pretest && karma start test/karma.conf.js --browsers Safari",
"preversion": "npm test",
"version": "npm run build",
"watch": "npm-run-all -p watch:*",
@ -119,7 +115,6 @@
"karma-browserify": "^4.4.0",
"karma-chrome-launcher": "^2.2.0",
"karma-coverage": "^1.1.1",
"karma-detect-browsers": "^2.0.0",
"karma-firefox-launcher": "^1.1.0",
"karma-ie-launcher": "^0.2.0",
"karma-qunit": "^1.2.1",

30
test/karma.conf.js

@ -3,33 +3,18 @@ var isparta = require('isparta');
module.exports = function(config) {
var detectBrowsers = {
enabled: false,
usePhantomJS: false,
postDetection: function(availableBrowsers) {
var safariIndex = availableBrowsers.indexOf('Safari');
if(safariIndex !== -1) {
availableBrowsers.splice(safariIndex, 1);
console.log("Disabled Safari as it was/is not supported");
}
return availableBrowsers;
}
};
if (process.env.TRAVIS) {
config.browsers = ['ChromeHeadlessNoSandbox'];
} else {
config.browsers = ['ChromeHeadlessNoSandbox', 'ChromeCanaryHeadlessNoSandbox', 'FirefoxHeadless'];
}
// If no browsers are specified, we enable `karma-detect-browsers`
// this will detect all browsers that are available for testing
if (!config.browsers.length) {
detectBrowsers.enabled = true;
}
config.set({
basePath: '..',
frameworks: ['qunit', 'browserify', 'detectBrowsers'],
frameworks: ['qunit', 'browserify'],
files: [
'node_modules/sinon/pkg/sinon.js',
'node_modules/sinon/pkg/sinon-ie.js',
@ -47,8 +32,12 @@ module.exports = function(config) {
customLaunchers: {
ChromeHeadlessNoSandbox: {
base: 'ChromeHeadless',
flags: ['--no-sandbox']
}
flags: ['--no-sandbox', '--autoplay-policy=no-user-gesture-required']
},
ChromeCanaryHeadlessNoSandbox: {
base: 'ChromeCanaryHeadless',
flags: ['--no-sandbox', '--autoplay-policy=no-user-gesture-required'],
}
},
preprocessors: {
'test/**/*.test.js': ['browserify']
@ -72,7 +61,6 @@ module.exports = function(config) {
return file.originalPath;
}
},
detectBrowsers: detectBrowsers,
reporters: ['dots'],
port: 9876,
colors: true,

Loading…
Cancel
Save