artes 1.0.55 → 1.0.56

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/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "artes",
3
- "version": "1.0.55",
3
+ "version": "1.0.56",
4
4
  "description": "The package provide step definitions and user writes feature files, and the package handles automation, with optional POM files and custom step definitions.",
5
5
  "main": "index.js",
6
6
  "scripts": {
@@ -39,7 +39,8 @@ function createProject(createYes) {
39
39
  headless: false, // Set to true for headless browser mode
40
40
 
41
41
  // Configuration options:
42
- // baseURL: "", // string - Base URL for API tests
42
+ // env: "", // string - Environment name for tests
43
+ // baseURL: "", // string - Base URL for API tests
43
44
  // paths: [], // string[] - Paths to feature files
44
45
  // steps: "", // string - Step definitions files
45
46
  // pomPath: "", // string - Path to POM files
@@ -80,33 +80,43 @@ const api = {
80
80
  const res = await context.request.get(resolvedURL, {
81
81
  headers: payloadJSON ? payloadJSON.headers : {},
82
82
  });
83
- const header = await res.headers();
84
- const body = await res.json();
85
-
86
- const response = {
87
- url: res.url(),
88
- response: res,
89
- responseHeaders: header,
90
- responseBody: body,
91
- };
92
-
93
- context.response = response;
83
+
84
+ try{
85
+ const header = await res.headers();
86
+ const body = await res.json();
87
+
88
+ const response = {
89
+ url: res.url(),
90
+ response: res,
91
+ responseHeaders: header,
92
+ responseBody: body,
93
+ };
94
+
95
+ context.response = response;
96
+ }catch(error) {
97
+ throw new Error(`Error processing response: ${error.message}`);
98
+ }
94
99
  },
95
100
  head: async (url) => {
96
101
  const URL = await selector(url);
97
102
  const resolvedURL = await resolveVariable(URL);
98
103
 
99
104
  const res = await context.request.head(resolvedURL);
100
- const header = await res.headers();
101
-
102
- const response = {
103
- url: res.url(),
104
- response: res,
105
- responseHeaders: header,
106
- responseBody: body,
107
- };
108
-
109
- context.response = response;
105
+
106
+ try{
107
+ const header = await res.headers();
108
+
109
+ const response = {
110
+ url: res.url(),
111
+ response: res,
112
+ responseHeaders: header,
113
+ responseBody: body,
114
+ };
115
+
116
+ context.response = response;
117
+ }catch(error) {
118
+ throw new Error(`Error processing response: ${error.message}`);
119
+ }
110
120
  },
111
121
  post: async (url, payload, bodyType) => {
112
122
  const URL = await selector(url);
@@ -136,19 +146,24 @@ const api = {
136
146
 
137
147
  const res = await context.request.post(resolvedURL, requestBody);
138
148
 
139
- const header = await res.headers();
140
- const body = await res.json();
141
-
142
- const response = {
143
- url: res.url(),
144
- requestHeaders: payloadJSON.headers,
145
- requestBody: payloadJSON.body,
146
- response: res,
147
- responseHeaders: header,
148
- responseBody: body,
149
- };
149
+ try{
150
+ const header = await res.headers();
151
+ const body = await res.json();
152
+
153
+ const response = {
154
+ url: res.url(),
155
+ requestHeaders: payloadJSON.headers,
156
+ requestBody: payloadJSON.body,
157
+ response: res,
158
+ responseHeaders: header,
159
+ responseBody: body,
160
+ };
161
+ context.response = response;
162
+ }catch(error) {
163
+ throw new Error(`Error processing response: ${error.message}`);
164
+ }
165
+
150
166
 
151
- context.response = response;
152
167
  },
153
168
  put: async (url, payload, bodyType) => {
154
169
  const URL = await selector(url);
@@ -178,19 +193,22 @@ const api = {
178
193
 
179
194
  const res = await context.request.put(resolvedURL, requestBody);
180
195
 
181
- const header = await res.headers();
182
- const body = await res.json();
183
-
184
- const response = {
185
- url: res.url(),
186
- requestHeaders: payloadJSON.headers,
187
- requestBody: payloadJSON.body,
188
- response: res,
189
- responseHeaders: header,
190
- responseBody: body,
191
- };
192
-
193
- context.response = response;
196
+ try{
197
+ const header = await res.headers();
198
+ const body = await res.json();
199
+
200
+ const response = {
201
+ url: res.url(),
202
+ requestHeaders: payloadJSON.headers,
203
+ requestBody: payloadJSON.body,
204
+ response: res,
205
+ responseHeaders: header,
206
+ responseBody: body,
207
+ };
208
+ context.response = response;
209
+ }catch(error) {
210
+ throw new Error(`Error processing response: ${error.message}`);
211
+ }
194
212
  },
195
213
  patch: async (url, payload, bodyType) => {
196
214
  const URL = await selector(url);
@@ -220,19 +238,22 @@ const api = {
220
238
 
221
239
  const res = await context.request.patch(resolvedURL, requestBody);
222
240
 
223
- const header = await res.headers();
224
- const body = await res.json();
225
-
226
- const response = {
227
- url: res.url(),
228
- requestHeaders: payloadJSON.headers,
229
- requestBody: payloadJSON.body,
230
- response: res,
231
- responseHeaders: header,
232
- responseBody: body,
233
- };
234
-
235
- context.response = response;
241
+ try{
242
+ const header = await res.headers();
243
+ const body = await res.json();
244
+
245
+ const response = {
246
+ url: res.url(),
247
+ requestHeaders: payloadJSON.headers,
248
+ requestBody: payloadJSON.body,
249
+ response: res,
250
+ responseHeaders: header,
251
+ responseBody: body,
252
+ };
253
+ context.response = response;
254
+ }catch(error) {
255
+ throw new Error(`Error processing response: ${error.message}`);
256
+ }
236
257
  },
237
258
  delete: async (url, payload) => {
238
259
  const URL = await selector(url);
@@ -245,17 +266,23 @@ const api = {
245
266
  headers: payloadJSON.headers,
246
267
  });
247
268
 
248
- const header = await res.headers();
249
- const body = await res.json();
250
269
 
251
- const response = {
252
- url: res.url(),
253
- response: res,
254
- responseHeaders: header,
255
- responseBody: body,
256
- };
270
+ try{
271
+ const header = await res.headers();
272
+ const body = await res.json();
273
+
274
+ const response = {
275
+ url: res.url(),
276
+ response: res,
277
+ responseHeaders: header,
278
+ responseBody: body,
279
+ };
280
+
281
+ context.response = response;
282
+ }catch(error) {
283
+ throw new Error(`Error processing response: ${error.message}`);
284
+ }
257
285
 
258
- context.response = response;
259
286
  },
260
287
  vars: () => {
261
288
  return context.vars;