artes 1.0.89 → 1.0.90
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 +2 -0
- package/cucumber.config.js +1 -0
- package/executer.js +3 -0
- package/package.json +1 -1
- package/src/helper/executers/helper.js +3 -0
- package/src/helper/executers/projectCreator.js +1 -0
- package/src/hooks/hooks.js +28 -23
package/README.md
CHANGED
|
@@ -49,6 +49,7 @@ npx artes [options]
|
|
|
49
49
|
| 🏗️ `-c, --create` | Create an example project with Artes | `artes -c` or `artes --create` |
|
|
50
50
|
| ✅ `-y, --yes` | Skip the confirmation prompt when creating an example project | `artes -c -y` or `artes --create --yes` |
|
|
51
51
|
| 📊 `-r, --report` | Run tests and generate Allure report | `artes -r` or `artes --report` |
|
|
52
|
+
| `--reportSuccess` | Add screenshots and video records for also Success test cases | `artes --reportSuccess`|
|
|
52
53
|
| 📁 `--features` | Specify one or more feature files' relative paths to run (comma-separated) | `artes --features "tests/features/Alma,tests/features/Banan.feature"` |
|
|
53
54
|
| 🔖 `--tags` | Run tests with specified Cucumber tags | `artes --tags "@smoke or @wip"` |
|
|
54
55
|
| 🌐 `--env` | Set the environment for the test run | `artes --env "dev"` |
|
|
@@ -293,6 +294,7 @@ You can configure Artes by editing the `artes.config.js` file. Below are the def
|
|
|
293
294
|
| `pomPath` | `moduleConfig.pomPath` | Path to Page Object Models. |
|
|
294
295
|
| `import` | `[]` | Support code paths. |
|
|
295
296
|
| `testPercentage` | `0` | Define test coverage percentage |
|
|
297
|
+
| `reportSuccess` | `true` | Add screenshots and video records for also success test cases |
|
|
296
298
|
| `format` | `["rerun:@rerun.txt", "allure-cucumberjs/reporter"]` | Formatter names/paths. |
|
|
297
299
|
| `formatOptions` | `{ "resultsDir": "allure-result" }` | Formatter options. |
|
|
298
300
|
| `parallel` | `1` | Number of parallel workers. |
|
package/cucumber.config.js
CHANGED
|
@@ -57,6 +57,7 @@ module.exports = {
|
|
|
57
57
|
import: artesConfig.import || [], // Support code paths
|
|
58
58
|
|
|
59
59
|
// Formatting and output
|
|
60
|
+
successReport: process.env.REPORT_SUCCESS ? true : artesConfig.reportSuccess || false, // Include successful tests in report
|
|
60
61
|
format: finalFormats, // Formatter names/paths
|
|
61
62
|
formatOptions: artesConfig.formatOptions || {
|
|
62
63
|
resultsDir: `allure-result`,
|
package/executer.js
CHANGED
|
@@ -16,6 +16,7 @@ const flags = {
|
|
|
16
16
|
create: args.includes("-c") || args.includes("--create"),
|
|
17
17
|
createYes: args.includes("-y") || args.includes("--yes"),
|
|
18
18
|
report: args.includes("-r") || args.includes("--report"),
|
|
19
|
+
reportSuccess: args.includes("--reportSuccess"),
|
|
19
20
|
trace: args.includes("-t") || args.includes("--trace"),
|
|
20
21
|
features: args.includes("--features"),
|
|
21
22
|
tags: args.includes("--tags"),
|
|
@@ -57,6 +58,8 @@ flags.report
|
|
|
57
58
|
]))
|
|
58
59
|
: "";
|
|
59
60
|
|
|
61
|
+
flags.reportSuccess ? (process.env.REPORT_SUCCESS = true) : "";
|
|
62
|
+
|
|
60
63
|
flags.tags && console.log("Running tags:", tags);
|
|
61
64
|
flags.tags ? (process.env.RUN_TAGS = JSON.stringify(tags)) : "";
|
|
62
65
|
|
package/package.json
CHANGED
|
@@ -24,6 +24,9 @@ function showHelp() {
|
|
|
24
24
|
|
|
25
25
|
📊 -r, --report Run tests and generate Allure report
|
|
26
26
|
Usage: artes -r or artes --report
|
|
27
|
+
|
|
28
|
+
✅ --reportSuccess Generate screenshot and video record with also successful tests
|
|
29
|
+
Usage: artes --reportSuccess
|
|
27
30
|
|
|
28
31
|
📁 --features Specify one or more feature files' relative paths to run (comma-separated)
|
|
29
32
|
Usage: artes --features "tests/features/Alma, tests/features/Banan.feature"
|
|
@@ -48,6 +48,7 @@ function createProject(createYes) {
|
|
|
48
48
|
// timeout : 0, // number - Test timeout in seconds
|
|
49
49
|
// slowMo: 0, // number - Slow down test execution (Default: 0 seconds)
|
|
50
50
|
// parallel: 0, // number - Number of parallel workers
|
|
51
|
+
// reportSuccess: false, // boolean - Add screenshots and video records to report also for success test cases
|
|
51
52
|
// format: [], // string[] - Formatter names/paths
|
|
52
53
|
// formatOptions: {}, // object - Formatter options
|
|
53
54
|
// retry: 0, // number - Retry attempts for failing tests
|
package/src/hooks/hooks.js
CHANGED
|
@@ -78,7 +78,7 @@ AfterStep(async function ({ pickleStep }) {
|
|
|
78
78
|
});
|
|
79
79
|
|
|
80
80
|
After(async function ({ pickle, result }) {
|
|
81
|
-
if (result?.status
|
|
81
|
+
if (process.env.REPORT_SUCCESS || result?.status !== Status.PASSED) {
|
|
82
82
|
let img = await context.page.screenshot({
|
|
83
83
|
path: `./test-results/visualReport/${pickle.name}/${pickle.name}.png`,
|
|
84
84
|
type: "png",
|
|
@@ -119,7 +119,10 @@ After(async function ({ pickle, result }) {
|
|
|
119
119
|
|
|
120
120
|
await context.request?.dispose();
|
|
121
121
|
|
|
122
|
-
if (
|
|
122
|
+
if (
|
|
123
|
+
(process.env.REPORT_SUCCESS || result?.status !== Status.PASSED) &&
|
|
124
|
+
context.page.video()
|
|
125
|
+
) {
|
|
123
126
|
const videoPath = await context.page.video().path();
|
|
124
127
|
await new Promise((resolve) => setTimeout(resolve, 1000));
|
|
125
128
|
|
|
@@ -131,27 +134,29 @@ After(async function ({ pickle, result }) {
|
|
|
131
134
|
});
|
|
132
135
|
|
|
133
136
|
AfterAll(async function () {
|
|
134
|
-
|
|
135
|
-
|
|
136
|
-
|
|
137
|
-
|
|
138
|
-
|
|
139
|
-
|
|
140
|
-
|
|
141
|
-
|
|
142
|
-
|
|
143
|
-
|
|
144
|
-
|
|
145
|
-
if (
|
|
146
|
-
|
|
147
|
-
|
|
148
|
-
|
|
149
|
-
|
|
150
|
-
|
|
151
|
-
|
|
152
|
-
|
|
153
|
-
|
|
154
|
-
|
|
137
|
+
if (fs.existsSync(statusDir)) {
|
|
138
|
+
const files = fs.readdirSync(statusDir);
|
|
139
|
+
const passedCount = files.filter(
|
|
140
|
+
(file) => file.split("-")[0] === "PASSED",
|
|
141
|
+
).length;
|
|
142
|
+
const totalTests = files.length;
|
|
143
|
+
|
|
144
|
+
const successPercentage = (passedCount / totalTests) * 100;
|
|
145
|
+
const successRate =
|
|
146
|
+
successPercentage.toFixed(2) >= cucumberConfig.default.testPercentage;
|
|
147
|
+
|
|
148
|
+
if (!isNaN(successPercentage)) {
|
|
149
|
+
if (successRate) {
|
|
150
|
+
console.log(
|
|
151
|
+
`Tests passed required ${cucumberConfig.default.testPercentage}% success rate with ${successPercentage.toFixed(2)}% !`,
|
|
152
|
+
);
|
|
153
|
+
process.env.EXIT_CODE = 0;
|
|
154
|
+
} else {
|
|
155
|
+
console.log(
|
|
156
|
+
`Tests failed at required ${cucumberConfig.default.testPercentage}% success rate with ${successPercentage.toFixed(2)}%!`,
|
|
157
|
+
);
|
|
158
|
+
process.env.EXIT_CODE = 1;
|
|
159
|
+
}
|
|
155
160
|
}
|
|
156
161
|
}
|
|
157
162
|
});
|