artes 1.2.25 → 1.2.27
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
CHANGED
|
@@ -60,11 +60,13 @@ module.exports = {
|
|
|
60
60
|
timeout: process.env.TIMEOUT
|
|
61
61
|
? Number(process.env.TIMEOUT) * 1000
|
|
62
62
|
: artesConfig.timeout * 1000 || 30 * 1000, // Default timeout in seconds
|
|
63
|
-
paths: process.env.
|
|
64
|
-
? [path.join(
|
|
65
|
-
:
|
|
66
|
-
? path.join(moduleConfig.projectPath,
|
|
67
|
-
:
|
|
63
|
+
paths: process.env.RERUN
|
|
64
|
+
? [`${path.join("../../", process.env.RERUN)}`]
|
|
65
|
+
: process.env.FEATURES
|
|
66
|
+
? [path.join(moduleConfig.projectPath, process.env.FEATURES)]
|
|
67
|
+
: artesConfig.features
|
|
68
|
+
? [path.join(moduleConfig.projectPath, artesConfig.features)]
|
|
69
|
+
: [moduleConfig.featuresPath], // Paths to feature files
|
|
68
70
|
require: [
|
|
69
71
|
process.env.STEP_DEFINITIONS
|
|
70
72
|
? [path.join(moduleConfig.projectPath, process.env.STEP_DEFINITIONS)]
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "artes",
|
|
3
|
-
"version": "1.2.
|
|
3
|
+
"version": "1.2.27",
|
|
4
4
|
"description": "The simplest way to automate UI and API tests using Cucumber-style steps.",
|
|
5
5
|
"main": "index.js",
|
|
6
6
|
"scripts": {
|
|
@@ -23,9 +23,9 @@
|
|
|
23
23
|
"@faker-js/faker": "9.8.0",
|
|
24
24
|
"@types/node": "22.9.0",
|
|
25
25
|
"ajv": "8.17.1",
|
|
26
|
-
"allure-commandline": "2.
|
|
27
|
-
"allure-cucumberjs": "3.
|
|
28
|
-
"allure-js-commons": "3.
|
|
26
|
+
"allure-commandline": "2.36.0",
|
|
27
|
+
"allure-cucumberjs": "3.4.5",
|
|
28
|
+
"allure-js-commons": "3.4.5",
|
|
29
29
|
"archiver": "^7.0.1",
|
|
30
30
|
"dayjs": "1.11.13",
|
|
31
31
|
"deasync": "^0.1.31",
|
|
@@ -12,7 +12,7 @@ function addElements(newElements) {
|
|
|
12
12
|
// return locatorCount ==0 ? false : true;
|
|
13
13
|
// }
|
|
14
14
|
|
|
15
|
-
function
|
|
15
|
+
function selectorSeparator(element) {
|
|
16
16
|
if (typeof element !== "string") return element;
|
|
17
17
|
|
|
18
18
|
const selector = element?.split("=");
|
|
@@ -41,7 +41,7 @@ function selectorSeperator(element) {
|
|
|
41
41
|
function getSelector(element) {
|
|
42
42
|
const selector =
|
|
43
43
|
elements?.[element]?.selector || elements?.[element] || element;
|
|
44
|
-
return resolveVariable(
|
|
44
|
+
return resolveVariable(selectorSeparator(selector));
|
|
45
45
|
}
|
|
46
46
|
|
|
47
47
|
function getElement(element) {
|
|
@@ -1,25 +1,53 @@
|
|
|
1
1
|
const { addElements } = require("./elementController");
|
|
2
2
|
const cucumberConfig = require("../../../cucumber.config");
|
|
3
3
|
const fs = require("fs");
|
|
4
|
+
const path = require("path");
|
|
5
|
+
|
|
6
|
+
const duplicateWarnings = [];
|
|
7
|
+
const keyRegistry = {};
|
|
4
8
|
|
|
5
9
|
function pomCollector() {
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
10
|
+
const pomPath = cucumberConfig.default.pomPath;
|
|
11
|
+
|
|
12
|
+
if (!fs.existsSync(pomPath)) return;
|
|
13
|
+
|
|
14
|
+
fs.readdirSync(pomPath).forEach((file) => {
|
|
15
|
+
const filePath = path.join(pomPath, file);
|
|
16
|
+
|
|
17
|
+
let parsed;
|
|
18
|
+
try {
|
|
19
|
+
parsed = JSON.parse(fs.readFileSync(filePath, "utf-8"));
|
|
20
|
+
} catch (error) {
|
|
21
|
+
console.log(`Error parsing POM file ${file}: ${error.message}`);
|
|
22
|
+
return;
|
|
23
|
+
}
|
|
24
|
+
|
|
25
|
+
Object.keys(parsed).forEach((key) => {
|
|
26
|
+
if (keyRegistry[key]) {
|
|
27
|
+
duplicateWarnings.push(
|
|
28
|
+
`${key} in ${file} has the same key with ${key} in ${keyRegistry[key]}`
|
|
19
29
|
);
|
|
20
|
-
}
|
|
30
|
+
} else {
|
|
31
|
+
keyRegistry[key] = file;
|
|
32
|
+
}
|
|
21
33
|
});
|
|
22
|
-
|
|
34
|
+
|
|
35
|
+
addElements(parsed);
|
|
36
|
+
});
|
|
37
|
+
}
|
|
38
|
+
|
|
39
|
+
function logPomWarnings() {
|
|
40
|
+
if (duplicateWarnings.length === 0) return;
|
|
41
|
+
|
|
42
|
+
console.warn(
|
|
43
|
+
"\n\x1b[33m[WARNING] POM DUPLICATE KEY WARNINGS: This may break your tests or cause flaky behavior."
|
|
44
|
+
);
|
|
45
|
+
|
|
46
|
+
duplicateWarnings.forEach((warning) => {
|
|
47
|
+
console.warn(`- ${warning}`);
|
|
48
|
+
});
|
|
49
|
+
|
|
50
|
+
console.log("\x1b[0m")
|
|
23
51
|
}
|
|
24
52
|
|
|
25
|
-
module.exports = { pomCollector };
|
|
53
|
+
module.exports = { pomCollector, logPomWarnings };
|
|
@@ -5,15 +5,10 @@ const path = require("path");
|
|
|
5
5
|
function runTests() {
|
|
6
6
|
try {
|
|
7
7
|
console.log("🧪 Running tests...");
|
|
8
|
-
process.env.FORCE_COLOR = "1";
|
|
9
|
-
process.env.FORCE_STDIO_TTY = "1";
|
|
10
8
|
|
|
11
9
|
spawnSync(
|
|
12
10
|
"cucumber-js",
|
|
13
|
-
[
|
|
14
|
-
"--config=cucumber.config.js",
|
|
15
|
-
`${process.env.RERUN ? path.join("../../", process.env.RERUN) : ""}`,
|
|
16
|
-
],
|
|
11
|
+
[ "--config=cucumber.config.js"],
|
|
17
12
|
{
|
|
18
13
|
cwd: moduleConfig.modulePath,
|
|
19
14
|
stdio: "inherit",
|
package/src/hooks/hooks.js
CHANGED
|
@@ -11,7 +11,7 @@ const {
|
|
|
11
11
|
const { spawnSync } = require("child_process");
|
|
12
12
|
const { invokeBrowser } = require("../helper/contextManager/browserManager");
|
|
13
13
|
const { invokeRequest } = require("../helper/contextManager/requestManager");
|
|
14
|
-
const { pomCollector } = require("../helper/controller/pomCollector");
|
|
14
|
+
const { pomCollector, logPomWarnings } = require("../helper/controller/pomCollector");
|
|
15
15
|
const cucumberConfig = require("../../cucumber.config");
|
|
16
16
|
const { context } = require("./context");
|
|
17
17
|
const fs = require("fs");
|
|
@@ -156,9 +156,10 @@ After(async function ({ pickle, result }) {
|
|
|
156
156
|
path: screenshotPath,
|
|
157
157
|
type: "png",
|
|
158
158
|
});
|
|
159
|
+
|
|
159
160
|
await this.attach(img, {
|
|
160
161
|
mediaType: "image/png",
|
|
161
|
-
fileName:
|
|
162
|
+
fileName: "Screenshot",
|
|
162
163
|
});
|
|
163
164
|
}
|
|
164
165
|
|
|
@@ -184,7 +185,7 @@ After(async function ({ pickle, result }) {
|
|
|
184
185
|
|
|
185
186
|
await this.attach(trace, {
|
|
186
187
|
mediaType: "application/zip",
|
|
187
|
-
fileName:
|
|
188
|
+
fileName: "Trace",
|
|
188
189
|
});
|
|
189
190
|
|
|
190
191
|
if (!cucumberConfig.default.trace) {
|
|
@@ -227,7 +228,7 @@ After(async function ({ pickle, result }) {
|
|
|
227
228
|
const webmBuffer = fs.readFileSync(videoPath);
|
|
228
229
|
await this.attach(webmBuffer, {
|
|
229
230
|
mediaType: "video/webm",
|
|
230
|
-
fileName:
|
|
231
|
+
fileName: "Screenrecord",
|
|
231
232
|
});
|
|
232
233
|
}
|
|
233
234
|
}
|
|
@@ -239,6 +240,8 @@ AfterAll(async () => {
|
|
|
239
240
|
await projectHooks.AfterAll();
|
|
240
241
|
}
|
|
241
242
|
|
|
243
|
+
logPomWarnings();
|
|
244
|
+
|
|
242
245
|
if (!fs.existsSync(statusDir)) return;
|
|
243
246
|
|
|
244
247
|
const files = fs.readdirSync(statusDir);
|
|
@@ -256,9 +259,8 @@ AfterAll(async () => {
|
|
|
256
259
|
});
|
|
257
260
|
}
|
|
258
261
|
|
|
259
|
-
if (cucumberConfig.default.testPercentage
|
|
260
|
-
const meetsThreshold =
|
|
261
|
-
successPercentage >= cucumberConfig.default.testPercentage;
|
|
262
|
+
if (cucumberConfig.default.testPercentage>0) {
|
|
263
|
+
const meetsThreshold = successPercentage >= cucumberConfig.default.testPercentage;
|
|
262
264
|
|
|
263
265
|
if (meetsThreshold) {
|
|
264
266
|
console.log(
|