artes 1.2.22 β 1.2.24
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 +9 -5
- package/docs/functionDefinitions.md +3 -0
- package/executer.js +4 -0
- package/package.json +1 -1
- package/src/helper/executers/helper.js +3 -0
- package/src/helper/executers/projectCreator.js +1 -5
- package/src/helper/executers/reportGenerator.js +1 -3
- package/src/helper/executers/testRunner.js +18 -10
- package/src/helper/imports/commons.js +1 -1
- package/src/hooks/hooks.js +34 -16
- package/src/stepDefinitions/API.steps.js +0 -1
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
|
@@ -90,11 +90,15 @@ module.exports = {
|
|
|
90
90
|
? true
|
|
91
91
|
: artesConfig.reportSuccess || false, // Include successful tests in report
|
|
92
92
|
|
|
93
|
-
trace:
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
93
|
+
trace:
|
|
94
|
+
process.env.TRACE === "true"
|
|
95
|
+
? process.env.TRACE
|
|
96
|
+
: artesConfig.trace || false, // Enable tracing
|
|
97
|
+
|
|
98
|
+
reportWithTrace:
|
|
99
|
+
process.env.REPORT_WITH_TRACE === "true"
|
|
100
|
+
? process.env.REPORT_WITH_TRACE
|
|
101
|
+
: artesConfig.reportWithTrace || false, // Include trace in report
|
|
98
102
|
|
|
99
103
|
format: finalFormats, // Formatter names/paths
|
|
100
104
|
formatOptions: artesConfig.formatOptions || {
|
|
@@ -434,6 +434,7 @@ await getURL();
|
|
|
434
434
|
```
|
|
435
435
|
|
|
436
436
|
- **Returns**:
|
|
437
|
+
|
|
437
438
|
- _(string)_: The current page URL.
|
|
438
439
|
|
|
439
440
|
***
|
|
@@ -655,6 +656,7 @@ await shouldHaveId("#element-id", "unique-id");
|
|
|
655
656
|
```
|
|
656
657
|
|
|
657
658
|
- **Parameters**:
|
|
659
|
+
|
|
658
660
|
- `id` _(string)_: The expected ID.
|
|
659
661
|
|
|
660
662
|
Got it! Hereβs the refined format for the assertion methods:
|
|
@@ -1542,6 +1544,7 @@ await shouldObjectContaining(".element", { key: "value" });
|
|
|
1542
1544
|
```
|
|
1543
1545
|
|
|
1544
1546
|
- **Parameters**:
|
|
1547
|
+
|
|
1545
1548
|
- `selector` _(string)_: The CSS selector for the element.
|
|
1546
1549
|
- `properties` _(object)_: The object properties to check for.
|
|
1547
1550
|
|
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
|
|
@@ -23,7 +23,7 @@ function createProject(createYes, noDeps) {
|
|
|
23
23
|
});
|
|
24
24
|
|
|
25
25
|
if (!noDeps) {
|
|
26
|
-
execSync("npm i artes", { cwd: projectDir, stdio: "inherit" });
|
|
26
|
+
execSync("npm i artes@latest", { cwd: projectDir, stdio: "inherit" });
|
|
27
27
|
console.log("π¦ Setting up browsers...");
|
|
28
28
|
execSync("npx playwright install", { cwd: projectDir, stdio: "inherit" });
|
|
29
29
|
}
|
|
@@ -40,10 +40,6 @@ function createProject(createYes, noDeps) {
|
|
|
40
40
|
testWithReport: "npx artes -r",
|
|
41
41
|
};
|
|
42
42
|
|
|
43
|
-
packageJson.dependencies = {
|
|
44
|
-
artes: "1.2.21",
|
|
45
|
-
};
|
|
46
|
-
|
|
47
43
|
fs.writeFileSync(packageJsonPath, JSON.stringify(packageJson, null, 2));
|
|
48
44
|
|
|
49
45
|
const config = `module.exports = {
|
|
@@ -29,7 +29,6 @@ function generateReport() {
|
|
|
29
29
|
`π Report generated successfully in ${moduleConfig.reportPath}!`,
|
|
30
30
|
);
|
|
31
31
|
|
|
32
|
-
|
|
33
32
|
if (fs.existsSync(moduleConfig.reportPath) && process.env.ZIP === "true") {
|
|
34
33
|
console.log(`ποΈ Zipping report folder`);
|
|
35
34
|
|
|
@@ -61,8 +60,7 @@ function generateReport() {
|
|
|
61
60
|
|
|
62
61
|
console.log(`ποΈ Zipped in ${moduleConfig.reportPath}/report.zip!`);
|
|
63
62
|
if (error) throw error;
|
|
64
|
-
}
|
|
65
|
-
|
|
63
|
+
}
|
|
66
64
|
} catch (err) {
|
|
67
65
|
console.error("β Report generation failed:", err);
|
|
68
66
|
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,17 +8,24 @@ function runTests() {
|
|
|
7
8
|
process.env.FORCE_COLOR = "1";
|
|
8
9
|
process.env.FORCE_STDIO_TTY = "1";
|
|
9
10
|
|
|
10
|
-
spawnSync(
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
11
|
+
spawnSync(
|
|
12
|
+
"cucumber-js",
|
|
13
|
+
[
|
|
14
|
+
"--config=cucumber.config.js",
|
|
15
|
+
`${process.env.RERUN ? path.join("../../", process.env.RERUN) : ""}`,
|
|
16
|
+
],
|
|
17
|
+
{
|
|
18
|
+
cwd: moduleConfig.modulePath,
|
|
19
|
+
stdio: "inherit",
|
|
20
|
+
shell: true,
|
|
21
|
+
env: {
|
|
22
|
+
...process.env,
|
|
23
|
+
FORCE_TTY: "1",
|
|
24
|
+
FORCE_COLOR: "1",
|
|
25
|
+
CI: "false",
|
|
26
|
+
},
|
|
19
27
|
},
|
|
20
|
-
|
|
28
|
+
);
|
|
21
29
|
console.log("β
Tests running completed successfully!");
|
|
22
30
|
} catch (error) {
|
|
23
31
|
console.error("β Test execution failed:", error);
|
|
@@ -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,7 +103,7 @@ Before(async function () {
|
|
|
103
103
|
|
|
104
104
|
await context.page.setDefaultTimeout(cucumberConfig.default.timeout);
|
|
105
105
|
|
|
106
|
-
if (
|
|
106
|
+
if (cucumberConfig.default.reportWithTrace || cucumberConfig.default.trace) {
|
|
107
107
|
await browserContext.tracing.start({
|
|
108
108
|
sources: true,
|
|
109
109
|
screenshots: true,
|
|
@@ -142,8 +142,7 @@ After(async function ({ pickle, result }) {
|
|
|
142
142
|
}
|
|
143
143
|
|
|
144
144
|
const shouldReport =
|
|
145
|
-
|
|
146
|
-
result?.status !== Status.PASSED)
|
|
145
|
+
cucumberConfig.default.successReport || result?.status !== Status.PASSED;
|
|
147
146
|
|
|
148
147
|
if (shouldReport) {
|
|
149
148
|
const screenshotPath = path.join(
|
|
@@ -164,16 +163,17 @@ After(async function ({ pickle, result }) {
|
|
|
164
163
|
}
|
|
165
164
|
|
|
166
165
|
saveTestStatus(result, pickle);
|
|
167
|
-
if(
|
|
168
|
-
|
|
169
|
-
|
|
170
|
-
|
|
171
|
-
|
|
172
|
-
}
|
|
173
|
-
|
|
166
|
+
if (cucumberConfig.default.reportWithTrace || cucumberConfig.default.trace) {
|
|
167
|
+
var tracePath = path.join(
|
|
168
|
+
moduleConfig.projectPath,
|
|
169
|
+
`./traces/${pickle.name.replaceAll(" ", "_")}.zip`,
|
|
170
|
+
);
|
|
171
|
+
}
|
|
174
172
|
|
|
175
173
|
if (
|
|
176
|
-
(cucumberConfig.default.reportWithTrace || cucumberConfig.default.trace) &&
|
|
174
|
+
(cucumberConfig.default.reportWithTrace || cucumberConfig.default.trace) &&
|
|
175
|
+
shouldReport &&
|
|
176
|
+
context.page.url() !== "about:blank"
|
|
177
177
|
) {
|
|
178
178
|
await context.browserContext.tracing.stop({
|
|
179
179
|
path: tracePath,
|
|
@@ -188,11 +188,19 @@ if((cucumberConfig.default.reportWithTrace || cucumberConfig.default.trace)){
|
|
|
188
188
|
});
|
|
189
189
|
|
|
190
190
|
if (!cucumberConfig.default.trace) {
|
|
191
|
-
spawnSync(
|
|
192
|
-
|
|
193
|
-
|
|
194
|
-
|
|
195
|
-
|
|
191
|
+
spawnSync(
|
|
192
|
+
"npx",
|
|
193
|
+
[
|
|
194
|
+
"rimraf",
|
|
195
|
+
"--no-glob",
|
|
196
|
+
path.join(moduleConfig.projectPath, "./traces"),
|
|
197
|
+
],
|
|
198
|
+
{
|
|
199
|
+
cwd: moduleConfig.projectPath,
|
|
200
|
+
stdio: "inherit",
|
|
201
|
+
shell: false,
|
|
202
|
+
},
|
|
203
|
+
);
|
|
196
204
|
}
|
|
197
205
|
}
|
|
198
206
|
}
|
|
@@ -234,6 +242,16 @@ AfterAll(async () => {
|
|
|
234
242
|
const totalTests = files.length;
|
|
235
243
|
const successPercentage = (passedCount / totalTests) * 100;
|
|
236
244
|
|
|
245
|
+
const failed = files.filter((f) => f.split("-")[0] === "FAILED").length;
|
|
246
|
+
|
|
247
|
+
if (failed > 0) {
|
|
248
|
+
spawnSync("mv", ["@rerun.txt", moduleConfig.projectPath], {
|
|
249
|
+
cwd: path.join(moduleConfig.projectPath, "node_modules", "artes"),
|
|
250
|
+
stdio: "ignore",
|
|
251
|
+
shell: true,
|
|
252
|
+
});
|
|
253
|
+
}
|
|
254
|
+
|
|
237
255
|
if (cucumberConfig.default.testPercentage !== undefined) {
|
|
238
256
|
const meetsThreshold =
|
|
239
257
|
successPercentage >= cucumberConfig.default.testPercentage;
|