artes 1.7.19 → 1.7.21
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/README.md +781 -781
- package/assets/styles.css +4 -4
- package/cucumber.config.js +253 -253
- package/docs/ciExecutors.md +198 -198
- package/docs/emulationDevicesList.md +152 -152
- package/docs/functionDefinitions.md +2401 -2401
- package/docs/stepDefinitions.md +435 -435
- package/executer.js +266 -266
- package/index.js +51 -51
- package/package.json +56 -56
- package/src/helper/contextManager/browserManager.js +74 -74
- package/src/helper/contextManager/requestManager.js +23 -23
- package/src/helper/controller/elementController.js +230 -230
- package/src/helper/controller/findDuplicateTestNames.js +69 -69
- package/src/helper/controller/getEnvInfo.js +97 -97
- package/src/helper/controller/getExecutor.js +109 -109
- package/src/helper/controller/pomCollector.js +83 -83
- package/src/helper/controller/reportCustomizer.js +511 -511
- package/src/helper/controller/screenComparer.js +96 -96
- package/src/helper/controller/status-formatter.js +137 -137
- package/src/helper/controller/testCoverageCalculator.js +111 -111
- package/src/helper/executers/cleaner.js +23 -23
- package/src/helper/executers/exporter.js +19 -19
- package/src/helper/executers/helper.js +193 -193
- package/src/helper/executers/projectCreator.js +226 -226
- package/src/helper/executers/reportGenerator.js +91 -91
- package/src/helper/executers/testRunner.js +28 -28
- package/src/helper/executers/versionChecker.js +31 -31
- package/src/helper/imports/commons.js +69 -69
- package/src/helper/stepFunctions/APIActions.js +582 -582
- package/src/helper/stepFunctions/assertions.js +986 -986
- package/src/helper/stepFunctions/browserActions.js +87 -87
- package/src/helper/stepFunctions/elementInteractions.js +60 -60
- package/src/helper/stepFunctions/exporter.js +19 -19
- package/src/helper/stepFunctions/frameActions.js +72 -72
- package/src/helper/stepFunctions/keyboardActions.js +66 -66
- package/src/helper/stepFunctions/mouseActions.js +84 -84
- package/src/helper/stepFunctions/pageActions.js +43 -43
- package/src/hooks/context.js +18 -18
- package/src/hooks/hooks.js +287 -287
- package/src/stepDefinitions/API.steps.js +404 -404
- package/src/stepDefinitions/assertions.steps.js +1358 -1351
- package/src/stepDefinitions/browser.steps.js +74 -74
- package/src/stepDefinitions/frameActions.steps.js +76 -76
- package/src/stepDefinitions/keyboardActions.steps.js +264 -264
- package/src/stepDefinitions/mouseActions.steps.js +374 -374
- package/src/stepDefinitions/page.steps.js +71 -71
- package/src/stepDefinitions/random.steps.js +199 -199
- package/src/stepDefinitions/report.steps.js +5 -5
|
@@ -1,111 +1,111 @@
|
|
|
1
|
-
const fs = require("fs");
|
|
2
|
-
const path = require("path");
|
|
3
|
-
|
|
4
|
-
function testCoverageCalculator({ silent = false, percentage = 0 } = {}) {
|
|
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 null;
|
|
16
|
-
}
|
|
17
|
-
|
|
18
|
-
const content = fs.readFileSync(testStatusFile, "utf8");
|
|
19
|
-
const lines = content.split("\n").filter((line) => line.trim());
|
|
20
|
-
|
|
21
|
-
const map = {};
|
|
22
|
-
const retriedTests = [];
|
|
23
|
-
const uuidRegex =
|
|
24
|
-
/[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}/i;
|
|
25
|
-
|
|
26
|
-
lines.forEach((line) => {
|
|
27
|
-
const parts = line.split(" | ");
|
|
28
|
-
if (parts.length < 5) return;
|
|
29
|
-
|
|
30
|
-
const timestamp = parts[0].trim();
|
|
31
|
-
const status = parts[1].trim();
|
|
32
|
-
const scenario = parts[2].trim();
|
|
33
|
-
const id = parts[3].trim();
|
|
34
|
-
const uri = parts[4].trim();
|
|
35
|
-
|
|
36
|
-
if (!uuidRegex.test(id)) return;
|
|
37
|
-
|
|
38
|
-
if (!map[id]) {
|
|
39
|
-
map[id] = {
|
|
40
|
-
count: 1,
|
|
41
|
-
latest: { status, scenario, timestamp, uri },
|
|
42
|
-
};
|
|
43
|
-
} else {
|
|
44
|
-
map[id].count++;
|
|
45
|
-
if (timestamp > map[id].latest.timestamp) {
|
|
46
|
-
map[id].latest = { status, scenario, timestamp, uri };
|
|
47
|
-
}
|
|
48
|
-
}
|
|
49
|
-
});
|
|
50
|
-
|
|
51
|
-
let total = 0;
|
|
52
|
-
let notPassed = 0;
|
|
53
|
-
|
|
54
|
-
Object.entries(map).forEach(([id, data]) => {
|
|
55
|
-
total++;
|
|
56
|
-
|
|
57
|
-
if (data.count > 1) {
|
|
58
|
-
retriedTests.push({
|
|
59
|
-
scenario: data.latest.scenario,
|
|
60
|
-
id,
|
|
61
|
-
count: data.count,
|
|
62
|
-
});
|
|
63
|
-
}
|
|
64
|
-
|
|
65
|
-
if (data.latest.status !== "PASSED") {
|
|
66
|
-
notPassed++;
|
|
67
|
-
}
|
|
68
|
-
});
|
|
69
|
-
|
|
70
|
-
const result = {
|
|
71
|
-
percentage: ((total - notPassed) / total) * 100,
|
|
72
|
-
totalTests: total,
|
|
73
|
-
notPassed,
|
|
74
|
-
passed: total - notPassed,
|
|
75
|
-
latestStatuses: Object.fromEntries(
|
|
76
|
-
Object.entries(map).map(([id, data]) => [id, data.latest.status]),
|
|
77
|
-
),
|
|
78
|
-
};
|
|
79
|
-
|
|
80
|
-
if (!silent && result.totalTests === 0) {
|
|
81
|
-
console.log("\x1b[33mNo tests were run (0 scenarios).\x1b[0m");
|
|
82
|
-
process.env.EXIT_CODE = 1;
|
|
83
|
-
return result;
|
|
84
|
-
}
|
|
85
|
-
|
|
86
|
-
if (!silent && retriedTests.length > 0) {
|
|
87
|
-
console.warn(`\n\x1b[33mRetried ${retriedTests.length} test cases:`);
|
|
88
|
-
retriedTests.forEach((t) => {
|
|
89
|
-
console.warn(`- "${t.scenario}" ran ${t.count} times`);
|
|
90
|
-
});
|
|
91
|
-
console.log("\x1b[0m");
|
|
92
|
-
console.log("");
|
|
93
|
-
}
|
|
94
|
-
|
|
95
|
-
if (!silent && percentage > 0) {
|
|
96
|
-
const meetsThreshold = result.percentage >= percentage;
|
|
97
|
-
|
|
98
|
-
if (meetsThreshold) {
|
|
99
|
-
console.log(`\x1b[32mTests passed required ${percentage}% success rate with ${result.percentage.toFixed(2)}%!\x1b[0m`);
|
|
100
|
-
process.env.EXIT_CODE = 0;
|
|
101
|
-
} else {
|
|
102
|
-
console.log(`\x1b[31mTests failed required ${percentage}% success rate with ${result.percentage.toFixed(2)}%!\x1b[0m`);
|
|
103
|
-
process.env.EXIT_CODE = 1;
|
|
104
|
-
}
|
|
105
|
-
}
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
return result
|
|
109
|
-
}
|
|
110
|
-
|
|
111
|
-
module.exports = { testCoverageCalculator };
|
|
1
|
+
const fs = require("fs");
|
|
2
|
+
const path = require("path");
|
|
3
|
+
|
|
4
|
+
function testCoverageCalculator({ silent = false, percentage = 0 } = {}) {
|
|
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 null;
|
|
16
|
+
}
|
|
17
|
+
|
|
18
|
+
const content = fs.readFileSync(testStatusFile, "utf8");
|
|
19
|
+
const lines = content.split("\n").filter((line) => line.trim());
|
|
20
|
+
|
|
21
|
+
const map = {};
|
|
22
|
+
const retriedTests = [];
|
|
23
|
+
const uuidRegex =
|
|
24
|
+
/[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}/i;
|
|
25
|
+
|
|
26
|
+
lines.forEach((line) => {
|
|
27
|
+
const parts = line.split(" | ");
|
|
28
|
+
if (parts.length < 5) return;
|
|
29
|
+
|
|
30
|
+
const timestamp = parts[0].trim();
|
|
31
|
+
const status = parts[1].trim();
|
|
32
|
+
const scenario = parts[2].trim();
|
|
33
|
+
const id = parts[3].trim();
|
|
34
|
+
const uri = parts[4].trim();
|
|
35
|
+
|
|
36
|
+
if (!uuidRegex.test(id)) return;
|
|
37
|
+
|
|
38
|
+
if (!map[id]) {
|
|
39
|
+
map[id] = {
|
|
40
|
+
count: 1,
|
|
41
|
+
latest: { status, scenario, timestamp, uri },
|
|
42
|
+
};
|
|
43
|
+
} else {
|
|
44
|
+
map[id].count++;
|
|
45
|
+
if (timestamp > map[id].latest.timestamp) {
|
|
46
|
+
map[id].latest = { status, scenario, timestamp, uri };
|
|
47
|
+
}
|
|
48
|
+
}
|
|
49
|
+
});
|
|
50
|
+
|
|
51
|
+
let total = 0;
|
|
52
|
+
let notPassed = 0;
|
|
53
|
+
|
|
54
|
+
Object.entries(map).forEach(([id, data]) => {
|
|
55
|
+
total++;
|
|
56
|
+
|
|
57
|
+
if (data.count > 1) {
|
|
58
|
+
retriedTests.push({
|
|
59
|
+
scenario: data.latest.scenario,
|
|
60
|
+
id,
|
|
61
|
+
count: data.count,
|
|
62
|
+
});
|
|
63
|
+
}
|
|
64
|
+
|
|
65
|
+
if (data.latest.status !== "PASSED") {
|
|
66
|
+
notPassed++;
|
|
67
|
+
}
|
|
68
|
+
});
|
|
69
|
+
|
|
70
|
+
const result = {
|
|
71
|
+
percentage: ((total - notPassed) / total) * 100,
|
|
72
|
+
totalTests: total,
|
|
73
|
+
notPassed,
|
|
74
|
+
passed: total - notPassed,
|
|
75
|
+
latestStatuses: Object.fromEntries(
|
|
76
|
+
Object.entries(map).map(([id, data]) => [id, data.latest.status]),
|
|
77
|
+
),
|
|
78
|
+
};
|
|
79
|
+
|
|
80
|
+
if (!silent && result.totalTests === 0) {
|
|
81
|
+
console.log("\x1b[33mNo tests were run (0 scenarios).\x1b[0m");
|
|
82
|
+
process.env.EXIT_CODE = 1;
|
|
83
|
+
return result;
|
|
84
|
+
}
|
|
85
|
+
|
|
86
|
+
if (!silent && retriedTests.length > 0) {
|
|
87
|
+
console.warn(`\n\x1b[33mRetried ${retriedTests.length} test cases:`);
|
|
88
|
+
retriedTests.forEach((t) => {
|
|
89
|
+
console.warn(`- "${t.scenario}" ran ${t.count} times`);
|
|
90
|
+
});
|
|
91
|
+
console.log("\x1b[0m");
|
|
92
|
+
console.log("");
|
|
93
|
+
}
|
|
94
|
+
|
|
95
|
+
if (!silent && percentage > 0) {
|
|
96
|
+
const meetsThreshold = result.percentage >= percentage;
|
|
97
|
+
|
|
98
|
+
if (meetsThreshold) {
|
|
99
|
+
console.log(`\x1b[32mTests passed required ${percentage}% success rate with ${result.percentage.toFixed(2)}%!\x1b[0m`);
|
|
100
|
+
process.env.EXIT_CODE = 0;
|
|
101
|
+
} else {
|
|
102
|
+
console.log(`\x1b[31mTests failed required ${percentage}% success rate with ${result.percentage.toFixed(2)}%!\x1b[0m`);
|
|
103
|
+
process.env.EXIT_CODE = 1;
|
|
104
|
+
}
|
|
105
|
+
}
|
|
106
|
+
|
|
107
|
+
|
|
108
|
+
return result
|
|
109
|
+
}
|
|
110
|
+
|
|
111
|
+
module.exports = { testCoverageCalculator };
|
|
@@ -1,23 +1,23 @@
|
|
|
1
|
-
const { moduleConfig } = require("../imports/commons");
|
|
2
|
-
const fs = require("fs");
|
|
3
|
-
const path = require("path");
|
|
4
|
-
|
|
5
|
-
function cleanUp() {
|
|
6
|
-
try {
|
|
7
|
-
for (const p of moduleConfig.cleanUpPaths) {
|
|
8
|
-
const fullPath = path.join(moduleConfig.modulePath, p);
|
|
9
|
-
|
|
10
|
-
fs.rmSync(fullPath, {
|
|
11
|
-
recursive: true,
|
|
12
|
-
force: true,
|
|
13
|
-
});
|
|
14
|
-
}
|
|
15
|
-
} catch (error) {
|
|
16
|
-
console.error("❌ Error in cleanup:", error.message);
|
|
17
|
-
process.env.EXIT_CODE = 1;
|
|
18
|
-
}
|
|
19
|
-
}
|
|
20
|
-
|
|
21
|
-
module.exports = {
|
|
22
|
-
cleanUp,
|
|
23
|
-
};
|
|
1
|
+
const { moduleConfig } = require("../imports/commons");
|
|
2
|
+
const fs = require("fs");
|
|
3
|
+
const path = require("path");
|
|
4
|
+
|
|
5
|
+
function cleanUp() {
|
|
6
|
+
try {
|
|
7
|
+
for (const p of moduleConfig.cleanUpPaths) {
|
|
8
|
+
const fullPath = path.join(moduleConfig.modulePath, p);
|
|
9
|
+
|
|
10
|
+
fs.rmSync(fullPath, {
|
|
11
|
+
recursive: true,
|
|
12
|
+
force: true,
|
|
13
|
+
});
|
|
14
|
+
}
|
|
15
|
+
} catch (error) {
|
|
16
|
+
console.error("❌ Error in cleanup:", error.message);
|
|
17
|
+
process.env.EXIT_CODE = 1;
|
|
18
|
+
}
|
|
19
|
+
}
|
|
20
|
+
|
|
21
|
+
module.exports = {
|
|
22
|
+
cleanUp,
|
|
23
|
+
};
|
|
@@ -1,19 +1,19 @@
|
|
|
1
|
-
const { showHelp, showBrowserHelp, showExecutionHelp, showReportingHelp, showAIHelp } = require("./helper");
|
|
2
|
-
const { createProject } = require("./projectCreator");
|
|
3
|
-
const { generateReport } = require("./reportGenerator");
|
|
4
|
-
const { runTests } = require("./testRunner");
|
|
5
|
-
const { showVersion } = require("./versionChecker");
|
|
6
|
-
const { cleanUp } = require("./cleaner");
|
|
7
|
-
|
|
8
|
-
module.exports = {
|
|
9
|
-
createProject,
|
|
10
|
-
generateReport,
|
|
11
|
-
runTests,
|
|
12
|
-
showHelp,
|
|
13
|
-
showBrowserHelp,
|
|
14
|
-
showExecutionHelp,
|
|
15
|
-
showReportingHelp,
|
|
16
|
-
showAIHelp,
|
|
17
|
-
showVersion,
|
|
18
|
-
cleanUp,
|
|
19
|
-
};
|
|
1
|
+
const { showHelp, showBrowserHelp, showExecutionHelp, showReportingHelp, showAIHelp } = require("./helper");
|
|
2
|
+
const { createProject } = require("./projectCreator");
|
|
3
|
+
const { generateReport } = require("./reportGenerator");
|
|
4
|
+
const { runTests } = require("./testRunner");
|
|
5
|
+
const { showVersion } = require("./versionChecker");
|
|
6
|
+
const { cleanUp } = require("./cleaner");
|
|
7
|
+
|
|
8
|
+
module.exports = {
|
|
9
|
+
createProject,
|
|
10
|
+
generateReport,
|
|
11
|
+
runTests,
|
|
12
|
+
showHelp,
|
|
13
|
+
showBrowserHelp,
|
|
14
|
+
showExecutionHelp,
|
|
15
|
+
showReportingHelp,
|
|
16
|
+
showAIHelp,
|
|
17
|
+
showVersion,
|
|
18
|
+
cleanUp,
|
|
19
|
+
};
|