artes 1.7.23 → 1.7.25

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.7.23",
3
+ "version": "1.7.25",
4
4
  "description": "The simplest way to automate UI and API tests using Cucumber-style steps.",
5
5
  "main": "index.js",
6
6
  "scripts": {
@@ -1264,31 +1264,6 @@ Then(
1264
1264
  },
1265
1265
  );
1266
1266
 
1267
- Then(
1268
- "User expects that response has {string} field that contains {string} value",
1269
- async (field, value) => {
1270
- extractVarsFromResponse(context.response["Response Body"], field);
1271
- const key = pathToCamelCase(field);
1272
- expect(String(context.vars[key])).toContain(resolveVariable(value));
1273
- },
1274
- );
1275
-
1276
-
1277
- Then('User expects that response has {string} header with {string} value', async (field, value) => {
1278
- extractVarsFromResponse(context.response["Response Headers"], field);
1279
- const key = pathToCamelCase(field);
1280
- expect(String(context.vars[key])).toBe(resolveVariable(value));
1281
- })
1282
-
1283
- Then(
1284
- "User expects that response does not have {string} field with {string} value",
1285
- async (field, value) => {
1286
- extractVarsFromResponse(context.response["Response Body"], field);
1287
- const key = pathToCamelCase(field);
1288
- expect(String(context.vars[key])).not.toBe(resolveVariable(value));
1289
- },
1290
- );
1291
-
1292
1267
  Then(
1293
1268
  "User expects that {string} array has {int} items",
1294
1269
  async (field, count) => {
@@ -1338,6 +1313,21 @@ Then(
1338
1313
  },
1339
1314
  );
1340
1315
 
1316
+ Then(
1317
+ 'User expects that response can have {string} status codes',
1318
+ async function (expectedStatusCodes) {
1319
+ expectedStatusCodes = await resolveVariable(expectedStatusCodes);
1320
+
1321
+ const allowedStatusCodes = expectedStatusCodes
1322
+ .split(',')
1323
+ .map(code => Number(code.trim()));
1324
+
1325
+ const actualStatusCode = context.response.Response.status();
1326
+
1327
+ expect(allowedStatusCodes).toContain(actualStatusCode);
1328
+ }
1329
+ );
1330
+
1341
1331
 
1342
1332
  Then("User expects that response should have {string} field", async (field) => {
1343
1333
  extractVarsFromResponse(context.response["Response Body"], field);
@@ -1372,4 +1362,29 @@ Then(
1372
1362
  const resolvedCount = resolveVariable(count)
1373
1363
  expect(context.vars[key].length).toBeLessThan(resolvedCount);
1374
1364
  },
1365
+ );
1366
+
1367
+ Then(
1368
+ "User expects that response has {string} field that contains {string} value",
1369
+ async (field, value) => {
1370
+ extractVarsFromResponse(context.response["Response Body"], field);
1371
+ const key = pathToCamelCase(field);
1372
+ expect(String(context.vars[key])).toContain(resolveVariable(value));
1373
+ },
1374
+ );
1375
+
1376
+
1377
+ Then('User expects that response has {string} header with {string} value', async (field, value) => {
1378
+ extractVarsFromResponse(context.response["Response Headers"], field);
1379
+ const key = pathToCamelCase(field);
1380
+ expect(String(context.vars[key])).toBe(resolveVariable(value));
1381
+ })
1382
+
1383
+ Then(
1384
+ "User expects that response does not have {string} field with {string} value",
1385
+ async (field, value) => {
1386
+ extractVarsFromResponse(context.response["Response Body"], field);
1387
+ const key = pathToCamelCase(field);
1388
+ expect(String(context.vars[key])).not.toBe(resolveVariable(value));
1389
+ },
1375
1390
  );
@@ -14,7 +14,7 @@ Given("User sets random word as {string}", async (key) => {
14
14
 
15
15
  Given(
16
16
  "User sets random word that has {int} character as {string}",
17
- async (key, count) => {
17
+ async (count, key) => {
18
18
  const word = random.lorem.word(count);
19
19
  context.vars[key] = word;
20
20
  },
@@ -33,7 +33,7 @@ Given("User sets random words as {string}", async (key) => {
33
33
  context.vars[key] = words;
34
34
  });
35
35
 
36
- Given("User sets random {int} words as {string}", async (key, count) => {
36
+ Given("User sets random {int} words as {string}", async (count, key) => {
37
37
  const words = random.lorem.words({ wordCount: count });
38
38
  context.vars[key] = words;
39
39
  });