artes 1.5.9 → 1.5.10
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/cucumber.config.js +16 -14
- package/executer.js +37 -33
- package/package.json +1 -1
- package/src/helper/controller/elementController.js +4 -7
- package/src/helper/controller/findDuplicateTestNames.js +60 -46
- package/src/helper/controller/getEnvInfo.js +77 -64
- package/src/helper/controller/getExecutor.js +24 -23
- package/src/helper/controller/reportCustomizer.js +174 -74
- package/src/helper/controller/screenComparer.js +97 -74
- package/src/helper/controller/status-formatter.js +34 -35
- package/src/helper/controller/testCoverageCalculator.js +79 -76
- package/src/helper/executers/cleaner.js +4 -6
- package/src/helper/executers/reportGenerator.js +17 -8
- package/src/helper/imports/commons.js +3 -3
- package/src/helper/stepFunctions/APIActions.js +2 -2
- package/src/helper/stepFunctions/assertions.js +91 -87
- package/src/helper/stepFunctions/elementInteractions.js +1 -1
- package/src/helper/stepFunctions/mouseActions.js +2 -1
- package/src/hooks/hooks.js +51 -46
- package/src/stepDefinitions/API.steps.js +3 -3
- package/src/stepDefinitions/assertions.steps.js +355 -205
- package/src/stepDefinitions/keyboardActions.steps.js +8 -9
- package/src/stepDefinitions/mouseActions.steps.js +35 -35
- package/src/stepDefinitions/random.steps.js +7 -4
package/cucumber.config.js
CHANGED
|
@@ -14,7 +14,11 @@ try {
|
|
|
14
14
|
console.log("Proceeding with default config.");
|
|
15
15
|
}
|
|
16
16
|
|
|
17
|
-
const defaultFormats = [
|
|
17
|
+
const defaultFormats = [
|
|
18
|
+
"rerun:@rerun.txt",
|
|
19
|
+
"progress-bar",
|
|
20
|
+
"./src/helper/controller/status-formatter.js:null",
|
|
21
|
+
];
|
|
18
22
|
|
|
19
23
|
const userFormatsFromEnv = process.env.REPORT_FORMAT
|
|
20
24
|
? JSON.parse(process.env.REPORT_FORMAT)
|
|
@@ -52,7 +56,6 @@ function resolveEnv(artesConfig) {
|
|
|
52
56
|
const env = resolveEnv(artesConfig);
|
|
53
57
|
|
|
54
58
|
function loadVariables(cliVariables, artesConfigVariables) {
|
|
55
|
-
|
|
56
59
|
if (cliVariables) {
|
|
57
60
|
try {
|
|
58
61
|
cliVariables = JSON.parse(cliVariables);
|
|
@@ -72,13 +75,12 @@ function loadVariables(cliVariables, artesConfigVariables) {
|
|
|
72
75
|
|
|
73
76
|
const resolveFeaturePaths = (basePath, value) => {
|
|
74
77
|
return value
|
|
75
|
-
.split(
|
|
76
|
-
.map(p => p.trim())
|
|
78
|
+
.split(",")
|
|
79
|
+
.map((p) => p.trim())
|
|
77
80
|
.filter(Boolean)
|
|
78
|
-
.map(p => path.join(basePath, p));
|
|
81
|
+
.map((p) => path.join(basePath, p));
|
|
79
82
|
};
|
|
80
83
|
|
|
81
|
-
|
|
82
84
|
module.exports = {
|
|
83
85
|
default: {
|
|
84
86
|
// File paths and patterns
|
|
@@ -88,13 +90,13 @@ module.exports = {
|
|
|
88
90
|
timeout: process.env.TIMEOUT
|
|
89
91
|
? Number(process.env.TIMEOUT) * 1000
|
|
90
92
|
: artesConfig.timeout * 1000 || 30 * 1000, // Default timeout in seconds
|
|
91
|
-
|
|
93
|
+
paths: process.env.RERUN
|
|
92
94
|
? [path.join("../../", process.env.RERUN)]
|
|
93
95
|
: process.env.FEATURES
|
|
94
96
|
? resolveFeaturePaths(moduleConfig.projectPath, process.env.FEATURES)
|
|
95
97
|
: artesConfig.features
|
|
96
98
|
? resolveFeaturePaths(moduleConfig.projectPath, artesConfig.features)
|
|
97
|
-
: [moduleConfig.featuresPath], // Paths to feature files
|
|
99
|
+
: [moduleConfig.featuresPath], // Paths to feature files
|
|
98
100
|
require: [
|
|
99
101
|
process.env.STEP_DEFINITIONS
|
|
100
102
|
? [path.join(moduleConfig.projectPath, process.env.STEP_DEFINITIONS)]
|
|
@@ -173,14 +175,14 @@ module.exports = {
|
|
|
173
175
|
},
|
|
174
176
|
report: {
|
|
175
177
|
logo: process.env.LOGO
|
|
176
|
-
|
|
177
|
-
|
|
178
|
-
|
|
178
|
+
? process.env.LOGO
|
|
179
|
+
: artesConfig?.logo || "./logo.png",
|
|
180
|
+
brandName: process.env.BRAND_NAME
|
|
179
181
|
? process.env.BRAND_NAME
|
|
180
182
|
: artesConfig?.brandName || "ARTES",
|
|
181
|
-
|
|
182
|
-
|
|
183
|
-
|
|
183
|
+
reportName: process.env.REPORT_NAME
|
|
184
|
+
? process.env.REPORT_NAME
|
|
185
|
+
: artesConfig?.reportName || "ARTES REPORT",
|
|
184
186
|
singleFileReport:
|
|
185
187
|
process.env.SINGLE_FILE_REPORT == "true"
|
|
186
188
|
? true
|
package/executer.js
CHANGED
|
@@ -10,12 +10,15 @@ const {
|
|
|
10
10
|
const { logPomWarnings } = require("./src/helper/controller/pomCollector");
|
|
11
11
|
const fs = require("fs");
|
|
12
12
|
const path = require("path");
|
|
13
|
-
const {
|
|
13
|
+
const {
|
|
14
|
+
testCoverageCalculator,
|
|
15
|
+
} = require("./src/helper/controller/testCoverageCalculator");
|
|
14
16
|
const { getExecutor } = require("./src/helper/controller/getExecutor");
|
|
15
|
-
const {
|
|
17
|
+
const {
|
|
18
|
+
findDuplicateTestNames,
|
|
19
|
+
} = require("./src/helper/controller/findDuplicateTestNames");
|
|
16
20
|
const { getEnvInfo } = require("artes/src/helper/controller/getEnvInfo");
|
|
17
21
|
|
|
18
|
-
|
|
19
22
|
const artesConfigPath = path.resolve(process.cwd(), "artes.config.js");
|
|
20
23
|
|
|
21
24
|
let artesConfig = {};
|
|
@@ -43,8 +46,8 @@ const flags = {
|
|
|
43
46
|
reportWithTrace: args.includes("-rwt") || args.includes("--reportWithTrace"),
|
|
44
47
|
singleFileReport: args.includes("--singleFileReport"),
|
|
45
48
|
customLogo: args.includes("--logo"),
|
|
46
|
-
customBrandName:args.includes("--brandName"),
|
|
47
|
-
customReportName:args.includes("--reportName"),
|
|
49
|
+
customBrandName: args.includes("--brandName"),
|
|
50
|
+
customReportName: args.includes("--reportName"),
|
|
48
51
|
zip: args.includes("--zip"),
|
|
49
52
|
features: args.includes("--features"),
|
|
50
53
|
stepDef: args.includes("--stepDef"),
|
|
@@ -68,7 +71,6 @@ const flags = {
|
|
|
68
71
|
slowMo: args.includes("--slowMo"),
|
|
69
72
|
};
|
|
70
73
|
|
|
71
|
-
|
|
72
74
|
const env = getArgValue("--env");
|
|
73
75
|
const vars = getArgValue("--saveVar");
|
|
74
76
|
const logo = getArgValue("--logo");
|
|
@@ -90,7 +92,6 @@ const height = getArgValue("--height");
|
|
|
90
92
|
const timeout = getArgValue("--timeout");
|
|
91
93
|
const slowMo = getArgValue("--slowMo");
|
|
92
94
|
|
|
93
|
-
|
|
94
95
|
flags.env ? (process.env.ENV = env) : "";
|
|
95
96
|
|
|
96
97
|
vars ? (process.env.VARS = vars) : "";
|
|
@@ -172,8 +173,6 @@ flags.timeout ? (process.env.TIMEOUT = timeout) : "";
|
|
|
172
173
|
|
|
173
174
|
flags.slowMo ? (process.env.SLOWMO = slowMo) : "";
|
|
174
175
|
|
|
175
|
-
|
|
176
|
-
|
|
177
176
|
function main() {
|
|
178
177
|
if (flags.help) return showHelp();
|
|
179
178
|
if (flags.version) return showVersion();
|
|
@@ -185,57 +184,62 @@ function main() {
|
|
|
185
184
|
|
|
186
185
|
findDuplicateTestNames();
|
|
187
186
|
|
|
188
|
-
const testCoverage = testCoverageCalculator()
|
|
187
|
+
const testCoverage = testCoverageCalculator();
|
|
189
188
|
|
|
190
|
-
const testPercentage =
|
|
189
|
+
const testPercentage = process.env.PERCENTAGE
|
|
190
|
+
? Number(process.env.PERCENTAGE)
|
|
191
|
+
: artesConfig.testPercentage || 0;
|
|
191
192
|
|
|
192
193
|
if (testPercentage > 0) {
|
|
193
|
-
|
|
194
|
-
const meetsThreshold = testCoverage.percentage >= testPercentage
|
|
194
|
+
const meetsThreshold = testCoverage.percentage >= testPercentage;
|
|
195
195
|
|
|
196
196
|
if (meetsThreshold) {
|
|
197
197
|
console.log(
|
|
198
|
-
|
|
198
|
+
`\x1b[32mTests passed required ${testPercentage}% success rate with ${testCoverage.percentage.toFixed(2)}%!\x1b[0m`,
|
|
199
199
|
);
|
|
200
200
|
process.env.EXIT_CODE = parseInt(0, 10);
|
|
201
201
|
} else {
|
|
202
202
|
console.log(
|
|
203
|
-
|
|
203
|
+
`\x1b[31mTests failed required ${testPercentage}% success rate with ${testCoverage.percentage.toFixed(2)}%!\x1b[0m`,
|
|
204
204
|
);
|
|
205
205
|
process.env.EXIT_CODE = parseInt(1, 10);
|
|
206
206
|
}
|
|
207
207
|
}
|
|
208
208
|
|
|
209
|
+
const source = path.join(
|
|
210
|
+
process.cwd(),
|
|
211
|
+
"node_modules",
|
|
212
|
+
"artes",
|
|
213
|
+
"@rerun.txt",
|
|
214
|
+
);
|
|
215
|
+
const destination = path.join(process.cwd(), "@rerun.txt");
|
|
209
216
|
|
|
210
|
-
|
|
211
|
-
|
|
212
|
-
|
|
213
|
-
if (fs.existsSync(source)) {
|
|
214
|
-
fs.renameSync(source, destination);
|
|
215
|
-
}
|
|
217
|
+
if (fs.existsSync(source)) {
|
|
218
|
+
fs.renameSync(source, destination);
|
|
219
|
+
}
|
|
216
220
|
|
|
217
221
|
if (
|
|
218
222
|
flags.reportWithTrace ||
|
|
219
223
|
artesConfig.reportWithTrace ||
|
|
220
224
|
flags.report ||
|
|
221
225
|
artesConfig.report
|
|
222
|
-
){
|
|
223
|
-
|
|
226
|
+
) {
|
|
224
227
|
getExecutor();
|
|
225
|
-
getEnvInfo()
|
|
228
|
+
getEnvInfo();
|
|
226
229
|
generateReport();
|
|
227
|
-
|
|
228
230
|
}
|
|
229
231
|
|
|
230
|
-
|
|
232
|
+
if (
|
|
233
|
+
!(process.env.TRACE === "true"
|
|
231
234
|
? process.env.TRACE
|
|
232
|
-
: artesConfig.trace || false)
|
|
233
|
-
|
|
234
|
-
|
|
235
|
-
|
|
236
|
-
|
|
237
|
-
}
|
|
238
|
-
|
|
235
|
+
: artesConfig.trace || false)
|
|
236
|
+
) {
|
|
237
|
+
fs.rmSync(path.join(process.cwd(), "traces"), {
|
|
238
|
+
recursive: true,
|
|
239
|
+
force: true,
|
|
240
|
+
});
|
|
241
|
+
}
|
|
242
|
+
|
|
239
243
|
cleanUp();
|
|
240
244
|
process.exit(process.env.EXIT_CODE);
|
|
241
245
|
}
|
package/package.json
CHANGED
|
@@ -38,9 +38,8 @@ function selectorSeparator(element) {
|
|
|
38
38
|
}
|
|
39
39
|
}
|
|
40
40
|
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
element = resolveVariable(element)
|
|
41
|
+
function getSelector(element) {
|
|
42
|
+
element = resolveVariable(element);
|
|
44
43
|
|
|
45
44
|
const selector =
|
|
46
45
|
elements?.[element]?.selector || elements?.[element] || element;
|
|
@@ -94,9 +93,7 @@ function getElement(element) {
|
|
|
94
93
|
return locator;
|
|
95
94
|
}
|
|
96
95
|
|
|
97
|
-
|
|
98
96
|
function extractVarsFromResponse(responseBody, vars, customVarNames) {
|
|
99
|
-
|
|
100
97
|
function getValueByPath(obj, path) {
|
|
101
98
|
const keys = path.split(".");
|
|
102
99
|
let current = obj;
|
|
@@ -124,13 +121,13 @@ function extractVarsFromResponse(responseBody, vars, customVarNames) {
|
|
|
124
121
|
.join("");
|
|
125
122
|
}
|
|
126
123
|
|
|
127
|
-
const varPaths = vars.split(",").map(v => v.trim());
|
|
124
|
+
const varPaths = vars.split(",").map((v) => v.trim());
|
|
128
125
|
let customNames = [];
|
|
129
126
|
|
|
130
127
|
if (!customVarNames) {
|
|
131
128
|
customNames = varPaths.map(pathToCamelCase);
|
|
132
129
|
} else if (typeof customVarNames === "string") {
|
|
133
|
-
customNames = customVarNames.split(",").map(n => n.trim());
|
|
130
|
+
customNames = customVarNames.split(",").map((n) => n.trim());
|
|
134
131
|
} else if (Array.isArray(customVarNames)) {
|
|
135
132
|
customNames = customVarNames;
|
|
136
133
|
} else {
|
|
@@ -2,53 +2,67 @@ const fs = require("fs");
|
|
|
2
2
|
const path = require("path");
|
|
3
3
|
|
|
4
4
|
function findDuplicateTestNames() {
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
5
|
+
const testStatusFile = path.join(
|
|
6
|
+
process.cwd(),
|
|
7
|
+
"node_modules",
|
|
8
|
+
"artes",
|
|
9
|
+
"test-status",
|
|
10
|
+
"test-status.txt",
|
|
11
|
+
);
|
|
12
|
+
|
|
13
|
+
if (!fs.existsSync(testStatusFile)) {
|
|
14
|
+
console.error("test-status.txt not found");
|
|
15
|
+
return;
|
|
16
|
+
}
|
|
17
|
+
|
|
18
|
+
const content = fs.readFileSync(testStatusFile, "utf8");
|
|
19
|
+
const lines = content.split("\n").filter((line) => line.trim());
|
|
20
|
+
|
|
21
|
+
const testNameToEntries = {};
|
|
22
|
+
|
|
23
|
+
lines.forEach((line) => {
|
|
24
|
+
const parts = line.split(" | ");
|
|
25
|
+
if (parts.length < 5) return;
|
|
26
|
+
|
|
27
|
+
const testName = parts[2].trim();
|
|
28
|
+
const filePath = parts[4].trim();
|
|
29
|
+
const uuid = parts[3].trim();
|
|
30
|
+
|
|
31
|
+
if (!testNameToEntries[testName]) {
|
|
32
|
+
testNameToEntries[testName] = [];
|
|
10
33
|
}
|
|
11
|
-
|
|
12
|
-
const
|
|
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
|
-
if (Object.keys(duplicates).length > 0) {
|
|
40
|
-
console.warn('\n\x1b[33m[WARNING] Duplicate scenarios names found: This will effect your reporting');
|
|
41
|
-
Object.entries(duplicates).forEach(([testName, files]) => {
|
|
42
|
-
console.log(`\x1b[33m"${testName}" exists in:`);
|
|
43
|
-
files.forEach(file => {
|
|
44
|
-
console.log(` - ${file}`);
|
|
45
|
-
});
|
|
46
|
-
console.log('');
|
|
34
|
+
|
|
35
|
+
const alreadyExists = testNameToEntries[testName].some(
|
|
36
|
+
(e) => e.uuid === uuid,
|
|
37
|
+
);
|
|
38
|
+
if (!alreadyExists) {
|
|
39
|
+
testNameToEntries[testName].push({ filePath, uuid });
|
|
40
|
+
}
|
|
41
|
+
});
|
|
42
|
+
|
|
43
|
+
const duplicates = {};
|
|
44
|
+
|
|
45
|
+
Object.entries(testNameToEntries).forEach(([testName, entries]) => {
|
|
46
|
+
if (entries.length > 1) {
|
|
47
|
+
duplicates[testName] = entries.map((e) => e.filePath);
|
|
48
|
+
}
|
|
49
|
+
});
|
|
50
|
+
|
|
51
|
+
if (Object.keys(duplicates).length > 0) {
|
|
52
|
+
console.warn(
|
|
53
|
+
"\n\x1b[33m[WARNING] Duplicate scenario names found: This will affect your reporting",
|
|
54
|
+
);
|
|
55
|
+
Object.entries(duplicates).forEach(([testName, files]) => {
|
|
56
|
+
console.log(`\x1b[33m"${testName}" exists in:`);
|
|
57
|
+
files.forEach((file) => {
|
|
58
|
+
console.log(` - ${file}`);
|
|
47
59
|
});
|
|
48
|
-
console.log("
|
|
49
|
-
}
|
|
50
|
-
|
|
51
|
-
return duplicates;
|
|
60
|
+
console.log("");
|
|
61
|
+
});
|
|
62
|
+
console.log("\x1b[0m");
|
|
52
63
|
}
|
|
53
64
|
|
|
54
|
-
|
|
65
|
+
return duplicates;
|
|
66
|
+
}
|
|
67
|
+
|
|
68
|
+
module.exports = { findDuplicateTestNames };
|
|
@@ -3,71 +3,84 @@ const fs = require("fs");
|
|
|
3
3
|
const path = require("path");
|
|
4
4
|
const { moduleConfig } = require("artes/src/helper/imports/commons");
|
|
5
5
|
|
|
6
|
-
|
|
7
6
|
async function getEnvInfo() {
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
"Hostname": os.hostname(),
|
|
27
|
-
|
|
28
|
-
// ── Node ────────────────────────────────
|
|
29
|
-
"Node_Version": process.version,
|
|
30
|
-
"NPM_Version": process.env.npm_config_user_agent ?? "N/A",
|
|
31
|
-
"Working_Dir": process.cwd(),
|
|
32
|
-
|
|
33
|
-
// ── Browser ─────────────────────────────
|
|
34
|
-
"Browser_Name": cucumberConfig.browser.browserType,
|
|
35
|
-
"Browser_Version": browserInfo.BROWSER_VERSION,
|
|
36
|
-
"Screen_Size": `w: ${browserInfo.BROWSER_WIDTH}px h:${browserInfo.BROWSER_HEIGHT}px`,
|
|
37
|
-
"Headless": cucumberConfig.browser.headless ?? "N/A",
|
|
38
|
-
|
|
39
|
-
// ── Test Config ─────────────────────────
|
|
40
|
-
"Base_URL": cucumberConfig.baseURL || "N/A",
|
|
41
|
-
"Environment": cucumberConfig.env || "local",
|
|
42
|
-
"Timeout": cucumberConfig.default.timeout ?? "N/A",
|
|
43
|
-
|
|
44
|
-
// ── Git ─────────────────────────────────
|
|
45
|
-
"Git_Branch": process.env.GIT_BRANCH ?? process.env.BRANCH_NAME ?? "N/A",
|
|
46
|
-
"Git_Commit": process.env.GIT_COMMIT ?? process.env.GIT_SHA ?? "N/A",
|
|
47
|
-
"Git_Author": process.env.GIT_AUTHOR ?? "N/A",
|
|
48
|
-
|
|
49
|
-
// ── Timestamps ──────────────────────────
|
|
50
|
-
"Run_Date": new Date().toLocaleDateString(),
|
|
51
|
-
"Run_Time": new Date().toLocaleTimeString(),
|
|
52
|
-
"Timezone": Intl.DateTimeFormat().resolvedOptions().timeZone,
|
|
53
|
-
};
|
|
54
|
-
|
|
55
|
-
const allureResultsDir = path.join(moduleConfig.modulePath, "allure-result");
|
|
56
|
-
|
|
57
|
-
if (!fs.existsSync(allureResultsDir)) {
|
|
58
|
-
fs.mkdirSync(allureResultsDir, { recursive: true });
|
|
59
|
-
}
|
|
60
|
-
|
|
61
|
-
const propertiesContent = Object.entries(environment)
|
|
62
|
-
.map(([key, value]) => `${key}=${value}`)
|
|
63
|
-
.join("\n");
|
|
64
|
-
|
|
65
|
-
fs.writeFileSync(
|
|
66
|
-
path.join(allureResultsDir, "environment.properties"),
|
|
67
|
-
propertiesContent
|
|
7
|
+
delete require.cache[require.resolve("../../../cucumber.config.js")];
|
|
8
|
+
const cucumberConfig = require("../../../cucumber.config.js");
|
|
9
|
+
|
|
10
|
+
let baseURL = "";
|
|
11
|
+
|
|
12
|
+
if (typeof cucumberConfig.baseURL === "object") {
|
|
13
|
+
const env = (cucumberConfig.env || "").trim();
|
|
14
|
+
baseURL = cucumberConfig.baseURL[env];
|
|
15
|
+
} else {
|
|
16
|
+
baseURL = cucumberConfig.baseURL;
|
|
17
|
+
}
|
|
18
|
+
|
|
19
|
+
if (fs.existsSync(path.join(moduleConfig.modulePath, "browser-info.json"))) {
|
|
20
|
+
browserInfo = JSON.parse(
|
|
21
|
+
fs.readFileSync(
|
|
22
|
+
path.join(moduleConfig.modulePath, "browser-info.json"),
|
|
23
|
+
"utf8",
|
|
24
|
+
),
|
|
68
25
|
);
|
|
69
|
-
|
|
70
|
-
return environment;
|
|
71
26
|
}
|
|
72
27
|
|
|
73
|
-
|
|
28
|
+
const environment = {
|
|
29
|
+
// ── System ──────────────────────────────
|
|
30
|
+
OS_Name: os.type(),
|
|
31
|
+
OS_Version: os.release(),
|
|
32
|
+
OS_Platform: process.platform,
|
|
33
|
+
OS_Arch: os.arch(),
|
|
34
|
+
CPU_Cores: os.cpus().length,
|
|
35
|
+
CPU_Model: os.cpus()[0]?.model ?? "N/A",
|
|
36
|
+
RAM_Total: `${(os.totalmem() / 1024 / 1024 / 1024).toFixed(2)} GB`,
|
|
37
|
+
RAM_Free: `${(os.freemem() / 1024 / 1024 / 1024).toFixed(2)} GB`,
|
|
38
|
+
Hostname: os.hostname(),
|
|
39
|
+
|
|
40
|
+
// ── Node ────────────────────────────────
|
|
41
|
+
Node_Version: process.version,
|
|
42
|
+
NPM_Version: process.env.npm_config_user_agent ?? "N/A",
|
|
43
|
+
Working_Dir: process.cwd(),
|
|
44
|
+
|
|
45
|
+
// ── Browser ─────────────────────────────
|
|
46
|
+
Browser_Name: cucumberConfig.browser.browserType,
|
|
47
|
+
Browser_Version: browserInfo.BROWSER_VERSION,
|
|
48
|
+
Screen_Size: `w: ${browserInfo.BROWSER_WIDTH}px h:${browserInfo.BROWSER_HEIGHT}px`,
|
|
49
|
+
Headless: cucumberConfig.browser.headless ?? "N/A",
|
|
50
|
+
|
|
51
|
+
// ── Test Config ─────────────────────────
|
|
52
|
+
Base_URL: baseURL || "N/A",
|
|
53
|
+
Environment: cucumberConfig.env || "local",
|
|
54
|
+
Parallel_Runner: cucumberConfig.default.parallel,
|
|
55
|
+
Timeout: cucumberConfig.default.timeout ?? "N/A",
|
|
56
|
+
|
|
57
|
+
// ── Git ─────────────────────────────────
|
|
58
|
+
Git_Branch: process.env.GIT_BRANCH ?? process.env.BRANCH_NAME ?? "N/A",
|
|
59
|
+
Git_Commit: process.env.GIT_COMMIT ?? process.env.GIT_SHA ?? "N/A",
|
|
60
|
+
Git_Author: process.env.GIT_AUTHOR ?? "N/A",
|
|
61
|
+
|
|
62
|
+
// ── Timestamps ──────────────────────────
|
|
63
|
+
Run_Date: new Date().toLocaleDateString(),
|
|
64
|
+
Run_Time: new Date().toLocaleTimeString(),
|
|
65
|
+
Timezone: Intl.DateTimeFormat().resolvedOptions().timeZone,
|
|
66
|
+
};
|
|
67
|
+
|
|
68
|
+
const allureResultsDir = path.join(moduleConfig.modulePath, "allure-result");
|
|
69
|
+
|
|
70
|
+
if (!fs.existsSync(allureResultsDir)) {
|
|
71
|
+
fs.mkdirSync(allureResultsDir, { recursive: true });
|
|
72
|
+
}
|
|
73
|
+
|
|
74
|
+
const propertiesContent = Object.entries(environment)
|
|
75
|
+
.map(([key, value]) => `${key}=${value}`)
|
|
76
|
+
.join("\n");
|
|
77
|
+
|
|
78
|
+
fs.writeFileSync(
|
|
79
|
+
path.join(allureResultsDir, "environment.properties"),
|
|
80
|
+
propertiesContent,
|
|
81
|
+
);
|
|
82
|
+
|
|
83
|
+
return environment;
|
|
84
|
+
}
|
|
85
|
+
|
|
86
|
+
module.exports = { getEnvInfo };
|
|
@@ -10,99 +10,100 @@ function getExecutor() {
|
|
|
10
10
|
type: "github",
|
|
11
11
|
buildName: `Workflow #${process.env.GITHUB_RUN_NUMBER}`,
|
|
12
12
|
buildOrder: Number(process.env.GITHUB_RUN_NUMBER),
|
|
13
|
-
buildUrl: `${process.env.GITHUB_SERVER_URL}/${process.env.GITHUB_REPOSITORY}/actions/runs/${process.env.GITHUB_RUN_ID}
|
|
13
|
+
buildUrl: `${process.env.GITHUB_SERVER_URL}/${process.env.GITHUB_REPOSITORY}/actions/runs/${process.env.GITHUB_RUN_ID}`,
|
|
14
14
|
};
|
|
15
|
-
|
|
16
15
|
} else if (process.env.JENKINS_HOME) {
|
|
17
16
|
executor = {
|
|
18
17
|
name: "Jenkins",
|
|
19
18
|
type: "jenkins",
|
|
20
19
|
buildName: process.env.JOB_NAME || "Manual Run",
|
|
21
20
|
buildOrder: Number(process.env.BUILD_NUMBER) || 1,
|
|
22
|
-
buildUrl: process.env.BUILD_URL || ""
|
|
21
|
+
buildUrl: process.env.BUILD_URL || "",
|
|
23
22
|
};
|
|
24
|
-
|
|
25
23
|
} else if (process.env.CI_PIPELINE_ID) {
|
|
26
24
|
executor = {
|
|
27
25
|
name: "GitLab CI",
|
|
28
26
|
type: "gitlab",
|
|
29
27
|
buildName: `Pipeline #${process.env.CI_PIPELINE_IID}`,
|
|
30
28
|
buildOrder: Number(process.env.CI_PIPELINE_IID) || 1,
|
|
31
|
-
buildUrl: process.env.CI_PIPELINE_URL || ""
|
|
29
|
+
buildUrl: process.env.CI_PIPELINE_URL || "",
|
|
32
30
|
};
|
|
33
|
-
|
|
34
31
|
} else if (process.env.BITBUCKET_BUILD_NUMBER) {
|
|
35
32
|
executor = {
|
|
36
33
|
name: "Bitbucket Pipelines",
|
|
37
34
|
type: "bitbucket",
|
|
38
35
|
buildName: `Build #${process.env.BITBUCKET_BUILD_NUMBER}`,
|
|
39
36
|
buildOrder: Number(process.env.BITBUCKET_BUILD_NUMBER),
|
|
40
|
-
buildUrl: process.env.BITBUCKET_BUILD_URL || ""
|
|
37
|
+
buildUrl: process.env.BITBUCKET_BUILD_URL || "",
|
|
41
38
|
};
|
|
42
|
-
|
|
43
39
|
} else if (process.env.CIRCLE_WORKFLOW_ID) {
|
|
44
40
|
executor = {
|
|
45
41
|
name: "CircleCI",
|
|
46
42
|
type: "circleci",
|
|
47
43
|
buildName: `Workflow #${process.env.CIRCLE_WORKFLOW_ID}`,
|
|
48
44
|
buildOrder: Number(process.env.CIRCLE_BUILD_NUM) || 1,
|
|
49
|
-
buildUrl: process.env.CIRCLE_BUILD_URL || ""
|
|
45
|
+
buildUrl: process.env.CIRCLE_BUILD_URL || "",
|
|
50
46
|
};
|
|
51
|
-
|
|
52
47
|
} else if (process.env.BUILD_BUILDID) {
|
|
53
48
|
executor = {
|
|
54
49
|
name: "Azure Pipelines",
|
|
55
50
|
type: "azure",
|
|
56
51
|
buildName: `Build #${process.env.BUILD_BUILDID}`,
|
|
57
52
|
buildOrder: Number(process.env.BUILD_BUILDID) || 1,
|
|
58
|
-
buildUrl: process.env.BUILD_BUILDURI || ""
|
|
53
|
+
buildUrl: process.env.BUILD_BUILDURI || "",
|
|
59
54
|
};
|
|
60
|
-
|
|
61
55
|
} else if (process.env.BUILD_NUMBER && process.env.TEAMCITY_VERSION) {
|
|
62
56
|
executor = {
|
|
63
57
|
name: "TeamCity",
|
|
64
58
|
type: "teamcity",
|
|
65
59
|
buildName: `Build #${process.env.BUILD_NUMBER}`,
|
|
66
60
|
buildOrder: Number(process.env.BUILD_NUMBER) || 1,
|
|
67
|
-
buildUrl: process.env.BUILD_URL || ""
|
|
61
|
+
buildUrl: process.env.BUILD_URL || "",
|
|
68
62
|
};
|
|
69
|
-
|
|
70
63
|
} else if (process.env.TRAVIS_BUILD_NUMBER) {
|
|
71
64
|
executor = {
|
|
72
65
|
name: "Travis CI",
|
|
73
66
|
type: "travis",
|
|
74
67
|
buildName: `Build #${process.env.TRAVIS_BUILD_NUMBER}`,
|
|
75
68
|
buildOrder: Number(process.env.TRAVIS_BUILD_NUMBER) || 1,
|
|
76
|
-
buildUrl: process.env.TRAVIS_BUILD_WEB_URL || ""
|
|
69
|
+
buildUrl: process.env.TRAVIS_BUILD_WEB_URL || "",
|
|
77
70
|
};
|
|
78
|
-
|
|
79
71
|
} else if (process.env.bamboo_buildNumber) {
|
|
80
72
|
executor = {
|
|
81
73
|
name: "Bamboo",
|
|
82
74
|
type: "bamboo",
|
|
83
75
|
buildName: `Build #${process.env.bamboo_buildNumber}`,
|
|
84
76
|
buildOrder: Number(process.env.bamboo_buildNumber) || 1,
|
|
85
|
-
buildUrl: process.env.bamboo_resultsUrl || ""
|
|
77
|
+
buildUrl: process.env.bamboo_resultsUrl || "",
|
|
86
78
|
};
|
|
87
|
-
|
|
88
79
|
} else {
|
|
89
80
|
executor = {
|
|
90
81
|
name: "Local Run",
|
|
91
82
|
type: "local",
|
|
92
83
|
buildName: "Manual Execution",
|
|
93
84
|
buildOrder: 1,
|
|
94
|
-
buildUrl: ""
|
|
85
|
+
buildUrl: "",
|
|
95
86
|
};
|
|
96
87
|
}
|
|
97
88
|
|
|
98
|
-
if (
|
|
89
|
+
if (
|
|
90
|
+
fs.existsSync(
|
|
91
|
+
path.join(process.cwd(), "node_modules", "artes", "allure-result"),
|
|
92
|
+
)
|
|
93
|
+
) {
|
|
99
94
|
fs.writeFileSync(
|
|
100
|
-
path.join(
|
|
101
|
-
|
|
95
|
+
path.join(
|
|
96
|
+
process.cwd(),
|
|
97
|
+
"node_modules",
|
|
98
|
+
"artes",
|
|
99
|
+
"allure-result",
|
|
100
|
+
"executor.json",
|
|
101
|
+
),
|
|
102
|
+
JSON.stringify(executor, null, 2),
|
|
102
103
|
);
|
|
103
104
|
}
|
|
104
105
|
|
|
105
106
|
return executor;
|
|
106
107
|
}
|
|
107
108
|
|
|
108
|
-
module.exports= {getExecutor}
|
|
109
|
+
module.exports = { getExecutor };
|