forked from Alfresco/alfresco-content-app
-
Notifications
You must be signed in to change notification settings - Fork 0
/
protractor.conf.js
executable file
·226 lines (192 loc) · 6.67 KB
/
protractor.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
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
// Protractor configuration file, see link for more information
// https://github.com/angular/protractor/blob/master/lib/config.ts
require('dotenv').config({path: process.env.ENV_FILE});
const path = require('path');
const {SpecReporter} = require('jasmine-spec-reporter');
const retry = require('protractor-retry-angular-cli').retry;
const {uploadOutput} = require('./e2e/e2e-config/utils/upload-output');
const smartRunnerFactory = require('./e2e/smartrunner-factory');
const projectRoot = path.resolve(__dirname);
const downloadFolder = path.join(__dirname, 'e2e-downloads');
const screenshotsFolder = path.resolve(__dirname, 'e2e-output');
const e2eFolder = path.resolve(projectRoot, 'e2e');
const E2E_HOST = process.env.E2E_HOST || 'http://localhost:4200';
const BROWSER_RUN = !!process.env.BROWSER_RUN;
const width = 1366;
const height = 768;
const SAVE_SCREENSHOT = process.env.SAVE_SCREENSHOT === 'true';
const APP_CONFIG_ECM_HOST = process.env.APP_CONFIG_ECM_HOST || 'http://localhost:8080';
const MAXINSTANCES = process.env.MAXINSTANCES || 1;
const E2E_LOG_LEVEL = process.env.E2E_LOG_LEVEL || 'ERROR';
let retryCount = 0;
const appConfig = {
hostEcm: APP_CONFIG_ECM_HOST,
providers: 'ECM',
authType: 'BASIC'
};
exports.config = {
allScriptsTimeout: 150000,
params: {
index_search: 25000,
config: appConfig,
downloadFolder: downloadFolder,
ADMIN_USERNAME: process.env.ADMIN_EMAIL || 'admin',
ADMIN_PASSWORD: process.env.ADMIN_PASSWORD || 'admin',
e2eRootPath: e2eFolder,
testConfig: {
appConfig: {
log: E2E_LOG_LEVEL
}
}
},
specs: [
'./e2e/suites/actions/**/**/*test.ts',
'./e2e/suites/actions-available/**/**/*test.ts',
'./e2e/suites/application/**/*test.ts',
'./e2e/suites/authentication/**/*test.ts',
'./e2e/suites/extensions/**/*test.ts',
'./e2e/suites/info-drawer/**/*test.ts',
'./e2e/suites/list-views/**/*test.ts',
'./e2e/suites/navigation/**/*test.ts',
'./e2e/suites/pagination/**/*test.ts',
'./e2e/suites/search/**/*test.ts',
'./e2e/suites/viewer/**/*test.ts'
],
suites: {
copyMoveActions: './e2e/suites/actions/copy-move/**/**/*test.ts',
createActions: './e2e/suites/actions/create/**/**/*test.ts',
deleteActions: './e2e/suites/actions/delete/**/**/*test.ts',
editActions: './e2e/suites/actions/edit/**/**/*test.ts',
favoriteActions: './e2e/suites/actions/favorite/**/**/*test.ts',
libraryActions: './e2e/suites/actions/library/**/**/*test.ts',
shareActions: './e2e/suites/actions/share/**/**/*test.ts',
uploadDownloadActions: './e2e/suites/actions/upload-download/**/**/*test.ts',
actionsAvailableFilesFolders: './e2e/suites/actions-available/files-folders/**/**/*test.ts',
actionsAvailableLibraries: './e2e/suites/actions-available/libraries/**/**/*test.ts',
actionsAvailableSpecialPermissions: './e2e/suites/actions-available/special-permissions/**/**/*test.ts',
actionsAvailableNewMenu: './e2e/suites/actions-available/new-menu/**/**/*test.ts',
application: './e2e/suites/application/**/*test.ts',
authentication: './e2e/suites/authentication/**/*test.ts',
extensions: './e2e/suites/extensions/**/*test.ts',
infoDrawer: './e2e/suites/info-drawer/**/*test.ts',
listViews: './e2e/suites/list-views/**/*test.ts',
navigation: './e2e/suites/navigation/**/*test.ts',
pagination: './e2e/suites/pagination/**/*test.ts',
search: './e2e/suites/search/**/*test.ts',
viewer: './e2e/suites/viewer/**/*test.ts'
},
SELENIUM_PROMISE_MANAGER: false,
capabilities: {
loggingPrefs: {
browser: 'ALL' // "OFF", "SEVERE", "WARNING", "INFO", "CONFIG", "FINE", "FINER", "FINEST", "ALL".
},
browserName: 'chrome',
maxInstances: MAXINSTANCES,
shardTestFiles: MAXINSTANCES > 1,
chromeOptions: {
prefs: {
credentials_enable_service: false,
download: {
prompt_for_download: false,
directory_upgrade: true,
default_directory: downloadFolder
},
browser: {
setDownloadBehavior: {
behavior: 'allow',
downloadPath: downloadFolder
}
}
},
args: [
`--window-size=${width},${height}`,
'--disable-gpu',
'--no-sandbox',
'--disable-web-security',
'--disable-browser-side-navigation',
'--allow-running-insecure-content',
...(BROWSER_RUN === true ? [] : ['--headless'])
]
}
},
directConnect: true,
baseUrl: E2E_HOST,
getPageTimeout: 150000,
framework: 'jasmine',
jasmineNodeOpts: {
showColors: true,
defaultTimeoutInterval: 200000,
includeStackTrace: true,
print: function () {
},
...(process.env.CI ? smartRunnerFactory.applyExclusionFilter() : {})
},
plugins: [
{
package: 'protractor-screenshoter-plugin',
screenshotPath: screenshotsFolder,
screenshotOnExpect: 'failure',
screenshotOnSpec: 'none',
withLogs: true,
writeReportFreq: 'end',
imageToAscii: 'none',
htmlOnExpect: 'none',
htmlOnSpec: 'none',
clearFoldersBeforeTest: true
}
],
onCleanUp(results) {
if (process.env.CI) {
retry.onCleanUp(results);
}
},
onPrepare() {
if (process.env.CI) {
retry.onPrepare();
smartRunnerFactory.getInstance().onPrepare();
}
const tsConfigPath = path.resolve(e2eFolder, 'tsconfig.e2e.json');
const tsConfig = require(tsConfigPath);
require('ts-node').register({
project: tsConfigPath,
compilerOptions: {
paths: tsConfig.compilerOptions.paths
}
});
require('tsconfig-paths').register({
project: tsConfigPath,
baseUrl: e2eFolder,
paths: tsConfig.compilerOptions.paths
});
browser.manage().window().setSize(width, height);
jasmine.getEnv().addReporter(
new SpecReporter({
spec: {
displayStacktrace: 'raw',
displayDuration: true
}
})
);
browser.driver.sendChromiumCommand('Page.setDownloadBehavior', {
behavior: 'allow',
downloadPath: downloadFolder
});
},
afterLaunch: async function (statusCode) {
if (SAVE_SCREENSHOT && statusCode !== 0) {
console.log(`Status code is ${statusCode}, trying to save screenshots.`);
retryCount++;
try {
await uploadOutput(retryCount);
console.log('Screenshots saved successfully.');
} catch (e) {
console.log('Error happened while trying to upload screenshots and test reports: ', e);
}
} else {
console.log(`Status code is ${statusCode}, no need to save screenshots.`);
}
if (process.env.CI) {
return retry.afterLaunch(process.env.RETRY_COUNT || 4, statusCode);
}
}
};