Skip to content

Commit 1634031

Browse files
committed
Add sauce labs testing info to karma
1 parent b261459 commit 1634031

File tree

4 files changed

+302
-68
lines changed

4 files changed

+302
-68
lines changed

README.md

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,8 @@ Accessible modal dialog component for React.JS
55
[![Code Climate](https://codeclimate.com/github/reactjs/react-modal/badges/gpa.svg)](https://codeclimate.com/github/reactjs/react-modal)
66
[![Coverage Status](https://coveralls.io/repos/github/reactjs/react-modal/badge.svg?branch=master)](https://coveralls.io/github/reactjs/react-modal?branch=master)
77

8+
[![Build Status](https://saucelabs.com/browser-matrix/cd-reactmodal.svg)](https://saucelabs.com/beta/builds/ad582339a83145e1a4d3e8b8a1809b6c)
9+
810
## Active Development
911
The modal is currently undergoing significant development for a v2 release. The `master` branch contains that development work.
1012
If you'd like to see the latest stable version please use the release tags (https://github.com/reactjs/react-modal/releases)

karma.conf.js

Lines changed: 79 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,66 @@
1-
module.exports = function(config) {
1+
const webpackTestConfig = require('./webpack.test.config');
2+
3+
module.exports = function karmaConfig (config) {
4+
let browsers = [];
5+
const customLaunchers = {};
6+
7+
function createCustomLauncher (browser, version, platform) {
8+
return {
9+
base: 'SauceLabs',
10+
browserName: browser,
11+
version,
12+
platform
13+
};
14+
}
15+
16+
if (process.env.SAUCE_USERNAME || process.env.SAUCE_ACCESS_KEY) {
17+
const OPTIONS = [
18+
'SAUCE_CHROME',
19+
'SAUCE_FIREFOX',
20+
'SAUCE_SAFARI',
21+
'SAUCE_IE',
22+
'SAUCE_EDGE',
23+
];
24+
25+
let runAll = true;
26+
27+
OPTIONS.forEach((opt) => {
28+
if (process.env[opt]) {
29+
runAll = false;
30+
}
31+
});
32+
33+
// Chrome
34+
if (runAll || process.env.SAUCE_CHROME) {
35+
customLaunchers.SL_Chrome = createCustomLauncher('chrome');
36+
}
37+
38+
// Firefox
39+
if (runAll || process.env.SAUCE_FIREFOX) {
40+
customLaunchers.SL_Firefox = createCustomLauncher('firefox');
41+
}
42+
43+
// Safari
44+
if (runAll || process.env.SAUCE_SAFARI) {
45+
customLaunchers.SL_Safari10 = createCustomLauncher('safari', 10);
46+
customLaunchers.SL_Safari10 = createCustomLauncher('safari', 9);
47+
}
48+
49+
// IE
50+
if (runAll || process.env.SAUCE_IE) {
51+
customLaunchers.SL_IE11 = createCustomLauncher('internet explorer', 11, 'Windows 10');
52+
}
53+
54+
// Edge
55+
if (runAll || process.env.SAUCE_EDGE) {
56+
customLaunchers.SL_Edge = createCustomLauncher('microsoftedge', null, 'Windows 10');
57+
}
58+
59+
browsers = Object.keys(customLaunchers);
60+
} else {
61+
browsers = [(process.env.CONTINUOUS_INTEGRATION) ? 'Firefox' : 'Chrome'];
62+
}
63+
264
config.set({
365

466
basePath: '',
@@ -10,10 +72,10 @@ module.exports = function(config) {
1072
],
1173

1274
preprocessors: {
13-
'specs/spec_index.js': [ 'webpack', 'sourcemap' ]
75+
'specs/spec_index.js': ['webpack', 'sourcemap']
1476
},
1577

16-
webpack: require('./webpack.test.config'),
78+
webpack: webpackTestConfig,
1779

1880
webpackMiddleware: {
1981
stats: 'errors-only'
@@ -39,10 +101,21 @@ module.exports = function(config) {
39101

40102
autoWatch: true,
41103

42-
browsers: [ (process.env.CONTINUOUS_INTEGRATION) ? 'Firefox' : 'Chrome' ],
104+
browsers,
105+
customLaunchers,
106+
107+
// Increase timeouts to prevent the issue with disconnected tests (https://goo.gl/nstA69)
108+
captureTimeout: 4 * 60 * 1000,
109+
browserDisconnectTimeout: 10000,
110+
browserDisconnectTolerance: 1,
111+
browserNoActivityTimeout: 4 * 60 * 1000,
43112

44-
captureTimeout: 60000,
113+
singleRun: (process.env.CONTINUOUS_INTEGRATION),
45114

46-
singleRun: (process.env.CONTINUOUS_INTEGRATION)
115+
// SauceLabs config
116+
sauceLabs: {
117+
recordScreenshots: false,
118+
public: 'public'
119+
}
47120
});
48121
};

package.json

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -55,6 +55,7 @@
5555
"karma-firefox-launcher": "1.0.0",
5656
"karma-mocha": "^1.3.0",
5757
"karma-mocha-reporter": "^2.2.1",
58+
"karma-sauce-launcher": "^1.1.0",
5859
"karma-sourcemap-loader": "^0.3.7",
5960
"karma-webpack": "^1.8.1",
6061
"mocha": "3.2.0",

0 commit comments

Comments
 (0)