artes 1.0.56 โ 1.0.57
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 +4 -3
- package/cucumber.config.js +5 -1
- package/executer.js +3 -2
- package/package.json +2 -2
- package/src/helper/executers/helper.js +6 -0
- package/src/helper/executers/testRunner.js +15 -11
- package/src/helper/stepFunctions/APIActions.js +23 -27
package/README.md
CHANGED
|
@@ -49,9 +49,10 @@ npx artes [options]
|
|
|
49
49
|
| ๐๏ธ `-c, --create` | Create an example project with Artes | `artes -c` or `artes --create` |
|
|
50
50
|
| โ
`-y, --yes` | Skip the confirmation prompt when creating an example project | `artes -c -y` or `artes --create --yes` |
|
|
51
51
|
| ๐ `-r, --report` | Run tests and generate Allure report | `artes -r` or `artes --report` |
|
|
52
|
-
| ๐ `--features` | Specify one or more feature files to run (comma-separated) | `artes --features 'Alma, Banan'`
|
|
53
|
-
| ๐ `--tags` | Run tests with specified Cucumber tags | `artes --tags "@smoke or @wip"`
|
|
54
|
-
|
|
52
|
+
| ๐ `--features` | Specify one or more feature files to run (comma-separated) | `artes --features 'Alma, Banan'` |
|
|
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` |
|
|
55
56
|
|
|
56
57
|
\*\* To just run the tests: <br>
|
|
57
58
|
Globally: artes <br>
|
package/cucumber.config.js
CHANGED
|
@@ -87,6 +87,10 @@ module.exports = {
|
|
|
87
87
|
artesConfig?.maximizeScreen !== undefined
|
|
88
88
|
? artesConfig.maximizeScreen
|
|
89
89
|
: true,
|
|
90
|
-
headless:
|
|
90
|
+
headless: process.env.MODE
|
|
91
|
+
? JSON.parse(process.env.MODE)
|
|
92
|
+
: artesConfig?.headless !== undefined
|
|
93
|
+
? artesConfig.headless
|
|
94
|
+
: true,
|
|
91
95
|
},
|
|
92
96
|
};
|
package/executer.js
CHANGED
|
@@ -21,6 +21,7 @@ const flags = {
|
|
|
21
21
|
features: args.includes("--features"),
|
|
22
22
|
tags: args.includes("--tags"),
|
|
23
23
|
env: args.includes("--env"),
|
|
24
|
+
headless: args.includes("--headless"),
|
|
24
25
|
};
|
|
25
26
|
|
|
26
27
|
function main() {
|
|
@@ -46,11 +47,11 @@ function main() {
|
|
|
46
47
|
// }
|
|
47
48
|
|
|
48
49
|
if (flags.report) {
|
|
49
|
-
runTests(
|
|
50
|
+
runTests(args, flags);
|
|
50
51
|
generateReport();
|
|
51
52
|
cleanUp();
|
|
52
53
|
} else {
|
|
53
|
-
runTests(
|
|
54
|
+
runTests(args, flags);
|
|
54
55
|
cleanUp();
|
|
55
56
|
}
|
|
56
57
|
}
|
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "artes",
|
|
3
|
-
"version": "1.0.
|
|
4
|
-
"description": "The
|
|
3
|
+
"version": "1.0.57",
|
|
4
|
+
"description": "The simplest way to automate UI and API tests using Cucumber-style steps.",
|
|
5
5
|
"main": "index.js",
|
|
6
6
|
"scripts": {
|
|
7
7
|
"test": "cucumber-js --config=cucumber.config.js",
|
|
@@ -30,6 +30,12 @@ function showHelp() {
|
|
|
30
30
|
|
|
31
31
|
๐ --tags Run tests with specified Cucumber tags
|
|
32
32
|
Usage: artes --tags "@smoke and not @wip"
|
|
33
|
+
|
|
34
|
+
๐ --env Set environment for the test run
|
|
35
|
+
Usage: artes --env "dev"
|
|
36
|
+
|
|
37
|
+
๐ถ๏ธ --headless Run browser in headless mode
|
|
38
|
+
Usage: artes --headless
|
|
33
39
|
`);
|
|
34
40
|
}
|
|
35
41
|
|
|
@@ -2,35 +2,39 @@ const { spawnSync } = require("child_process");
|
|
|
2
2
|
const { moduleConfig } = require("../imports/commons");
|
|
3
3
|
const path = require("path");
|
|
4
4
|
|
|
5
|
-
function runTests(
|
|
6
|
-
const args = process.argv.slice(2);
|
|
7
|
-
|
|
5
|
+
function runTests(args, flags) {
|
|
8
6
|
const env = args[args.indexOf("--env") + 1];
|
|
9
7
|
|
|
10
8
|
const featureFiles = args[args.indexOf("--features") + 1];
|
|
11
9
|
const features =
|
|
12
|
-
|
|
10
|
+
flags.features &&
|
|
13
11
|
featureFiles
|
|
14
12
|
.split(",")
|
|
15
13
|
.map((f) => path.join(moduleConfig.featuresPath, `${f.trim()}.feature`));
|
|
16
14
|
|
|
17
15
|
const tags = args[args.indexOf("--tags") + 1];
|
|
18
16
|
|
|
19
|
-
|
|
20
|
-
|
|
17
|
+
const headless = args.includes("--headless");
|
|
18
|
+
|
|
19
|
+
flags.env && console.log("Running env:", env);
|
|
20
|
+
flags.env ? (process.env.ENV = JSON.stringify(env)) : "";
|
|
21
21
|
|
|
22
|
-
|
|
22
|
+
flags.report
|
|
23
23
|
? (process.env.REPORT_FORMAT = JSON.stringify([
|
|
24
24
|
"rerun:@rerun.txt",
|
|
25
25
|
"allure-cucumberjs/reporter",
|
|
26
26
|
]))
|
|
27
27
|
: "";
|
|
28
28
|
|
|
29
|
-
|
|
30
|
-
|
|
29
|
+
flags.tags && console.log("Running tags:", tags);
|
|
30
|
+
flags.tags ? (process.env.RUN_TAGS = JSON.stringify(tags)) : "";
|
|
31
|
+
|
|
32
|
+
flags.features && console.log("Running features:", features);
|
|
33
|
+
flags.features ? (process.env.FEATURES = JSON.stringify(features)) : "";
|
|
31
34
|
|
|
32
|
-
|
|
33
|
-
|
|
35
|
+
flags.headless &&
|
|
36
|
+
console.log("Running mode:", flags.headless ? "headless" : "headed");
|
|
37
|
+
flags.headless ? (process.env.MODE = JSON.stringify(true)) : false;
|
|
34
38
|
|
|
35
39
|
try {
|
|
36
40
|
console.log("๐งช Running tests...");
|
|
@@ -80,20 +80,20 @@ const api = {
|
|
|
80
80
|
const res = await context.request.get(resolvedURL, {
|
|
81
81
|
headers: payloadJSON ? payloadJSON.headers : {},
|
|
82
82
|
});
|
|
83
|
-
|
|
84
|
-
try{
|
|
83
|
+
|
|
84
|
+
try {
|
|
85
85
|
const header = await res.headers();
|
|
86
86
|
const body = await res.json();
|
|
87
|
-
|
|
87
|
+
|
|
88
88
|
const response = {
|
|
89
89
|
url: res.url(),
|
|
90
90
|
response: res,
|
|
91
91
|
responseHeaders: header,
|
|
92
92
|
responseBody: body,
|
|
93
93
|
};
|
|
94
|
-
|
|
94
|
+
|
|
95
95
|
context.response = response;
|
|
96
|
-
}catch(error) {
|
|
96
|
+
} catch (error) {
|
|
97
97
|
throw new Error(`Error processing response: ${error.message}`);
|
|
98
98
|
}
|
|
99
99
|
},
|
|
@@ -102,19 +102,19 @@ const api = {
|
|
|
102
102
|
const resolvedURL = await resolveVariable(URL);
|
|
103
103
|
|
|
104
104
|
const res = await context.request.head(resolvedURL);
|
|
105
|
-
|
|
106
|
-
try{
|
|
105
|
+
|
|
106
|
+
try {
|
|
107
107
|
const header = await res.headers();
|
|
108
|
-
|
|
108
|
+
|
|
109
109
|
const response = {
|
|
110
110
|
url: res.url(),
|
|
111
111
|
response: res,
|
|
112
112
|
responseHeaders: header,
|
|
113
113
|
responseBody: body,
|
|
114
114
|
};
|
|
115
|
-
|
|
115
|
+
|
|
116
116
|
context.response = response;
|
|
117
|
-
}catch(error) {
|
|
117
|
+
} catch (error) {
|
|
118
118
|
throw new Error(`Error processing response: ${error.message}`);
|
|
119
119
|
}
|
|
120
120
|
},
|
|
@@ -146,10 +146,10 @@ const api = {
|
|
|
146
146
|
|
|
147
147
|
const res = await context.request.post(resolvedURL, requestBody);
|
|
148
148
|
|
|
149
|
-
try{
|
|
149
|
+
try {
|
|
150
150
|
const header = await res.headers();
|
|
151
151
|
const body = await res.json();
|
|
152
|
-
|
|
152
|
+
|
|
153
153
|
const response = {
|
|
154
154
|
url: res.url(),
|
|
155
155
|
requestHeaders: payloadJSON.headers,
|
|
@@ -159,11 +159,9 @@ const api = {
|
|
|
159
159
|
responseBody: body,
|
|
160
160
|
};
|
|
161
161
|
context.response = response;
|
|
162
|
-
}catch(error) {
|
|
162
|
+
} catch (error) {
|
|
163
163
|
throw new Error(`Error processing response: ${error.message}`);
|
|
164
164
|
}
|
|
165
|
-
|
|
166
|
-
|
|
167
165
|
},
|
|
168
166
|
put: async (url, payload, bodyType) => {
|
|
169
167
|
const URL = await selector(url);
|
|
@@ -193,10 +191,10 @@ const api = {
|
|
|
193
191
|
|
|
194
192
|
const res = await context.request.put(resolvedURL, requestBody);
|
|
195
193
|
|
|
196
|
-
try{
|
|
194
|
+
try {
|
|
197
195
|
const header = await res.headers();
|
|
198
196
|
const body = await res.json();
|
|
199
|
-
|
|
197
|
+
|
|
200
198
|
const response = {
|
|
201
199
|
url: res.url(),
|
|
202
200
|
requestHeaders: payloadJSON.headers,
|
|
@@ -206,7 +204,7 @@ const api = {
|
|
|
206
204
|
responseBody: body,
|
|
207
205
|
};
|
|
208
206
|
context.response = response;
|
|
209
|
-
}catch(error) {
|
|
207
|
+
} catch (error) {
|
|
210
208
|
throw new Error(`Error processing response: ${error.message}`);
|
|
211
209
|
}
|
|
212
210
|
},
|
|
@@ -238,10 +236,10 @@ const api = {
|
|
|
238
236
|
|
|
239
237
|
const res = await context.request.patch(resolvedURL, requestBody);
|
|
240
238
|
|
|
241
|
-
try{
|
|
239
|
+
try {
|
|
242
240
|
const header = await res.headers();
|
|
243
241
|
const body = await res.json();
|
|
244
|
-
|
|
242
|
+
|
|
245
243
|
const response = {
|
|
246
244
|
url: res.url(),
|
|
247
245
|
requestHeaders: payloadJSON.headers,
|
|
@@ -251,7 +249,7 @@ const api = {
|
|
|
251
249
|
responseBody: body,
|
|
252
250
|
};
|
|
253
251
|
context.response = response;
|
|
254
|
-
}catch(error) {
|
|
252
|
+
} catch (error) {
|
|
255
253
|
throw new Error(`Error processing response: ${error.message}`);
|
|
256
254
|
}
|
|
257
255
|
},
|
|
@@ -266,23 +264,21 @@ const api = {
|
|
|
266
264
|
headers: payloadJSON.headers,
|
|
267
265
|
});
|
|
268
266
|
|
|
269
|
-
|
|
270
|
-
try{
|
|
267
|
+
try {
|
|
271
268
|
const header = await res.headers();
|
|
272
269
|
const body = await res.json();
|
|
273
|
-
|
|
270
|
+
|
|
274
271
|
const response = {
|
|
275
272
|
url: res.url(),
|
|
276
273
|
response: res,
|
|
277
274
|
responseHeaders: header,
|
|
278
275
|
responseBody: body,
|
|
279
276
|
};
|
|
280
|
-
|
|
277
|
+
|
|
281
278
|
context.response = response;
|
|
282
|
-
}catch(error) {
|
|
279
|
+
} catch (error) {
|
|
283
280
|
throw new Error(`Error processing response: ${error.message}`);
|
|
284
281
|
}
|
|
285
|
-
|
|
286
282
|
},
|
|
287
283
|
vars: () => {
|
|
288
284
|
return context.vars;
|