artes 1.7.4 → 1.7.6

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.
Files changed (48) hide show
  1. package/README.md +781 -779
  2. package/assets/styles.css +4 -4
  3. package/cucumber.config.js +253 -253
  4. package/docs/ciExecutors.md +198 -198
  5. package/docs/emulationDevicesList.md +152 -152
  6. package/docs/functionDefinitions.md +2401 -2401
  7. package/docs/stepDefinitions.md +435 -433
  8. package/executer.js +266 -264
  9. package/index.js +50 -50
  10. package/package.json +56 -56
  11. package/src/helper/contextManager/browserManager.js +74 -74
  12. package/src/helper/contextManager/requestManager.js +23 -23
  13. package/src/helper/controller/elementController.js +210 -210
  14. package/src/helper/controller/findDuplicateTestNames.js +69 -69
  15. package/src/helper/controller/getEnvInfo.js +94 -94
  16. package/src/helper/controller/getExecutor.js +109 -109
  17. package/src/helper/controller/pomCollector.js +83 -83
  18. package/src/helper/controller/reportCustomizer.js +485 -485
  19. package/src/helper/controller/screenComparer.js +97 -108
  20. package/src/helper/controller/status-formatter.js +137 -137
  21. package/src/helper/controller/testCoverageCalculator.js +111 -111
  22. package/src/helper/executers/cleaner.js +23 -23
  23. package/src/helper/executers/exporter.js +19 -19
  24. package/src/helper/executers/helper.js +193 -191
  25. package/src/helper/executers/projectCreator.js +226 -222
  26. package/src/helper/executers/reportGenerator.js +91 -91
  27. package/src/helper/executers/testRunner.js +28 -28
  28. package/src/helper/executers/versionChecker.js +31 -31
  29. package/src/helper/imports/commons.js +65 -65
  30. package/src/helper/stepFunctions/APIActions.js +495 -495
  31. package/src/helper/stepFunctions/assertions.js +986 -986
  32. package/src/helper/stepFunctions/browserActions.js +87 -87
  33. package/src/helper/stepFunctions/elementInteractions.js +60 -60
  34. package/src/helper/stepFunctions/exporter.js +19 -19
  35. package/src/helper/stepFunctions/frameActions.js +72 -72
  36. package/src/helper/stepFunctions/keyboardActions.js +66 -66
  37. package/src/helper/stepFunctions/mouseActions.js +84 -84
  38. package/src/helper/stepFunctions/pageActions.js +43 -43
  39. package/src/hooks/context.js +15 -15
  40. package/src/hooks/hooks.js +287 -279
  41. package/src/stepDefinitions/API.steps.js +310 -310
  42. package/src/stepDefinitions/assertions.steps.js +1303 -1280
  43. package/src/stepDefinitions/browser.steps.js +74 -74
  44. package/src/stepDefinitions/frameActions.steps.js +76 -76
  45. package/src/stepDefinitions/keyboardActions.steps.js +264 -264
  46. package/src/stepDefinitions/mouseActions.steps.js +378 -378
  47. package/src/stepDefinitions/page.steps.js +71 -71
  48. package/src/stepDefinitions/random.steps.js +191 -191
@@ -1,91 +1,91 @@
1
- const fs = require("fs");
2
- const path = require("path");
3
- const archiver = require("archiver");
4
- const { spawnSync } = require("child_process");
5
- const { moduleConfig } = require("../imports/commons");
6
- const {
7
- reportCustomizer,
8
- } = require("../../helper/controller/reportCustomizer");
9
-
10
- function generateReport() {
11
- try {
12
- console.log("📊 Generating report...");
13
-
14
- spawnSync(
15
- "allure",
16
- [
17
- "generate",
18
- "--clean",
19
- `${process.env.SINGLE_FILE_REPORT == "true" ? "--single-file" : ""}`,
20
- "allure-result",
21
- "--output",
22
- moduleConfig.reportPath,
23
- ],
24
- {
25
- cwd: moduleConfig.modulePath,
26
- stdio: "ignore",
27
- shell: true,
28
- },
29
- );
30
-
31
- console.log(
32
- `📋 Report generated successfully in ${moduleConfig.reportPath}!`,
33
- );
34
-
35
- let customizerDone = false;
36
- let customizerError = null;
37
-
38
- Promise.resolve(reportCustomizer())
39
- .then(() => {
40
- customizerDone = true;
41
- })
42
- .catch((err) => {
43
- customizerError = err;
44
- customizerDone = true;
45
- });
46
-
47
- require("deasync").loopWhile(() => !customizerDone);
48
-
49
- if (customizerError) throw customizerError;
50
-
51
- if (fs.existsSync(moduleConfig.reportPath) && process.env.ZIP === "true") {
52
- console.log(`🗜️ Zipping report folder...`);
53
-
54
- const zipPath = path.join(
55
- path.dirname(moduleConfig.reportPath),
56
- "report.zip",
57
- );
58
-
59
- let done = false;
60
- let error = null;
61
-
62
- const output = fs.createWriteStream(zipPath);
63
- const archive = archiver("zip", { zlib: { level: 9 } });
64
-
65
- output.on("close", () => {
66
- done = true;
67
- });
68
-
69
- archive.on("error", (err) => {
70
- error = err;
71
- done = true;
72
- });
73
-
74
- archive.pipe(output);
75
- archive.directory(moduleConfig.reportPath, false);
76
- archive.finalize();
77
-
78
- require("deasync").loopWhile(() => !done);
79
-
80
- console.log(
81
- `🗜️ Zipped in ${path.join(path.dirname(moduleConfig.reportPath), "report.zip")}!`,
82
- );
83
- if (error) throw error;
84
- }
85
- } catch (err) {
86
- console.error("❌ Report generation failed:", err);
87
- process.env.EXIT_CODE = 1;
88
- }
89
- }
90
-
91
- module.exports = { generateReport };
1
+ const fs = require("fs");
2
+ const path = require("path");
3
+ const archiver = require("archiver");
4
+ const { spawnSync } = require("child_process");
5
+ const { moduleConfig } = require("../imports/commons");
6
+ const {
7
+ reportCustomizer,
8
+ } = require("../../helper/controller/reportCustomizer");
9
+
10
+ function generateReport() {
11
+ try {
12
+ console.log("📊 Generating report...");
13
+
14
+ spawnSync(
15
+ "allure",
16
+ [
17
+ "generate",
18
+ "--clean",
19
+ `${process.env.SINGLE_FILE_REPORT == "true" ? "--single-file" : ""}`,
20
+ "allure-result",
21
+ "--output",
22
+ moduleConfig.reportPath,
23
+ ],
24
+ {
25
+ cwd: moduleConfig.modulePath,
26
+ stdio: "ignore",
27
+ shell: true,
28
+ },
29
+ );
30
+
31
+ console.log(
32
+ `📋 Report generated successfully in ${moduleConfig.reportPath}!`,
33
+ );
34
+
35
+ let customizerDone = false;
36
+ let customizerError = null;
37
+
38
+ Promise.resolve(reportCustomizer())
39
+ .then(() => {
40
+ customizerDone = true;
41
+ })
42
+ .catch((err) => {
43
+ customizerError = err;
44
+ customizerDone = true;
45
+ });
46
+
47
+ require("deasync").loopWhile(() => !customizerDone);
48
+
49
+ if (customizerError) throw customizerError;
50
+
51
+ if (fs.existsSync(moduleConfig.reportPath) && process.env.ZIP === "true") {
52
+ console.log(`🗜️ Zipping report folder...`);
53
+
54
+ const zipPath = path.join(
55
+ path.dirname(moduleConfig.reportPath),
56
+ "report.zip",
57
+ );
58
+
59
+ let done = false;
60
+ let error = null;
61
+
62
+ const output = fs.createWriteStream(zipPath);
63
+ const archive = archiver("zip", { zlib: { level: 9 } });
64
+
65
+ output.on("close", () => {
66
+ done = true;
67
+ });
68
+
69
+ archive.on("error", (err) => {
70
+ error = err;
71
+ done = true;
72
+ });
73
+
74
+ archive.pipe(output);
75
+ archive.directory(moduleConfig.reportPath, false);
76
+ archive.finalize();
77
+
78
+ require("deasync").loopWhile(() => !done);
79
+
80
+ console.log(
81
+ `🗜️ Zipped in ${path.join(path.dirname(moduleConfig.reportPath), "report.zip")}!`,
82
+ );
83
+ if (error) throw error;
84
+ }
85
+ } catch (err) {
86
+ console.error("❌ Report generation failed:", err);
87
+ process.env.EXIT_CODE = 1;
88
+ }
89
+ }
90
+
91
+ module.exports = { generateReport };
@@ -1,28 +1,28 @@
1
- const { spawnSync } = require("child_process");
2
- const { moduleConfig } = require("../imports/commons");
3
-
4
- function runTests() {
5
- try {
6
- console.log("🧪 Running tests...");
7
-
8
- spawnSync("cucumber-js", ["--config=cucumber.config.js"], {
9
- cwd: moduleConfig.modulePath,
10
- stdio: "inherit",
11
- shell: true,
12
- env: {
13
- ...process.env,
14
- FORCE_TTY: "1",
15
- FORCE_COLOR: "1",
16
- CI: "false",
17
- },
18
- });
19
- console.log("✅ Tests running completed successfully!");
20
- } catch (error) {
21
- console.error("❌ Test execution failed:", error);
22
- process.env.EXIT_CODE = 1;
23
- }
24
- }
25
-
26
- module.exports = {
27
- runTests,
28
- };
1
+ const { spawnSync } = require("child_process");
2
+ const { moduleConfig } = require("../imports/commons");
3
+
4
+ function runTests() {
5
+ try {
6
+ console.log("🧪 Running tests...");
7
+
8
+ spawnSync("cucumber-js", ["--config=cucumber.config.js"], {
9
+ cwd: moduleConfig.modulePath,
10
+ stdio: "inherit",
11
+ shell: true,
12
+ env: {
13
+ ...process.env,
14
+ FORCE_TTY: "1",
15
+ FORCE_COLOR: "1",
16
+ CI: "false",
17
+ },
18
+ });
19
+ console.log("✅ Tests running completed successfully!");
20
+ } catch (error) {
21
+ console.error("❌ Test execution failed:", error);
22
+ process.env.EXIT_CODE = 1;
23
+ }
24
+ }
25
+
26
+ module.exports = {
27
+ runTests,
28
+ };
@@ -1,31 +1,31 @@
1
- const { execSync } = require("child_process");
2
- const path = require("path");
3
- const fs = require("fs");
4
-
5
- function showVersion() {
6
- try {
7
- const localPath = path.join(
8
- process.cwd(),
9
- "node_modules",
10
- "artes",
11
- "package.json",
12
- );
13
- const localData = fs.readFileSync(localPath, "utf8");
14
- const localArtes = JSON.parse(localData);
15
- console.log(`ARTES Version: ${localArtes.version}`);
16
- return;
17
- } catch (err) {}
18
-
19
- try {
20
- const globalRoot = execSync("npm root -g").toString().trim();
21
- const globalPath = path.join(globalRoot, "artes", "package.json");
22
- const globalData = fs.readFileSync(globalPath, "utf8");
23
- const globalArtes = JSON.parse(globalData);
24
- console.log(`ARTES Version: ${globalArtes.version}`);
25
- return;
26
- } catch (err) {}
27
- }
28
-
29
- module.exports = {
30
- showVersion,
31
- };
1
+ const { execSync } = require("child_process");
2
+ const path = require("path");
3
+ const fs = require("fs");
4
+
5
+ function showVersion() {
6
+ try {
7
+ const localPath = path.join(
8
+ process.cwd(),
9
+ "node_modules",
10
+ "artes",
11
+ "package.json",
12
+ );
13
+ const localData = fs.readFileSync(localPath, "utf8");
14
+ const localArtes = JSON.parse(localData);
15
+ console.log(`ARTES Version: ${localArtes.version}`);
16
+ return;
17
+ } catch (err) {}
18
+
19
+ try {
20
+ const globalRoot = execSync("npm root -g").toString().trim();
21
+ const globalPath = path.join(globalRoot, "artes", "package.json");
22
+ const globalData = fs.readFileSync(globalPath, "utf8");
23
+ const globalArtes = JSON.parse(globalData);
24
+ console.log(`ARTES Version: ${globalArtes.version}`);
25
+ return;
26
+ } catch (err) {}
27
+ }
28
+
29
+ module.exports = {
30
+ showVersion,
31
+ };
@@ -1,65 +1,65 @@
1
- const { expect } = require("playwright/test");
2
- const { Given, When, Then } = require("@cucumber/cucumber");
3
- const {
4
- getElement,
5
- getSelector,
6
- extractVarsFromResponse,
7
- saveVar,
8
- resolveVariable,
9
- } = require("../controller/elementController");
10
- const { context } = require("../../hooks/context");
11
-
12
- const { faker } = require("@faker-js/faker");
13
- const dayjs = require("dayjs");
14
-
15
- const element = getElement;
16
- const selector = getSelector;
17
- const browserPage = context.page;
18
- const request = context.request;
19
-
20
- const random = faker;
21
- const time = dayjs;
22
-
23
- const path = require("path");
24
- const projectPath = path.resolve(__dirname, "../../../../../");
25
- const modulePath = path.join(projectPath, "node_modules", "artes");
26
-
27
- const moduleConfig = {
28
- projectPath: projectPath,
29
- modulePackageJsonPath: path.join(modulePath, "package.json"),
30
- modulePath: modulePath,
31
- reportPath: path.join(projectPath, "report"),
32
- tracerPath: path.join(projectPath, "trace.zip"),
33
- cucumberConfigPath: path.join(projectPath, "artes.config.js"),
34
- featuresPath: path.join(projectPath, "tests", "features"),
35
- stepsPath: path.join(projectPath, "tests", "steps", "*.js"),
36
- pomPath: path.join(projectPath, "tests", "POMs"),
37
- cleanUpPaths: [
38
- "allure-result",
39
- "allure-results",
40
- "test-results",
41
- "@rerun.txt",
42
- "test-status",
43
- "null",
44
- "pomDuplicateWarnings.json",
45
- "browser-info.json",
46
- ],
47
- };
48
-
49
- module.exports = {
50
- expect,
51
- Given,
52
- When,
53
- Then,
54
- element,
55
- selector,
56
- extractVarsFromResponse,
57
- saveVar,
58
- resolveVariable,
59
- random,
60
- time,
61
- browserPage,
62
- request,
63
- context,
64
- moduleConfig,
65
- };
1
+ const { expect } = require("playwright/test");
2
+ const { Given, When, Then } = require("@cucumber/cucumber");
3
+ const {
4
+ getElement,
5
+ getSelector,
6
+ extractVarsFromResponse,
7
+ saveVar,
8
+ resolveVariable,
9
+ } = require("../controller/elementController");
10
+ const { context } = require("../../hooks/context");
11
+
12
+ const { faker } = require("@faker-js/faker");
13
+ const dayjs = require("dayjs");
14
+
15
+ const element = getElement;
16
+ const selector = getSelector;
17
+ const browserPage = context.page;
18
+ const request = context.request;
19
+
20
+ const random = faker;
21
+ const time = dayjs;
22
+
23
+ const path = require("path");
24
+ const projectPath = path.resolve(__dirname, "../../../../../");
25
+ const modulePath = path.join(projectPath, "node_modules", "artes");
26
+
27
+ const moduleConfig = {
28
+ projectPath: projectPath,
29
+ modulePackageJsonPath: path.join(modulePath, "package.json"),
30
+ modulePath: modulePath,
31
+ reportPath: path.join(projectPath, "report"),
32
+ tracerPath: path.join(projectPath, "trace.zip"),
33
+ cucumberConfigPath: path.join(projectPath, "artes.config.js"),
34
+ featuresPath: path.join(projectPath, "tests", "features"),
35
+ stepsPath: path.join(projectPath, "tests", "steps", "*.js"),
36
+ pomPath: path.join(projectPath, "tests", "POMs"),
37
+ cleanUpPaths: [
38
+ "allure-result",
39
+ "allure-results",
40
+ "test-results",
41
+ "@rerun.txt",
42
+ "test-status",
43
+ "null",
44
+ "pomDuplicateWarnings.json",
45
+ "browser-info.json",
46
+ ],
47
+ };
48
+
49
+ module.exports = {
50
+ expect,
51
+ Given,
52
+ When,
53
+ Then,
54
+ element,
55
+ selector,
56
+ extractVarsFromResponse,
57
+ saveVar,
58
+ resolveVariable,
59
+ random,
60
+ time,
61
+ browserPage,
62
+ request,
63
+ context,
64
+ moduleConfig,
65
+ };