artes 1.0.83 โ 1.0.85
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 +21 -15
- package/cucumber.config.js +22 -9
- package/executer.js +72 -31
- package/package.json +1 -1
- package/src/helper/executers/cleaner.js +6 -10
- package/src/helper/executers/helper.js +18 -0
- package/src/helper/executers/projectCreator.js +1 -1
- package/src/helper/executers/reportGenerator.js +6 -10
- package/src/helper/executers/testRunner.js +3 -42
- package/src/helper/imports/commons.js +2 -1
- package/src/hooks/hooks.js +19 -9
package/README.md
CHANGED
|
@@ -42,21 +42,27 @@ npx artes [options]
|
|
|
42
42
|
|
|
43
43
|
### Options
|
|
44
44
|
|
|
45
|
-
| Option
|
|
46
|
-
|
|
|
47
|
-
| ๐ `-h, --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`
|
|
51
|
-
| ๐ `-r, --report`
|
|
52
|
-
| ๐ `--features`
|
|
53
|
-
| ๐ `--tags`
|
|
54
|
-
| ๐ `--env`
|
|
55
|
-
| ๐ถ๏ธ `--headless` | Run browser in headless mode | `artes --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
|
+
| ๐ `--browser` | Specify browser to use (`chromium`, `firefox`, or `webkit`) | `artes --browser chromium` |
|
|
61
|
+
| ๐ `--baseURL` | Set base URL for the tests | `artes --baseURL "https://example.com"` |
|
|
62
|
+
| ๐ฅ๏ธ `--maxScreen` | Maximize browser window on launch | `artes --maxScreen` |
|
|
63
|
+
| ๐ `--width` | Set browser width (default is 1280) | `artes --width 1920` |
|
|
64
|
+
| ๐ `--height` | Set browser height (default is 720) | `artes --height 1080` |
|
|
65
|
+
| โฑ๏ธ `--timeout` | Set timeout for each test step in seconds (default is 30) | `artes --timeout 10` |
|
|
60
66
|
|
|
61
67
|
\*\* To just run the tests: <br>
|
|
62
68
|
Globally: artes <br>
|
package/cucumber.config.js
CHANGED
|
@@ -20,7 +20,9 @@ module.exports = {
|
|
|
20
20
|
testPercentage: process.env.PERCENTAGE
|
|
21
21
|
? Number(process.env.PERCENTAGE)
|
|
22
22
|
: artesConfig.testPercentage || 0, // number - Percentage of tests to run (0-100)
|
|
23
|
-
timeout:
|
|
23
|
+
timeout: process.env.TIMEOUT
|
|
24
|
+
? Number(process.env.TIMEOUT)
|
|
25
|
+
: artesConfig.timeout || 30, // Default timeout in milliseconds
|
|
24
26
|
paths: process.env.FEATURES
|
|
25
27
|
? [path.join(moduleConfig.projectPath, process.env.FEATURES)]
|
|
26
28
|
: artesConfig.features
|
|
@@ -54,7 +56,7 @@ module.exports = {
|
|
|
54
56
|
? Number(process.env.PARALLEL)
|
|
55
57
|
: artesConfig.parallel || 1, // Number of parallel workers
|
|
56
58
|
dryRun: process.env.DRYRUN
|
|
57
|
-
?
|
|
59
|
+
? process.env.DRYRUN
|
|
58
60
|
: artesConfig.dryRun || false, // Prepare test run without execution
|
|
59
61
|
failFast: artesConfig.failFast || false, // Stop on first test failure
|
|
60
62
|
forceExit: artesConfig.forceExit || false, // Force process.exit() after tests
|
|
@@ -75,7 +77,7 @@ module.exports = {
|
|
|
75
77
|
|
|
76
78
|
// Retry logic
|
|
77
79
|
retry: process.env.RETRY
|
|
78
|
-
?
|
|
80
|
+
? Number(process.env.RETRY)
|
|
79
81
|
: artesConfig.retry || 0, // Retry attempts for failing tests
|
|
80
82
|
retryTagFilter: artesConfig.retryTagFilter || "", // Tag expression for retries
|
|
81
83
|
|
|
@@ -86,16 +88,27 @@ module.exports = {
|
|
|
86
88
|
worldParameters: artesConfig.worldParameters || {}, // Custom world parameters
|
|
87
89
|
},
|
|
88
90
|
env: process.env.ENV ? JSON.parse(process.env.ENV) : artesConfig.env || "",
|
|
89
|
-
baseURL:
|
|
91
|
+
baseURL: process.env.BASE_URL
|
|
92
|
+
? JSON.parse(process.env.BASE_URL)
|
|
93
|
+
: artesConfig?.baseURL
|
|
94
|
+
? artesConfig?.baseURL
|
|
95
|
+
: "",
|
|
90
96
|
|
|
91
97
|
browser: {
|
|
92
|
-
browserType:
|
|
98
|
+
browserType: process.env.BROWSER
|
|
99
|
+
? JSON.parse(process.env.BROWSER)
|
|
100
|
+
: artesConfig?.browser || "chrome",
|
|
93
101
|
viewport: {
|
|
94
|
-
width:
|
|
95
|
-
|
|
102
|
+
width: process.env.WIDTH
|
|
103
|
+
? Number(process.env.WIDTH)
|
|
104
|
+
: artesConfig?.width || 1280,
|
|
105
|
+
height: process.env.HEIGHT
|
|
106
|
+
? Number(process.env.HEIGHT)
|
|
107
|
+
: artesConfig?.height || 720,
|
|
96
108
|
},
|
|
97
|
-
maximizeScreen:
|
|
98
|
-
|
|
109
|
+
maximizeScreen: process.env.MAXIMIZE_SCREEN
|
|
110
|
+
? JSON.parse(process.env.MAXIMIZE_SCREEN)
|
|
111
|
+
: artesConfig?.maximizeScreen !== undefined
|
|
99
112
|
? artesConfig.maximizeScreen
|
|
100
113
|
: true,
|
|
101
114
|
headless: process.env.MODE
|
package/executer.js
CHANGED
|
@@ -1,5 +1,4 @@
|
|
|
1
1
|
#!/usr/bin/env node
|
|
2
|
-
|
|
3
2
|
const {
|
|
4
3
|
showHelp,
|
|
5
4
|
showVersion,
|
|
@@ -26,40 +25,82 @@ const flags = {
|
|
|
26
25
|
retry: args.includes("--retry"),
|
|
27
26
|
dryrun: args.includes("--dryrun"),
|
|
28
27
|
percentage: args.includes("--percentage"),
|
|
28
|
+
browser: args.includes("--browser"),
|
|
29
|
+
baseURL: args.includes("--baseURL"),
|
|
30
|
+
maximizeScreen: args.includes("--maxScreen"),
|
|
31
|
+
width: args.includes("--width"),
|
|
32
|
+
height: args.includes("--height"),
|
|
33
|
+
timeout: args.includes("--timeout"),
|
|
29
34
|
};
|
|
30
35
|
|
|
36
|
+
const env = args[args.indexOf("--env") + 1];
|
|
37
|
+
const featureFiles = args[args.indexOf("--features") + 1];
|
|
38
|
+
const features = flags.features && featureFiles;
|
|
39
|
+
const tags = args[args.indexOf("--tags") + 1];
|
|
40
|
+
const parallel = args[args.indexOf("--parallel") + 1];
|
|
41
|
+
const retry = args[args.indexOf("--retry") + 1];
|
|
42
|
+
const percentage = args[args.indexOf("--percentage") + 1];
|
|
43
|
+
const browser = args[args.indexOf("--browser") + 1];
|
|
44
|
+
const baseURL = args[args.indexOf("--baseURL") + 1];
|
|
45
|
+
const width = args[args.indexOf("--width") + 1];
|
|
46
|
+
const height = args[args.indexOf("--height") + 1];
|
|
47
|
+
const timeout = args[args.indexOf("--timeout") + 1];
|
|
48
|
+
|
|
49
|
+
flags.env && console.log("Running env:", env);
|
|
50
|
+
flags.env ? (process.env.ENV = JSON.stringify(env)) : "";
|
|
51
|
+
|
|
52
|
+
flags.report
|
|
53
|
+
? (process.env.REPORT_FORMAT = JSON.stringify([
|
|
54
|
+
"rerun:@rerun.txt",
|
|
55
|
+
"progress-bar",
|
|
56
|
+
"allure-cucumberjs/reporter:./allure-results",
|
|
57
|
+
]))
|
|
58
|
+
: "";
|
|
59
|
+
|
|
60
|
+
flags.tags && console.log("Running tags:", tags);
|
|
61
|
+
flags.tags ? (process.env.RUN_TAGS = JSON.stringify(tags)) : "";
|
|
62
|
+
|
|
63
|
+
flags.features && console.log("Running features:", features);
|
|
64
|
+
flags.features ? (process.env.FEATURES = features) : "";
|
|
65
|
+
|
|
66
|
+
flags.headless &&
|
|
67
|
+
console.log("Running mode:", flags.headless ? "headless" : "headed");
|
|
68
|
+
flags.headless ? (process.env.MODE = JSON.stringify(true)) : false;
|
|
69
|
+
|
|
70
|
+
flags.parallel ? (process.env.PARALLEL = parallel) : "";
|
|
71
|
+
|
|
72
|
+
flags.retry ? (process.env.RETRY = retry) : "";
|
|
73
|
+
|
|
74
|
+
flags.dryrun ? (process.env.DRYRUN = flags.dryrun) : "";
|
|
75
|
+
|
|
76
|
+
flags.percentage ? (process.env.PERCENTAGE = percentage) : "";
|
|
77
|
+
|
|
78
|
+
flags.browser && console.log("Running browser:", browser);
|
|
79
|
+
flags.browser ? (process.env.BROWSER = JSON.stringify(browser)) : "";
|
|
80
|
+
|
|
81
|
+
flags.baseURL ? (process.env.BASE_URL = JSON.stringify(baseURL)) : "";
|
|
82
|
+
|
|
83
|
+
flags.maximizeScreen
|
|
84
|
+
? (process.env.MAXIMIZE_SCREEN = flags.maximizeScreen)
|
|
85
|
+
: "";
|
|
86
|
+
|
|
87
|
+
flags.width && console.log("Running width:", width);
|
|
88
|
+
flags.width ? (process.env.WIDTH = width) : "";
|
|
89
|
+
|
|
90
|
+
flags.height && console.log("Running height:", height);
|
|
91
|
+
flags.height ? (process.env.HEIGHT = height) : "";
|
|
92
|
+
|
|
93
|
+
flags.timeout ? (process.env.TIMEOUT = timeout) : "";
|
|
94
|
+
|
|
31
95
|
function main() {
|
|
32
|
-
if (flags.help)
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
if (flags.
|
|
38
|
-
showVersion();
|
|
39
|
-
return;
|
|
40
|
-
}
|
|
41
|
-
|
|
42
|
-
if (flags.create) {
|
|
43
|
-
createProject(flags.createYes);
|
|
44
|
-
return;
|
|
45
|
-
}
|
|
46
|
-
|
|
47
|
-
// if (flags.trace) {
|
|
48
|
-
// runTests();
|
|
49
|
-
// tracer();
|
|
50
|
-
// cleanUp();
|
|
51
|
-
// }
|
|
52
|
-
|
|
53
|
-
if (flags.report) {
|
|
54
|
-
const result = runTests(args, flags)
|
|
55
|
-
generateReport();
|
|
56
|
-
cleanUp();
|
|
57
|
-
process.exit(result.status);
|
|
58
|
-
} else {
|
|
59
|
-
const result = runTests(args, flags);
|
|
96
|
+
if (flags.help) return showHelp();
|
|
97
|
+
if (flags.version) return showVersion();
|
|
98
|
+
if (flags.create) return createProject(flags.createYes);
|
|
99
|
+
|
|
100
|
+
runTests();
|
|
101
|
+
if (flags.report) generateReport();
|
|
60
102
|
cleanUp();
|
|
61
|
-
process.exit(
|
|
62
|
-
}
|
|
103
|
+
process.exit(process.env.EXIT_CODE);
|
|
63
104
|
}
|
|
64
105
|
|
|
65
106
|
main();
|
package/package.json
CHANGED
|
@@ -3,18 +3,14 @@ const { spawnSync } = require("child_process");
|
|
|
3
3
|
|
|
4
4
|
function cleanUp() {
|
|
5
5
|
try {
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
stdio: "ignore",
|
|
12
|
-
shell: true,
|
|
13
|
-
},
|
|
14
|
-
);
|
|
6
|
+
spawnSync("npm", ["run", "clean", moduleConfig.cleanUpPaths], {
|
|
7
|
+
cwd: moduleConfig.modulePath,
|
|
8
|
+
stdio: "ignore",
|
|
9
|
+
shell: true,
|
|
10
|
+
});
|
|
15
11
|
} catch (error) {
|
|
16
12
|
console.error("โ Error in cleanup:", error.message);
|
|
17
|
-
process.
|
|
13
|
+
process.env.EXIT_CODE = 1;
|
|
18
14
|
}
|
|
19
15
|
}
|
|
20
16
|
|
|
@@ -48,6 +48,24 @@ function showHelp() {
|
|
|
48
48
|
|
|
49
49
|
๐ --percentage Set minimum success percentage to pass test run
|
|
50
50
|
Usage: artes --percentage 85
|
|
51
|
+
|
|
52
|
+
๐ --browser Specify browser to use (chromium, firefox, webkit)
|
|
53
|
+
Usage: artes --browser chromium
|
|
54
|
+
|
|
55
|
+
๐ --baseURL Set base URL for the tests
|
|
56
|
+
Usage: artes --baseURL "https://example.com"
|
|
57
|
+
|
|
58
|
+
๐ --maxScreen Maximize browser window
|
|
59
|
+
Usage: artes --maxScreen
|
|
60
|
+
|
|
61
|
+
๐ --width Set browser width (default: 1280)
|
|
62
|
+
Usage: artes --width 1920
|
|
63
|
+
|
|
64
|
+
๐ --height Set browser height (default: 720)
|
|
65
|
+
Usage: artes --height 1080
|
|
66
|
+
|
|
67
|
+
โฑ๏ธ --timeout Set timeout for each test step (default: 30 seconds)
|
|
68
|
+
Usage: artes --timeout 10
|
|
51
69
|
`);
|
|
52
70
|
}
|
|
53
71
|
|
|
@@ -40,7 +40,7 @@ function createProject(createYes) {
|
|
|
40
40
|
|
|
41
41
|
// Configuration options:
|
|
42
42
|
// env: "", // string - Environment name for tests
|
|
43
|
-
//testPercentage: 0, // number - Minimum success rate percentage(Default: 0)
|
|
43
|
+
// testPercentage: 0, // number - Minimum success rate percentage(Default: 0)
|
|
44
44
|
// baseURL: "", // string - Base URL for API tests
|
|
45
45
|
// paths: [], // string[] - Paths to feature files
|
|
46
46
|
// steps: "", // string - Step definitions files
|
|
@@ -5,22 +5,18 @@ function generateReport() {
|
|
|
5
5
|
try {
|
|
6
6
|
console.log("๐ Generating report...");
|
|
7
7
|
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
stdio: "ignore",
|
|
14
|
-
shell: true,
|
|
15
|
-
},
|
|
16
|
-
);
|
|
8
|
+
spawnSync("npm", ["run", "testWithReport", moduleConfig.reportPath], {
|
|
9
|
+
cwd: moduleConfig.modulePath,
|
|
10
|
+
stdio: "ignore",
|
|
11
|
+
shell: true,
|
|
12
|
+
});
|
|
17
13
|
|
|
18
14
|
console.log(
|
|
19
15
|
`๐ Report generated successfully in ${moduleConfig.reportPath}!`,
|
|
20
16
|
);
|
|
21
17
|
} catch (error) {
|
|
22
18
|
console.error("โ Report generation failed:", error);
|
|
23
|
-
process.
|
|
19
|
+
process.env.EXIT_CODE = 1;
|
|
24
20
|
}
|
|
25
21
|
}
|
|
26
22
|
|
|
@@ -1,51 +1,13 @@
|
|
|
1
1
|
const { spawnSync } = require("child_process");
|
|
2
2
|
const { moduleConfig } = require("../imports/commons");
|
|
3
|
-
const path = require("path");
|
|
4
3
|
|
|
5
|
-
function runTests(
|
|
6
|
-
const env = args[args.indexOf("--env") + 1];
|
|
7
|
-
|
|
8
|
-
const featureFiles = args[args.indexOf("--features") + 1];
|
|
9
|
-
const features = flags.features && featureFiles;
|
|
10
|
-
|
|
11
|
-
const tags = args[args.indexOf("--tags") + 1];
|
|
12
|
-
const parallel = args[args.indexOf("--parallel") + 1];
|
|
13
|
-
const retry = args[args.indexOf("--retry") + 1];
|
|
14
|
-
const percentage = args[args.indexOf("percentage") + 1];
|
|
15
|
-
|
|
16
|
-
flags.env && console.log("Running env:", env);
|
|
17
|
-
flags.env ? (process.env.ENV = JSON.stringify(env)) : "";
|
|
18
|
-
|
|
19
|
-
flags.report
|
|
20
|
-
? (process.env.REPORT_FORMAT = JSON.stringify([
|
|
21
|
-
"rerun:@rerun.txt",
|
|
22
|
-
"progress-bar",
|
|
23
|
-
"allure-cucumberjs/reporter:./allure-results",
|
|
24
|
-
]))
|
|
25
|
-
: "";
|
|
26
|
-
|
|
27
|
-
flags.tags && console.log("Running tags:", tags);
|
|
28
|
-
flags.tags ? (process.env.RUN_TAGS = JSON.stringify(tags)) : "";
|
|
29
|
-
|
|
30
|
-
flags.features && console.log("Running features:", features);
|
|
31
|
-
flags.features ? (process.env.FEATURES = features) : "";
|
|
32
|
-
|
|
33
|
-
flags.headless &&
|
|
34
|
-
console.log("Running mode:", flags.headless ? "headless" : "headed");
|
|
35
|
-
flags.headless ? (process.env.MODE = JSON.stringify(true)) : false;
|
|
36
|
-
|
|
37
|
-
flags.parallel ? (process.env.PARALLEL = parallel) : "";
|
|
38
|
-
flags.retry ? (process.env.RETRY = JSON.stringify(retry)) : "";
|
|
39
|
-
flags.dryrun ? (process.env.DRYRUN = JSON.stringify(true)) : "";
|
|
40
|
-
flags.percentage ? (process.env.PERCENTAGE = percentage) : "";
|
|
41
|
-
|
|
42
|
-
|
|
4
|
+
function runTests() {
|
|
43
5
|
try {
|
|
44
6
|
console.log("๐งช Running tests...");
|
|
45
7
|
process.env.FORCE_COLOR = "1";
|
|
46
8
|
process.env.FORCE_STDIO_TTY = "1";
|
|
47
9
|
|
|
48
|
-
|
|
10
|
+
spawnSync("cucumber-js", ["--config=cucumber.config.js"], {
|
|
49
11
|
cwd: moduleConfig.modulePath,
|
|
50
12
|
stdio: "inherit",
|
|
51
13
|
shell: true,
|
|
@@ -57,10 +19,9 @@ function runTests(args, flags) {
|
|
|
57
19
|
},
|
|
58
20
|
});
|
|
59
21
|
console.log("โ
Tests running completed successfully!");
|
|
60
|
-
return result;
|
|
61
22
|
} catch (error) {
|
|
62
23
|
console.error("โ Test execution failed:", error);
|
|
63
|
-
process.
|
|
24
|
+
process.env.EXIT_CODE = 1;
|
|
64
25
|
}
|
|
65
26
|
}
|
|
66
27
|
|
|
@@ -30,7 +30,8 @@ const moduleConfig = {
|
|
|
30
30
|
featuresPath: path.join(projectPath, "/tests/features/"),
|
|
31
31
|
stepsPath: path.join(projectPath, "/tests/steps/*.js"),
|
|
32
32
|
pomPath: path.join(projectPath, "/tests/POMs"),
|
|
33
|
-
cleanUpPaths:
|
|
33
|
+
cleanUpPaths:
|
|
34
|
+
"allure-result allure-results test-results @rerun.txt testsStatus",
|
|
34
35
|
};
|
|
35
36
|
|
|
36
37
|
module.exports = {
|
package/src/hooks/hooks.js
CHANGED
|
@@ -17,8 +17,7 @@ const fs = require("fs");
|
|
|
17
17
|
const { moduleConfig } = require("artes/src/helper/imports/commons");
|
|
18
18
|
const path = require("path");
|
|
19
19
|
|
|
20
|
-
|
|
21
|
-
let testsFailed = 0;
|
|
20
|
+
const statusDir = path.join(process.cwd(), "testsStatus");
|
|
22
21
|
|
|
23
22
|
setDefaultTimeout(cucumberConfig.default.timeout * 1000);
|
|
24
23
|
|
|
@@ -27,7 +26,6 @@ BeforeAll(async function () {
|
|
|
27
26
|
});
|
|
28
27
|
|
|
29
28
|
Before(async function () {
|
|
30
|
-
totalTests++;
|
|
31
29
|
context.vars = {};
|
|
32
30
|
|
|
33
31
|
const { browser, context: browserContext } = await invokeBrowser();
|
|
@@ -81,7 +79,13 @@ AfterStep(async function ({ pickleStep }) {
|
|
|
81
79
|
|
|
82
80
|
After(async function ({ pickle, result }) {
|
|
83
81
|
if (result?.status != Status.PASSED) {
|
|
84
|
-
|
|
82
|
+
fs.mkdirSync(statusDir, { recursive: true });
|
|
83
|
+
|
|
84
|
+
fs.writeFileSync(
|
|
85
|
+
path.join(statusDir, `${result.status}-${pickle.id}.txt`),
|
|
86
|
+
"",
|
|
87
|
+
);
|
|
88
|
+
|
|
85
89
|
let img = await context.page.screenshot({
|
|
86
90
|
path: `./test-results/visualReport/${pickle.name}/${pickle.name}.png`,
|
|
87
91
|
type: "png",
|
|
@@ -127,21 +131,27 @@ After(async function ({ pickle, result }) {
|
|
|
127
131
|
});
|
|
128
132
|
|
|
129
133
|
AfterAll(async function () {
|
|
130
|
-
const
|
|
134
|
+
const files = fs.readdirSync(statusDir);
|
|
135
|
+
const passedCount = files.filter(
|
|
136
|
+
(file) => file.split("-")[0] === "PASSED",
|
|
137
|
+
).length;
|
|
138
|
+
const totalTests = files.length;
|
|
139
|
+
|
|
140
|
+
const successPercentage = (passedCount / totalTests) * 100;
|
|
131
141
|
const successRate =
|
|
132
|
-
successPercentage.toFixed(2)
|
|
142
|
+
successPercentage.toFixed(2) > cucumberConfig.default.testPercentage;
|
|
133
143
|
|
|
134
|
-
|
|
144
|
+
if (!isNaN(successPercentage)) {
|
|
135
145
|
if (successRate) {
|
|
136
146
|
console.log(
|
|
137
147
|
`Tests passed required ${cucumberConfig.default.testPercentage}% success rate with ${successPercentage.toFixed(2)}% !`,
|
|
138
148
|
);
|
|
139
|
-
process.
|
|
149
|
+
process.env.EXIT_CODE = 0;
|
|
140
150
|
} else {
|
|
141
151
|
console.log(
|
|
142
152
|
`Tests failed at required ${cucumberConfig.default.testPercentage}% success rate with ${successPercentage.toFixed(2)}%!`,
|
|
143
153
|
);
|
|
144
|
-
process.
|
|
154
|
+
process.env.EXIT_CODE = 1;
|
|
145
155
|
}
|
|
146
156
|
}
|
|
147
157
|
});
|