-
Notifications
You must be signed in to change notification settings - Fork 11
/
Copy pathsample-courgette-mobile-conf.js
121 lines (107 loc) · 4.38 KB
/
sample-courgette-mobile-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
const path = require('path');
const specsPath = 'uiTests';
const outputPath = 'uiTestResult';
const courgettePath = 'node_modules/courgette/uiTestHelpers';
const platform = process.env.PLATFORM;
const ANDROID_APP_PATH = './android/app/build/outputs/apk/debug/app-debug.apk';
const IOS_APP_PATH = './ios/build/Products/Release-iphonesimulator/APPNAME.app';
const ANDROID_10 = {
platformName: 'android',
platformVersion: '10',
deviceName: 'Android Emulator',
app: path.resolve(ANDROID_APP_PATH),
};
const IOS_13_3 = {
platformName: 'ios',
platformVersion: '13.3',
deviceName: 'iPhone 11',
automationName: 'XCUITest',
app: path.resolve(IOS_APP_PATH),
showXcodeLog: false,
};
const ALL_CAPABILITIES = {
android: [ANDROID_10],
ios: [IOS_13_3],
};
const CAPABILITIES_TO_USE = [];
if (platform === 'android' || !platform) {
CAPABILITIES_TO_USE.push(...ALL_CAPABILITIES.android);
}
if (platform === 'ios' || !platform) {
CAPABILITIES_TO_USE.push(...ALL_CAPABILITIES.ios);
}
exports.pomConfig = {
platform: 'mobile',
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,
};
exports.cucumberHtmlReporterConfig = {};
const tagExpression = ['not @ignore', process.env.COURGETTE_TAGS].filter((tag) => !!tag).join(' and ');
if (process.env.COURGETTE_DEBUG) {
console.log({ tagExpression });
}
exports.config = { // see https://webdriver.io/docs/configurationfile.html
port: 4723,
exclude: [],
maxInstances: 1,
capabilities: CAPABILITIES_TO_USE,
logLevel: 'warn', // Level of logging verbosity: trace | debug | info | warn | error | silent
bail: 0, // (default is 0 - don't bail, run all tests).
waitforTimeout: 20000,
connectionRetryCount: 3,
services: ['appium'],
appium: {}, // Appium Service config see details: https://webdriver.io/docs/appium-service.html
framework: 'cucumber',
reporters: [
'spec',
[
'json',
{
outputDir: './uiTestResult',
// outputFileFormat: function(opts) {
// return `results-${opts.cid}.${opts.capabilities}.json`;
// },
},
],
],
specs: [`${specsPath}/features/**/*.feature`],
cucumberOpts: {
'require': [
`${courgettePath}/hooks/loadStepsMobile.js`,
// `${specsPath}/helpers/globals.js`,
`${courgettePath}/globals.js`,
`${courgettePath}/hooks/pageObjectModelMobileBefore.js`,
`${courgettePath}/hooks/setDefaultTimeout.js`,
`${courgettePath}/mobileStepDefinitions/commonGivenSteps.js`,
`${courgettePath}/mobileStepDefinitions/commonWhenSteps.js`,
`${courgettePath}/mobileStepDefinitions/commonThenSteps.js`,
`${specsPath}/step-definitions/*.js`,
// `${specsPath}/helpers/hooks.js`,
`${courgettePath}/hooks/attachScenarioNameMobileBefore.js`,
`${courgettePath}/hooks/attachMobileScreenshotAfter.js`,
`${courgettePath}/hooks/reset-app-between-scenarios.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; },
};