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 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` |
@@ -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
@@ -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
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "artes",
3
- "version": "1.2.22",
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": {
@@ -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("cucumber-js", ["--config=cucumber.config.js"], {
11
- cwd: moduleConfig.modulePath,
12
- stdio: "inherit",
13
- shell: true,
14
- env: {
15
- ...process.env,
16
- FORCE_TTY: "1",
17
- FORCE_COLOR: "1",
18
- 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
+ },
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 @rerun.txt testsStatus EXIT_CODE.txt",
38
+ "allure-result allure-results test-results testsStatus EXIT_CODE.txt",
39
39
  };
40
40
 
41
41
  module.exports = {
@@ -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
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
  }
@@ -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;
@@ -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);