artes 1.0.79 → 1.0.81

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
@@ -42,21 +42,21 @@ npx artes [options]
42
42
 
43
43
  ### Options
44
44
 
45
- | Option | Description | Usage Example |
46
- | ------------------- | ------------------------------------------------------------- | ------------------------------------------------- |
47
- | 🆘 `-h, --help` | Show the usage options | `artes -h` or `artes --help` |
48
- | 🏷️ `-v, --version` | Show the current version of Artes | `artes -v` or `artes --version` |
49
- | 🏗️ `-c, --create` | Create an example project with Artes | `artes -c` or `artes --create` |
50
- | ✅ `-y, --yes` | Skip the confirmation prompt when creating an example project | `artes -c -y` or `artes --create --yes` |
51
- | 📊 `-r, --report` | Run tests and generate Allure report | `artes -r` or `artes --report` |
52
- | 📁 `--features` | Specify one or more feature files' relative paths to run (comma-separated) | `artes --features "tests/features/Alma, tests/features/Banan.feature"` |
53
- | 🔖 `--tags` | Run tests with specified Cucumber tags | `artes --tags "@smoke or @wip"` |
54
- | 🌐 `--env` | Set the environment for the test run | `artes --env "dev"` |
55
- | 🕶️ `--headless` | Run browser in headless mode | `artes --headless` |
56
- | ⚡ `--parallel` | Run tests in parallel mode | `artes --parallel 2` |
57
- | 🔁 `--retry` | Retry failed tests | `artes --retry 3` |
58
- | 🎭 `--dryrun` | Perform a dry run without executing tests | `artes --dryrun` |
59
- | 📈 `--percentage` | Set minimum success percentage to pass test run | `artes --percentage 85` |
45
+ | Option | Description | Usage Example |
46
+ | ------------------ | -------------------------------------------------------------------------- | ---------------------------------------------------------------------- |
47
+ | 🆘 `-h, --help` | Show the usage options | `artes -h` or `artes --help` |
48
+ | 🏷️ `-v, --version` | Show the current version of Artes | `artes -v` or `artes --version` |
49
+ | 🏗️ `-c, --create` | Create an example project with Artes | `artes -c` or `artes --create` |
50
+ | ✅ `-y, --yes` | Skip the confirmation prompt when creating an example project | `artes -c -y` or `artes --create --yes` |
51
+ | 📊 `-r, --report` | Run tests and generate Allure report | `artes -r` or `artes --report` |
52
+ | 📁 `--features` | Specify one or more feature files' relative paths to run (comma-separated) | `artes --features "tests/features/Alma, tests/features/Banan.feature"` |
53
+ | 🔖 `--tags` | Run tests with specified Cucumber tags | `artes --tags "@smoke or @wip"` |
54
+ | 🌐 `--env` | Set the environment for the test run | `artes --env "dev"` |
55
+ | 🕶️ `--headless` | Run browser in headless mode | `artes --headless` |
56
+ | ⚡ `--parallel` | Run tests in parallel mode | `artes --parallel 2` |
57
+ | 🔁 `--retry` | Retry failed tests | `artes --retry 3` |
58
+ | 🎭 `--dryrun` | Perform a dry run without executing tests | `artes --dryrun` |
59
+ | 📈 `--percentage` | Set minimum success percentage to pass test run(default is 0) | `artes --percentage 85` |
60
60
 
61
61
  \*\* To just run the tests: <br>
62
62
  Globally: artes <br>
@@ -277,39 +277,38 @@ Then("User should see the login form", async () => {
277
277
 
278
278
  You can configure Artes by editing the `artes.config.js` file. Below are the default configuration options with explanations:
279
279
 
280
-
281
- | **Option** | **Default Value** | **Description** |
282
- | ----------------- | ---------------------------------------------------- | ----------------------------------------------------- |
283
- | `timeout` | `30` | Default timeout in milliseconds. |
284
- | `paths` | `[moduleConfig.featuresPath]` | Paths to feature files. |
280
+ | **Option** | **Default Value** | **Description** |
281
+ | ----------------- | ---------------------------------------------------------------------------- | ----------------------------------- |
282
+ | `timeout` | `30` | Default timeout in milliseconds. |
283
+ | `paths` | `[moduleConfig.featuresPath]` | Paths to feature files. |
285
284
  | `require` | `[moduleConfig.stepsPath, "src/stepDefinitions/*.js", "src/hooks/hooks.js"]` | Support code paths (CommonJS). |
286
- | `pomPath` | `moduleConfig.pomPath` | Path to Page Object Models. |
287
- | `import` | `[]` | Support code paths. |
288
- | `format` | `["rerun:@rerun.txt", "allure-cucumberjs/reporter"]` | Formatter names/paths. |
289
- | `formatOptions` | `{ "resultsDir": "allure-result" }` | Formatter options. |
290
- | `parallel` | `1` | Number of parallel workers. |
291
- | `dryRun` | `false` | Prepare test run without execution. |
292
- | `failFast` | `false` | Stop on first test failure. |
293
- | `forceExit` | `false` | Force `process.exit()` after tests. |
294
- | `strict` | `true` | Fail on pending steps. |
295
- | `backtrace` | `false` | Show full backtrace for errors. |
296
- | `tags` | `""` | Tag expression to filter scenarios. |
297
- | `name` | `[]` | Run scenarios matching regex. |
298
- | `order` | `"defined"` | Run order (defined/random). |
299
- | `language` | `"en"` | Default feature file language. |
300
- | `loader` | `[]` | Module loader specifications. |
301
- | `requireModule` | `[]` | Transpilation module names. |
302
- | `retry` | `0` | Retry attempts for failing tests. |
303
- | `retryTagFilter` | `""` | Tag expression for retries. |
304
- | `publish` | `false` | Publish to cucumber.io. |
305
- | `worldParameters` | `{}` | Custom world parameters. |
285
+ | `pomPath` | `moduleConfig.pomPath` | Path to Page Object Models. |
286
+ | `import` | `[]` | Support code paths. |
287
+ | `format` | `["rerun:@rerun.txt", "allure-cucumberjs/reporter"]` | Formatter names/paths. |
288
+ | `formatOptions` | `{ "resultsDir": "allure-result" }` | Formatter options. |
289
+ | `parallel` | `1` | Number of parallel workers. |
290
+ | `dryRun` | `false` | Prepare test run without execution. |
291
+ | `failFast` | `false` | Stop on first test failure. |
292
+ | `forceExit` | `false` | Force `process.exit()` after tests. |
293
+ | `strict` | `true` | Fail on pending steps. |
294
+ | `backtrace` | `false` | Show full backtrace for errors. |
295
+ | `tags` | `""` | Tag expression to filter scenarios. |
296
+ | `name` | `[]` | Run scenarios matching regex. |
297
+ | `order` | `"defined"` | Run order (defined/random). |
298
+ | `language` | `"en"` | Default feature file language. |
299
+ | `loader` | `[]` | Module loader specifications. |
300
+ | `requireModule` | `[]` | Transpilation module names. |
301
+ | `retry` | `0` | Retry attempts for failing tests. |
302
+ | `retryTagFilter` | `""` | Tag expression for retries. |
303
+ | `publish` | `false` | Publish to cucumber.io. |
304
+ | `worldParameters` | `{}` | Custom world parameters. |
306
305
 
307
306
  ### Environment Configuration
308
307
 
309
- | **Option** | **Default Value** | **Description** |
310
- | ----------- | ----------------- | ---------------------------------- |
311
- | `env` | `""` | Environment configuration. Should match the name with the baseURL object, like "dev" |
312
- | `baseURL` | `""` | Base URL for API requests. Can be object {"dev":"dev-api.com", "pre":"pre-api.com"}, or string "dev-api.com" |
308
+ | **Option** | **Default Value** | **Description** |
309
+ | ---------- | ----------------- | ------------------------------------------------------------------------------------------------------------ |
310
+ | `env` | `""` | Environment configuration. Should match the name with the baseURL object, like "dev" |
311
+ | `baseURL` | `""` | Base URL for API requests. Can be object {"dev":"dev-api.com", "pre":"pre-api.com"}, or string "dev-api.com" |
313
312
 
314
313
  ---
315
314
 
@@ -17,7 +17,9 @@ try {
17
17
  module.exports = {
18
18
  default: {
19
19
  // File paths and patterns
20
- testPercentage: process.env.PERCENTAGE ? process.env.PERCENTAGE : artesConfig.testPercentage || 0, // number - Percentage of tests to run (0-100)
20
+ testPercentage: process.env.PERCENTAGE
21
+ ? process.env.PERCENTAGE
22
+ : artesConfig.testPercentage || 0, // number - Percentage of tests to run (0-100)
21
23
  timeout: artesConfig.timeout || 30, // Default timeout in milliseconds
22
24
  paths: process.env.FEATURES
23
25
  ? [path.join(moduleConfig.projectPath, process.env.FEATURES)]
package/executer.js CHANGED
@@ -25,7 +25,7 @@ const flags = {
25
25
  parallel: args.includes("--parallel"),
26
26
  retry: args.includes("--retry"),
27
27
  dryrun: args.includes("--dryrun"),
28
- percentage: args.includes("--percentage")
28
+ percentage: args.includes("--percentage"),
29
29
  };
30
30
 
31
31
  function main() {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "artes",
3
- "version": "1.0.79",
3
+ "version": "1.0.81",
4
4
  "description": "The simplest way to automate UI and API tests using Cucumber-style steps.",
5
5
  "main": "index.js",
6
6
  "scripts": {
@@ -55,8 +55,8 @@ function runTests(args, flags) {
55
55
  CI: "false",
56
56
  },
57
57
  });
58
-
59
- console.log("✅ Tests completed successfully!");
58
+ console.log("✅ Tests running completed successfully!");
59
+ process.exit(result.status);
60
60
  } catch (error) {
61
61
  console.error("❌ Test execution failed:", error);
62
62
  process.exit(1);
@@ -17,6 +17,9 @@ const fs = require("fs");
17
17
  const { moduleConfig } = require("artes/src/helper/imports/commons");
18
18
  const path = require("path");
19
19
 
20
+ let totalTests = 0;
21
+ let testsFailed = 0;
22
+
20
23
  setDefaultTimeout(cucumberConfig.default.timeout * 1000);
21
24
 
22
25
  BeforeAll(async function () {
@@ -24,6 +27,7 @@ BeforeAll(async function () {
24
27
  });
25
28
 
26
29
  Before(async function () {
30
+ totalTests++;
27
31
  context.vars = {};
28
32
 
29
33
  const { browser, context: browserContext } = await invokeBrowser();
@@ -77,6 +81,7 @@ AfterStep(async function ({ pickleStep }) {
77
81
 
78
82
  After(async function ({ pickle, result }) {
79
83
  if (result?.status != Status.PASSED) {
84
+ testsFailed++;
80
85
  let img = await context.page.screenshot({
81
86
  path: `./test-results/visualReport/${pickle.name}/${pickle.name}.png`,
82
87
  type: "png",
@@ -124,16 +129,17 @@ After(async function ({ pickle, result }) {
124
129
  AfterAll(async function () {
125
130
  const successPercentage = 100 - (testsFailed / totalTests) * 100;
126
131
  const successRate =
127
- successPercentage.toFixed(2) >= cucumberConfig.testPercentage;
128
- if (!isNaN(successPercentage)) {
132
+ successPercentage.toFixed(2) >= cucumberConfig.default.testPercentage;
133
+
134
+ if (!isNaN(successPercentage)) {
129
135
  if (successRate) {
130
136
  console.log(
131
- `Tests passed with ${successPercentage.toFixed(2)}% results!`,
137
+ `Tests passed required ${cucumberConfig.default.testPercentage}% success rate with ${successPercentage.toFixed(2)}% !`,
132
138
  );
133
139
  process.exit(0);
134
140
  } else {
135
141
  console.log(
136
- `Tests failed with ${successPercentage.toFixed(2)}% results!`,
142
+ `Tests failed at required ${cucumberConfig.default.testPercentage}% success rate with ${successPercentage.toFixed(2)}%!`,
137
143
  );
138
144
  process.exit(1);
139
145
  }