Skip to content

Commit

Permalink
chore(infrastructure): Set up continuous integration
Browse files Browse the repository at this point in the history
* Add .travis.yml file to the repo, enabling TravisCI to run against PRs
  for master and branches of.
* Set up Sauce Labs running on the last two versions of every major
  browser (excluding Android 4 and Opera). Android 4 is quite old, and
  Opera is very similar to Chrome as it uses blink/chromium under the hood.
* Fix false negative in IE11 for mdl-auto-init test.

Part of #4464
  • Loading branch information
traviskaufman committed Jul 21, 2016
1 parent ff30193 commit 76388ab
Show file tree
Hide file tree
Showing 4 changed files with 96 additions and 2 deletions.
10 changes: 10 additions & 0 deletions .travis.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
language: node_js
node_js:
- node # stable
- "4" # LTS
env:
global:
- SAUCE_USERNAME=material-sauce
- SAUCE_ACCESS_KEY=b2d0a657cb53-0a28-4a84-6202-4b5933e5
addons:
sauce_connect: true
85 changes: 84 additions & 1 deletion karma.conf.js
Original file line number Diff line number Diff line change
@@ -1,6 +1,81 @@
const path = require('path');
const webpackConfig = require('./webpack.config')[0];

const USING_SL = Boolean(process.env.SAUCE_USERNAME && process.env.SAUCE_ACCESS_KEY);

const CUSTOM_LAUNCHERS = {
'sl-chrome-stable': {
base: 'SauceLabs',
browserName: 'chrome',
version: '51'
},
'sl-chrome-beta': {
base: 'SauceLabs',
browserName: 'chrome',
version: 'beta'
},
'sl-chrome-previous': {
base: 'SauceLabs',
browserName: 'chrome',
version: '50'
},
'sl-firefox-stable': {
base: 'SauceLabs',
browserName: 'firefox'
},
'sl-firefox-previous': {
base: 'SauceLabs',
browserName: 'firefox',
version: '47'
},
// NOTE(traviskaufman): Tried adding Firefox beta but it was consistently flaky. Holding off on adding
// it in for now. If it proves to be less flaky in the future, we should add it.
'sl-safari-stable': {
base: 'SauceLabs',
browserName: 'safari',
version: '9',
platform: 'OS X 10.11'
},
'sl-safari-previous': {
base: 'SauceLabs',
browserName: 'safari',
version: '8',
platform: 'OS X 10.10'
},
'sl-ie': {
base: 'SauceLabs',
browserName: 'internet explorer',
version: '11',
platform: 'Windows 8.1'
},
'sl-edge': {
base: 'SauceLabs',
browserName: 'microsoftedge',
version: '13',
platform: 'Windows 10'
},
'sl-android-stable': {
base: 'SauceLabs',
browserName: 'android',
version: '5.0'
},
'sl-ios-safari-latest': {
base: 'SauceLabs',
browserName: 'iphone',
platform: 'OS X 10.10',
version: '9.1'
},
'sl-ios-safari-previous': {
base: 'SauceLabs',
browserName: 'iphone',
version: '8.4'
}
};

if (USING_SL) {
process.env.SAUCE_ACCESS_KEY = k(process.env.SAUCE_ACCESS_KEY);
}

module.exports = function(config) {
config.set({
basePath: '',
Expand All @@ -15,8 +90,12 @@ module.exports = function(config) {
port: 9876,
colors: true,
logLevel: config.LOG_INFO,
browsers: ['Chrome'],
browsers: USING_SL ? Object.keys(CUSTOM_LAUNCHERS) : ['Chrome'],
browserDisconnectTimeout: 20000,
browserNoActivityTimeout: 240000,
captureTimeout: 120000,
concurrency: Infinity,
customLaunchers: CUSTOM_LAUNCHERS,

coverageReporter: {
dir: 'coverage',
Expand Down Expand Up @@ -47,3 +126,7 @@ module.exports = function(config) {
}
});
};

function k(s) {
return (s || '').split('').reverse().join('');
}
1 change: 1 addition & 0 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -38,6 +38,7 @@
"karma": "^1.1.1",
"karma-chrome-launcher": "^1.0.1",
"karma-coverage": "^1.1.0",
"karma-sauce-launcher": "^1.0.0",
"karma-sourcemap-loader": "^0.3.7",
"karma-tap": "^2.0.1",
"karma-webpack": "^1.7.0",
Expand Down
2 changes: 1 addition & 1 deletion test/unit/mdl-auto-init/mdl-auto-init.test.js
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ const createFixture = () => bel`

const setupTest = () => {
mdlAutoInit.deregisterAll();
mdlAutoInit.register(FakeComponent.name, FakeComponent);
mdlAutoInit.register('FakeComponent', FakeComponent);
return createFixture();
};

Expand Down

0 comments on commit 76388ab

Please sign in to comment.