summaryrefslogtreecommitdiffstats
path: root/openecomp-bdd
diff options
context:
space:
mode:
authorayalaben <Ayala.Benzvi@Amdocs.Com>2018-02-18 10:03:22 +0200
committerayalaben <ayala.benzvi@amdocs.com>2018-02-18 10:03:22 +0200
commitaad2781298db9c48ef4be167709b905af39bf9e4 (patch)
tree76d1e2ea2c6827d8d31de7bc5faaded2a2cf62f6 /openecomp-bdd
parent7866faac17505ef230f4e01c487a0b72621ee409 (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')
-rw-r--r--openecomp-bdd/features/Example_Toggle.feature8
-rw-r--r--openecomp-bdd/features/Onboarding/DeleteItem/DeleteVLMCertified.feature24
-rw-r--r--openecomp-bdd/features/Onboarding/DeleteItem/DeleteVLMDraft.feature24
-rw-r--r--openecomp-bdd/features/Onboarding/DeleteItem/DeleteVSPCertified.feature29
-rw-r--r--openecomp-bdd/features/Onboarding/DeleteItem/DeleteVSPDraft.feature22
-rw-r--r--openecomp-bdd/stepDefinitions/General_Steps.js12
-rw-r--r--openecomp-bdd/stepDefinitions/Toggle_Steps.js48
-rw-r--r--openecomp-bdd/stepDefinitions/Utils.js14
-rw-r--r--openecomp-bdd/stepDefinitions/VLM_steps.js10
-rw-r--r--openecomp-bdd/stepDefinitions/VSP_steps.js11
10 files changed, 202 insertions, 0 deletions
diff --git a/openecomp-bdd/features/Example_Toggle.feature b/openecomp-bdd/features/Example_Toggle.feature
new file mode 100644
index 0000000000..2d930773bd
--- /dev/null
+++ b/openecomp-bdd/features/Example_Toggle.feature
@@ -0,0 +1,8 @@
+Feature: Enable all toggls
+
+Scenario: Enable/Disable all toggls
+ When I want to list Togglz
+ Then I want to set all Togglz to be "true"
+ Then I want to list Togglz
+ Then I want to set all Togglz to be "false"
+ Then I want to list Togglz \ No newline at end of file
diff --git a/openecomp-bdd/features/Onboarding/DeleteItem/DeleteVLMCertified.feature b/openecomp-bdd/features/Onboarding/DeleteItem/DeleteVLMCertified.feature
new file mode 100644
index 0000000000..4eb31aeafe
--- /dev/null
+++ b/openecomp-bdd/features/Onboarding/DeleteItem/DeleteVLMCertified.feature
@@ -0,0 +1,24 @@
+Feature: Delete VLM Certified
+
+ Scenario: Delete VLM that was certified - negative
+ When I want to create a VLM
+ Then I want to create input data
+ Then I want to update the input property "name" with a random value
+ Then I want to update the input property "type" with value "Universal"
+ Then I want to create for path "/vendor-license-models/{item.id}/versions/{item.versionId}/license-key-groups" with the input data from the context
+ Then I want to copy to property "lastProcessId" from response data path "value"
+ Then I want to commit this Item
+
+ Then I want to get path "/items/{item.id}/versions"
+ Then I want to check property "listCount" for value 1
+ Then I want to make sure this Item has status "Draft"
+ When I want to submit this VLM
+ Then I want to make sure this Item has status "Certified"
+ Then I want to get path "/items/{item.id}/versions"
+ Then I want to check property "listCount" for value 1
+
+ Then I want the following to fail with error message "VLM has been certified and cannot be deleted."
+ Then I want to delete this VLM
+
+ Then I want to get path "/items/{item.id}/versions"
+ Then I want to check property "listCount" for value 1
diff --git a/openecomp-bdd/features/Onboarding/DeleteItem/DeleteVLMDraft.feature b/openecomp-bdd/features/Onboarding/DeleteItem/DeleteVLMDraft.feature
new file mode 100644
index 0000000000..c9a7ed7823
--- /dev/null
+++ b/openecomp-bdd/features/Onboarding/DeleteItem/DeleteVLMDraft.feature
@@ -0,0 +1,24 @@
+Feature: Delete VLM
+
+Scenario: Delete VLM with only draft
+ When I want to create a VLM
+ Then I want to create input data
+ Then I want to update the input property "name" with a random value
+ Then I want to update the input property "type" with value "Universal"
+ Then I want to create for path "/vendor-license-models/{item.id}/versions/{item.versionId}/license-key-groups" with the input data from the context
+ Then I want to copy to property "lastProcessId" from response data path "value"
+ Then I want to commit this Item
+
+ Then I want to get path "/items/{item.id}/versions"
+ Then I want to check property "listCount" for value 1
+ Then I want to make sure this Item has status "Draft"
+
+ Then I want to delete this VLM
+
+ Then I want the following to fail with error code "GENERAL_ERROR_REST_ID"
+ Then I want to get path "/items/{item.id}/versions"
+
+
+
+
+
diff --git a/openecomp-bdd/features/Onboarding/DeleteItem/DeleteVSPCertified.feature b/openecomp-bdd/features/Onboarding/DeleteItem/DeleteVSPCertified.feature
new file mode 100644
index 0000000000..35a506a010
--- /dev/null
+++ b/openecomp-bdd/features/Onboarding/DeleteItem/DeleteVSPCertified.feature
@@ -0,0 +1,29 @@
+Feature: Delete VSP Draft
+
+ Background: Init
+ Given I want to create a VLM
+
+ Scenario: Delete VSP with only draft
+ When I want to create a VSP with onboarding type "NetworkPackage"
+ Then I want to make sure this Item has status "Draft"
+
+ When I want to upload a NetworkPackage for this VSP from path "resources/uploads/BASE_MUX.zip"
+ And I want to process the NetworkPackage file for this VSP
+
+ Then I want to commit this Item
+
+ Then I want to get path "/items/{item.id}/versions"
+ Then I want to check property "listCount" for value 1
+ Then I want to make sure this Item has status "Draft"
+
+ When I want to submit this VSP
+ Then I want to make sure this Item has status "Certified"
+ Then I want to get path "/items/{item.id}/versions"
+ Then I want to check property "listCount" for value 1
+
+ Then I want the following to fail with error message "VSP has been certified and cannot be deleted."
+ Then I want to delete this VSP
+
+ Then I want to get path "/items/{item.id}/versions"
+ Then I want to check property "listCount" for value 1
+
diff --git a/openecomp-bdd/features/Onboarding/DeleteItem/DeleteVSPDraft.feature b/openecomp-bdd/features/Onboarding/DeleteItem/DeleteVSPDraft.feature
new file mode 100644
index 0000000000..aade3bf383
--- /dev/null
+++ b/openecomp-bdd/features/Onboarding/DeleteItem/DeleteVSPDraft.feature
@@ -0,0 +1,22 @@
+Feature: Delete VSP Certified
+
+ Background: Init
+ Given I want to create a VLM
+
+ Scenario: Delete VSP with certified - negative
+ When I want to create a VSP with onboarding type "NetworkPackage"
+ Then I want to make sure this Item has status "Draft"
+
+ When I want to upload a NetworkPackage for this VSP from path "resources/uploads/BASE_MUX.zip"
+ And I want to process the NetworkPackage file for this VSP
+
+ Then I want to commit this Item
+
+ Then I want to get path "/items/{item.id}/versions"
+ Then I want to check property "listCount" for value 1
+ Then I want to make sure this Item has status "Draft"
+
+ Then I want to delete this VSP
+
+ Then I want the following to fail with error code "GENERAL_ERROR_REST_ID"
+ Then I want to get path "/items/{item.id}/versions"
diff --git a/openecomp-bdd/stepDefinitions/General_Steps.js b/openecomp-bdd/stepDefinitions/General_Steps.js
index 389112da84..bf35cb8499 100644
--- a/openecomp-bdd/stepDefinitions/General_Steps.js
+++ b/openecomp-bdd/stepDefinitions/General_Steps.js
@@ -172,6 +172,18 @@ Then('I want the following to fail with error code {string}', function(string)
this.context.errorCode = string;
});
+
+/**
+ * @module ContextData
+ * @description Set this in order to check that the following Rest call will have the error message on the return data
+ * @exampleFile DeleteVLMCertified.feature
+ * @step I want the following to fail with error message {string}
+ **/
+Then('I want the following to fail with error message {string}', function(string) {
+ this.context.shouldFail = true;
+ this.context.errorMessage = string;
+});
+
/**
* @module ZipData
* @description Use this in order to extract a file from a zip file and to compare it to a local file (string comparison).
diff --git a/openecomp-bdd/stepDefinitions/Toggle_Steps.js b/openecomp-bdd/stepDefinitions/Toggle_Steps.js
new file mode 100644
index 0000000000..16bcc2afb9
--- /dev/null
+++ b/openecomp-bdd/stepDefinitions/Toggle_Steps.js
@@ -0,0 +1,48 @@
+/*
+* Copyright © 2016-2018 European Support Limited
+*
+* Licensed under the Apache License, Version 2.0 (the "License");
+* you may not use this file except in compliance with the License.
+* You may obtain a copy of the License at
+*
+* http://www.apache.org/licenses/LICENSE-2.0
+*
+* Unless required by applicable law or agreed to in writing, software
+* distributed under the License is distributed on an "AS IS" BASIS,
+* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+* See the License for the specific language governing permissions and
+* limitations under the License.
+*/
+
+const {Then, When, Given} = require('cucumber');
+const assert = require('assert');
+const util = require('./Utils.js');
+
+
+/**
+ * @module Toggle
+ * @description this step will retrun and print to console the list of toggled features with their status
+ * @exampleFile Example_Toggle.feature
+ * @step I want to list Togglz
+ **/
+
+Then('I want to list Togglz', function() {
+ let path = '/togglz' ;
+ return util.request(this.context, 'GET', path).then(result => {
+ const featureList = result.data.features;
+ console.log(featureList);
+ });
+
+});
+
+/**
+ * @module Toggle
+ * @description this step will set the status for all toggled features
+ * @exampleFile Example_Toggle.feature
+ * @step I want to set all Togglz to be "true/false"
+ **/
+
+Then('I want to set all Togglz to be {string}', function(string) {
+ let path = '/togglz/state/' + string ;
+ return util.request(this.context, 'PUT', path);
+}); \ No newline at end of file
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: {}});
diff --git a/openecomp-bdd/stepDefinitions/VLM_steps.js b/openecomp-bdd/stepDefinitions/VLM_steps.js
index 6e0dd318cf..ea75313789 100644
--- a/openecomp-bdd/stepDefinitions/VLM_steps.js
+++ b/openecomp-bdd/stepDefinitions/VLM_steps.js
@@ -45,3 +45,13 @@ Then('I want to submit this VLM', function() {
return util.request(this.context, 'PUT', path, inputData);
});
+/**
+ * @module VLM
+ * @exampleFile DeleteVLMDraft.feature
+ * @step I want to delete this VLM
+ **/
+Then('I want to delete this VLM', function() {
+ let path = '/vendor-license-models/' + this.context.item.id ;
+ return util.request(this.context, 'DELETE', path);
+});
+
diff --git a/openecomp-bdd/stepDefinitions/VSP_steps.js b/openecomp-bdd/stepDefinitions/VSP_steps.js
index b957e6f723..bed8921a3c 100644
--- a/openecomp-bdd/stepDefinitions/VSP_steps.js
+++ b/openecomp-bdd/stepDefinitions/VSP_steps.js
@@ -107,4 +107,15 @@ Then('I want to add a component', function () {
When('I want to get the package for this Item to path {string}', function (string, callback) {
let path = '/vendor-software-products/packages/' + this.context.item.id;
return [util.download(this.context, path, string, callback)];
+});
+
+
+/**
+ * @module VSP
+ * @exampleFile DeleteVSPDraft.feature
+ * @step I want to delete this VSP
+ **/
+Then('I want to delete this VSP', function() {
+ let path = '/vendor-software-products/' + this.context.item.id ;
+ return util.request(this.context, 'DELETE', path);
}); \ No newline at end of file