artes 1.7.7 → 1.7.9

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.7",
3
+ "version": "1.7.9",
4
4
  "description": "The simplest way to automate UI and API tests using Cucumber-style steps.",
5
5
  "main": "index.js",
6
6
  "scripts": {
@@ -13,6 +13,18 @@ const {
13
13
  const { assert, frame } = require("../helper/stepFunctions/exporter");
14
14
  const Ajv = require("ajv");
15
15
 
16
+
17
+ function pathToCamelCase(path) {
18
+ const parts = path.split(".");
19
+ return parts
20
+ .map((part, index) => {
21
+ if (index === 0) return part;
22
+ return part.charAt(0).toUpperCase() + part.slice(1);
23
+ })
24
+ .join("");
25
+ }
26
+
27
+
16
28
  // Check if a selector should be attached
17
29
  Then("User expects {string} should be attached", async function (selector) {
18
30
  await assert.shouldBeAttached(selector);
@@ -1256,9 +1268,9 @@ Then("User expects should have {int} {string}", async (count, elements) => {
1256
1268
  Then(
1257
1269
  "User expects that response has {string} field with {string} value",
1258
1270
  async (field, value) => {
1259
- extractVarsFromResponse(context.response["Response Body"], field);
1260
- const varToString = JSON.stringify(context.vars[field]);
1261
- expect(varToString).toBe(value);
1271
+ extractVarsFromResponse(context.response["Response Body"], field);
1272
+ const key = pathToCamelCase(field);
1273
+ expect(String(context.vars[key])).toBe(value);
1262
1274
  },
1263
1275
  );
1264
1276
 
@@ -135,6 +135,14 @@ Given(
135
135
  },
136
136
  );
137
137
 
138
+ Given(
139
+ "User sets random string in range from {int} to {int} in {string} casing as {string}",
140
+ async (from, to, casing, key) => {
141
+ const randomString = await random.string.alpha( { length: { min: from, max: to}, casing: casing });
142
+ context.vars[key] = randomString;
143
+ },
144
+ );
145
+
138
146
  Given("User sets random fullname as {string}", async (key) => {
139
147
  const randomFirstName = await random.person.firstName();
140
148
  const randomLastName = await random.person.lastName();