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 +43 -44
- package/cucumber.config.js +3 -1
- package/executer.js +1 -1
- package/package.json +1 -1
- package/src/helper/executers/testRunner.js +2 -2
- package/src/hooks/hooks.js +10 -4
package/README.md
CHANGED
|
@@ -42,21 +42,21 @@ npx artes [options]
|
|
|
42
42
|
|
|
43
43
|
### Options
|
|
44
44
|
|
|
45
|
-
| Option
|
|
46
|
-
|
|
|
47
|
-
| 🆘 `-h, --help`
|
|
48
|
-
| 🏷️ `-v, --version`
|
|
49
|
-
| 🏗️ `-c, --create`
|
|
50
|
-
| ✅ `-y, --yes`
|
|
51
|
-
| 📊 `-r, --report`
|
|
52
|
-
| 📁 `--features`
|
|
53
|
-
| 🔖 `--tags`
|
|
54
|
-
| 🌐 `--env`
|
|
55
|
-
| 🕶️ `--headless`
|
|
56
|
-
| ⚡ `--parallel`
|
|
57
|
-
| 🔁 `--retry`
|
|
58
|
-
| 🎭 `--dryrun`
|
|
59
|
-
| 📈 `--percentage`
|
|
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
|
-
|
|
|
282
|
-
|
|
|
283
|
-
| `
|
|
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`
|
|
287
|
-
| `import` | `[]`
|
|
288
|
-
| `format` | `["rerun:@rerun.txt", "allure-cucumberjs/reporter"]`
|
|
289
|
-
| `formatOptions` | `{ "resultsDir": "allure-result" }`
|
|
290
|
-
| `parallel` | `1`
|
|
291
|
-
| `dryRun` | `false`
|
|
292
|
-
| `failFast` | `false`
|
|
293
|
-
| `forceExit` | `false`
|
|
294
|
-
| `strict` | `true`
|
|
295
|
-
| `backtrace` | `false`
|
|
296
|
-
| `tags` | `""`
|
|
297
|
-
| `name` | `[]`
|
|
298
|
-
| `order` | `"defined"`
|
|
299
|
-
| `language` | `"en"`
|
|
300
|
-
| `loader` | `[]`
|
|
301
|
-
| `requireModule` | `[]`
|
|
302
|
-
| `retry` | `0`
|
|
303
|
-
| `retryTagFilter` | `""`
|
|
304
|
-
| `publish` | `false`
|
|
305
|
-
| `worldParameters` | `{}`
|
|
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**
|
|
310
|
-
|
|
|
311
|
-
| `env`
|
|
312
|
-
| `baseURL`
|
|
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
|
|
package/cucumber.config.js
CHANGED
|
@@ -17,7 +17,9 @@ try {
|
|
|
17
17
|
module.exports = {
|
|
18
18
|
default: {
|
|
19
19
|
// File paths and patterns
|
|
20
|
-
testPercentage: process.env.PERCENTAGE
|
|
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
package/package.json
CHANGED
|
@@ -55,8 +55,8 @@ function runTests(args, flags) {
|
|
|
55
55
|
CI: "false",
|
|
56
56
|
},
|
|
57
57
|
});
|
|
58
|
-
|
|
59
|
-
|
|
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);
|
package/src/hooks/hooks.js
CHANGED
|
@@ -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
|
-
|
|
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)}%
|
|
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)}
|
|
142
|
+
`Tests failed at required ${cucumberConfig.default.testPercentage}% success rate with ${successPercentage.toFixed(2)}%!`,
|
|
137
143
|
);
|
|
138
144
|
process.exit(1);
|
|
139
145
|
}
|