artes 1.0.82 โ†’ 1.0.84

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,27 @@ 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(default is 0) | `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
+ | ๐ŸŒ `--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>
@@ -18,9 +18,9 @@ module.exports = {
18
18
  default: {
19
19
  // File paths and patterns
20
20
  testPercentage: process.env.PERCENTAGE
21
- ? process.env.PERCENTAGE
21
+ ? Number(process.env.PERCENTAGE)
22
22
  : artesConfig.testPercentage || 0, // number - Percentage of tests to run (0-100)
23
- timeout: artesConfig.timeout || 30, // Default timeout in milliseconds
23
+ timeout: process.env.TIMEOUT ? Number(process.env.TIMEOUT) : artesConfig.timeout || 30, // Default timeout in milliseconds
24
24
  paths: process.env.FEATURES
25
25
  ? [path.join(moduleConfig.projectPath, process.env.FEATURES)]
26
26
  : artesConfig.features
@@ -51,10 +51,10 @@ module.exports = {
51
51
 
52
52
  // Execution options
53
53
  parallel: process.env.PARALLEL
54
- ? JSON.parse(process.env.PARALLEL)
54
+ ? Number(process.env.PARALLEL)
55
55
  : artesConfig.parallel || 1, // Number of parallel workers
56
56
  dryRun: process.env.DRYRUN
57
- ? JSON.parse(process.env.DRYRUN)
57
+ ? process.env.DRYRUN
58
58
  : artesConfig.dryRun || false, // Prepare test run without execution
59
59
  failFast: artesConfig.failFast || false, // Stop on first test failure
60
60
  forceExit: artesConfig.forceExit || false, // Force process.exit() after tests
@@ -75,7 +75,7 @@ module.exports = {
75
75
 
76
76
  // Retry logic
77
77
  retry: process.env.RETRY
78
- ? JSON.parse(process.env.RETRY)
78
+ ? Number(process.env.RETRY)
79
79
  : artesConfig.retry || 0, // Retry attempts for failing tests
80
80
  retryTagFilter: artesConfig.retryTagFilter || "", // Tag expression for retries
81
81
 
@@ -86,16 +86,26 @@ module.exports = {
86
86
  worldParameters: artesConfig.worldParameters || {}, // Custom world parameters
87
87
  },
88
88
  env: process.env.ENV ? JSON.parse(process.env.ENV) : artesConfig.env || "",
89
- baseURL: artesConfig?.baseURL ? artesConfig?.baseURL : "",
89
+ baseURL: process.env.BASE_URL ? JSON.parse(process.env.BASE_URL) : artesConfig?.baseURL ? artesConfig?.baseURL : "",
90
90
 
91
91
  browser: {
92
- browserType: artesConfig?.browser || "chrome",
92
+ browserType: process.env.BROWSER
93
+ ? JSON.parse(process.env.BROWSER)
94
+ : artesConfig?.browser || "chrome",
93
95
  viewport: {
94
- width: artesConfig?.width || 1280,
95
- height: artesConfig?.height || 720,
96
+ width:
97
+ process.env.WIDTH
98
+ ? Number(process.env.WIDTH)
99
+ : artesConfig?.width || 1280,
100
+ height:
101
+ process.env.HEIGHT
102
+ ? Number(process.env.HEIGHT)
103
+ : artesConfig?.height || 720,
96
104
  },
97
105
  maximizeScreen:
98
- artesConfig?.maximizeScreen !== undefined
106
+ process.env.MAXIMIZE_SCREEN
107
+ ? JSON.parse(process.env.MAXIMIZE_SCREEN)
108
+ : artesConfig?.maximizeScreen !== undefined
99
109
  ? artesConfig.maximizeScreen
100
110
  : true,
101
111
  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,84 @@ 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
80
+ ? (process.env.BROWSER = JSON.stringify(browser))
81
+ : "";
82
+
83
+ flags.baseURL
84
+ ? (process.env.BASE_URL = JSON.stringify(baseURL))
85
+ : "";
86
+
87
+ flags.maximizeScreen ? (process.env.MAXIMIZE_SCREEN = flags.maximizeScreen) : "";
88
+
89
+ flags.width && console.log("Running width:", width);
90
+ flags.width ? (process.env.WIDTH = width) : "";
91
+
92
+ flags.height && console.log("Running height:", height);
93
+ flags.height ? (process.env.HEIGHT = height) : "";
94
+
95
+ flags.timeout ? (process.env.TIMEOUT = timeout) : "";
96
+
31
97
  function main() {
32
- if (flags.help) {
33
- showHelp();
34
- return;
35
- }
36
-
37
- if (flags.version) {
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);
98
+ if (flags.help) return showHelp();
99
+ if (flags.version) return showVersion();
100
+ if (flags.create) return createProject(flags.createYes);
101
+
102
+ const result = runTests();
103
+ if (flags.report) generateReport();
60
104
  cleanUp();
61
105
  process.exit(result.status);
62
106
  }
63
- }
64
107
 
65
108
  main();
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "artes",
3
- "version": "1.0.82",
3
+ "version": "1.0.84",
4
4
  "description": "The simplest way to automate UI and API tests using Cucumber-style steps.",
5
5
  "main": "index.js",
6
6
  "scripts": {
@@ -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
 
@@ -1,43 +1,7 @@
1
1
  const { spawnSync } = require("child_process");
2
2
  const { moduleConfig } = require("../imports/commons");
3
- const path = require("path");
4
3
 
5
- function runTests(args, flags) {
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 = JSON.stringify(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) : "";
4
+ function runTests() {
41
5
 
42
6
  try {
43
7
  console.log("๐Ÿงช Running tests...");
@@ -30,7 +30,7 @@ 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: "allure-result test-results @rerun.txt",
33
+ cleanUpPaths: "allure-result allure-results test-results @rerun.txt"
34
34
  };
35
35
 
36
36
  module.exports = {