artes 1.2.17 → 1.2.19

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 (38) hide show
  1. package/README.md +644 -630
  2. package/cucumber.config.js +182 -171
  3. package/docs/functionDefinitions.md +2398 -2401
  4. package/docs/stepDefinitions.md +401 -391
  5. package/executer.js +165 -161
  6. package/index.js +48 -48
  7. package/package.json +52 -51
  8. package/src/helper/contextManager/browserManager.js +63 -63
  9. package/src/helper/contextManager/requestManager.js +23 -23
  10. package/src/helper/controller/elementController.js +182 -182
  11. package/src/helper/controller/pomCollector.js +25 -25
  12. package/src/helper/executers/cleaner.js +19 -19
  13. package/src/helper/executers/exporter.js +15 -15
  14. package/src/helper/executers/helper.js +98 -95
  15. package/src/helper/executers/projectCreator.js +201 -198
  16. package/src/helper/executers/reportGenerator.js +74 -58
  17. package/src/helper/executers/testRunner.js +30 -30
  18. package/src/helper/executers/versionChecker.js +31 -31
  19. package/src/helper/imports/commons.js +57 -56
  20. package/src/helper/stepFunctions/APIActions.js +362 -363
  21. package/src/helper/stepFunctions/assertions.js +523 -523
  22. package/src/helper/stepFunctions/browserActions.js +22 -22
  23. package/src/helper/stepFunctions/elementInteractions.js +38 -38
  24. package/src/helper/stepFunctions/exporter.js +19 -19
  25. package/src/helper/stepFunctions/frameActions.js +50 -50
  26. package/src/helper/stepFunctions/keyboardActions.js +41 -41
  27. package/src/helper/stepFunctions/mouseActions.js +145 -145
  28. package/src/helper/stepFunctions/pageActions.js +27 -27
  29. package/src/hooks/context.js +15 -15
  30. package/src/hooks/hooks.js +257 -257
  31. package/src/stepDefinitions/API.steps.js +300 -300
  32. package/src/stepDefinitions/assertions.steps.js +864 -862
  33. package/src/stepDefinitions/browser.steps.js +7 -7
  34. package/src/stepDefinitions/frameActions.steps.js +76 -76
  35. package/src/stepDefinitions/keyboardActions.steps.js +261 -227
  36. package/src/stepDefinitions/mouseActions.steps.js +276 -276
  37. package/src/stepDefinitions/page.steps.js +71 -71
  38. package/src/stepDefinitions/random.steps.js +178 -159
@@ -1,171 +1,182 @@
1
- const fs = require("fs");
2
- const path = require("path");
3
- const { moduleConfig } = require("./src/helper/imports/commons");
4
-
5
- let artesConfig = {};
6
-
7
- try {
8
- if (fs.existsSync(moduleConfig.cucumberConfigPath)) {
9
- const artesConf = require(moduleConfig.cucumberConfigPath);
10
- artesConfig = artesConf || {};
11
- }
12
- } catch (error) {
13
- console.warn("Error reading config file:", error.message);
14
- console.log("Proceeding with default config.");
15
- }
16
-
17
- const defaultFormats = ["rerun:@rerun.txt", "progress-bar"];
18
-
19
- const userFormatsFromEnv = process.env.REPORT_FORMAT
20
- ? JSON.parse(process.env.REPORT_FORMAT)
21
- : [];
22
-
23
- const userFormatsFromConfig = artesConfig.format || [];
24
-
25
- const finalFormats = [
26
- ...new Set([
27
- ...defaultFormats,
28
- ...userFormatsFromEnv,
29
- ...userFormatsFromConfig,
30
- ]),
31
- ];
32
-
33
- function resolveEnv(artesConfig) {
34
- if (typeof artesConfig.baseURL === "object" && artesConfig.baseURL !== null) {
35
- if (process.env.ENV && artesConfig.baseURL.hasOwnProperty(process.env.ENV.trim())) {
36
- return process.env.ENV.trim();
37
- } else if (artesConfig.env && artesConfig.baseURL.hasOwnProperty(artesConfig.env.trim())) {
38
- return artesConfig.env.trim();
39
- } else {
40
- return Object.keys(artesConfig.baseURL)[0];
41
- }
42
- }
43
-
44
- return process.env.ENV || artesConfig.env || "";
45
- }
46
- const env = resolveEnv(artesConfig);
47
-
48
- module.exports = {
49
- default: {
50
- // File paths and patterns
51
- testPercentage: process.env.PERCENTAGE
52
- ? Number(process.env.PERCENTAGE)
53
- : artesConfig.testPercentage || 0, // number - Percentage of tests to run (0-100)
54
- timeout: process.env.TIMEOUT
55
- ? Number(process.env.TIMEOUT) * 1000
56
- : artesConfig.timeout * 1000 || 30 * 1000, // Default timeout in seconds
57
- paths: process.env.FEATURES
58
- ? [path.join(moduleConfig.projectPath, process.env.FEATURES)]
59
- : artesConfig.features
60
- ? path.join(moduleConfig.projectPath, artesConfig.features)
61
- : [moduleConfig.featuresPath], // Paths to feature files
62
- require: [
63
- process.env.STEP_DEFINITIONS
64
- ? [path.join(moduleConfig.projectPath, process.env.STEP_DEFINITIONS)]
65
- : artesConfig.steps
66
- ? path.join(moduleConfig.projectPath, artesConfig.steps)
67
- : moduleConfig.stepsPath,
68
- "src/stepDefinitions/*.js",
69
- "src/hooks/hooks.js",
70
- ], // Support code paths (CommonJS)
71
- pomPath: artesConfig.pomPath
72
- ? path.join(moduleConfig.projectPath, artesConfig.pomPath)
73
- : moduleConfig.pomPath,
74
- import: artesConfig.import || [], // Support code paths
75
-
76
- report:
77
- process.env.REPORT_WITH_TRACE ??
78
- artesConfig.reportWithTrace ??
79
- process.env.REPORT ??
80
- artesConfig.report ??
81
- false, // Generate report
82
- // Formatting and output
83
- successReport: process.env.REPORT_SUCCESS
84
- ? true
85
- : artesConfig.reportSuccess || false, // Include successful tests in report
86
-
87
- trace: process.env.TRACE ? process.env.TRACE : artesConfig.trace || false, // Enable tracing
88
-
89
- reportWithTrace: process.env.REPORT_WITH_TRACE
90
- ? process.env.REPORT_WITH_TRACE
91
- : artesConfig.reportWithTrace || false, // Include trace in report
92
-
93
- format: finalFormats, // Formatter names/paths
94
- formatOptions: artesConfig.formatOptions || {
95
- resultsDir: `allure-result`,
96
- }, // Formatter options
97
-
98
- // Execution options
99
- parallel: process.env.PARALLEL
100
- ? Number(process.env.PARALLEL)
101
- : artesConfig.parallel || 1, // Number of parallel workers
102
- dryRun: process.env.DRYRUN
103
- ? process.env.DRYRUN
104
- : artesConfig.dryRun || false, // Prepare test run without execution
105
- failFast: artesConfig.failFast || false, // Stop on first test failure
106
- forceExit: artesConfig.forceExit || false, // Force process.exit() after tests
107
- strict: artesConfig.strict || true, // Fail on pending steps
108
- backtrace: artesConfig.backtrace || false, // Show full backtrace for errors
109
-
110
- // Filtering and organization
111
- tags: process.env.RUN_TAGS
112
- ? JSON.parse(process.env.RUN_TAGS)
113
- : artesConfig.tags || artesConfig.tags || "", // Tag expression to filter scenarios
114
- name: artesConfig.name || [], // Run scenarios matching regex
115
- order: artesConfig.order || "defined", // Run order (defined/random)
116
- language: artesConfig.language || "en", // Default feature file language
117
-
118
- // Module loading
119
- loader: artesConfig.loader || [], // Module loader specifications
120
- requireModule: artesConfig.requireModule || [], // Transpilation module names
121
-
122
- // Retry logic
123
- retry: process.env.RETRY
124
- ? Number(process.env.RETRY)
125
- : artesConfig.retry || 0, // Retry attempts for failing tests
126
- retryTagFilter: artesConfig.retryTagFilter || "", // Tag expression for retries
127
-
128
- // Publishing
129
- publish: artesConfig.publish || false, // Publish to cucumber.io
130
-
131
- // World parameters
132
- worldParameters: artesConfig.worldParameters || {}, // Custom world parameters
133
- },
134
- report:{
135
- singleFileReport: process.env.SINGLE_FILE_REPORT == "true" ? true : artesConfig.singleFileReport ? true : false,
136
- zip: process.env.ZIP == "true" ? true : artesConfig.zip ? true : false
137
- },
138
- env: env,
139
- baseURL: process.env.BASE_URL
140
- ? JSON.parse(process.env.BASE_URL)
141
- : artesConfig?.baseURL
142
- ? artesConfig?.baseURL
143
- : "",
144
-
145
- browser: {
146
- browserType: process.env.BROWSER
147
- ? JSON.parse(process.env.BROWSER)
148
- : artesConfig?.browser || "chrome",
149
- viewport: {
150
- width: process.env.WIDTH
151
- ? Number(process.env.WIDTH)
152
- : artesConfig?.width || 1280,
153
- height: process.env.HEIGHT
154
- ? Number(process.env.HEIGHT)
155
- : artesConfig?.height || 720,
156
- },
157
- maximizeScreen: process.env.MAXIMIZE_SCREEN
158
- ? JSON.parse(process.env.MAXIMIZE_SCREEN)
159
- : artesConfig?.maximizeScreen !== undefined
160
- ? artesConfig.maximizeScreen
161
- : true,
162
- headless: process.env.MODE
163
- ? JSON.parse(process.env.MODE)
164
- : artesConfig?.headless !== undefined
165
- ? artesConfig.headless
166
- : true,
167
- slowMo: process.env.SLOWMO
168
- ? Number(process.env.SLOWMO) * 1000
169
- : artesConfig?.slowMo * 1000 || 0,
170
- },
171
- };
1
+ const fs = require("fs");
2
+ const path = require("path");
3
+ const { moduleConfig } = require("./src/helper/imports/commons");
4
+
5
+ let artesConfig = {};
6
+
7
+ try {
8
+ if (fs.existsSync(moduleConfig.cucumberConfigPath)) {
9
+ const artesConf = require(moduleConfig.cucumberConfigPath);
10
+ artesConfig = artesConf || {};
11
+ }
12
+ } catch (error) {
13
+ console.warn("Error reading config file:", error.message);
14
+ console.log("Proceeding with default config.");
15
+ }
16
+
17
+ const defaultFormats = ["rerun:@rerun.txt", "progress-bar"];
18
+
19
+ const userFormatsFromEnv = process.env.REPORT_FORMAT
20
+ ? JSON.parse(process.env.REPORT_FORMAT)
21
+ : [];
22
+
23
+ const userFormatsFromConfig = artesConfig.format || [];
24
+
25
+ const finalFormats = [
26
+ ...new Set([
27
+ ...defaultFormats,
28
+ ...userFormatsFromEnv,
29
+ ...userFormatsFromConfig,
30
+ ]),
31
+ ];
32
+
33
+ function resolveEnv(artesConfig) {
34
+ if (typeof artesConfig.baseURL === "object" && artesConfig.baseURL !== null) {
35
+ if (
36
+ process.env.ENV &&
37
+ artesConfig.baseURL.hasOwnProperty(process.env.ENV.trim())
38
+ ) {
39
+ return process.env.ENV.trim();
40
+ } else if (
41
+ artesConfig.env &&
42
+ artesConfig.baseURL.hasOwnProperty(artesConfig.env.trim())
43
+ ) {
44
+ return artesConfig.env.trim();
45
+ } else {
46
+ return Object.keys(artesConfig.baseURL)[0];
47
+ }
48
+ }
49
+
50
+ return process.env.ENV || artesConfig.env || "";
51
+ }
52
+ const env = resolveEnv(artesConfig);
53
+
54
+ module.exports = {
55
+ default: {
56
+ // File paths and patterns
57
+ testPercentage: process.env.PERCENTAGE
58
+ ? Number(process.env.PERCENTAGE)
59
+ : artesConfig.testPercentage || 0, // number - Percentage of tests to run (0-100)
60
+ timeout: process.env.TIMEOUT
61
+ ? Number(process.env.TIMEOUT) * 1000
62
+ : artesConfig.timeout * 1000 || 30 * 1000, // Default timeout in seconds
63
+ paths: process.env.FEATURES
64
+ ? [path.join(moduleConfig.projectPath, process.env.FEATURES)]
65
+ : artesConfig.features
66
+ ? path.join(moduleConfig.projectPath, artesConfig.features)
67
+ : [moduleConfig.featuresPath], // Paths to feature files
68
+ require: [
69
+ process.env.STEP_DEFINITIONS
70
+ ? [path.join(moduleConfig.projectPath, process.env.STEP_DEFINITIONS)]
71
+ : artesConfig.steps
72
+ ? path.join(moduleConfig.projectPath, artesConfig.steps)
73
+ : moduleConfig.stepsPath,
74
+ "src/stepDefinitions/*.js",
75
+ "src/hooks/hooks.js",
76
+ ], // Support code paths (CommonJS)
77
+ pomPath: artesConfig.pomPath
78
+ ? path.join(moduleConfig.projectPath, artesConfig.pomPath)
79
+ : moduleConfig.pomPath,
80
+ import: artesConfig.import || [], // Support code paths
81
+
82
+ report:
83
+ process.env.REPORT_WITH_TRACE ??
84
+ artesConfig.reportWithTrace ??
85
+ process.env.REPORT ??
86
+ artesConfig.report ??
87
+ false, // Generate report
88
+ // Formatting and output
89
+ successReport: process.env.REPORT_SUCCESS
90
+ ? true
91
+ : artesConfig.reportSuccess || false, // Include successful tests in report
92
+
93
+ trace: process.env.TRACE ? process.env.TRACE : artesConfig.trace || false, // Enable tracing
94
+
95
+ reportWithTrace: process.env.REPORT_WITH_TRACE
96
+ ? process.env.REPORT_WITH_TRACE
97
+ : artesConfig.reportWithTrace || false, // Include trace in report
98
+
99
+ format: finalFormats, // Formatter names/paths
100
+ formatOptions: artesConfig.formatOptions || {
101
+ resultsDir: `allure-result`,
102
+ }, // Formatter options
103
+
104
+ // Execution options
105
+ parallel: process.env.PARALLEL
106
+ ? Number(process.env.PARALLEL)
107
+ : artesConfig.parallel || 1, // Number of parallel workers
108
+ dryRun: process.env.DRYRUN
109
+ ? process.env.DRYRUN
110
+ : artesConfig.dryRun || false, // Prepare test run without execution
111
+ failFast: artesConfig.failFast || false, // Stop on first test failure
112
+ forceExit: artesConfig.forceExit || false, // Force process.exit() after tests
113
+ strict: artesConfig.strict || true, // Fail on pending steps
114
+ backtrace: artesConfig.backtrace || false, // Show full backtrace for errors
115
+
116
+ // Filtering and organization
117
+ tags: process.env.RUN_TAGS
118
+ ? JSON.parse(process.env.RUN_TAGS)
119
+ : artesConfig.tags || artesConfig.tags || "", // Tag expression to filter scenarios
120
+ name: artesConfig.name || [], // Run scenarios matching regex
121
+ order: artesConfig.order || "defined", // Run order (defined/random)
122
+ language: artesConfig.language || "en", // Default feature file language
123
+
124
+ // Module loading
125
+ loader: artesConfig.loader || [], // Module loader specifications
126
+ requireModule: artesConfig.requireModule || [], // Transpilation module names
127
+
128
+ // Retry logic
129
+ retry: process.env.RETRY
130
+ ? Number(process.env.RETRY)
131
+ : artesConfig.retry || 0, // Retry attempts for failing tests
132
+ retryTagFilter: artesConfig.retryTagFilter || "", // Tag expression for retries
133
+
134
+ // Publishing
135
+ publish: artesConfig.publish || false, // Publish to cucumber.io
136
+
137
+ // World parameters
138
+ worldParameters: artesConfig.worldParameters || {}, // Custom world parameters
139
+ },
140
+ report: {
141
+ singleFileReport:
142
+ process.env.SINGLE_FILE_REPORT == "true"
143
+ ? true
144
+ : artesConfig.singleFileReport
145
+ ? true
146
+ : false,
147
+ zip: process.env.ZIP == "true" ? true : artesConfig.zip ? true : false,
148
+ },
149
+ env: env,
150
+ baseURL: process.env.BASE_URL
151
+ ? JSON.parse(process.env.BASE_URL)
152
+ : artesConfig?.baseURL
153
+ ? artesConfig?.baseURL
154
+ : "",
155
+
156
+ browser: {
157
+ browserType: process.env.BROWSER
158
+ ? JSON.parse(process.env.BROWSER)
159
+ : artesConfig?.browser || "chrome",
160
+ viewport: {
161
+ width: process.env.WIDTH
162
+ ? Number(process.env.WIDTH)
163
+ : artesConfig?.width || 1280,
164
+ height: process.env.HEIGHT
165
+ ? Number(process.env.HEIGHT)
166
+ : artesConfig?.height || 720,
167
+ },
168
+ maximizeScreen: process.env.MAXIMIZE_SCREEN
169
+ ? JSON.parse(process.env.MAXIMIZE_SCREEN)
170
+ : artesConfig?.maximizeScreen !== undefined
171
+ ? artesConfig.maximizeScreen
172
+ : true,
173
+ headless: process.env.MODE
174
+ ? JSON.parse(process.env.MODE)
175
+ : artesConfig?.headless !== undefined
176
+ ? artesConfig.headless
177
+ : true,
178
+ slowMo: process.env.SLOWMO
179
+ ? Number(process.env.SLOWMO) * 1000
180
+ : artesConfig?.slowMo * 1000 || 0,
181
+ },
182
+ };