diff options
author | ayalaben <Ayala.Benzvi@Amdocs.Com> | 2018-02-18 10:03:22 +0200 |
---|---|---|
committer | ayalaben <ayala.benzvi@amdocs.com> | 2018-02-18 10:03:22 +0200 |
commit | aad2781298db9c48ef4be167709b905af39bf9e4 (patch) | |
tree | 76d1e2ea2c6827d8d31de7bc5faaded2a2cf62f6 /openecomp-bdd/stepDefinitions/Utils.js | |
parent | 7866faac17505ef230f4e01c487a0b72621ee409 (diff) |
Flow Tests - delete item and Toggle
Change-Id: I73ed5fdc13891b3ad56ab5c8f00083bf8f7d13f3
Issue-ID: SDC-1034
Signed-off-by: ayalaben <ayala.benzvi@amdocs.com>
Diffstat (limited to 'openecomp-bdd/stepDefinitions/Utils.js')
-rw-r--r-- | openecomp-bdd/stepDefinitions/Utils.js | 14 |
1 files changed, 14 insertions, 0 deletions
diff --git a/openecomp-bdd/stepDefinitions/Utils.js b/openecomp-bdd/stepDefinitions/Utils.js index e818e72b1b..ff49727409 100644 --- a/openecomp-bdd/stepDefinitions/Utils.js +++ b/openecomp-bdd/stepDefinitions/Utils.js @@ -53,6 +53,9 @@ function _request(context, method, path, data, isBinary=false, isVFCall=false) { reject('Status Code was ' + result.statusCode); } if (context.shouldFail && context.errorCode) { + if (typeof data === 'string' && data) { + data = JSON.parse(data); + } let errorCode = data.errorCode; let contextErrorCode = context.errorCode; context.errorCode = null; @@ -60,6 +63,17 @@ function _request(context, method, path, data, isBinary=false, isVFCall=false) { reject('Error Code was ' + errorCode + ' instead of ' + contextErrorCode); } } + if (context.shouldFail && context.errorMessage) { + if (typeof data === 'string' && data) { + data = JSON.parse(data); + } + let errorMessage = data.message; + let contextErrorMessage = context.errorMessage; + context.errorMessage = null; + if (errorMessage !== contextErrorMessage) { + reject('Error Message was ' + errorMessage + ' instead of ' + contextErrorMessage); + } + } if (context.shouldFail) { context.shouldFail = false; resolve({statusCode: result.statusCode, data: {}}); |