-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathbase.conf.js
111 lines (100 loc) · 2.89 KB
/
base.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
require("@babel/register");
const fs = require("fs-extra");
const path = require("path");
const argv = require("yargs").argv;
const { setAllureCustomLogo, buildScreenshotFilename } = require("./e2e/utils/helpers");
const setCommands = require("./e2e/utils/commands").default;
const _ASSETS = path.resolve("assets");
const RUN_PATH = path.join(process.cwd(), ".run");
const _PATHS = {
_LOGS: "logs",
_SHOTS: "shots",
_RESULTS: "results",
_RESULTS_ALLURE: "results/allure",
_RESULTS_JSON: "results/json",
_REPORTS: "reports",
_REPORTS_ALLURE: "reports/allure",
_REPORTS_CUCUMBER: "reports/cucumber",
_VISUAL: "results/visual"
};
// Make all the run dirs
Object.entries(_PATHS).forEach(([k, p]) =>
fs.ensureDirSync((_PATHS[k] = path.join(RUN_PATH, p)))
);
module.exports.config = {
project: "FedEx",
baseUrl: "http://localhost:4200",
runner: "local",
maxInstances: 4,
sync: true,
logLevel: "debug",
logLevels: {
webdriver: "debug",
browserstack: "debug",
"@wdio/browserstack-service": "debug",
"@wdio/applitools-service": "info",
devtools: "info",
"wdio-multiple-cucumber-html-reporter": "debug"
},
bail: 0,
waitforTimeout: 20000,
connectionRetryTimeout: 90000,
connectionRetryCount: 3,
outputDir: _PATHS._LOGS,
logDir: _PATHS._LOGS,
seleniumLogs: _PATHS._LOGS,
reporters: [
"@wdio/spec-reporter",
[
"allure",
{
outputDir: _PATHS._RESULTS_ALLURE,
disableWebdriverStepsReporting: true,
disableWebdriverScreenshotsReporting: false
}
]
],
onPrepare: function(config, capabilities) {
require("@babel/register");
setAllureCustomLogo(
path.join(_ASSETS, "custom-logo.svg"),
path.join(_ASSETS, "custom-logo-collapsed.svg"),
path.join(_ASSETS, "styles.css")
);
},
before: function (capabilities, specs) {
const { config, isMobile } = browser;
const { automationProtocol } = config;
const { hostname } = new URL(config.baseUrl)
// browser.setTimeout({ implicit: 10000 });
// Pupeteer limitation
!isMobile && automationProtocol !== "devtools" && browser.maximizeWindow();
setCommands();
},
beforeStep: function ({ uri, feature, step }, context) {
const { keyword, text } = step.step;
// console.log(`Next step: ${keyword}${text}`);
// browser.debug();
},
after: function (result, capabilities, specs) {
},
afterTest: function (test, context, { result }) {
browser.saveScreenshot(buildScreenshotFilename(test.title))
},
filterCaps: function(capabilities) {
return capabilities.filter(cap =>
Object.keys(cap).every(key => {
const
capKeyValue = cap[key],
cliValues = [argv[key]].flat(),
capKeyValueIsObj = typeof capKeyValue === "object",
capKeyValueStr = `${capKeyValue || ""}`.toLowerCase();
return capKeyValueIsObj && this.filterCaps([capKeyValue]).length ||
cliValues.length ? cliValues.some(k => capKeyValueStr.includes(`${k || ""}`.toLowerCase())) : true
})
)
},
RUN_PATH,
_ASSETS,
..._PATHS
};