Skip to content

Commit

Permalink
chore(Saucelabs): test on IE9, IE10 and IE11.
Browse files Browse the repository at this point in the history
Fixes #2344.

This moves the selection of the browsers to test to the travis build
script. The number of concurrent travis jobs should be limited to 5
(Saucelabs limit).
This also removes the S3 env variable which does nothing
  • Loading branch information
coderbyheart committed Jan 20, 2017
1 parent 4eada55 commit 6811cec
Show file tree
Hide file tree
Showing 2 changed files with 60 additions and 53 deletions.
30 changes: 29 additions & 1 deletion .travis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -33,8 +33,36 @@ matrix:
env: TARGET=test-node
- node_js: '7'
env: TARGET=lint
# phantomjs
- node_js: '7'
env: TARGET=test-browser S3=1
env: TARGET=test-browser
# chrome
- node_js: '7'
env: TARGET=test-browser BROWSER="chrome@latest" PLATFORM="Windows 8"
# edge
- node_js: '7'
env: TARGET=test-browser BROWSER="MicrosoftEdge@latest" PLATFORM="Windows 10"
# ie11
- node_js: '7'
env: TARGET=test-browser BROWSER="internet [email protected]" PLATFORM="Windows 8.1"
# ie10
- node_js: '7'
env: TARGET=test-browser BROWSER="internet [email protected]" PLATFORM="Windows 8"
# ie9
- node_js: '7'
env: TARGET=test-browser BROWSER="internet [email protected]" PLATFORM="Windows 7"
# ie8
- node_js: '7'
env: TARGET=test-browser BROWSER="internet [email protected]" PLATFORM="Windows 7"
# ie7
- node_js: '7'
env: TARGET=test-browser BROWSER="internet [email protected]" PLATFORM="Windows XP"
# firefox
- node_js: '7'
env: TARGET=test-browser BROWSER="firefox@latest" PLATFORM="Windows 8.1"
# safari
- node_js: '7'
env: TARGET=test-browser BROWSER="safari@latest" PLATFORM="OS X 10.11"

before_install: scripts/travis-before-install.sh

Expand Down
83 changes: 31 additions & 52 deletions karma.conf.js
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,7 @@ module.exports = function (config) {
},
reporters: ['spec'],
colors: true,
browsers: [osName() === 'macOS Sierra' ? 'Chrome' : 'PhantomJS'],
browsers: [osName() === 'macOS Sierra' ? 'Chrome' : 'PhantomJS'], // This is the default browser to run, locally
logLevel: config.LOG_INFO,
client: {
mocha: {
Expand All @@ -58,8 +58,17 @@ module.exports = function (config) {
};

// see https://github.com/saucelabs/karma-sauce-example

// We define the browser to run on the Saucelabs Infrastructure
// via the environment variables BROWSER and PLATFORM.
// PLATFORM is e.g. "Windows"
// BROWSER is expected to be in the format "<name>@<version>",
// e.g. "MicrosoftEdge@latest"
// See https://wiki.saucelabs.com/display/DOCS/Platform+Configurator#/
// for available browsers.

// TO RUN LOCALLY, execute:
// `CI=1 SAUCE_USERNAME=<user> SAUCE_ACCESS_KEY=<key> make test-browser`
// `CI=1 SAUCE_USERNAME=<user> SAUCE_ACCESS_KEY=<key> BROWSER=<browser> PLATFORM=<platform> make test-browser`
var env = process.env;
var sauceConfig;

Expand All @@ -68,16 +77,18 @@ module.exports = function (config) {
if (env.TRAVIS) {
console.error('Travis-CI detected');
bundleDirpath = path.join(baseBundleDirpath, process.env.TRAVIS_BUILD_ID);
if (env.SAUCE_USERNAME && env.SAUCE_ACCESS_KEY) {
// correlate build/tunnel with Travis
sauceConfig = {
build: 'TRAVIS #' + env.TRAVIS_BUILD_NUMBER +
' (' + env.TRAVIS_BUILD_ID + ')',
tunnelIdentifier: env.TRAVIS_JOB_NUMBER
};
console.error('Configured SauceLabs');
} else {
console.error('No SauceLabs credentials present');
if (env.BROWSER && env.PLATFORM) {
if (env.SAUCE_USERNAME && env.SAUCE_ACCESS_KEY) {
// correlate build/tunnel with Travis
sauceConfig = {
build: 'TRAVIS #' + env.TRAVIS_BUILD_NUMBER +
' (' + env.TRAVIS_BUILD_ID + ')',
tunnelIdentifier: env.TRAVIS_JOB_NUMBER
};
console.error('Configured SauceLabs');
} else {
console.error('No SauceLabs credentials present');
}
}
} else if (env.APPVEYOR) {
console.error('AppVeyor detected');
Expand Down Expand Up @@ -126,48 +137,16 @@ module.exports = function (config) {
};

function addSauceTests (cfg) {
var env = process.env;
cfg.reporters.push('saucelabs');

cfg.customLaunchers = {
ie8: {
base: 'SauceLabs',
browserName: 'internet explorer',
platform: 'Windows 7',
version: '8.0'
},
ie7: {
base: 'SauceLabs',
browserName: 'internet explorer',
platform: 'Windows XP',
version: '7.0'
},
chrome: {
base: 'SauceLabs',
browserName: 'chrome',
platform: 'Windows 8',
version: 'latest'
},
edge: {
base: 'SauceLabs',
browserName: 'MicrosoftEdge',
platform: 'Windows 10',
version: 'latest'
},
firefox: {
base: 'SauceLabs',
browserName: 'firefox',
platform: 'Windows 8.1',
version: 'latest'
},
safari: {
base: 'SauceLabs',
browserName: 'safari',
platform: 'OS X 10.11',
version: 'latest'
}
cfg.customLaunchers = {};
cfg.customLaunchers[env.BROWSER] = {
base: 'SauceLabs',
browserName: env.BROWSER.split('@')[0],
version: env.BROWSER.split('@')[1],
platform: env.PLATFORM
};

cfg.browsers = cfg.browsers.concat(Object.keys(cfg.customLaunchers));
cfg.browsers = [env.BROWSER];

cfg.sauceLabs = {
public: 'public',
Expand Down

0 comments on commit 6811cec

Please sign in to comment.