artes 1.2.21 → 1.2.23
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 +1 -0
- package/cucumber.config.js +6 -6
- package/executer.js +4 -0
- package/package.json +1 -1
- package/src/helper/executers/helper.js +3 -0
- package/src/helper/executers/reportGenerator.js +4 -6
- package/src/helper/executers/testRunner.js +2 -1
- package/src/helper/imports/commons.js +1 -1
- package/src/hooks/hooks.js +24 -23
package/README.md
CHANGED
|
@@ -122,6 +122,7 @@ npx artes [options]
|
|
|
122
122
|
| 🕶️ `--headless` | Run browser in headless mode | `artes --headless` |
|
|
123
123
|
| ⚡ `--parallel` | Run tests in parallel mode | `artes --parallel 2` |
|
|
124
124
|
| 🔁 `--retry` | Retry failed tests | `artes --retry 3` |
|
|
125
|
+
| 🔁 `--rerun` | Rerun only the failed tests from previous run | `artes --rerun @rerun.txt`|
|
|
125
126
|
| 🎭 `--dryRun` | Perform a dry run without executing tests | `artes --dryRun` |
|
|
126
127
|
| 📈 `--percentage` | Set minimum success percentage to pass test run (default is 0) | `artes --percentage 85` |
|
|
127
128
|
| 🌍 `--browser` | Specify browser to use (`chromium`, `firefox`, or `webkit`) | `artes --browser chromium` |
|
package/cucumber.config.js
CHANGED
|
@@ -80,19 +80,19 @@ module.exports = {
|
|
|
80
80
|
import: artesConfig.import || [], // Support code paths
|
|
81
81
|
|
|
82
82
|
report:
|
|
83
|
-
process.env.REPORT_WITH_TRACE ??
|
|
84
|
-
artesConfig.reportWithTrace ??
|
|
85
|
-
process.env.REPORT ??
|
|
86
|
-
artesConfig.report ??
|
|
83
|
+
process.env.REPORT_WITH_TRACE === "true" ??
|
|
84
|
+
artesConfig.reportWithTrace === "true" ??
|
|
85
|
+
process.env.REPORT === "true" ??
|
|
86
|
+
artesConfig.report === "true" ??
|
|
87
87
|
false, // Generate report
|
|
88
88
|
// Formatting and output
|
|
89
89
|
successReport: process.env.REPORT_SUCCESS
|
|
90
90
|
? true
|
|
91
91
|
: artesConfig.reportSuccess || false, // Include successful tests in report
|
|
92
92
|
|
|
93
|
-
trace: process.env.TRACE ? process.env.TRACE : artesConfig.trace || false, // Enable tracing
|
|
93
|
+
trace: process.env.TRACE === "true" ? process.env.TRACE : artesConfig.trace || false, // Enable tracing
|
|
94
94
|
|
|
95
|
-
reportWithTrace: process.env.REPORT_WITH_TRACE
|
|
95
|
+
reportWithTrace: process.env.REPORT_WITH_TRACE === "true"
|
|
96
96
|
? process.env.REPORT_WITH_TRACE
|
|
97
97
|
: artesConfig.reportWithTrace || false, // Include trace in report
|
|
98
98
|
|
package/executer.js
CHANGED
|
@@ -39,6 +39,7 @@ const flags = {
|
|
|
39
39
|
headless: args.includes("--headless"),
|
|
40
40
|
parallel: args.includes("--parallel"),
|
|
41
41
|
retry: args.includes("--retry"),
|
|
42
|
+
rerun: args.includes("--rerun"),
|
|
42
43
|
dryRun: args.includes("--dryRun"),
|
|
43
44
|
percentage: args.includes("--percentage"),
|
|
44
45
|
browser: args.includes("--browser"),
|
|
@@ -57,6 +58,7 @@ const stepDef = args[args.indexOf("--stepDef") + 1];
|
|
|
57
58
|
const tags = args[args.indexOf("--tags") + 1];
|
|
58
59
|
const parallel = args[args.indexOf("--parallel") + 1];
|
|
59
60
|
const retry = args[args.indexOf("--retry") + 1];
|
|
61
|
+
const rerun = args[args.indexOf("--rerun") + 1];
|
|
60
62
|
const percentage = args[args.indexOf("--percentage") + 1];
|
|
61
63
|
const browser = args[args.indexOf("--browser") + 1];
|
|
62
64
|
const baseURL = args[args.indexOf("--baseURL") + 1];
|
|
@@ -109,6 +111,8 @@ flags.parallel ? (process.env.PARALLEL = parallel) : "";
|
|
|
109
111
|
|
|
110
112
|
flags.retry ? (process.env.RETRY = retry) : "";
|
|
111
113
|
|
|
114
|
+
flags.rerun ? ( process.env.RERUN = rerun) : "";
|
|
115
|
+
|
|
112
116
|
flags.dryRun ? (process.env.DRYRUN = flags.dryRun) : "";
|
|
113
117
|
|
|
114
118
|
flags.percentage ? (process.env.PERCENTAGE = percentage) : "";
|
package/package.json
CHANGED
|
@@ -63,6 +63,9 @@ function showHelp() {
|
|
|
63
63
|
|
|
64
64
|
🔁 --retry Retry failed tests
|
|
65
65
|
Usage: artes --retry 2
|
|
66
|
+
|
|
67
|
+
🔄 --rerun Rerun only the failed tests from previous run
|
|
68
|
+
Usage: artes --rerun @rerun.txt
|
|
66
69
|
|
|
67
70
|
🎭 --dryRun Perform a dry run without executing tests
|
|
68
71
|
Usage: artes --dryRun
|
|
@@ -29,7 +29,8 @@ function generateReport() {
|
|
|
29
29
|
`📋 Report generated successfully in ${moduleConfig.reportPath}!`,
|
|
30
30
|
);
|
|
31
31
|
|
|
32
|
-
|
|
32
|
+
|
|
33
|
+
if (fs.existsSync(moduleConfig.reportPath) && process.env.ZIP === "true") {
|
|
33
34
|
console.log(`🗜️ Zipping report folder`);
|
|
34
35
|
|
|
35
36
|
const zipPath = path.join(
|
|
@@ -60,11 +61,8 @@ function generateReport() {
|
|
|
60
61
|
|
|
61
62
|
console.log(`🗜️ Zipped in ${moduleConfig.reportPath}/report.zip!`);
|
|
62
63
|
if (error) throw error;
|
|
63
|
-
}
|
|
64
|
-
|
|
65
|
-
`⚠️ Report folder does not exist: ${moduleConfig.reportPath}`,
|
|
66
|
-
);
|
|
67
|
-
}
|
|
64
|
+
}
|
|
65
|
+
|
|
68
66
|
} catch (err) {
|
|
69
67
|
console.error("❌ Report generation failed:", err);
|
|
70
68
|
process.env.EXIT_CODE = 1;
|
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
const { spawnSync } = require("child_process");
|
|
2
2
|
const { moduleConfig } = require("../imports/commons");
|
|
3
|
+
const path = require("path");
|
|
3
4
|
|
|
4
5
|
function runTests() {
|
|
5
6
|
try {
|
|
@@ -7,7 +8,7 @@ function runTests() {
|
|
|
7
8
|
process.env.FORCE_COLOR = "1";
|
|
8
9
|
process.env.FORCE_STDIO_TTY = "1";
|
|
9
10
|
|
|
10
|
-
spawnSync("cucumber-js", ["--config=cucumber.config.js"], {
|
|
11
|
+
spawnSync("cucumber-js", ["--config=cucumber.config.js", `${process.env.RERUN ? path.join("../../", process.env.RERUN) : ""}`], {
|
|
11
12
|
cwd: moduleConfig.modulePath,
|
|
12
13
|
stdio: "inherit",
|
|
13
14
|
shell: true,
|
|
@@ -35,7 +35,7 @@ const moduleConfig = {
|
|
|
35
35
|
stepsPath: path.join(projectPath, "/tests/steps/*.js"),
|
|
36
36
|
pomPath: path.join(projectPath, "/tests/POMs"),
|
|
37
37
|
cleanUpPaths:
|
|
38
|
-
"allure-result allure-results test-results
|
|
38
|
+
"allure-result allure-results test-results testsStatus EXIT_CODE.txt",
|
|
39
39
|
};
|
|
40
40
|
|
|
41
41
|
module.exports = {
|
package/src/hooks/hooks.js
CHANGED
|
@@ -103,10 +103,7 @@ Before(async function () {
|
|
|
103
103
|
|
|
104
104
|
await context.page.setDefaultTimeout(cucumberConfig.default.timeout);
|
|
105
105
|
|
|
106
|
-
if (
|
|
107
|
-
(cucumberConfig.default.reportWithTrace || cucumberConfig.default.trace) &&
|
|
108
|
-
!context.response
|
|
109
|
-
) {
|
|
106
|
+
if ( cucumberConfig.default.reportWithTrace || cucumberConfig.default.trace) {
|
|
110
107
|
await browserContext.tracing.start({
|
|
111
108
|
sources: true,
|
|
112
109
|
screenshots: true,
|
|
@@ -146,8 +143,7 @@ After(async function ({ pickle, result }) {
|
|
|
146
143
|
|
|
147
144
|
const shouldReport =
|
|
148
145
|
(cucumberConfig.default.successReport ||
|
|
149
|
-
result?.status !== Status.PASSED)
|
|
150
|
-
!context.response;
|
|
146
|
+
result?.status !== Status.PASSED)
|
|
151
147
|
|
|
152
148
|
if (shouldReport) {
|
|
153
149
|
const screenshotPath = path.join(
|
|
@@ -168,16 +164,16 @@ After(async function ({ pickle, result }) {
|
|
|
168
164
|
}
|
|
169
165
|
|
|
170
166
|
saveTestStatus(result, pickle);
|
|
171
|
-
|
|
172
|
-
|
|
167
|
+
if((cucumberConfig.default.reportWithTrace || cucumberConfig.default.trace)){
|
|
168
|
+
var tracePath = path.join(
|
|
173
169
|
moduleConfig.projectPath,
|
|
174
|
-
|
|
170
|
+
`./traces/${pickle.name.replaceAll(" ", "_")}.zip`,
|
|
175
171
|
);
|
|
172
|
+
}
|
|
173
|
+
|
|
176
174
|
|
|
177
175
|
if (
|
|
178
|
-
(cucumberConfig.default.reportWithTrace || cucumberConfig.default.trace) &&
|
|
179
|
-
!context.response &&
|
|
180
|
-
shouldReport
|
|
176
|
+
(cucumberConfig.default.reportWithTrace || cucumberConfig.default.trace) && shouldReport && context.page.url() !== "about:blank"
|
|
181
177
|
) {
|
|
182
178
|
await context.browserContext.tracing.stop({
|
|
183
179
|
path: tracePath,
|
|
@@ -192,10 +188,10 @@ After(async function ({ pickle, result }) {
|
|
|
192
188
|
});
|
|
193
189
|
|
|
194
190
|
if (!cucumberConfig.default.trace) {
|
|
195
|
-
spawnSync("npx", ["rimraf",
|
|
191
|
+
spawnSync("npx", ["rimraf", "--no-glob", path.join(moduleConfig.projectPath, "./traces")], {
|
|
196
192
|
cwd: moduleConfig.projectPath,
|
|
197
193
|
stdio: "inherit",
|
|
198
|
-
shell:
|
|
194
|
+
shell: false,
|
|
199
195
|
});
|
|
200
196
|
}
|
|
201
197
|
}
|
|
@@ -238,19 +234,24 @@ AfterAll(async () => {
|
|
|
238
234
|
const totalTests = files.length;
|
|
239
235
|
const successPercentage = (passedCount / totalTests) * 100;
|
|
240
236
|
|
|
237
|
+
const failed = files.filter((f) => f.split("-")[0] === "FAILED").length;
|
|
238
|
+
|
|
239
|
+
if (failed > 0 ){
|
|
240
|
+
spawnSync("mv", ["@rerun.txt", moduleConfig.projectPath], {
|
|
241
|
+
cwd: path.join(moduleConfig.projectPath, "node_modules", "artes"),
|
|
242
|
+
stdio: "ignore",
|
|
243
|
+
shell: true,
|
|
244
|
+
});
|
|
245
|
+
}
|
|
246
|
+
|
|
247
|
+
|
|
241
248
|
if (cucumberConfig.default.testPercentage !== undefined) {
|
|
242
|
-
const meetsThreshold =
|
|
243
|
-
successPercentage >= cucumberConfig.default.testPercentage;
|
|
249
|
+
const meetsThreshold = successPercentage >= cucumberConfig.default.testPercentage;
|
|
244
250
|
|
|
245
251
|
if (meetsThreshold) {
|
|
246
|
-
console.log(
|
|
247
|
-
`✅ Tests passed required ${cucumberConfig.default.testPercentage}% success rate with ${successPercentage.toFixed(2)}%!`,
|
|
248
|
-
);
|
|
252
|
+
console.log(`✅ Tests passed required ${cucumberConfig.default.testPercentage}% success rate with ${successPercentage.toFixed(2)}%!`);
|
|
249
253
|
fs.writeFileSync(path.join(process.cwd(), "EXIT_CODE.txt"), "0");
|
|
250
|
-
} else {
|
|
251
|
-
console.log(
|
|
252
|
-
`❌ Tests failed required ${cucumberConfig.default.testPercentage}% success rate with ${successPercentage.toFixed(2)}%!`,
|
|
253
|
-
);
|
|
254
|
+
} else {console.log(`❌ Tests failed required ${cucumberConfig.default.testPercentage}% success rate with ${successPercentage.toFixed(2)}%!`,);
|
|
254
255
|
fs.writeFileSync(path.join(process.cwd(), "EXIT_CODE.txt"), "1");
|
|
255
256
|
}
|
|
256
257
|
}
|