artes 1.2.22 → 1.2.23

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` |
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.23",
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
@@ -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,7 +8,7 @@ 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
+ spawnSync("cucumber-js", ["--config=cucumber.config.js", `${process.env.RERUN ? path.join("../../", process.env.RERUN) : ""}`], {
11
12
  cwd: moduleConfig.modulePath,
12
13
  stdio: "inherit",
13
14
  shell: true,
@@ -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 = {
@@ -173,7 +173,7 @@ if((cucumberConfig.default.reportWithTrace || cucumberConfig.default.trace)){
173
173
 
174
174
 
175
175
  if (
176
- (cucumberConfig.default.reportWithTrace || cucumberConfig.default.trace) && shouldReport
176
+ (cucumberConfig.default.reportWithTrace || cucumberConfig.default.trace) && shouldReport && context.page.url() !== "about:blank"
177
177
  ) {
178
178
  await context.browserContext.tracing.stop({
179
179
  path: tracePath,
@@ -234,19 +234,24 @@ AfterAll(async () => {
234
234
  const totalTests = files.length;
235
235
  const successPercentage = (passedCount / totalTests) * 100;
236
236
 
237
+ const failed = files.filter((f) => f.split("-")[0] === "FAILED").length;
238
+
239
+ if (failed > 0 ){
240
+ spawnSync("mv", ["@rerun.txt", moduleConfig.projectPath], {
241
+ cwd: path.join(moduleConfig.projectPath, "node_modules", "artes"),
242
+ stdio: "ignore",
243
+ shell: true,
244
+ });
245
+ }
246
+
247
+
237
248
  if (cucumberConfig.default.testPercentage !== undefined) {
238
- const meetsThreshold =
239
- successPercentage >= cucumberConfig.default.testPercentage;
249
+ const meetsThreshold = successPercentage >= cucumberConfig.default.testPercentage;
240
250
 
241
251
  if (meetsThreshold) {
242
- console.log(
243
- `✅ Tests passed required ${cucumberConfig.default.testPercentage}% success rate with ${successPercentage.toFixed(2)}%!`,
244
- );
252
+ console.log(`✅ Tests passed required ${cucumberConfig.default.testPercentage}% success rate with ${successPercentage.toFixed(2)}%!`);
245
253
  fs.writeFileSync(path.join(process.cwd(), "EXIT_CODE.txt"), "0");
246
- } else {
247
- console.log(
248
- `❌ Tests failed required ${cucumberConfig.default.testPercentage}% success rate with ${successPercentage.toFixed(2)}%!`,
249
- );
254
+ } else {console.log(`❌ Tests failed required ${cucumberConfig.default.testPercentage}% success rate with ${successPercentage.toFixed(2)}%!`,);
250
255
  fs.writeFileSync(path.join(process.cwd(), "EXIT_CODE.txt"), "1");
251
256
  }
252
257
  }