artes 1.4.7 → 1.4.9

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 (40) hide show
  1. package/README.md +668 -668
  2. package/cucumber.config.js +223 -223
  3. package/docs/emulationDevicesList.md +152 -152
  4. package/docs/functionDefinitions.md +2401 -2401
  5. package/docs/stepDefinitions.md +402 -402
  6. package/executer.js +479 -479
  7. package/index.js +50 -50
  8. package/package.json +52 -52
  9. package/src/helper/contextManager/browserManager.js +74 -74
  10. package/src/helper/contextManager/requestManager.js +23 -23
  11. package/src/helper/controller/elementController.js +203 -185
  12. package/src/helper/controller/pomCollector.js +82 -82
  13. package/src/helper/executers/cleaner.js +19 -19
  14. package/src/helper/executers/exporter.js +15 -15
  15. package/src/helper/executers/helper.js +110 -110
  16. package/src/helper/executers/projectCreator.js +206 -206
  17. package/src/helper/executers/reportGenerator.js +70 -70
  18. package/src/helper/executers/testRunner.js +28 -28
  19. package/src/helper/executers/versionChecker.js +31 -31
  20. package/src/helper/imports/commons.js +57 -57
  21. package/src/helper/stepFunctions/APIActions.js +495 -495
  22. package/src/helper/stepFunctions/assertions.js +989 -989
  23. package/src/helper/stepFunctions/browserActions.js +22 -22
  24. package/src/helper/stepFunctions/elementInteractions.js +60 -60
  25. package/src/helper/stepFunctions/exporter.js +19 -19
  26. package/src/helper/stepFunctions/frameActions.js +72 -72
  27. package/src/helper/stepFunctions/keyboardActions.js +66 -66
  28. package/src/helper/stepFunctions/mouseActions.js +83 -83
  29. package/src/helper/stepFunctions/pageActions.js +43 -43
  30. package/src/hooks/context.js +15 -15
  31. package/src/hooks/hooks.js +215 -215
  32. package/src/stepDefinitions/API.steps.js +310 -310
  33. package/src/stepDefinitions/assertions.steps.js +1092 -1092
  34. package/src/stepDefinitions/browser.steps.js +7 -7
  35. package/src/stepDefinitions/frameActions.steps.js +76 -76
  36. package/src/stepDefinitions/keyboardActions.steps.js +265 -265
  37. package/src/stepDefinitions/mouseActions.steps.js +378 -378
  38. package/src/stepDefinitions/page.steps.js +71 -71
  39. package/src/stepDefinitions/random.steps.js +188 -188
  40. package/status-formatter.js +138 -138
@@ -1,223 +1,223 @@
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", './status-formatter.js:null'];
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
- function loadVariables(cliVariables, artesConfigVariables) {
55
-
56
- if (cliVariables) {
57
- try {
58
- cliVariables = JSON.parse(cliVariables);
59
- } catch (err) {
60
- console.error("Invalid JSON in process.env.VARS:", process.env.VARS);
61
- envVars = {};
62
- }
63
- }
64
-
65
- const mergedVars = {
66
- ...(artesConfigVariables || {}),
67
- ...cliVariables,
68
- };
69
-
70
- return mergedVars;
71
- }
72
-
73
- const resolveFeaturePaths = (basePath, value) => {
74
- return value
75
- .split(',')
76
- .map(p => p.trim())
77
- .filter(Boolean)
78
- .map(p => path.join(basePath, p));
79
- };
80
-
81
-
82
- module.exports = {
83
- default: {
84
- // File paths and patterns
85
- testPercentage: process.env.PERCENTAGE
86
- ? Number(process.env.PERCENTAGE)
87
- : artesConfig.testPercentage || 0, // number - Percentage of tests to run (0-100)
88
- timeout: process.env.TIMEOUT
89
- ? Number(process.env.TIMEOUT) * 1000
90
- : artesConfig.timeout * 1000 || 30 * 1000, // Default timeout in seconds
91
- paths: process.env.RERUN
92
- ? [path.join("../../", process.env.RERUN)]
93
- : process.env.FEATURES
94
- ? resolveFeaturePaths(moduleConfig.projectPath, process.env.FEATURES)
95
- : artesConfig.features
96
- ? resolveFeaturePaths(moduleConfig.projectPath, artesConfig.features)
97
- : [moduleConfig.featuresPath], // Paths to feature files
98
- require: [
99
- process.env.STEP_DEFINITIONS
100
- ? [path.join(moduleConfig.projectPath, process.env.STEP_DEFINITIONS)]
101
- : artesConfig.steps
102
- ? path.join(moduleConfig.projectPath, artesConfig.steps)
103
- : moduleConfig.stepsPath,
104
- "src/stepDefinitions/*.js",
105
- "src/hooks/hooks.js",
106
- ], // Support code paths (CommonJS)
107
- pomPath: artesConfig.pomPath
108
- ? path.join(moduleConfig.projectPath, artesConfig.pomPath)
109
- : moduleConfig.pomPath,
110
- import: artesConfig.import || [], // Support code paths
111
-
112
- report:
113
- process.env.REPORT_WITH_TRACE === "true" ??
114
- artesConfig.reportWithTrace === "true" ??
115
- process.env.REPORT === "true" ??
116
- artesConfig.report === "true" ??
117
- false, // Generate report
118
- // Formatting and output
119
- successReport: process.env.REPORT_SUCCESS
120
- ? true
121
- : artesConfig.reportSuccess || false, // Include successful tests in report
122
-
123
- trace:
124
- process.env.TRACE === "true"
125
- ? process.env.TRACE
126
- : artesConfig.trace || false, // Enable tracing
127
-
128
- reportWithTrace:
129
- process.env.REPORT_WITH_TRACE === "true"
130
- ? process.env.REPORT_WITH_TRACE
131
- : artesConfig.reportWithTrace || false, // Include trace in report
132
-
133
- format: finalFormats, // Formatter names/paths
134
- formatOptions: artesConfig.formatOptions || {
135
- resultsDir: `allure-result`,
136
- }, // Formatter options
137
-
138
- // Execution options
139
- parallel: process.env.PARALLEL
140
- ? Number(process.env.PARALLEL)
141
- : artesConfig.parallel || 1, // Number of parallel workers
142
- dryRun: process.env.DRYRUN
143
- ? process.env.DRYRUN
144
- : artesConfig.dryRun || false, // Prepare test run without execution
145
- failFast: artesConfig.failFast || false, // Stop on first test failure
146
- forceExit: artesConfig.forceExit || false, // Force process.exit() after tests
147
- strict: artesConfig.strict || true, // Fail on pending steps
148
- backtrace: artesConfig.backtrace || false, // Show full backtrace for errors
149
-
150
- // Filtering and organization
151
- tags: process.env.RUN_TAGS
152
- ? JSON.parse(process.env.RUN_TAGS)
153
- : artesConfig.tags || artesConfig.tags || "", // Tag expression to filter scenarios
154
- name: artesConfig.name || [], // Run scenarios matching regex
155
- order: artesConfig.order || "defined", // Run order (defined/random)
156
- language: artesConfig.language || "en", // Default feature file language
157
-
158
- // Module loading
159
- loader: artesConfig.loader || [], // Module loader specifications
160
- requireModule: artesConfig.requireModule || [], // Transpilation module names
161
-
162
- // Retry logic
163
- retry: process.env.RETRY
164
- ? Number(process.env.RETRY)
165
- : artesConfig.retry || 0, // Retry attempts for failing tests
166
- retryTagFilter: artesConfig.retryTagFilter || "", // Tag expression for retries
167
-
168
- // Publishing
169
- publish: artesConfig.publish || false, // Publish to cucumber.io
170
-
171
- // World parameters
172
- worldParameters: artesConfig.worldParameters || {}, // Custom world parameters
173
- },
174
- report: {
175
- singleFileReport:
176
- process.env.SINGLE_FILE_REPORT == "true"
177
- ? true
178
- : artesConfig.singleFileReport
179
- ? true
180
- : false,
181
- zip: process.env.ZIP == "true" ? true : artesConfig.zip ? true : false,
182
- },
183
- env: env,
184
- variables: loadVariables(process.env.VARS, artesConfig.variables),
185
- baseURL: process.env.BASE_URL
186
- ? JSON.parse(process.env.BASE_URL)
187
- : artesConfig?.baseURL
188
- ? artesConfig?.baseURL
189
- : "",
190
-
191
- browser: {
192
- browserType: process.env.BROWSER
193
- ? JSON.parse(process.env.BROWSER)
194
- : artesConfig?.browser || "chrome",
195
- device: process.env.DEVICE
196
- ? JSON.parse(process.env.DEVICE)
197
- : artesConfig?.device || null,
198
- offline: process.env.OFFLINE
199
- ? JSON.parse(process.env.OFFLINE)
200
- : artesConfig?.offline || false,
201
- viewport: {
202
- width: process.env.WIDTH
203
- ? Number(process.env.WIDTH)
204
- : artesConfig?.width || 1280,
205
- height: process.env.HEIGHT
206
- ? Number(process.env.HEIGHT)
207
- : artesConfig?.height || 720,
208
- },
209
- maximizeScreen: process.env.MAXIMIZE_SCREEN
210
- ? JSON.parse(process.env.MAXIMIZE_SCREEN)
211
- : artesConfig?.maximizeScreen !== undefined
212
- ? artesConfig.maximizeScreen
213
- : true,
214
- headless: process.env.MODE
215
- ? JSON.parse(process.env.MODE)
216
- : artesConfig?.headless !== undefined
217
- ? artesConfig.headless
218
- : true,
219
- slowMo: process.env.SLOWMO
220
- ? Number(process.env.SLOWMO) * 1000
221
- : artesConfig?.slowMo * 1000 || 0,
222
- },
223
- };
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", './status-formatter.js:null'];
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
+ function loadVariables(cliVariables, artesConfigVariables) {
55
+
56
+ if (cliVariables) {
57
+ try {
58
+ cliVariables = JSON.parse(cliVariables);
59
+ } catch (err) {
60
+ console.error("Invalid JSON in process.env.VARS:", process.env.VARS);
61
+ envVars = {};
62
+ }
63
+ }
64
+
65
+ const mergedVars = {
66
+ ...(artesConfigVariables || {}),
67
+ ...cliVariables,
68
+ };
69
+
70
+ return mergedVars;
71
+ }
72
+
73
+ const resolveFeaturePaths = (basePath, value) => {
74
+ return value
75
+ .split(',')
76
+ .map(p => p.trim())
77
+ .filter(Boolean)
78
+ .map(p => path.join(basePath, p));
79
+ };
80
+
81
+
82
+ module.exports = {
83
+ default: {
84
+ // File paths and patterns
85
+ testPercentage: process.env.PERCENTAGE
86
+ ? Number(process.env.PERCENTAGE)
87
+ : artesConfig.testPercentage || 0, // number - Percentage of tests to run (0-100)
88
+ timeout: process.env.TIMEOUT
89
+ ? Number(process.env.TIMEOUT) * 1000
90
+ : artesConfig.timeout * 1000 || 30 * 1000, // Default timeout in seconds
91
+ paths: process.env.RERUN
92
+ ? [path.join("../../", process.env.RERUN)]
93
+ : process.env.FEATURES
94
+ ? resolveFeaturePaths(moduleConfig.projectPath, process.env.FEATURES)
95
+ : artesConfig.features
96
+ ? resolveFeaturePaths(moduleConfig.projectPath, artesConfig.features)
97
+ : [moduleConfig.featuresPath], // Paths to feature files
98
+ require: [
99
+ process.env.STEP_DEFINITIONS
100
+ ? [path.join(moduleConfig.projectPath, process.env.STEP_DEFINITIONS)]
101
+ : artesConfig.steps
102
+ ? path.join(moduleConfig.projectPath, artesConfig.steps)
103
+ : moduleConfig.stepsPath,
104
+ "src/stepDefinitions/*.js",
105
+ "src/hooks/hooks.js",
106
+ ], // Support code paths (CommonJS)
107
+ pomPath: artesConfig.pomPath
108
+ ? path.join(moduleConfig.projectPath, artesConfig.pomPath)
109
+ : moduleConfig.pomPath,
110
+ import: artesConfig.import || [], // Support code paths
111
+
112
+ report:
113
+ process.env.REPORT_WITH_TRACE === "true" ??
114
+ artesConfig.reportWithTrace === "true" ??
115
+ process.env.REPORT === "true" ??
116
+ artesConfig.report === "true" ??
117
+ false, // Generate report
118
+ // Formatting and output
119
+ successReport: process.env.REPORT_SUCCESS
120
+ ? true
121
+ : artesConfig.reportSuccess || false, // Include successful tests in report
122
+
123
+ trace:
124
+ process.env.TRACE === "true"
125
+ ? process.env.TRACE
126
+ : artesConfig.trace || false, // Enable tracing
127
+
128
+ reportWithTrace:
129
+ process.env.REPORT_WITH_TRACE === "true"
130
+ ? process.env.REPORT_WITH_TRACE
131
+ : artesConfig.reportWithTrace || false, // Include trace in report
132
+
133
+ format: finalFormats, // Formatter names/paths
134
+ formatOptions: artesConfig.formatOptions || {
135
+ resultsDir: `allure-result`,
136
+ }, // Formatter options
137
+
138
+ // Execution options
139
+ parallel: process.env.PARALLEL
140
+ ? Number(process.env.PARALLEL)
141
+ : artesConfig.parallel || 1, // Number of parallel workers
142
+ dryRun: process.env.DRYRUN
143
+ ? process.env.DRYRUN
144
+ : artesConfig.dryRun || false, // Prepare test run without execution
145
+ failFast: artesConfig.failFast || false, // Stop on first test failure
146
+ forceExit: artesConfig.forceExit || false, // Force process.exit() after tests
147
+ strict: artesConfig.strict || true, // Fail on pending steps
148
+ backtrace: artesConfig.backtrace || false, // Show full backtrace for errors
149
+
150
+ // Filtering and organization
151
+ tags: process.env.RUN_TAGS
152
+ ? JSON.parse(process.env.RUN_TAGS)
153
+ : artesConfig.tags || artesConfig.tags || "", // Tag expression to filter scenarios
154
+ name: artesConfig.name || [], // Run scenarios matching regex
155
+ order: artesConfig.order || "defined", // Run order (defined/random)
156
+ language: artesConfig.language || "en", // Default feature file language
157
+
158
+ // Module loading
159
+ loader: artesConfig.loader || [], // Module loader specifications
160
+ requireModule: artesConfig.requireModule || [], // Transpilation module names
161
+
162
+ // Retry logic
163
+ retry: process.env.RETRY
164
+ ? Number(process.env.RETRY)
165
+ : artesConfig.retry || 0, // Retry attempts for failing tests
166
+ retryTagFilter: artesConfig.retryTagFilter || "", // Tag expression for retries
167
+
168
+ // Publishing
169
+ publish: artesConfig.publish || false, // Publish to cucumber.io
170
+
171
+ // World parameters
172
+ worldParameters: artesConfig.worldParameters || {}, // Custom world parameters
173
+ },
174
+ report: {
175
+ singleFileReport:
176
+ process.env.SINGLE_FILE_REPORT == "true"
177
+ ? true
178
+ : artesConfig.singleFileReport
179
+ ? true
180
+ : false,
181
+ zip: process.env.ZIP == "true" ? true : artesConfig.zip ? true : false,
182
+ },
183
+ env: env,
184
+ variables: loadVariables(process.env.VARS, artesConfig.variables),
185
+ baseURL: process.env.BASE_URL
186
+ ? JSON.parse(process.env.BASE_URL)
187
+ : artesConfig?.baseURL
188
+ ? artesConfig?.baseURL
189
+ : "",
190
+
191
+ browser: {
192
+ browserType: process.env.BROWSER
193
+ ? JSON.parse(process.env.BROWSER)
194
+ : artesConfig?.browser || "chrome",
195
+ device: process.env.DEVICE
196
+ ? JSON.parse(process.env.DEVICE)
197
+ : artesConfig?.device || null,
198
+ offline: process.env.OFFLINE
199
+ ? JSON.parse(process.env.OFFLINE)
200
+ : artesConfig?.offline || false,
201
+ viewport: {
202
+ width: process.env.WIDTH
203
+ ? Number(process.env.WIDTH)
204
+ : artesConfig?.width || 1280,
205
+ height: process.env.HEIGHT
206
+ ? Number(process.env.HEIGHT)
207
+ : artesConfig?.height || 720,
208
+ },
209
+ maximizeScreen: process.env.MAXIMIZE_SCREEN
210
+ ? JSON.parse(process.env.MAXIMIZE_SCREEN)
211
+ : artesConfig?.maximizeScreen !== undefined
212
+ ? artesConfig.maximizeScreen
213
+ : true,
214
+ headless: process.env.MODE
215
+ ? JSON.parse(process.env.MODE)
216
+ : artesConfig?.headless !== undefined
217
+ ? artesConfig.headless
218
+ : true,
219
+ slowMo: process.env.SLOWMO
220
+ ? Number(process.env.SLOWMO) * 1000
221
+ : artesConfig?.slowMo * 1000 || 0,
222
+ },
223
+ };