-
Notifications
You must be signed in to change notification settings - Fork 11
/
Copy pathsample-courgette-conf-wdio.js
115 lines (106 loc) · 4.74 KB
/
sample-courgette-conf-wdio.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
const path = require('path');
const CucumberFormatter = require(path.join(process.cwd(), 'node_modules/courgette/cucumberFormatter.js'));
const specsPath = 'uiTests';
const outputPath = 'uiTestResult';
const courgettePath = 'node_modules/courgette/uiTestHelpers';
exports.pomConfig = {
bindings: 'wdio',
outputPath,
timeoutInSeconds: process.env.COURGETTE_TIMEOUT || 20, // minimum 2 or you'll see strange behaviour with some steps
pagesPath: path.resolve(specsPath, 'pages'),
componentsPath: path.resolve(specsPath, 'components'),
stepsPath: path.resolve(specsPath, 'stepDefinitions'),
screenshotPath: outputPath, // not needed unless you need it to differ to the outputPath. Used for error screenshots
screenshotStepPath: 'stepDefinitionScreenshots', // is appended to the screenshotPath or outputPath if one isn't set. Used for screenshots in the step definitions (e.g. When I take a screenshot)
minifyPng: false, // defaults to '0.6-0.8', can be set to the quality string or true / false
minifyStepPathOutput: 'uiTestResult/stepDefinitionScreenshots',
removeOutputPathOnStart: true,
baseUrl: 'https://courgette-testing.com', // <------------ SET THE URL TO YOUR PROJECT HERE
};
exports.cucumberHtmlReporterConfig = {};
const tagExpression = ['not @ignore', process.env.COURGETTE_TAGS].filter((tag) => !!tag).join(' and ');
if (process.env.COURGETTE_DEBUG) {
console.log({ tagExpression });
}
const runHeadless = !(process.env.COURGETTE_HEADLESS === 'false' || process.env.DH);
const maxInstances = process.env.COURGETTE_MAX_INSTANCES || 1;
exports.config = { // see https://webdriver.io/docs/configurationfile.html
port: 4723,
exclude: [],
maxInstances,
capabilities: [{
maxInstances,
browserName: 'chrome',
acceptInsecureCerts: true,
'goog:chromeOptions': {
args: ['--window-size=1100,800', '--allow-insecure-localhost', '--no-sandbox']
.concat(runHeadless ? ['--headless', '--disable-gpu'] : []),
},
// If outputDir is provided WebdriverIO can capture driver session logs
// it is possible to configure which logTypes to include/exclude.
// excludeDriverLogs: ['*'], // pass '*' to exclude all driver session logs
// excludeDriverLogs: ['bugreport', 'server'],
}],
logLevel: 'warn', // Level of logging verbosity: trace | debug | info | warn | error | silent
bail: 1, // (default is 1 - i.e. don't run all tests if one fails).
waitforTimeout: process.env.COURGETTE_TIMEOUT * 1000,
connectionRetryCount: 2,
services: [
['chromedriver', {
port: Number(process.env.COURGETTE_CHROME_PORT) || 7676,
}],
],
framework: 'cucumber',
reporters: [
maxInstances > 1 ? 'spec' : CucumberFormatter,
[
'cucumberjs-json', {
jsonFolder: `./${outputPath}`,
language: 'en',
},
],
// [
// 'json',
// {
// outputDir: './uiTestResult',
// // outputFileFormat: function(opts) {
// // return `results-${opts.cid}.${opts.capabilities}.json`;
// // },
// },
// ],
],
specs: [`${specsPath}/features/**/*.feature`],
cucumberOpts: {
'require': [
`${courgettePath}/hooksWDIO/loadSteps.js`,
`${courgettePath}/globals.js`,
`${courgettePath}/hooksWDIO/pageObjectModelBefore.js`,
`${courgettePath}/hooksWDIO/addMethodsBefore.js`,
`${courgettePath}/hooksWDIO/setDefaultTimeout.js`,
`${courgettePath}/stepDefinitionsWDIO/commonGivenSteps.js`,
`${courgettePath}/stepDefinitionsWDIO/commonWhenSteps.js`,
`${courgettePath}/stepDefinitionsWDIO/commonThenSteps.js`,
`${specsPath}/stepDefinitions/*.js`,
`${courgettePath}/hooksWDIO/attachScenarioNameBefore.js`,
`${courgettePath}/hooksWDIO/attachScreenshotAfter.js`,
],
// 'format': [
// // CucumberFormatter,
// `json:./${outputPath}/report.json`,
// ].concat(process.env.COURGETTE_SHOW_STEP_DEFINITION_USAGE ? 'node_modules/cucumber/lib/formatter/usage_formatter.js' : []),
tagExpression,
'source': true,
'format-options': '{"colorsEnabled": true}',
'colors': true,
'timeout': (process.env.COURGETTE_TIMEOUT || 20) * 1000,
'profile': [],
// backtrace: false, // <boolean> show full backtrace for errors
// compiler: [], // <string[]> ("extension:module") require files with the given EXTENSION after requiring MODULE (repeatable)
// dryRun: false, // <boolean> invoke formatters without executing steps
'failFast': true, // <boolean> abort the run on first failure
// snippets: true, // <boolean> hide step definition snippets for pending steps
// strict: false, // <boolean> fail if there are any undefined or pending steps
// ignoreUndefinedDefinitions: false
},
// onPrepare: () => { browser.ignoreSynchronization = true; },
};