artes 1.2.23 β 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 -1
- package/cucumber.config.js +9 -5
- package/docs/functionDefinitions.md +3 -0
- package/executer.js +1 -1
- package/package.json +1 -1
- package/src/helper/executers/projectCreator.js +1 -5
- package/src/helper/executers/reportGenerator.js +1 -3
- package/src/helper/executers/testRunner.js +17 -10
- package/src/hooks/hooks.js +34 -21
- package/src/stepDefinitions/API.steps.js +0 -1
package/README.md
CHANGED
|
@@ -122,7 +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
|
|
125
|
+
| π `--rerun` | Rerun only the failed tests from previous run | `artes --rerun @rerun.txt` |
|
|
126
126
|
| π `--dryRun` | Perform a dry run without executing tests | `artes --dryRun` |
|
|
127
127
|
| π `--percentage` | Set minimum success percentage to pass test run (default is 0) | `artes --percentage 85` |
|
|
128
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
|
@@ -111,7 +111,7 @@ flags.parallel ? (process.env.PARALLEL = parallel) : "";
|
|
|
111
111
|
|
|
112
112
|
flags.retry ? (process.env.RETRY = retry) : "";
|
|
113
113
|
|
|
114
|
-
flags.rerun ? (
|
|
114
|
+
flags.rerun ? (process.env.RERUN = rerun) : "";
|
|
115
115
|
|
|
116
116
|
flags.dryRun ? (process.env.DRYRUN = flags.dryRun) : "";
|
|
117
117
|
|
package/package.json
CHANGED
|
@@ -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;
|
|
@@ -8,17 +8,24 @@ function runTests() {
|
|
|
8
8
|
process.env.FORCE_COLOR = "1";
|
|
9
9
|
process.env.FORCE_STDIO_TTY = "1";
|
|
10
10
|
|
|
11
|
-
spawnSync(
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
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
|
+
},
|
|
20
27
|
},
|
|
21
|
-
|
|
28
|
+
);
|
|
22
29
|
console.log("β
Tests running completed successfully!");
|
|
23
30
|
} catch (error) {
|
|
24
31
|
console.error("β Test execution failed:", error);
|
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
|
}
|
|
@@ -236,22 +244,27 @@ AfterAll(async () => {
|
|
|
236
244
|
|
|
237
245
|
const failed = files.filter((f) => f.split("-")[0] === "FAILED").length;
|
|
238
246
|
|
|
239
|
-
if (failed
|
|
247
|
+
if (failed > 0) {
|
|
240
248
|
spawnSync("mv", ["@rerun.txt", moduleConfig.projectPath], {
|
|
241
249
|
cwd: path.join(moduleConfig.projectPath, "node_modules", "artes"),
|
|
242
250
|
stdio: "ignore",
|
|
243
251
|
shell: true,
|
|
244
252
|
});
|
|
245
253
|
}
|
|
246
|
-
|
|
247
254
|
|
|
248
255
|
if (cucumberConfig.default.testPercentage !== undefined) {
|
|
249
|
-
const meetsThreshold =
|
|
256
|
+
const meetsThreshold =
|
|
257
|
+
successPercentage >= cucumberConfig.default.testPercentage;
|
|
250
258
|
|
|
251
259
|
if (meetsThreshold) {
|
|
252
|
-
console.log(
|
|
260
|
+
console.log(
|
|
261
|
+
`β
Tests passed required ${cucumberConfig.default.testPercentage}% success rate with ${successPercentage.toFixed(2)}%!`,
|
|
262
|
+
);
|
|
253
263
|
fs.writeFileSync(path.join(process.cwd(), "EXIT_CODE.txt"), "0");
|
|
254
|
-
} else {
|
|
264
|
+
} else {
|
|
265
|
+
console.log(
|
|
266
|
+
`β Tests failed required ${cucumberConfig.default.testPercentage}% success rate with ${successPercentage.toFixed(2)}%!`,
|
|
267
|
+
);
|
|
255
268
|
fs.writeFileSync(path.join(process.cwd(), "EXIT_CODE.txt"), "1");
|
|
256
269
|
}
|
|
257
270
|
}
|