Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

chore(Saucelabs): test on IE9, IE10 and IE11. #2678

Merged
merged 1 commit into from
Jan 28, 2017
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
34 changes: 33 additions & 1 deletion .travis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -33,11 +33,43 @@ 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
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I mentioned this in the original issue, but how can we ensure we don't open too many concurrent sessions if all of these jobs one concurrently on Travis?

# 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 explorer@11.0" PLATFORM="Windows 8.1"
# ie10
- node_js: '7'
env: TARGET=test-browser BROWSER="internet explorer@10.0" PLATFORM="Windows 8"
# ie9
- node_js: '7'
env: TARGET=test-browser BROWSER="internet explorer@9.0" PLATFORM="Windows 7"
# ie8
- node_js: '7'
env: TARGET=test-browser BROWSER="internet explorer@8.0" PLATFORM="Windows 7"
# ie7
- node_js: '7'
env: TARGET=test-browser BROWSER="internet explorer@7.0" 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

install:
- npm install
- cd node_modules && ln -nsf @coderbyheart/karma-sauce-launcher karma-sauce-launcher && cd ../

before_script: scripts/travis-before-script.sh

script: make $TARGET
Expand Down
93 changes: 40 additions & 53 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,56 +137,32 @@ 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 = [env.BROWSER];

cfg.browsers = cfg.browsers.concat(Object.keys(cfg.customLaunchers));

// See https://github.com/karma-runner/karma-sauce-launcher
// See https://github.com/bermi/sauce-connect-launcher#advanced-usage
cfg.sauceLabs = {
public: 'public',
startConnect: true
startConnect: true,
connectOptions: {
connectRetries: 10,
connectRetryTimeout: 60000
}
};

cfg.concurrency = 5;

cfg.retryLimit = 5;

// for slow browser booting, ostensibly
cfg.captureTimeout = 120000;
cfg.browserNoActivityTimeout = 20000;
Expand Down
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -336,7 +336,7 @@
"karma-expect": "^1.1.2",
"karma-mocha": "^1.3.0",
"karma-phantomjs-launcher": "^1.0.2",
"karma-sauce-launcher": "^1.0.0",
"karma-sauce-launcher": "coderbyheart/karma-sauce-launcher",
"karma-spec-reporter": "0.0.26",
"nyc": "^10.0.0",
"os-name": "^2.0.1",
Expand Down