forked from layui/layui
-
Notifications
You must be signed in to change notification settings - Fork 0
/
karma.conf.sauce.js
109 lines (98 loc) · 2.62 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
101
102
103
104
105
106
107
108
109
/**
* @file karma配置
* @author fe.xiaowu@gmail.com
*/
var base = require('./karma.conf.base.js');
var customLaunchers = {
// Safari
sl_ios_safari: {
base: 'SauceLabs',
browserName: 'Safari'
},
// 安卓浏览器
// sl_android_4_4: {
// base: 'SauceLabs',
// browserName: 'android',
// version: '4.4'
// },
// sl_android_5: {
// base: 'SauceLabs',
// browserName: 'android',
// version: '5'
// },
sl_android_6: {
base: 'SauceLabs',
browserName: 'android',
version: '6'
},
// chrome
sl_ios_chrome: {
base: 'SauceLabs',
browserName: 'chrome'
},
// sl_ie_8: {
// base: 'SauceLabs',
// browserName: 'internet explorer',
// version: '8'
// },
sl_ie_9: {
base: 'SauceLabs',
browserName: 'internet explorer',
version: '9'
},
sl_ie_10: {
base: 'SauceLabs',
browserName: 'internet explorer',
version: '10'
},
sl_ie_11: {
base: 'SauceLabs',
browserName: 'internet explorer',
version: '11'
},
sl_edga: {
base: 'SauceLabs',
browserName: 'microsoftedge',
// platform: 'Windows 10'
},
// sl_firefox: {
// base: 'SauceLabs',
// browserName: 'firefox'
// }
};
// 不支持本地运行
if (!process.env.TRAVIS) {
console.error('不支持本地运行, 请使用 npm run test!');
process.exit(1);
}
// 变量检查
if (!process.env.SAUCE_USERNAME || !process.env.SAUCE_ACCESS_KEY) {
console.error('---------------');
console.error('Make sure the SAUCE_USERNAME and SAUCE_ACCESS_KEY environment variables are set.');
console.error('---------------');
process.exit(1);
}
module.exports = function (config) {
var options = Object.assign(base(config), {
reporters: ['mocha', 'saucelabs'],
sauceLabs: {
'testName': 'layui',
'recordVideo': false,
'recordScreenshots': false,
'startConnect': false,
'connectOptions': {
'no-ssl-bump-domains': 'all'
},
'public': 'public',
'build': 'layui-build-' + process.env.TRAVIS_BUILD_NUMBER,
'tunnelIdentifier': process.env.TRAVIS_JOB_NUMBER
},
customLaunchers: customLaunchers,
browsers: Object.keys(customLaunchers),
captureTimeout: 1000 * 60 * 5,
browserNoActivityTimeout: 1000 * 60 * 5,
browserDisconnectTolerance: 3,
browserDisconnectTimeout: 10000
});
config.set(options);
};