artes 1.2.28 → 1.3.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 +8 -0
- package/cucumber.config.js +3 -0
- package/docs/emulationDevicesList.md +156 -0
- package/executer.js +5 -0
- package/index.js +0 -1
- package/package.json +1 -1
- package/src/helper/contextManager/browserManager.js +14 -7
- package/src/helper/executers/helper.js +3 -0
- package/src/helper/executers/projectCreator.js +4 -3
- package/src/helper/executers/testRunner.js +0 -1
- package/src/helper/stepFunctions/assertions.js +2 -2
- package/src/helper/stepFunctions/keyboardActions.js +2 -0
- package/src/hooks/hooks.js +3 -1
- package/src/stepDefinitions/assertions.steps.js +1 -0
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
|
+
| 📱 `--device` | Emulate specific device (e.g., "iPhone 13") | `artes --device "iPhone 13"` |
|
|
129
130
|
| 🔗 `--baseURL` | Set base URL for the tests | `artes --baseURL "https://example.com"` |
|
|
130
131
|
| 🖥️ `--maxScreen` | Maximize browser window on launch | `artes --maxScreen` |
|
|
131
132
|
| 📏 `--width` | Set browser width (default is 1280) | `artes --width 1920` |
|
|
@@ -589,6 +590,13 @@ Artes supports environment-specific configurations through environment variables
|
|
|
589
590
|
| `viewport` | `{ width: 1280, height: 720 }` | Browser viewport size. |
|
|
590
591
|
| `headless` | `true` | Run browser in headless mode (`true` or `false`). |
|
|
591
592
|
|
|
593
|
+
### Device Configuration
|
|
594
|
+
|
|
595
|
+
| Option | Default Value | Description |
|
|
596
|
+
| ------------- | ------------------------------ | ------------------------------------------------------ |
|
|
597
|
+
| `device` | `""` | [Device List](./docs/emulationDevicesList.md) |
|
|
598
|
+
|
|
599
|
+
|
|
592
600
|
## 📊 Report Generation
|
|
593
601
|
|
|
594
602
|
Artes can generate Allure reports. After running tests with the `-r` flag, the reports will be stored in the `report` folder in HTML format. You can view them in your browser after the tests complete.
|
package/cucumber.config.js
CHANGED
|
@@ -163,6 +163,9 @@ module.exports = {
|
|
|
163
163
|
browserType: process.env.BROWSER
|
|
164
164
|
? JSON.parse(process.env.BROWSER)
|
|
165
165
|
: artesConfig?.browser || "chrome",
|
|
166
|
+
device: process.env.DEVICE
|
|
167
|
+
? JSON.parse(process.env.DEVICE)
|
|
168
|
+
: artesConfig?.device || null,
|
|
166
169
|
viewport: {
|
|
167
170
|
width: process.env.WIDTH
|
|
168
171
|
? Number(process.env.WIDTH)
|
|
@@ -0,0 +1,156 @@
|
|
|
1
|
+
# Emulation Supported Devices
|
|
2
|
+
|
|
3
|
+
> **Important:** Device names must be written **exactly as listed** and enclosed in double quotes (`""`) when used.
|
|
4
|
+
> Example:
|
|
5
|
+
>
|
|
6
|
+
> ```bash
|
|
7
|
+
> npx artes --device "iPhone 13"
|
|
8
|
+
> ```
|
|
9
|
+
|
|
10
|
+
> ⚠️ Make sure to **copy the names exactly** including spaces, capital letters, and parentheses when using them.
|
|
11
|
+
|
|
12
|
+
---
|
|
13
|
+
|
|
14
|
+
## Mobile Devices
|
|
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"
|
|
142
|
+
|
|
143
|
+
---
|
|
144
|
+
|
|
145
|
+
## Desktop Devices
|
|
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
|
+
|
package/executer.js
CHANGED
|
@@ -43,6 +43,7 @@ const flags = {
|
|
|
43
43
|
dryRun: args.includes("--dryRun"),
|
|
44
44
|
percentage: args.includes("--percentage"),
|
|
45
45
|
browser: args.includes("--browser"),
|
|
46
|
+
device: args.includes("--device"),
|
|
46
47
|
baseURL: args.includes("--baseURL"),
|
|
47
48
|
maximizeScreen: args.includes("--maxScreen"),
|
|
48
49
|
width: args.includes("--width"),
|
|
@@ -61,6 +62,7 @@ const retry = args[args.indexOf("--retry") + 1];
|
|
|
61
62
|
const rerun = args[args.indexOf("--rerun") + 1];
|
|
62
63
|
const percentage = args[args.indexOf("--percentage") + 1];
|
|
63
64
|
const browser = args[args.indexOf("--browser") + 1];
|
|
65
|
+
const device = args[args.indexOf("--device") + 1];
|
|
64
66
|
const baseURL = args[args.indexOf("--baseURL") + 1];
|
|
65
67
|
const width = args[args.indexOf("--width") + 1];
|
|
66
68
|
const height = args[args.indexOf("--height") + 1];
|
|
@@ -120,6 +122,9 @@ flags.percentage ? (process.env.PERCENTAGE = percentage) : "";
|
|
|
120
122
|
flags.browser && console.log("Running browser:", browser);
|
|
121
123
|
flags.browser ? (process.env.BROWSER = JSON.stringify(browser)) : "";
|
|
122
124
|
|
|
125
|
+
flags.device && console.log("Running device:", device);
|
|
126
|
+
flags.device ? (process.env.DEVICE = JSON.stringify(device)) : "";
|
|
127
|
+
|
|
123
128
|
flags.baseURL ? (process.env.BASE_URL = JSON.stringify(baseURL)) : "";
|
|
124
129
|
|
|
125
130
|
flags.maximizeScreen
|
package/index.js
CHANGED
package/package.json
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
const { chromium, firefox, webkit } = require("playwright");
|
|
1
|
+
const { chromium, firefox, webkit, devices } = require("playwright");
|
|
2
2
|
const cucumberConfig = require("../../../cucumber.config.js");
|
|
3
3
|
|
|
4
4
|
const invokeBrowser = async () => {
|
|
@@ -19,14 +19,17 @@ const invokeBrowser = async () => {
|
|
|
19
19
|
args: [cucumberConfig.browser.maximizeScreen ? "--start-maximized" : ""],
|
|
20
20
|
};
|
|
21
21
|
|
|
22
|
-
const browserType =
|
|
23
|
-
cucumberConfig.browser.browserType.toLowerCase() || "chrome";
|
|
22
|
+
const browserType = cucumberConfig.browser.device ? "webkit" : cucumberConfig.browser.browserType.toLowerCase() || "chrome";
|
|
24
23
|
|
|
25
24
|
const browserContextOptions = {
|
|
26
25
|
baseURL: baseURL,
|
|
27
|
-
|
|
28
|
-
?
|
|
29
|
-
:
|
|
26
|
+
...(cucumberConfig.browser.device
|
|
27
|
+
? {}
|
|
28
|
+
: {
|
|
29
|
+
viewport: cucumberConfig.browser.maximizeScreen
|
|
30
|
+
? null
|
|
31
|
+
: cucumberConfig.browser.viewport,
|
|
32
|
+
}),
|
|
30
33
|
recordVideo: {
|
|
31
34
|
dir: "./test-results/visualReport/",
|
|
32
35
|
size: cucumberConfig.browser.viewport,
|
|
@@ -50,7 +53,11 @@ const invokeBrowser = async () => {
|
|
|
50
53
|
);
|
|
51
54
|
}
|
|
52
55
|
|
|
53
|
-
|
|
56
|
+
|
|
57
|
+
const context = await browser.newContext({
|
|
58
|
+
...(cucumberConfig.browser.device ? devices[cucumberConfig.browser.device] : {}),
|
|
59
|
+
...browserContextOptions,
|
|
60
|
+
});
|
|
54
61
|
|
|
55
62
|
return {
|
|
56
63
|
browser: browser,
|
|
@@ -76,6 +76,9 @@ function showHelp() {
|
|
|
76
76
|
🌐 --browser Specify browser to use (chromium, firefox, webkit)
|
|
77
77
|
Usage: artes --browser chromium
|
|
78
78
|
|
|
79
|
+
📱 --device Emulate specific device (e.g., "iPhone 13")
|
|
80
|
+
Usage: artes --device "iPhone 13"
|
|
81
|
+
|
|
79
82
|
🌐 --baseURL Set base URL for the tests
|
|
80
83
|
Usage: artes --baseURL "https://example.com"
|
|
81
84
|
|
|
@@ -43,11 +43,11 @@ function createProject(createYes, noDeps) {
|
|
|
43
43
|
fs.writeFileSync(packageJsonPath, JSON.stringify(packageJson, null, 2));
|
|
44
44
|
|
|
45
45
|
const config = `module.exports = {
|
|
46
|
-
headless: false,
|
|
46
|
+
headless: false, // Set to true for headless browser mode
|
|
47
47
|
|
|
48
48
|
// Configuration options:
|
|
49
49
|
// env: "", // string - Environment name for tests
|
|
50
|
-
// testPercentage: 0,
|
|
50
|
+
// testPercentage: 0, // number - Minimum success rate percentage(Default: 0)
|
|
51
51
|
// baseURL: "", // string - Base URL for API tests
|
|
52
52
|
// paths: [], // string[] - Paths to feature files
|
|
53
53
|
// steps: "", // string - Step definitions files
|
|
@@ -55,7 +55,7 @@ function createProject(createYes, noDeps) {
|
|
|
55
55
|
// timeout : 0, // number - Test timeout in seconds
|
|
56
56
|
// slowMo: 0, // number - Slow down test execution (Default: 0 seconds)
|
|
57
57
|
// parallel: 0, // number - Number of parallel workers
|
|
58
|
-
// report: true
|
|
58
|
+
// report: true // boolean - Generate report
|
|
59
59
|
// reportSuccess: false, // boolean - Add screenshots and video records to report also for success test cases
|
|
60
60
|
// trace: false, // boolean - Enable tracing
|
|
61
61
|
// reportWithTrace: false, // boolean - Include trace in report
|
|
@@ -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
|
+
// device: "", // string - Emulate specific device (e.g., "iPhone 13", for more devices look at the documentation)
|
|
69
70
|
// width: 1280, // number - Browser width
|
|
70
71
|
// height: 720, // number - Browser height
|
|
71
72
|
// maximizeScreen: true // boolean - Maximize browser window
|
|
@@ -336,7 +336,7 @@ const assert = {
|
|
|
336
336
|
expect(elementInteractions.textContent(selector)).toContain(substring);
|
|
337
337
|
},
|
|
338
338
|
shouldContainEqual: (selector, expected) => {
|
|
339
|
-
expect(elementInteractions.textContent(selector)).toContainEqual(
|
|
339
|
+
expect(elementInteractions.textContent(selector)).toContainEqual(expected);
|
|
340
340
|
},
|
|
341
341
|
shouldEqual: (selector, expected) => {
|
|
342
342
|
expect(Number(elementInteractions.textContent(selector))).toEqual(expected);
|
|
@@ -455,7 +455,7 @@ const assert = {
|
|
|
455
455
|
shouldNotContainEqual: (selector, expected) => {
|
|
456
456
|
expect(
|
|
457
457
|
Number(elementInteractions.textContent(selector)),
|
|
458
|
-
).not.toContainEqual(
|
|
458
|
+
).not.toContainEqual(expected);
|
|
459
459
|
},
|
|
460
460
|
shouldNotEqual: (selector, expected) => {
|
|
461
461
|
expect(Number(elementInteractions.textContent(selector))).not.toEqual(
|
package/src/hooks/hooks.js
CHANGED
|
@@ -151,7 +151,7 @@ After(async function ({ pickle, result }) {
|
|
|
151
151
|
const screenshotBuffer = await context.page.screenshot({ type: "png" });
|
|
152
152
|
|
|
153
153
|
await allure.attachment(
|
|
154
|
-
|
|
154
|
+
"Screenshot",
|
|
155
155
|
screenshotBuffer,
|
|
156
156
|
"image/png"
|
|
157
157
|
);
|
|
@@ -233,6 +233,8 @@ AfterAll(async () => {
|
|
|
233
233
|
await projectHooks.AfterAll();
|
|
234
234
|
}
|
|
235
235
|
|
|
236
|
+
logPomWarnings();
|
|
237
|
+
|
|
236
238
|
if (!fs.existsSync(statusDir)) return;
|
|
237
239
|
|
|
238
240
|
const files = fs.readdirSync(statusDir);
|