artes 1.3.0 โ†’ 1.4.0

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
@@ -126,6 +126,7 @@ npx artes [options]
126
126
  | ๐ŸŽญ `--dryRun` | Perform a dry run without executing tests | `artes --dryRun` |
127
127
  | ๐Ÿ“ˆ `--percentage` | Set minimum success percentage to pass test run (default is 0) | `artes --percentage 85` |
128
128
  | ๐ŸŒ `--browser` | Specify browser to use (`chromium`, `firefox`, or `webkit`) | `artes --browser chromium` |
129
+ | `--offline` | Run browser in offline mode | `artes --offline` |
129
130
  | ๐Ÿ“ฑ `--device` | Emulate specific device (e.g., "iPhone 13") | `artes --device "iPhone 13"` |
130
131
  | ๐Ÿ”— `--baseURL` | Set base URL for the tests | `artes --baseURL "https://example.com"` |
131
132
  | ๐Ÿ–ฅ๏ธ `--maxScreen` | Maximize browser window on launch | `artes --maxScreen` |
@@ -589,6 +590,8 @@ Artes supports environment-specific configurations through environment variables
589
590
  | `browserType` | `"chrome"` | Browser type (`"chrome"`, `"firefox"`, or `"webkit"`). |
590
591
  | `viewport` | `{ width: 1280, height: 720 }` | Browser viewport size. |
591
592
  | `headless` | `true` | Run browser in headless mode (`true` or `false`). |
593
+ | `offline` | `false` | Run browser in offline mode (`true` or `false`). |
594
+
592
595
 
593
596
  ### Device Configuration
594
597
 
@@ -164,8 +164,11 @@ module.exports = {
164
164
  ? JSON.parse(process.env.BROWSER)
165
165
  : artesConfig?.browser || "chrome",
166
166
  device: process.env.DEVICE
167
- ? JSON.parse(process.env.DEVICE)
168
- : artesConfig?.device || null,
167
+ ? JSON.parse(process.env.DEVICE)
168
+ : artesConfig?.device || null,
169
+ offline: process.env.OFFLINE
170
+ ? JSON.parse(process.env.OFFLINE)
171
+ : artesConfig?.offline || false,
169
172
  viewport: {
170
173
  width: process.env.WIDTH
171
174
  ? Number(process.env.WIDTH)
@@ -13,144 +13,141 @@
13
13
 
14
14
  ## Mobile Devices
15
15
 
16
- - "Blackberry PlayBook"
17
- - "Blackberry PlayBook landscape"
18
- - "BlackBerry Z30"
19
- - "BlackBerry Z30 landscape"
20
- - "Galaxy Note 3"
21
- - "Galaxy Note 3 landscape"
22
- - "Galaxy Note II"
23
- - "Galaxy Note II landscape"
24
- - "Galaxy S III"
25
- - "Galaxy S III landscape"
26
- - "Galaxy S5"
27
- - "Galaxy S5 landscape"
28
- - "Galaxy S8"
29
- - "Galaxy S8 landscape"
30
- - "Galaxy S9+"
31
- - "Galaxy S9+ landscape"
32
- - "Galaxy Tab S4"
33
- - "Galaxy Tab S4 landscape"
34
- - "iPad (gen 5)"
35
- - "iPad (gen 5) landscape"
36
- - "iPad (gen 6)"
37
- - "iPad (gen 6) landscape"
38
- - "iPad (gen 7)"
39
- - "iPad (gen 7) landscape"
40
- - "iPad Mini"
41
- - "iPad Mini landscape"
42
- - "iPad Pro 11"
43
- - "iPad Pro 11 landscape"
44
- - "iPhone 6"
45
- - "iPhone 6 landscape"
46
- - "iPhone 6 Plus"
47
- - "iPhone 6 Plus landscape"
48
- - "iPhone 7"
49
- - "iPhone 7 landscape"
50
- - "iPhone 7 Plus"
51
- - "iPhone 7 Plus landscape"
52
- - "iPhone 8"
53
- - "iPhone 8 landscape"
54
- - "iPhone 8 Plus"
55
- - "iPhone 8 Plus landscape"
56
- - "iPhone SE"
57
- - "iPhone SE landscape"
58
- - "iPhone X"
59
- - "iPhone X landscape"
60
- - "iPhone XR"
61
- - "iPhone XR landscape"
62
- - "iPhone 11"
63
- - "iPhone 11 landscape"
64
- - "iPhone 11 Pro"
65
- - "iPhone 11 Pro landscape"
66
- - "iPhone 11 Pro Max"
67
- - "iPhone 11 Pro Max landscape"
68
- - "iPhone 12"
69
- - "iPhone 12 landscape"
70
- - "iPhone 12 Pro"
71
- - "iPhone 12 Pro landscape"
72
- - "iPhone 12 Pro Max"
73
- - "iPhone 12 Pro Max landscape"
74
- - "iPhone 12 Mini"
75
- - "iPhone 12 Mini landscape"
76
- - "iPhone 13"
77
- - "iPhone 13 landscape"
78
- - "iPhone 13 Pro"
79
- - "iPhone 13 Pro landscape"
80
- - "iPhone 13 Pro Max"
81
- - "iPhone 13 Pro Max landscape"
82
- - "iPhone 13 Mini"
83
- - "iPhone 13 Mini landscape"
84
- - "iPhone 14"
85
- - "iPhone 14 landscape"
86
- - "iPhone 14 Plus"
87
- - "iPhone 14 Plus landscape"
88
- - "iPhone 14 Pro"
89
- - "iPhone 14 Pro landscape"
90
- - "iPhone 14 Pro Max"
91
- - "iPhone 14 Pro Max landscape"
92
- - "iPhone 15"
93
- - "iPhone 15 landscape"
94
- - "iPhone 15 Plus"
95
- - "iPhone 15 Plus landscape"
96
- - "iPhone 15 Pro"
97
- - "iPhone 15 Pro landscape"
98
- - "iPhone 15 Pro Max"
99
- - "iPhone 15 Pro Max landscape"
100
- - "Kindle Fire HDX"
101
- - "Kindle Fire HDX landscape"
102
- - "LG Optimus L70"
103
- - "LG Optimus L70 landscape"
104
- - "Microsoft Lumia 550"
105
- - "Microsoft Lumia 550 landscape"
106
- - "Microsoft Lumia 950"
107
- - "Microsoft Lumia 950 landscape"
108
- - "Nexus 10"
109
- - "Nexus 10 landscape"
110
- - "Nexus 4"
111
- - "Nexus 4 landscape"
112
- - "Nexus 5"
113
- - "Nexus 5 landscape"
114
- - "Nexus 5X"
115
- - "Nexus 5X landscape"
116
- - "Nexus 6"
117
- - "Nexus 6 landscape"
118
- - "Nexus 6P"
119
- - "Nexus 6P landscape"
120
- - "Nexus 7"
121
- - "Nexus 7 landscape"
122
- - "Nokia Lumia 520"
123
- - "Nokia Lumia 520 landscape"
124
- - "Nokia N9"
125
- - "Nokia N9 landscape"
126
- - "Pixel 2"
127
- - "Pixel 2 landscape"
128
- - "Pixel 2 XL"
129
- - "Pixel 2 XL landscape"
130
- - "Pixel 3"
131
- - "Pixel 3 landscape"
132
- - "Pixel 4"
133
- - "Pixel 4 landscape"
134
- - "Pixel 4a (5G)"
135
- - "Pixel 4a (5G) landscape"
136
- - "Pixel 5"
137
- - "Pixel 5 landscape"
138
- - "Pixel 7"
139
- - "Pixel 7 landscape"
140
- - "Moto G4"
141
- - "Moto G4 landscape"
16
+ - Blackberry PlayBook
17
+ - Blackberry PlayBook landscape
18
+ - BlackBerry Z30
19
+ - BlackBerry Z30 landscape
20
+ - Galaxy Note 3
21
+ - Galaxy Note 3 landscape
22
+ - Galaxy Note II
23
+ - Galaxy Note II landscape
24
+ - Galaxy S III
25
+ - Galaxy S III landscape
26
+ - Galaxy S5
27
+ - Galaxy S5 landscape
28
+ - Galaxy S8
29
+ - Galaxy S8 landscape
30
+ - Galaxy S9+
31
+ - Galaxy S9+ landscape
32
+ - Galaxy Tab S4
33
+ - Galaxy Tab S4 landscape
34
+ - iPad (gen 5)
35
+ - iPad (gen 5) landscape
36
+ - iPad (gen 6)
37
+ - iPad (gen 6) landscape
38
+ - iPad (gen 7)
39
+ - iPad (gen 7) landscape
40
+ - iPad Mini
41
+ - iPad Mini landscape
42
+ - iPad Pro 11
43
+ - iPad Pro 11 landscape
44
+ - iPhone 6
45
+ - iPhone 6 landscape
46
+ - iPhone 6 Plus
47
+ - iPhone 6 Plus landscape
48
+ - iPhone 7
49
+ - iPhone 7 landscape
50
+ - iPhone 7 Plus
51
+ - iPhone 7 Plus landscape
52
+ - iPhone 8
53
+ - iPhone 8 landscape
54
+ - iPhone 8 Plus
55
+ - iPhone 8 Plus landscape
56
+ - iPhone SE
57
+ - iPhone SE landscape
58
+ - iPhone X
59
+ - iPhone X landscape
60
+ - iPhone XR
61
+ - iPhone XR landscape
62
+ - iPhone 11
63
+ - iPhone 11 landscape
64
+ - iPhone 11 Pro
65
+ - iPhone 11 Pro landscape
66
+ - iPhone 11 Pro Max
67
+ - iPhone 11 Pro Max landscape
68
+ - iPhone 12
69
+ - iPhone 12 landscape
70
+ - iPhone 12 Pro
71
+ - iPhone 12 Pro landscape
72
+ - iPhone 12 Pro Max
73
+ - iPhone 12 Pro Max landscape
74
+ - iPhone 12 Mini
75
+ - iPhone 12 Mini landscape
76
+ - iPhone 13
77
+ - iPhone 13 landscape
78
+ - iPhone 13 Pro
79
+ - iPhone 13 Pro landscape
80
+ - iPhone 13 Pro Max
81
+ - iPhone 13 Pro Max landscape
82
+ - iPhone 13 Mini
83
+ - iPhone 13 Mini landscape
84
+ - iPhone 14
85
+ - iPhone 14 landscape
86
+ - iPhone 14 Plus
87
+ - iPhone 14 Plus landscape
88
+ - iPhone 14 Pro
89
+ - iPhone 14 Pro landscape
90
+ - iPhone 14 Pro Max
91
+ - iPhone 14 Pro Max landscape
92
+ - iPhone 15
93
+ - iPhone 15 landscape
94
+ - iPhone 15 Plus
95
+ - iPhone 15 Plus landscape
96
+ - iPhone 15 Pro
97
+ - iPhone 15 Pro landscape
98
+ - iPhone 15 Pro Max
99
+ - iPhone 15 Pro Max landscape
100
+ - Kindle Fire HDX
101
+ - Kindle Fire HDX landscape
102
+ - LG Optimus L70
103
+ - LG Optimus L70 landscape
104
+ - Microsoft Lumia 550
105
+ - Microsoft Lumia 550 landscape
106
+ - Microsoft Lumia 950
107
+ - Microsoft Lumia 950 landscape
108
+ - Nexus 10
109
+ - Nexus 10 landscape
110
+ - Nexus 4
111
+ - Nexus 4 landscape
112
+ - Nexus 5
113
+ - Nexus 5 landscape
114
+ - Nexus 5X
115
+ - Nexus 5X landscape
116
+ - Nexus 6
117
+ - Nexus 6 landscape
118
+ - Nexus 6P
119
+ - Nexus 6P landscape
120
+ - Nexus 7
121
+ - Nexus 7 landscape
122
+ - Nokia Lumia 520
123
+ - Nokia Lumia 520 landscape
124
+ - Nokia N9
125
+ - Nokia N9 landscape
126
+ - Pixel 2
127
+ - Pixel 2 landscape
128
+ - Pixel 2 XL
129
+ - Pixel 2 XL landscape
130
+ - Pixel 3
131
+ - Pixel 3 landscape
132
+ - Pixel 4
133
+ - Pixel 4 landscape
134
+ - Pixel 4a (5G)
135
+ - Pixel 4a (5G) landscape
136
+ - Pixel 5
137
+ - Pixel 5 landscape
138
+ - Pixel 7
139
+ - Pixel 7 landscape
140
+ - Moto G4
141
+ - Moto G4 landscape
142
142
 
143
143
  ---
144
144
 
145
145
  ## Desktop Devices
146
146
 
147
- - "Desktop Chrome HiDPI"
148
- - "Desktop Edge HiDPI"
149
- - "Desktop Firefox HiDPI"
150
- - "Desktop Safari"
151
- - "Desktop Chrome"
152
- - "Desktop Edge"
153
- - "Desktop Firefox"
154
-
155
-
156
-
147
+ - Desktop Chrome HiDPI
148
+ - Desktop Edge HiDPI
149
+ - Desktop Firefox HiDPI
150
+ - Desktop Safari
151
+ - Desktop Chrome
152
+ - Desktop Edge
153
+ - Desktop Firefox
package/executer.js CHANGED
@@ -7,6 +7,7 @@ const {
7
7
  generateReport,
8
8
  cleanUp,
9
9
  } = require("./src/helper/executers/exporter");
10
+ const { logPomWarnings } = require("./src/helper/controller/pomCollector");
10
11
  const fs = require("fs");
11
12
  const path = require("path");
12
13
 
@@ -43,6 +44,7 @@ const flags = {
43
44
  dryRun: args.includes("--dryRun"),
44
45
  percentage: args.includes("--percentage"),
45
46
  browser: args.includes("--browser"),
47
+ offline: args.includes("--offline"),
46
48
  device: args.includes("--device"),
47
49
  baseURL: args.includes("--baseURL"),
48
50
  maximizeScreen: args.includes("--maxScreen"),
@@ -122,6 +124,9 @@ flags.percentage ? (process.env.PERCENTAGE = percentage) : "";
122
124
  flags.browser && console.log("Running browser:", browser);
123
125
  flags.browser ? (process.env.BROWSER = JSON.stringify(browser)) : "";
124
126
 
127
+ flags.browser && console.log("Running mode:", flags.offline && "Offline");
128
+ flags.offline ? (process.env.OFFLINE = true) : "";
129
+
125
130
  flags.device && console.log("Running device:", device);
126
131
  flags.device ? (process.env.DEVICE = JSON.stringify(device)) : "";
127
132
 
@@ -147,6 +152,9 @@ function main() {
147
152
  if (flags.create) return createProject(flags.createYes, flags.noDeps);
148
153
 
149
154
  runTests();
155
+
156
+ logPomWarnings();
157
+
150
158
  if (
151
159
  flags.reportWithTrace ||
152
160
  artesConfig.reportWithTrace ||
package/index.js CHANGED
@@ -8,12 +8,13 @@ const {
8
8
  selector,
9
9
  saveVar,
10
10
  extractVarsFromResponse,
11
- page,
11
+ browserPage,
12
12
  request,
13
13
  random,
14
14
  time,
15
15
  resolveVariable,
16
16
  } = require("./src/helper/imports/commons");
17
+
17
18
  const {
18
19
  keyboard,
19
20
  mouse,
@@ -21,6 +22,7 @@ const {
21
22
  assert,
22
23
  elementInteractions,
23
24
  api,
25
+ page,
24
26
  } = require("./src/helper/stepFunctions/exporter");
25
27
 
26
28
  module.exports = {
@@ -34,6 +36,7 @@ module.exports = {
34
36
  extractVarsFromResponse,
35
37
  resolveVariable,
36
38
  context,
39
+ browserPage,
37
40
  api,
38
41
  random,
39
42
  time,
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "artes",
3
- "version": "1.3.0",
3
+ "version": "1.4.0",
4
4
  "description": "The simplest way to automate UI and API tests using Cucumber-style steps.",
5
5
  "main": "index.js",
6
6
  "scripts": {
@@ -19,7 +19,9 @@ const invokeBrowser = async () => {
19
19
  args: [cucumberConfig.browser.maximizeScreen ? "--start-maximized" : ""],
20
20
  };
21
21
 
22
- const browserType = cucumberConfig.browser.device ? "webkit" : cucumberConfig.browser.browserType.toLowerCase() || "chrome";
22
+ const browserType = cucumberConfig.browser.device
23
+ ? "webkit"
24
+ : cucumberConfig.browser.browserType.toLowerCase() || "chrome";
23
25
 
24
26
  const browserContextOptions = {
25
27
  baseURL: baseURL,
@@ -35,6 +37,7 @@ const invokeBrowser = async () => {
35
37
  size: cucumberConfig.browser.viewport,
36
38
  },
37
39
  ignoreHTTPSErrors: true,
40
+ offline: cucumberConfig.browser.offline,
38
41
  };
39
42
 
40
43
  switch (browserType) {
@@ -53,9 +56,10 @@ const invokeBrowser = async () => {
53
56
  );
54
57
  }
55
58
 
56
-
57
59
  const context = await browser.newContext({
58
- ...(cucumberConfig.browser.device ? devices[cucumberConfig.browser.device] : {}),
60
+ ...(cucumberConfig.browser.device
61
+ ? devices[cucumberConfig.browser.device]
62
+ : {}),
59
63
  ...browserContextOptions,
60
64
  });
61
65
 
@@ -2,6 +2,7 @@ const { addElements } = require("./elementController");
2
2
  const cucumberConfig = require("../../../cucumber.config");
3
3
  const fs = require("fs");
4
4
  const path = require("path");
5
+ const { moduleConfig } = require("../../helper/imports/commons");
5
6
 
6
7
  const duplicateWarnings = [];
7
8
  const keyRegistry = {};
@@ -25,7 +26,7 @@ function pomCollector() {
25
26
  Object.keys(parsed).forEach((key) => {
26
27
  if (keyRegistry[key]) {
27
28
  duplicateWarnings.push(
28
- `${key} in ${file} has the same key with ${key} in ${keyRegistry[key]}`
29
+ `${key} in ${file} has the same key with ${key} in ${keyRegistry[key]}`,
29
30
  );
30
31
  } else {
31
32
  keyRegistry[key] = file;
@@ -34,20 +35,48 @@ function pomCollector() {
34
35
 
35
36
  addElements(parsed);
36
37
  });
38
+
39
+ const duplicationFilePath = path.join(
40
+ moduleConfig.projectPath,
41
+ "node_modules",
42
+ "artes",
43
+ "pomDuplicateWarnings.json",
44
+ );
45
+
46
+ if (duplicateWarnings.length > 0) {
47
+ fs.mkdirSync(path.dirname(duplicationFilePath), { recursive: true });
48
+ fs.writeFileSync(
49
+ duplicationFilePath,
50
+ JSON.stringify(duplicateWarnings, null, 2),
51
+ "utf8",
52
+ );
53
+ }
37
54
  }
38
55
 
39
56
  function logPomWarnings() {
40
- if (duplicateWarnings.length === 0) return;
57
+ if (
58
+ !fs.existsSync(
59
+ path.join(moduleConfig.modulePath, "pomDuplicateWarnings.json"),
60
+ )
61
+ )
62
+ return;
63
+
64
+ const duplicateWarnings = JSON.parse(
65
+ fs.readFileSync(
66
+ path.join(moduleConfig.modulePath, "pomDuplicateWarnings.json"),
67
+ "utf8",
68
+ ),
69
+ );
41
70
 
42
71
  console.warn(
43
- "\n\x1b[33m[WARNING] POM DUPLICATE KEY WARNINGS: This may break your tests or cause flaky behavior."
44
- );
45
-
72
+ "\n\x1b[33m[WARNING] POM DUPLICATE KEY WARNINGS: This may break your tests or cause flaky behavior.",
73
+ );
74
+
46
75
  duplicateWarnings.forEach((warning) => {
47
76
  console.warn(`- ${warning}`);
48
77
  });
49
78
 
50
- console.log("\x1b[0m")
79
+ console.log("\x1b[0m");
51
80
  }
52
81
 
53
82
  module.exports = { pomCollector, logPomWarnings };
@@ -75,6 +75,9 @@ function showHelp() {
75
75
 
76
76
  ๐ŸŒ --browser Specify browser to use (chromium, firefox, webkit)
77
77
  Usage: artes --browser chromium
78
+
79
+ --offline Run browser in offline mode
80
+ Usage: artes --offline
78
81
 
79
82
  ๐Ÿ“ฑ --device Emulate specific device (e.g., "iPhone 13")
80
83
  Usage: artes --device "iPhone 13"
@@ -66,6 +66,7 @@ function createProject(createYes, noDeps) {
66
66
  // backtrace: false, // boolean - Show full backtrace for errors
67
67
  // dryRun: false, // boolean - Prepare test run without execution
68
68
  // browser: "chrome", // "chrome", "firefox", "webkit"
69
+ // offline: false, // boolean - Run browser in offline mode
69
70
  // device: "", // string - Emulate specific device (e.g., "iPhone 13", for more devices look at the documentation)
70
71
  // width: 1280, // number - Browser width
71
72
  // height: 720, // number - Browser height
@@ -5,21 +5,17 @@ function runTests() {
5
5
  try {
6
6
  console.log("๐Ÿงช Running tests...");
7
7
 
8
- spawnSync(
9
- "cucumber-js",
10
- [ "--config=cucumber.config.js"],
11
- {
12
- cwd: moduleConfig.modulePath,
13
- stdio: "inherit",
14
- shell: true,
15
- env: {
16
- ...process.env,
17
- FORCE_TTY: "1",
18
- FORCE_COLOR: "1",
19
- CI: "false",
20
- },
8
+ spawnSync("cucumber-js", ["--config=cucumber.config.js"], {
9
+ cwd: moduleConfig.modulePath,
10
+ stdio: "inherit",
11
+ shell: true,
12
+ env: {
13
+ ...process.env,
14
+ FORCE_TTY: "1",
15
+ FORCE_COLOR: "1",
16
+ CI: "false",
21
17
  },
22
- );
18
+ });
23
19
  console.log("โœ… Tests running completed successfully!");
24
20
  } catch (error) {
25
21
  console.error("โŒ Test execution failed:", error);
@@ -14,7 +14,7 @@ const dayjs = require("dayjs");
14
14
 
15
15
  const element = getElement;
16
16
  const selector = getSelector;
17
- const page = context.page;
17
+ const browserPage = context.page;
18
18
  const request = context.request;
19
19
 
20
20
  const random = faker;
@@ -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 @rerun.txt testsStatus EXIT_CODE.txt pomDuplicateWarnings.json",
39
39
  };
40
40
 
41
41
  module.exports = {
@@ -50,7 +50,7 @@ module.exports = {
50
50
  resolveVariable,
51
51
  random,
52
52
  time,
53
- page,
53
+ browserPage,
54
54
  request,
55
55
  context,
56
56
  moduleConfig,