-
Notifications
You must be signed in to change notification settings - Fork 8
/
protractor.shared.conf.js
67 lines (63 loc) · 2.22 KB
/
protractor.shared.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
// Protractor configuration file, see link for more information
// https://github.com/angular/protractor/blob/master/lib/config.ts
const argv = require('yargs').argv;
const jsonReports = process.cwd() + '/reports/json';
const Reporter = require('./e2e/support/reporter');
exports.config = {
framework: 'custom',
frameworkPath: require.resolve('protractor-cucumber-framework'),
specs: getFeatureFiles(),
cucumberOpts: {
compiler: ['ts:ts-node/register'],
require: ['./e2e/**/*.e2e-spec.ts', './e2e/support/*.js'],
strict: true, // <boolean> fail if there are any undefined or pending steps
format: 'json:./reports/json/cucumber_report.json',
dryRun: false, // <boolean> invoke every formatter without executing steps
tags: ["~@ignore"], // <string[]> (expression) only execute the features or scenarios with tags matching the expression
},
onPrepare: function () {
require('ts-node').register({
project: 'e2e/tsconfig.e2e.json'
});
browser.manage().window().maximize();
// implicit and page load timeouts
browser.manage().timeouts().pageLoadTimeout(40000);
browser.manage().timeouts().implicitlyWait(25000);
Reporter.createDirectory(jsonReports);
},
onComplete: function () {
Reporter.createHTMLReport();
},
allScriptsTimeout: 60000,
disableChecks: true,
useAllAngular2AppRoots: true
};
/**
* Get the feature files that need to be run based on an command line flag that
* is passed, if nothing is passed all the feature files are run
*
* @example:
*
* <pre>
* // For 1 features
* npm run e2e -- --features=playground
*
* // For multiple features
* npm run e2e -- --features=playground,dashboard,...
*
* // Else
* npm run e2e
* </pre>
*
* @return {Array<string>}
*/
function getFeatureFiles() {
const featureArgs = argv.features || process.env['features'] || '';
if (featureArgs && featureArgs.trim().length > 0) {
console.log('... loading feature files by parameters. features=' + featureArgs);
return featureArgs.split(',').map(feature => `${process.cwd()}/e2e/features/${feature}.feature`);
} else {
console.log('... loading ALL feature files.');
return [`${process.cwd()}/e2e/features/*.feature`];
}
}