artes 1.2.14 → 1.2.16
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/README.md +533 -533
- package/cucumber.config.js +171 -171
- package/docs/functionDefinitions.md +2401 -2401
- package/docs/stepDefinitions.md +352 -352
- package/executer.js +161 -161
- package/index.js +48 -48
- package/package.json +51 -54
- package/src/helper/contextManager/browserManager.js +63 -63
- package/src/helper/contextManager/requestManager.js +23 -23
- package/src/helper/controller/elementController.js +182 -182
- package/src/helper/controller/pomCollector.js +25 -25
- package/src/helper/executers/cleaner.js +19 -19
- package/src/helper/executers/exporter.js +15 -15
- package/src/helper/executers/helper.js +95 -95
- package/src/helper/executers/projectCreator.js +198 -198
- package/src/helper/executers/reportGenerator.js +58 -57
- package/src/helper/executers/testRunner.js +30 -30
- package/src/helper/executers/versionChecker.js +31 -31
- package/src/helper/imports/commons.js +56 -56
- package/src/helper/stepFunctions/APIActions.js +362 -362
- package/src/helper/stepFunctions/assertions.js +523 -523
- package/src/helper/stepFunctions/browserActions.js +22 -22
- package/src/helper/stepFunctions/elementInteractions.js +38 -38
- package/src/helper/stepFunctions/exporter.js +19 -19
- package/src/helper/stepFunctions/frameActions.js +50 -50
- package/src/helper/stepFunctions/keyboardActions.js +41 -41
- package/src/helper/stepFunctions/mouseActions.js +145 -145
- package/src/helper/stepFunctions/pageActions.js +27 -27
- package/src/hooks/context.js +15 -15
- package/src/hooks/hooks.js +257 -257
- package/src/stepDefinitions/API.steps.js +299 -299
- package/src/stepDefinitions/assertions.steps.js +861 -861
- package/src/stepDefinitions/browser.steps.js +7 -7
- package/src/stepDefinitions/frameActions.steps.js +76 -76
- package/src/stepDefinitions/keyboardActions.steps.js +226 -226
- package/src/stepDefinitions/mouseActions.steps.js +275 -275
- package/src/stepDefinitions/page.steps.js +71 -71
- package/src/stepDefinitions/random.steps.js +158 -158
package/cucumber.config.js
CHANGED
|
@@ -1,171 +1,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 (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 (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
|
+
};
|