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 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 | `artes --rerun @rerun.txt`|
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` |
@@ -90,11 +90,15 @@ module.exports = {
90
90
  ? true
91
91
  : artesConfig.reportSuccess || false, // Include successful tests in report
92
92
 
93
- trace: process.env.TRACE === "true" ? process.env.TRACE : artesConfig.trace || false, // Enable tracing
94
-
95
- reportWithTrace: process.env.REPORT_WITH_TRACE === "true"
96
- ? process.env.REPORT_WITH_TRACE
97
- : artesConfig.reportWithTrace || false, // Include trace in report
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 ? ( process.env.RERUN = 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
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "artes",
3
- "version": "1.2.23",
3
+ "version": "1.2.24",
4
4
  "description": "The simplest way to automate UI and API tests using Cucumber-style steps.",
5
5
  "main": "index.js",
6
6
  "scripts": {
@@ -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("cucumber-js", ["--config=cucumber.config.js", `${process.env.RERUN ? path.join("../../", process.env.RERUN) : ""}`], {
12
- cwd: moduleConfig.modulePath,
13
- stdio: "inherit",
14
- shell: true,
15
- env: {
16
- ...process.env,
17
- FORCE_TTY: "1",
18
- FORCE_COLOR: "1",
19
- CI: "false",
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);
@@ -103,7 +103,7 @@ Before(async function () {
103
103
 
104
104
  await context.page.setDefaultTimeout(cucumberConfig.default.timeout);
105
105
 
106
- if ( cucumberConfig.default.reportWithTrace || cucumberConfig.default.trace) {
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
- (cucumberConfig.default.successReport ||
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((cucumberConfig.default.reportWithTrace || cucumberConfig.default.trace)){
168
- var tracePath = path.join(
169
- moduleConfig.projectPath,
170
- `./traces/${pickle.name.replaceAll(" ", "_")}.zip`,
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) && shouldReport && context.page.url() !== "about:blank"
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("npx", ["rimraf", "--no-glob", path.join(moduleConfig.projectPath, "./traces")], {
192
- cwd: moduleConfig.projectPath,
193
- stdio: "inherit",
194
- shell: false,
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 > 0 ){
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 = successPercentage >= cucumberConfig.default.testPercentage;
256
+ const meetsThreshold =
257
+ successPercentage >= cucumberConfig.default.testPercentage;
250
258
 
251
259
  if (meetsThreshold) {
252
- console.log(`βœ… Tests passed required ${cucumberConfig.default.testPercentage}% success rate with ${successPercentage.toFixed(2)}%!`);
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 {console.log(`❌ Tests failed required ${cucumberConfig.default.testPercentage}% success rate with ${successPercentage.toFixed(2)}%!`,);
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
  }
@@ -7,7 +7,6 @@ const {
7
7
  random,
8
8
  } = require("../helper/imports/commons");
9
9
  const { api } = require("../helper/stepFunctions/exporter");
10
- const Ajv = require("ajv");
11
10
 
12
11
  When("User sends GET request to {string}", async function (url) {
13
12
  await api.get(url);