-
-
Notifications
You must be signed in to change notification settings - Fork 3k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
consolidate saucelabs tests to address flake (#3019)
- run browser tests concurrently to avoid SauceLabs flake - remove some "unit" tests of questionable value - linting of `karma.conf.js`
- Loading branch information
Showing
5 changed files
with
49 additions
and
242 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -25,36 +25,8 @@ matrix: | |
env: TARGET=test-node | ||
- node_js: '8' | ||
env: TARGET=lint | ||
# phantomjs | ||
- node_js: '8' | ||
env: TARGET=test-browser | ||
# chrome | ||
- node_js: '8' | ||
env: TARGET=test-browser BROWSER="chrome@latest" PLATFORM="Windows 8" | ||
# edge | ||
- node_js: '8' | ||
env: TARGET=test-browser BROWSER="MicrosoftEdge@latest" PLATFORM="Windows 10" | ||
# ie11 | ||
- node_js: '8' | ||
env: TARGET=test-browser BROWSER="internet [email protected]" PLATFORM="Windows 8.1" | ||
# ie10 | ||
- node_js: '8' | ||
env: TARGET=test-browser BROWSER="internet [email protected]" PLATFORM="Windows 8" | ||
# ie9 | ||
- node_js: '8' | ||
env: TARGET=test-browser BROWSER="internet [email protected]" PLATFORM="Windows 7" | ||
# ie8 | ||
- node_js: '8' | ||
env: TARGET=test-browser BROWSER="internet [email protected]" PLATFORM="Windows 7" | ||
# ie7 | ||
- node_js: '8' | ||
env: TARGET=test-browser BROWSER="internet [email protected]" PLATFORM="Windows XP" | ||
# firefox | ||
- node_js: '8' | ||
env: TARGET=test-browser BROWSER="firefox@latest" PLATFORM="Windows 8.1" | ||
# safari | ||
- node_js: '8' | ||
env: TARGET=test-browser BROWSER="safari@latest" PLATFORM="OS X 10.11" | ||
|
||
before_install: scripts/travis-before-install.sh | ||
|
||
|
@@ -76,3 +48,4 @@ addons: | |
paths: | ||
- .karma/ | ||
- ./mocha.js | ||
sauce_connect: true |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -6,6 +6,16 @@ var mkdirp = require('mkdirp'); | |
var baseBundleDirpath = path.join(__dirname, '.karma'); | ||
var osName = require('os-name'); | ||
|
||
var browserPlatformPairs = { | ||
'chrome@latest': 'Windows 8', | ||
'MicrosoftEdge@latest': 'Windows 10', | ||
'internet [email protected]': 'Windows 8.1', | ||
'internet [email protected]': 'Windows 8', | ||
'internet [email protected]': 'Windows 7', | ||
'firefox@latest': 'Windows 10', | ||
'safari@latest': 'OS X 10.12' | ||
}; | ||
|
||
module.exports = function (config) { | ||
var bundleDirpath; | ||
var cfg = { | ||
|
@@ -51,7 +61,7 @@ module.exports = function (config) { | |
reporters: ['spec'], | ||
colors: true, | ||
browsers: [osName() === 'macOS Sierra' ? 'Chrome' : 'PhantomJS'], // This is the default browser to run, locally | ||
logLevel: config.LOG_INFO, | ||
logLevel: config.LOG_DEBUG, | ||
client: { | ||
mocha: { | ||
reporter: 'html' | ||
|
@@ -79,18 +89,17 @@ module.exports = function (config) { | |
if (env.TRAVIS) { | ||
console.error('Travis-CI detected'); | ||
bundleDirpath = path.join(baseBundleDirpath, process.env.TRAVIS_BUILD_ID); | ||
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 + | ||
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'); | ||
} | ||
tunnelIdentifier: env.TRAVIS_JOB_NUMBER, | ||
startConnect: false | ||
}; | ||
console.error('Configured SauceLabs'); | ||
} else { | ||
console.error('No SauceLabs credentials present'); | ||
} | ||
} else if (env.APPVEYOR) { | ||
console.error('AppVeyor detected'); | ||
|
@@ -100,9 +109,11 @@ module.exports = function (config) { | |
bundleDirpath = path.join(baseBundleDirpath, 'local'); | ||
// don't need to run sauce from appveyor b/c travis does it. | ||
if (env.SAUCE_USERNAME || env.SAUCE_ACCESS_KEY) { | ||
var id = require('os').hostname() + ' (' + Date.now() + ')'; | ||
sauceConfig = { | ||
build: require('os') | ||
.hostname() + ' (' + Date.now() + ')' | ||
build: id, | ||
tunnelIdentifier: id, | ||
startConnect: true | ||
}; | ||
console.error('Configured SauceLabs'); | ||
} else { | ||
|
@@ -140,31 +151,37 @@ module.exports = function (config) { | |
}; | ||
|
||
function addSauceTests (cfg) { | ||
var env = process.env; | ||
cfg.reporters.push('saucelabs'); | ||
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]; | ||
var browsers = Object.keys(browserPlatformPairs); | ||
cfg.browsers = cfg.browsers.concat(browsers); | ||
cfg.customLaunchers = browsers.reduce(function (acc, browser) { | ||
var platform = browserPlatformPairs[browser]; | ||
var browserParts = browser.split('@'); | ||
var browserName = browserParts[0]; | ||
var version = browserParts[1]; | ||
acc[browser] = { | ||
base: 'SauceLabs', | ||
browserName: browserName, | ||
version: version, | ||
platform: platform | ||
}; | ||
return acc; | ||
}, {}); | ||
|
||
// See https://github.com/karma-runner/karma-sauce-launcher | ||
// See https://github.com/bermi/sauce-connect-launcher#advanced-usage | ||
cfg.sauceLabs = { | ||
Object.assign(cfg.sauceLabs, { | ||
public: 'public', | ||
startConnect: true, | ||
connectOptions: { | ||
connectRetries: 10, | ||
connectRetryTimeout: 60000 | ||
connectRetries: 2, | ||
connectRetryTimeout: 30000, | ||
detached: cfg.sauceLabs.startConnect, | ||
tunnelIdentifier: cfg.sauceLabs.tunnelIdentifier | ||
} | ||
}; | ||
|
||
cfg.concurrency = 5; | ||
}); | ||
|
||
cfg.retryLimit = 5; | ||
cfg.concurrency = Infinity; | ||
cfg.retryLimit = 1; | ||
|
||
// for slow browser booting, ostensibly | ||
cfg.captureTimeout = 120000; | ||
|
This file was deleted.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.