-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathkarma.conf-sauce.js
100 lines (93 loc) · 3.38 KB
/
karma.conf-sauce.js
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
process.env.NODE_ENV = "development";
var path = require("path");
var webpackConfig = require(path.resolve("webpack.config.js"));
webpackConfig.module.loaders.push({
test: /\.spec\.js$/,
include: path.join(__dirname, "test"),
loader: "babel-loader!imports-loader?test_bootstrap=test/test_bootstrap.js"
});
webpackConfig.devtool = "inline-source-map";
var seleniumPlatforms = ["Windows 10", "Linux", "macOS 10.12"];
var appiumPlatforms = [
{platform: "Android", deviceName: "Android Emulator"},
{platform: "iOS", deviceName: "iPhone Simulator"}
];
var knownBrowsers = ["chrome", "firefox", "safari"];
var customLaunchers = {};
//here custom launchers are generated
/*
On all platforms Chrome and Firefox are supported but Safari is
supported only on MacOS and iOS
*/
for (var i = 0; i < seleniumPlatforms.length; i++) {
var platform1 = seleniumPlatforms[i];
for (var j = 0; j < knownBrowsers.length; j++) {
var browser1 = knownBrowsers[j];
if ((platform1 != "macOS 10.12") && (browser1 == "safari"))
continue;
else
customLaunchers[`sl_${platform1.split(" ")[0].toLowerCase()}_` +
browser1] = {
base: "SauceLabs",
browserName: browser1,
platform: platform1
};
}
}
for (var i = 0; i < appiumPlatforms.length; i++) {
var platform1 = appiumPlatforms[i];
var device1 = platform1.deviceName;
var platformName = platform1.platform;
for (var j = 0; j < knownBrowsers.length; j++) {
var browser1 = knownBrowsers[j];
browser1 = browser1.substr(0, 1).toUpperCase() + browser1.substr(1);
if ((platformName != "iOS") && (browser1 == "Safari"))
continue;
else
customLaunchers[`sl_${platformName.split(" ")[0].toLowerCase()}_` +
browser1] = {
base: "SauceLabs",
browserName: browser1,
platform: platformName,
deviceName: device1
}
}
}
module.exports = function (config) {
config.set({
singleRun: true, //just run once by default
sauceLabs: {
testName: 'Web App Unit Tests',
recordVideo: true,
recordScreenshots: true
},
customLaunchers: customLaunchers,
browsers: Object.keys(customLaunchers),
frameworks: [ "mocha" ], //use the mocha test framework
files: [ //just load these files
"test/test_bundle.js", "dist/main.css",
{pattern: "src/img/**/*.svg", watched: false, included: false, served: true, nocache: false},
{pattern: "dist/*", watched: false, included: false, served: true, nocache: false},
{pattern: "test/img/*", watched: false, included: false, served: true, nocache: false}
],
preprocessors: {
"test/test_bundle.js": [ "webpack", "sourcemap" ] //preprocess with webpack and our sourcemap loader
},
proxies: {
"/src/img/": "http://localhost:9876/base/src/img/",
"/dist/": "http://localhost:9876/base/dist/",
"/test/img/": "http://localhost:9876/base/test/img/"
},
reporters: [ "dots", "saucelabs" ], //report results in this format
webpack: webpackConfig,
webpackServer: {
noInfo: true //please don"t spam the console when running in karma!
},
// Timeout for capturing a browser (in ms).
captureTimeout: 180 * 1e3,
// to avoid DISCONNECTED messages
browserDisconnectTimeout : 10000, // default 2000
browserDisconnectTolerance : 1, // default 0
browserNoActivityTimeout : 60 * 1e3 //default 10000
});
};