artes 1.0.76 → 1.0.77
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,4 +1,5 @@
|
|
|
1
1
|
const { Given, context, random } = require("../helper/imports/commons");
|
|
2
|
+
const { api } = require("../helper/stepFunctions/exporter");
|
|
2
3
|
|
|
3
4
|
Given("User sets random words as {string} variable", async (key) => {
|
|
4
5
|
const words = random.lorem.words({ min: 2, max: 5 });
|
|
@@ -17,9 +18,14 @@ Given(
|
|
|
17
18
|
"User sends GET request to {string} and save {string} variable from {string} array as a {string} randomly",
|
|
18
19
|
async (endPoint, varName, fromArray, variableKey) => {
|
|
19
20
|
await api.get(endPoint);
|
|
20
|
-
|
|
21
|
+
let responseBody
|
|
22
|
+
if(fromArray=="[]"){
|
|
23
|
+
responseBody = await context.response["Response Body"]
|
|
24
|
+
}else{
|
|
25
|
+
responseBody = await context.response["Response Body"][fromArray]
|
|
26
|
+
}
|
|
21
27
|
const randomContent =
|
|
22
28
|
responseBody[random.number.int({ min: 0, max: responseBody.length - 1 })];
|
|
23
29
|
context.vars[variableKey] = randomContent[varName];
|
|
24
30
|
},
|
|
25
|
-
);
|
|
31
|
+
);
|