aboutsummaryrefslogtreecommitdiffstats
path: root/workflow-bdd/stepDefinitions
diff options
context:
space:
mode:
Diffstat (limited to 'workflow-bdd/stepDefinitions')
-rw-r--r--workflow-bdd/stepDefinitions/General_Steps.js15
-rw-r--r--workflow-bdd/stepDefinitions/Utils.js5
-rw-r--r--workflow-bdd/stepDefinitions/world.js5
3 files changed, 18 insertions, 7 deletions
diff --git a/workflow-bdd/stepDefinitions/General_Steps.js b/workflow-bdd/stepDefinitions/General_Steps.js
index 448c97f8..0550e415 100644
--- a/workflow-bdd/stepDefinitions/General_Steps.js
+++ b/workflow-bdd/stepDefinitions/General_Steps.js
@@ -52,11 +52,11 @@ Given('Response Data:', function (docString) {
/**
* @module ContextData
- * @description Copy a property from the response data to context Item/VLM/VSP data, example: vsp.componentId
+ * @description Copy a property from the response data to context Item data, example: item.componentId
* @step I want to save on the context for {string} property {string} with value {string}
**/
Then('I want to save on the context for {string} property {string} with value {string}', function(string, string1, string2) {
- assert.equal(_.includes(['VLM', 'VSP', 'Item'], string), true);
+ assert.equal(_.includes(['Item'], string), true);
let val = _.get(this.context.responseData, string2);
_.set(this.context, string1, val);
});
@@ -170,6 +170,17 @@ Then('I want the following to fail', function() {
/**
* @module ContextData
+ * @description Set this in order to check that the following Rest call will not have response code 200
+ * @exampleFile Example_Rest_Calls.feature
+ * @step I want the following to fail
+ **/
+Then('I want the following to fail with response status code {int}', function(int) {
+ this.context.shouldFail = true;
+ this.context.responseStatusCode = int;
+});
+
+/**
+ * @module ContextData
* @description Set this in order to check that the following Rest call will have the error code on the return data
* @exampleFile Example_VSP.feature
* @step I want the following to fail with error code {string}
diff --git a/workflow-bdd/stepDefinitions/Utils.js b/workflow-bdd/stepDefinitions/Utils.js
index 66e959f6..6f8a7a5c 100644
--- a/workflow-bdd/stepDefinitions/Utils.js
+++ b/workflow-bdd/stepDefinitions/Utils.js
@@ -55,6 +55,11 @@ function _request(context, method, path, data, isBinary=false, type='onboarding'
console.error(result.body);
reject('Status Code was ' + result.statusCode);
}
+ if (context.shouldFail && context.responseStatusCode) {
+ if (result.statusCode !== context.responseStatusCode) {
+ reject('Response Status Code was ' + result.statusCode + ' instead of ' + context.responseStatusCode);
+ }
+ }
if (context.shouldFail && context.errorCode) {
if (typeof data === 'string' && data) {
data = JSON.parse(data);
diff --git a/workflow-bdd/stepDefinitions/world.js b/workflow-bdd/stepDefinitions/world.js
index 4ef03813..cf749e66 100644
--- a/workflow-bdd/stepDefinitions/world.js
+++ b/workflow-bdd/stepDefinitions/world.js
@@ -38,9 +38,6 @@ var {setDefaultTimeout} = require('cucumber');
*<Br>
* Contains the following items:<br>
* <li>this.context.server <ul>REST server and onboarding prefix including version. set either in configuration file or from the command line or SERVER environment variable</ul>
- * <li>this.context.vlm <ul>When a VLM has been created, this has the an id and versionId set to the correct IDs.</ul>
- * <li>this.context.vsp <ul>When a VSP has been created, this has the an id and versionId and componentId set to the correct IDs.</ul>
- * <li>this.context.item <ul>When a VLM or VSP has been created, this has the an id and versionId set to the correct IDs.</ul>
* <li>this.context <ul>Object with properties that were saved in the steps.</ul>
* <li>this.context.inputdata <ul><b>Automatically updated with the last responseData from the Rest call</b><br>Object with properties that were prepares in the steps.</ul>
* <li>this.context.responseData <ul>Response from the last REST call.</ul>
@@ -57,8 +54,6 @@ class CustomWorld {
}
}
- this.context.vlm = {id: null, versionId: null};
- this.context.vsp = {id: null, versionId: null};
this.context.item = {id: null, versionId: null, componentId: null};
this.context.shouldFail = false;