-
Notifications
You must be signed in to change notification settings - Fork 39
/
protractor.config.js
139 lines (134 loc) · 4.59 KB
/
protractor.config.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
129
130
131
132
133
134
135
136
137
138
139
const HtmlScreenshotReporter = require('protractor-jasmine2-screenshot-reporter');
const SpecReporter = require('jasmine-spec-reporter');
const webpackConfig = require('./webpack.config');
const args = require('yargs').argv;
const e2eBaseFolder = './source/test/e2e';
const config = {
baseUrl: `http://localhost:${webpackConfig.devServer.port}`,
framework: 'jasmine2',
jasmineNodeOpts: {
showColors: true,
defaultTimeoutInterval: 600 * 1000,
// remove ugly protractor dot reporter
print: () => {}
},
specs: `${e2eBaseFolder}/specs/*.spec.js`,
onPrepare: () => {
// support ES6, need to put this line in onPrepare to make line number
// in error report correct
require('babel-core/register'); // eslint-disable-line
const helper = require('./source/test/e2e/helper'); // eslint-disable-line
browser._BasePageObject = helper.BasePageObject;
browser._ = new helper.E2EHelper();
if (!args.ci) {
// screenshot reporter
jasmine.getEnv().addReporter(new HtmlScreenshotReporter({
dest: `${e2eBaseFolder}/screenshots`,
filename: 'e2e-report.html',
captureOnlyFailedSpecs: true,
reportOnlyFailedSpecs: false,
pathBuilder: (currentSpec) => {
// TODO: can not get browser name due to
// https://github.com/mlison/protractor-jasmine2-screenshot-reporter/issues/4
return currentSpec.description.replace(/[ :]/g, '-');
}
}));
}
// add jasmine spec reporter
jasmine.getEnv().addReporter(new SpecReporter({
displayStacktrace: 'all',
displayFailuresSummary: false
}));
beforeEach(() => {
// add custom matchers
jasmine.addMatchers(helper.customMatchers);
});
},
params: {
timeout: 10000
}
};
if (args.ci) {
// run by sauce lab
config.baseUrl = 'http://localhost:8080/#';
config.sauceUser = 'sd4399340';
config.sauceKey = '5829a37c-41c0-4490-b6c2-061ae4acc5e9';
// https://wiki.saucelabs.com/display/DOCS/Platform+Configurator#/
config.multiCapabilities = [
{
name: `Chrome (build-${args.buildId})`,
build: `${args.buildId}`,
'tunnel-identifier': `${args.jobId}`,
browserName: 'chrome',
platform: 'Windows 7',
maxDuration: 3600,
commandTimeout: 600,
idleTimeout: 1000
},
{
name: `Safari (build-${args.buildId})`,
build: `${args.buildId}`,
'tunnel-identifier': `${args.jobId}`,
browserName: 'safari',
platform: 'OS X 10.11',
maxDuration: 3600,
commandTimeout: 600,
idleTimeout: 1000
},
{
name: `IE (build-${args.buildId})`,
build: `${args.buildId}`,
'tunnel-identifier': `${args.jobId}`,
browserName: 'internet explorer',
platform: 'Windows 7',
version: '11.0',
maxDuration: 3600,
commandTimeout: 600,
idleTimeout: 1000
},
{
name: `iOS (build-${args.buildId})`,
build: `${args.buildId}`,
'tunnel-identifier': `${args.jobId}`,
browserName: 'Safari',
appiumVersion: '1.5.0',
deviceName: 'iPhone 5s',
deviceOrientation: 'portrait',
platformVersion: '9.1',
platformName: 'iOS',
maxDuration: 3600,
commandTimeout: 600,
idleTimeout: 1000
},
{
name: `Android (build-${args.buildId})`,
build: `${args.buildId}`,
'tunnel-identifier': `${args.jobId}`,
browserName: 'Browser',
appiumVersion: '1.5.0',
deviceName: 'Android Emulator',
deviceType: 'phone',
deviceOrientation: 'portrait',
platformVersion: '4.4',
platformName: 'Android',
maxDuration: 3600,
commandTimeout: 600,
idleTimeout: 1000
}
];
} else {
// local run
config.multiCapabilities = [
{
browserName: 'chrome'
},
{
browserName: 'chrome',
chromeOptions: {
// https://sites.google.com/a/chromium.org/chromedriver/capabilities
args: ['--window-size=375,627', '--user-agent=Android']
}
}
];
}
exports.config = config;