forked from wix-incubator/wix-gruntfile
-
Notifications
You must be signed in to change notification settings - Fork 0
/
protractor-teamcity-conf.js
128 lines (117 loc) · 3.34 KB
/
protractor-teamcity-conf.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
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
/* global process, exports, jasmine */
'use strict';
var buildName = 'e2e tests';
try {
buildName = require(process.cwd() + '/package.json').name;
} catch (e) {
}
var config = require('./protractor-conf').config;
if (process.env.IS_BUILD_AGENT) {
var onPrepare = config.onPrepare || function () {};
config.capabilities.maxInstances = parseInt(process.env.PROTRACTOR_SHARDS, 10) || 1;
if (config.capabilities.maxInstances === 1) {
config.capabilities.shardTestFiles = false;
}
config.onPrepare = function () {
if (config.framework === 'jasmine2') {
var reporters = require('jasmine-reporters2');
jasmine.getEnv().addReporter(new reporters.TeamCityReporter());
} else {
require('jasmine-reporters');
jasmine.getEnv().addReporter(new jasmine.TeamcityReporter());
}
onPrepare.apply(this, arguments);
};
}
var sauceLabsBrowsers = {
Chrome: {
browserName: 'chrome',
platform: 'Windows 7'
},
ChromeOSX: {
browserName: 'chrome',
platform: 'OS X 10.8'
},
FF: {
browserName: 'firefox',
platform: 'Windows 7'
},
FFOSX: {
browserName: 'firefox',
platform: 'OS X 10.10'
},
IE11: {
browserName: 'internet explorer',
version: '11',
platform: 'Windows 7'
},
IE10: {
browserName: 'internet explorer',
version: '10',
platform: 'Windows 7'
},
IE9: {
browserName: 'internet explorer',
version: '9',
platform: 'Windows 7'
},
Safari8: {
browserName: 'safari',
version: '8',
platform: 'OS X 10.10'
},
Safari7: {
browserName: 'safari',
version: '7',
platform: 'OS X 10.9'
},
Safari6: {
browserName: 'safari',
version: '6',
platform: 'OS X 10.8'
}
};
var testBrowsers = (process.env.SAUCE_BROWSERS ? process.env.SAUCE_BROWSERS.split(' ') : Object.keys(sauceLabsBrowsers));
var shardsLeft = 15;
var capabilities = testBrowsers.map(function (key, index) {
var browser = sauceLabsBrowsers[key];
browser.name = buildName;
browser['tunnel-identifier'] = process.env.BUILD_NUMBER;
if (browser.platform !== 'OS X 10.9' && browser.platform !== 'OS X 10.10') {
browser['screen-resolution'] = '1280x1024';
}
browser.public = 'team';
browser.idleTimeout = 180;
browser.build = buildName + ' ' + process.env.BUILD_NUMBER;
browser.shardTestFiles = true;
browser.recordVideo = false;
browser.recordScreenshots = false;
browser.recordLogs = false;
browser.maxInstances = Math.round(shardsLeft / (testBrowsers.length - index));
shardsLeft -= browser.maxInstances;
return sauceLabsBrowsers[key];
});
var indexArr = Math.floor(capabilities.length / 2);
var capabilities1 = capabilities.slice(0, indexArr);
var capabilities2 = capabilities.slice(indexArr);
// config.sauceUser = process.env.SAUCE_USERNAME;
// config.sauceKey = process.env.SAUCE_ACCESS_KEY;
// config.multiCapabilities = capabilities;
// config.getPageTimeout = 30;
config.seleniumPort = 4445;
if (process.env.WIX_SAUCE === 'true') {
var seleniunGrid = 'app56.aus.wixpress.com';
config.multiCapabilities = [{
browserName: 'firefox',
platform: 'LINUX'
}, {
browserName: 'chrome',
platform: 'LINUX'
}, {
browserName: 'internet explorer',
platform: 'WINDOWS'
}];
config.seleniumAddress = 'https://' + seleniunGrid + ':4444/wd/hub/';
}
exports.config = config;
exports.arrays = {cap1: capabilities1, cap2: capabilities2};