diff options
author | Avi Gaffa <avi.gaffa@amdocs.com> | 2018-08-05 08:09:14 +0000 |
---|---|---|
committer | Gerrit Code Review <gerrit@onap.org> | 2018-08-05 08:09:14 +0000 |
commit | bc16f708119e8907fd4beb8d1de9c525d4b9d9ee (patch) | |
tree | 9fc7e6c63af685062652d47987dc1e49e0b03eb2 /workflow-bdd/stepDefinitions/General_Steps.js | |
parent | 8372b56a5c36293dc06f2dda6bb9389467d3eba7 (diff) | |
parent | 02201e449b644790e99bbb230579d96cae4a53da (diff) |
Merge "Refactor and add test flows"
Diffstat (limited to 'workflow-bdd/stepDefinitions/General_Steps.js')
-rw-r--r-- | workflow-bdd/stepDefinitions/General_Steps.js | 88 |
1 files changed, 55 insertions, 33 deletions
diff --git a/workflow-bdd/stepDefinitions/General_Steps.js b/workflow-bdd/stepDefinitions/General_Steps.js index 2e74c6ee..69a703cc 100644 --- a/workflow-bdd/stepDefinitions/General_Steps.js +++ b/workflow-bdd/stepDefinitions/General_Steps.js @@ -39,7 +39,7 @@ Given('Item {string} and version Id {string}', function (string, string2) { }); /** * @module ContextData - * @exampleFile Example_ResponseData_CheckAndManipulation.feature + * @exampleFile ResponseDataChecks.feature * @description Response Data::<br> * """<br> * {jsonObject}<br> @@ -83,7 +83,7 @@ Then('I want to set property {string} to value {string}', function(string, strin /** * @module ResponseData * @description Will check the output data for a property and a value. property can be a path (example: results[0].id) - * @exampleFile Example_ResponseData_CheckAndManipulation.feature + * @exampleFile ResponseDataChecks.feature * @step I want to check property {string} for value {string} **/ Then('I want to check property {string} for value {string}', function(string, string2) { @@ -103,16 +103,17 @@ Then('I want to check property {string} for value:', function(string, docString) /** * @module ResponseData * @description Will check the output data for a property and a integer. property can be a path (example: results[0].id) - * @exampleFile Example_ResponseData_CheckAndManipulation.feature + * @exampleFile ResponseDataChecks.feature * @step I want to check property {string} for value {int} **/ Then('I want to check property {string} for value {int}', function(string, int) { assert.equal(_.get(this.context.responseData, string), int); }); + /** * @module ResponseData * @description Will check the output data for a property and a boolean. property can be a path (example: results[0].id) - * @exampleFile Example_ResponseData_CheckAndManipulation.feature + * @exampleFile ResponseDataChecks.feature * @step I want to check property {string} to be "True/False" **/ Then('I want to check property {string} to be {word}', function(string, string2) { @@ -121,7 +122,7 @@ Then('I want to check property {string} to be {word}', function(string, string2) /** * @module ResponseData * @description Will check the output data for a property and a boolean. property can be a path (example: results[0].id) - * @exampleFile Example_ResponseData_CheckAndManipulation.feature + * @exampleFile ResponseDataChecks.feature * @step I want to check property {string} to have length {int} **/ Then('I want to check property {string} to have length {int}', function(string, intLength) { @@ -131,7 +132,7 @@ Then('I want to check property {string} to have length {int}', function(string, /** * @module ResponseData * @description Will check the output data for a property and make sure it exists - * @exampleFile Example_ResponseData_CheckAndManipulation.feature + * @exampleFile ResponseDataChecks.feature * @step I want to check property {string} exists **/ Then('I want to check property {string} exists', function(string) { @@ -140,7 +141,7 @@ Then('I want to check property {string} exists', function(string) { /** * @module ResponseData * @description Will check the output data for a property and make sure it does not exist - * @exampleFile Example_ResponseData_CheckAndManipulation.feature + * @exampleFile ResponseDataChecks.feature * @step I want to check property {string} does not exist **/ Then('I want to check property {string} does not exist', function(string) { @@ -148,9 +149,55 @@ Then('I want to check property {string} does not exist', function(string) { }); /** + * @module ResponseData + * @description Will check the output data for a property and a value. property can be a path (example: results[0].id) + * @exampleFile ResponseDataChecks.feature + * @step I want to check property {string} for value {string} + **/ +Then('I want to check in the list {string} property {string} with value {string} exists', function(listPath, propertyPath, value) { + var list = _.get(this.context.responseData, listPath); + assert.notEqual(list.find(element => _.get(element, propertyPath) === value), undefined); +}); + +/** + * @module ResponseData + * @description Will check the output data for a property and a value. property can be a path (example: results[0].id) + * @exampleFile ResponseDataChecks.feature + * @step I want to check property {string} for value {string} + **/ +Then('I want to check in the list {string} property {string} with value {string} does not exist', function(listPath, propertyPath, value) { + var list = _.get(this.context.responseData, listPath); + assert.equal(list.find(element => _.get(element, propertyPath) === value), undefined); +}); + +/** + * @module ResponseData + * @description Will check the output data for a property and a value. property can be a path (example: results[0].id) + * @exampleFile ResponseDataChecks.feature + * @step I want to check property {string} for value {string} + **/ +Then('I want to check in the list {string} property {string} with value of saved property {string} exists', function(listPath, propertyPath, valueProperty) { + var list = _.get(this.context.responseData, listPath); + var value = _.get(this.context, valueProperty); + assert.notEqual(list.find(element => _.get(element, propertyPath) === value), undefined); +}); + +/** + * @module ResponseData + * @description Will check the output data for a property and a value. property can be a path (example: results[0].id) + * @exampleFile ResponseDataChecks.feature + * @step I want to check property {string} for value {string} + **/ +Then('I want to check in the list {string} property {string} with value of saved property {string} does not exist', function(listPath, propertyPath, valueProperty) { + var list = _.get(this.context.responseData, listPath); + var value = _.get(this.context, valueProperty); + assert.equal(list.find(element => _.get(element, propertyPath) === value), undefined); +}); + +/** * @module ContextData * @description Use during development to see what is on the context - * @exampleFile Example_ResponseData_CheckAndManipulation.feature + * @exampleFile ResponseDataChecks.feature * @step I want to print the context data **/ Then('I want to print the context data', function() { @@ -247,31 +294,6 @@ When('I want to load the json content of the entry {string} in the zip {string} callback(); }); -/** - * @module ResponseData - * @description Check that the result list doesn't contain an element with property x which has value - * equals to saved property y - * @exampleFile ListItemsFilters.feature - * @step I want to check that element in the response list with {string} equals to value of saved property {string} does not exist - **/ -Then('I want to check that element in the response list with {string} equals to value of saved property {string} does not exist', function (propertyPath, valueProperty) { - const results = this.context.responseData.results; - assert.equal(results.find(result => this.context[valueProperty] === _.get(result, propertyPath)), undefined); -}); - -/** - * @module ResponseData - * @description Check that the result list contains an element with property x which has value - * equals to saved property y - * @exampleFile ListItemsFilters.feature - * @step I want to check that element in the response list with {string} equals to value of saved property {string} exists - **/ -Then('I want to check that element in the response list with {string} equals to value of saved property {string} exists', function(propertyPath, valueProperty) { - const results = this.context.responseData.results; - assert.notEqual(results.find(result => _.get(this.context, valueProperty) === _.get(result, propertyPath)), undefined); -}); - - Then('I want to check that property {string} in the response equals to value of saved property {string}', function(propertyPath, valueProperty) { const results = this.context.responseData; assert.equal(results[propertyPath], _.get(this.context, valueProperty)); |