mirror of
https://github.com/webrecorder/pywb.git
synced 2025-03-23 22:52:25 +01:00
* Provide a fallback mode in the Karma tests which tests against a local browser (defaults to Firefox) if Sauce Labs credentials are not set. This is useful for local testing for contributors who might not have a Sauce Labs account. * Add Safari under OS X to the set of Sauce Labs browsers that the Karma tests are run against, following the merge of the WombatJS fixes for Safari and Edge. Although Edge now works under manual testing, automated testing against Sauce Labs is not yet working for reasons yet to be determined.
106 lines
2.2 KiB
JavaScript
106 lines
2.2 KiB
JavaScript
var sauceLabsConfig = {
|
|
testName: 'PyWB Client Tests',
|
|
};
|
|
|
|
// see https://github.com/karma-runner/karma-sauce-launcher/issues/73
|
|
if (process.env.TRAVIS_JOB_NUMBER) {
|
|
sauceLabsConfig.startConnect = false;
|
|
sauceLabsConfig.tunnelIdentifier = process.env.TRAVIS_JOB_NUMBER;
|
|
}
|
|
|
|
var WOMBAT_JS_PATH = 'pywb/static/wombat.js';
|
|
|
|
var sauceLaunchers = {
|
|
sl_chrome: {
|
|
base: 'SauceLabs',
|
|
browserName: 'chrome',
|
|
},
|
|
|
|
sl_firefox: {
|
|
base: 'SauceLabs',
|
|
browserName: 'firefox',
|
|
},
|
|
|
|
sl_safari: {
|
|
base: 'SauceLabs',
|
|
browserName: 'safari',
|
|
platform: 'OS X 10.11',
|
|
version: '9.0',
|
|
},
|
|
|
|
/* Edge is currently broken in
|
|
pywb.
|
|
|
|
See: https://github.com/ikreymer/pywb/issues/148 (Edge)
|
|
https://github.com/ikreymer/pywb/issues/147 (Safari)
|
|
|
|
|
|
sl_edge: {
|
|
base: 'SauceLabs',
|
|
browserName: 'MicrosoftEdge',
|
|
},
|
|
*/
|
|
};
|
|
|
|
var localLaunchers = {
|
|
localFirefox: {
|
|
base: 'Firefox',
|
|
},
|
|
};
|
|
|
|
var customLaunchers = {};
|
|
|
|
if (process.env['SAUCE_USERNAME'] && process.env['SAUCE_ACCESS_KEY']) {
|
|
customLaunchers = sauceLaunchers;
|
|
} else {
|
|
console.error('Sauce Labs account details not set, ' +
|
|
'Karma tests will be run only against local browsers.' +
|
|
'Set SAUCE_USERNAME and SAUCE_ACCESS_KEY environment variables to ' +
|
|
'run tests against Sauce Labs browsers');
|
|
customLaunchers = localLaunchers;
|
|
}
|
|
|
|
module.exports = function(config) {
|
|
config.set({
|
|
basePath: '../',
|
|
|
|
frameworks: ['mocha', 'chai'],
|
|
|
|
files: [
|
|
{
|
|
pattern: WOMBAT_JS_PATH,
|
|
watched: true,
|
|
included: false,
|
|
served: true,
|
|
},
|
|
'karma-tests/*.spec.js',
|
|
],
|
|
|
|
preprocessors: {},
|
|
|
|
reporters: ['progress'],
|
|
|
|
port: 9876,
|
|
|
|
colors: true,
|
|
|
|
logLevel: config.LOG_INFO,
|
|
|
|
autoWatch: true,
|
|
|
|
sauceLabs: sauceLabsConfig,
|
|
|
|
// use an extended timeout for capturing Sauce Labs
|
|
// browsers in case the service is busy
|
|
captureTimeout: 3 * 60000,
|
|
|
|
customLaunchers: customLaunchers,
|
|
|
|
browsers: Object.keys(customLaunchers),
|
|
|
|
singleRun: false,
|
|
|
|
concurrency: Infinity
|
|
})
|
|
};
|