artes 1.1.29 → 1.1.31

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 +458 -458
  2. package/cucumber.config.js +162 -160
  3. package/docs/functionDefinitions.md +2401 -2401
  4. package/docs/stepDefinitions.md +352 -352
  5. package/executer.js +162 -148
  6. package/index.js +48 -48
  7. package/package.json +54 -54
  8. package/src/helper/contextManager/browserManager.js +68 -68
  9. package/src/helper/contextManager/requestManager.js +28 -28
  10. package/src/helper/controller/elementController.js +157 -157
  11. package/src/helper/controller/pomCollector.js +24 -24
  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 +89 -89
  15. package/src/helper/executers/projectCreator.js +168 -168
  16. package/src/helper/executers/reportGenerator.js +25 -25
  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 -57
  20. package/src/helper/stepFunctions/APIActions.js +298 -298
  21. package/src/helper/stepFunctions/assertions.js +523 -523
  22. package/src/helper/stepFunctions/browserActions.js +21 -21
  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 +216 -216
  31. package/src/stepDefinitions/API.steps.js +247 -247
  32. package/src/stepDefinitions/assertions.steps.js +826 -826
  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 +95 -95
  36. package/src/stepDefinitions/mouseActions.steps.js +256 -256
  37. package/src/stepDefinitions/page.steps.js +71 -71
  38. package/src/stepDefinitions/random.steps.js +68 -68
@@ -1,160 +1,162 @@
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
- module.exports = {
34
- default: {
35
- // File paths and patterns
36
- testPercentage: process.env.PERCENTAGE
37
- ? Number(process.env.PERCENTAGE)
38
- : artesConfig.testPercentage || 0, // number - Percentage of tests to run (0-100)
39
- timeout: process.env.TIMEOUT
40
- ? Number(process.env.TIMEOUT) * 1000
41
- : artesConfig.timeout * 1000 || 30 * 1000, // Default timeout in seconds
42
- paths: process.env.FEATURES
43
- ? [path.join(moduleConfig.projectPath, process.env.FEATURES)]
44
- : artesConfig.features
45
- ? path.join(moduleConfig.projectPath, artesConfig.features)
46
- : [moduleConfig.featuresPath], // Paths to feature files
47
- require: [
48
- process.env.STEP_DEFINITIONS
49
- ? [path.join(moduleConfig.projectPath, process.env.STEP_DEFINITIONS)]
50
- : artesConfig.steps
51
- ? path.join(moduleConfig.projectPath, artesConfig.steps)
52
- : moduleConfig.stepsPath,
53
- "src/stepDefinitions/*.js",
54
- "src/hooks/hooks.js",
55
- ], // Support code paths (CommonJS)
56
- pomPath: artesConfig.pomPath
57
- ? path.join(moduleConfig.projectPath, artesConfig.pomPath)
58
- : moduleConfig.pomPath,
59
- import: artesConfig.import || [], // Support code paths
60
-
61
- report:
62
- process.env.REPORT_WITH_TRACE ??
63
- artesConfig.reportWithTrace ??
64
- process.env.REPORT ??
65
- artesConfig.report ??
66
- false, // Generate report
67
- // Formatting and output
68
- successReport: process.env.REPORT_SUCCESS
69
- ? true
70
- : artesConfig.reportSuccess || false, // Include successful tests in report
71
-
72
- trace: process.env.TRACE ? process.env.TRACE : artesConfig.trace || false, // Enable tracing
73
-
74
- reportWithTrace: process.env.REPORT_WITH_TRACE
75
- ? process.env.REPORT_WITH_TRACE
76
- : artesConfig.reportWithTrace || false, // Include trace in report
77
-
78
- format: finalFormats, // Formatter names/paths
79
- formatOptions: artesConfig.formatOptions || {
80
- resultsDir: `allure-result`,
81
- }, // Formatter options
82
-
83
- // Execution options
84
- parallel: process.env.PARALLEL
85
- ? Number(process.env.PARALLEL)
86
- : artesConfig.parallel || 1, // Number of parallel workers
87
- dryRun: process.env.DRYRUN
88
- ? process.env.DRYRUN
89
- : artesConfig.dryRun || false, // Prepare test run without execution
90
- failFast: artesConfig.failFast || false, // Stop on first test failure
91
- forceExit: artesConfig.forceExit || false, // Force process.exit() after tests
92
- strict: artesConfig.strict || true, // Fail on pending steps
93
- backtrace: artesConfig.backtrace || false, // Show full backtrace for errors
94
-
95
- // Filtering and organization
96
- tags: process.env.RUN_TAGS
97
- ? JSON.parse(process.env.RUN_TAGS)
98
- : artesConfig.tags || artesConfig.tags || "", // Tag expression to filter scenarios
99
- name: artesConfig.name || [], // Run scenarios matching regex
100
- order: artesConfig.order || "defined", // Run order (defined/random)
101
- language: artesConfig.language || "en", // Default feature file language
102
-
103
- // Module loading
104
- loader: artesConfig.loader || [], // Module loader specifications
105
- requireModule: artesConfig.requireModule || [], // Transpilation module names
106
-
107
- // Retry logic
108
- retry: process.env.RETRY
109
- ? Number(process.env.RETRY)
110
- : artesConfig.retry || 0, // Retry attempts for failing tests
111
- retryTagFilter: artesConfig.retryTagFilter || "", // Tag expression for retries
112
-
113
- // Publishing
114
- publish: artesConfig.publish || false, // Publish to cucumber.io
115
-
116
- // World parameters
117
- worldParameters: artesConfig.worldParameters || {}, // Custom world parameters
118
- },
119
- env: process.env.ENV
120
- ? JSON.parse(process.env.ENV)
121
- : (typeof artesConfig.baseURL === "object" && artesConfig.baseURL !== null
122
- ? (
123
- artesConfig.env && artesConfig.baseURL.hasOwnProperty(artesConfig.env.trim())
124
- ? artesConfig.env.trim()
125
- : Object.keys(artesConfig.baseURL)[0]
126
- )
127
- : (artesConfig.env || "")),
128
- baseURL: process.env.BASE_URL
129
- ? JSON.parse(process.env.BASE_URL)
130
- : artesConfig?.baseURL
131
- ? artesConfig?.baseURL
132
- : "",
133
-
134
- browser: {
135
- browserType: process.env.BROWSER
136
- ? JSON.parse(process.env.BROWSER)
137
- : artesConfig?.browser || "chrome",
138
- viewport: {
139
- width: process.env.WIDTH
140
- ? Number(process.env.WIDTH)
141
- : artesConfig?.width || 1280,
142
- height: process.env.HEIGHT
143
- ? Number(process.env.HEIGHT)
144
- : artesConfig?.height || 720,
145
- },
146
- maximizeScreen: process.env.MAXIMIZE_SCREEN
147
- ? JSON.parse(process.env.MAXIMIZE_SCREEN)
148
- : artesConfig?.maximizeScreen !== undefined
149
- ? artesConfig.maximizeScreen
150
- : true,
151
- headless: process.env.MODE
152
- ? JSON.parse(process.env.MODE)
153
- : artesConfig?.headless !== undefined
154
- ? artesConfig.headless
155
- : true,
156
- slowMo: process.env.SLOWMO
157
- ? Number(process.env.SLOWMO) * 1000
158
- : artesConfig?.slowMo * 1000 || 0,
159
- },
160
- };
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
+ module.exports = {
34
+ default: {
35
+ // File paths and patterns
36
+ testPercentage: process.env.PERCENTAGE
37
+ ? Number(process.env.PERCENTAGE)
38
+ : artesConfig.testPercentage || 0, // number - Percentage of tests to run (0-100)
39
+ timeout: process.env.TIMEOUT
40
+ ? Number(process.env.TIMEOUT) * 1000
41
+ : artesConfig.timeout * 1000 || 30 * 1000, // Default timeout in seconds
42
+ paths: process.env.FEATURES
43
+ ? [path.join(moduleConfig.projectPath, process.env.FEATURES)]
44
+ : artesConfig.features
45
+ ? path.join(moduleConfig.projectPath, artesConfig.features)
46
+ : [moduleConfig.featuresPath], // Paths to feature files
47
+ require: [
48
+ process.env.STEP_DEFINITIONS
49
+ ? [path.join(moduleConfig.projectPath, process.env.STEP_DEFINITIONS)]
50
+ : artesConfig.steps
51
+ ? path.join(moduleConfig.projectPath, artesConfig.steps)
52
+ : moduleConfig.stepsPath,
53
+ "src/stepDefinitions/*.js",
54
+ "src/hooks/hooks.js",
55
+ ], // Support code paths (CommonJS)
56
+ pomPath: artesConfig.pomPath
57
+ ? path.join(moduleConfig.projectPath, artesConfig.pomPath)
58
+ : moduleConfig.pomPath,
59
+ import: artesConfig.import || [], // Support code paths
60
+
61
+ report:
62
+ process.env.REPORT_WITH_TRACE ??
63
+ artesConfig.reportWithTrace ??
64
+ process.env.REPORT ??
65
+ artesConfig.report ??
66
+ false, // Generate report
67
+ // Formatting and output
68
+ successReport: process.env.REPORT_SUCCESS
69
+ ? true
70
+ : artesConfig.reportSuccess || false, // Include successful tests in report
71
+
72
+ trace: process.env.TRACE ? process.env.TRACE : artesConfig.trace || false, // Enable tracing
73
+
74
+ reportWithTrace: process.env.REPORT_WITH_TRACE
75
+ ? process.env.REPORT_WITH_TRACE
76
+ : artesConfig.reportWithTrace || false, // Include trace in report
77
+
78
+ format: finalFormats, // Formatter names/paths
79
+ formatOptions: artesConfig.formatOptions || {
80
+ resultsDir: `allure-result`,
81
+ }, // Formatter options
82
+
83
+ // Execution options
84
+ parallel: process.env.PARALLEL
85
+ ? Number(process.env.PARALLEL)
86
+ : artesConfig.parallel || 1, // Number of parallel workers
87
+ dryRun: process.env.DRYRUN
88
+ ? process.env.DRYRUN
89
+ : artesConfig.dryRun || false, // Prepare test run without execution
90
+ failFast: artesConfig.failFast || false, // Stop on first test failure
91
+ forceExit: artesConfig.forceExit || false, // Force process.exit() after tests
92
+ strict: artesConfig.strict || true, // Fail on pending steps
93
+ backtrace: artesConfig.backtrace || false, // Show full backtrace for errors
94
+
95
+ // Filtering and organization
96
+ tags: process.env.RUN_TAGS
97
+ ? JSON.parse(process.env.RUN_TAGS)
98
+ : artesConfig.tags || artesConfig.tags || "", // Tag expression to filter scenarios
99
+ name: artesConfig.name || [], // Run scenarios matching regex
100
+ order: artesConfig.order || "defined", // Run order (defined/random)
101
+ language: artesConfig.language || "en", // Default feature file language
102
+
103
+ // Module loading
104
+ loader: artesConfig.loader || [], // Module loader specifications
105
+ requireModule: artesConfig.requireModule || [], // Transpilation module names
106
+
107
+ // Retry logic
108
+ retry: process.env.RETRY
109
+ ? Number(process.env.RETRY)
110
+ : artesConfig.retry || 0, // Retry attempts for failing tests
111
+ retryTagFilter: artesConfig.retryTagFilter || "", // Tag expression for retries
112
+
113
+ // Publishing
114
+ publish: artesConfig.publish || false, // Publish to cucumber.io
115
+
116
+ // World parameters
117
+ worldParameters: artesConfig.worldParameters || {}, // Custom world parameters
118
+ },
119
+ env: (typeof artesConfig.baseURL === "object" && artesConfig.baseURL !== null
120
+ ? (
121
+ process.env.ENV && artesConfig.baseURL.hasOwnProperty(process.env.ENV.trim())
122
+ ? process.env.ENV.trim()
123
+ : (
124
+ artesConfig.env && artesConfig.baseURL.hasOwnProperty(artesConfig.env.trim())
125
+ ? artesConfig.env.trim()
126
+ : Object.keys(artesConfig.baseURL)[0]
127
+ )
128
+ )
129
+ : (process.env.ENV || artesConfig.env || "")),
130
+ baseURL: process.env.BASE_URL
131
+ ? JSON.parse(process.env.BASE_URL)
132
+ : artesConfig?.baseURL
133
+ ? artesConfig?.baseURL
134
+ : "",
135
+
136
+ browser: {
137
+ browserType: process.env.BROWSER
138
+ ? JSON.parse(process.env.BROWSER)
139
+ : artesConfig?.browser || "chrome",
140
+ viewport: {
141
+ width: process.env.WIDTH
142
+ ? Number(process.env.WIDTH)
143
+ : artesConfig?.width || 1280,
144
+ height: process.env.HEIGHT
145
+ ? Number(process.env.HEIGHT)
146
+ : artesConfig?.height || 720,
147
+ },
148
+ maximizeScreen: process.env.MAXIMIZE_SCREEN
149
+ ? JSON.parse(process.env.MAXIMIZE_SCREEN)
150
+ : artesConfig?.maximizeScreen !== undefined
151
+ ? artesConfig.maximizeScreen
152
+ : true,
153
+ headless: process.env.MODE
154
+ ? JSON.parse(process.env.MODE)
155
+ : artesConfig?.headless !== undefined
156
+ ? artesConfig.headless
157
+ : true,
158
+ slowMo: process.env.SLOWMO
159
+ ? Number(process.env.SLOWMO) * 1000
160
+ : artesConfig?.slowMo * 1000 || 0,
161
+ },
162
+ };