Add more VNFs after loading a template + Remove + Duplicate
[vid.git] / vid-webpack-master / cypress / integration / iFrames / drawingBoard.e2e.ts
index 33829fb..cf870b7 100644 (file)
@@ -17,6 +17,22 @@ describe('Drawing board', function () {
     cy.screenshot();
   });
 
+  function addSameVnfMultipleTimes() {
+    cy.openIframe('app/ui/#/servicePlanning?serviceModelId=2f80c596-27e5-4ca9-b5bb-e03a7fd4c0fd');
+    const vnfNodeName = 'node-2017-488_PASQUALE-vPE 0';
+    cy.drawingBoardPressAddButtonByElementName(vnfNodeName).get('i').should('have.class', 'fa-plus-circle');
+    cy.drawingBoardPressAddButtonByElementName(vnfNodeName).click({force: true});
+    cy.fillVnfPopup().then(() => {
+      cy.drawingBoardPressAddButtonByElementName(vnfNodeName).click({force: true});
+      cy.fillVnfPopup().then(() => {
+        cy.drawingBoardPressAddButtonByElementName(vnfNodeName).click({force: true});
+        cy.fillVnfPopup().then(() => {
+          cy.drawingBoardNumberOfExistingElementsShouldContains(3);
+        });
+      });
+    });
+  }
+
   describe('duplicate', () => {
 
     it('delete vf module reduce the number of vf modules ', function () {
@@ -40,18 +56,7 @@ describe('Drawing board', function () {
     it('create new  vf module  update the number of vf modules ', () => {
       cy.readFile('cypress/support/jsonBuilders/mocks/jsons/emptyServiceRedux.json').then((res) => {
         cy.setReduxState(<any>res);
-        cy.openIframe('app/ui/#/servicePlanning?serviceModelId=2f80c596-27e5-4ca9-b5bb-e03a7fd4c0fd');
-        cy.drawingBoardPressAddButtonByElementName('node-2017-488_PASQUALE-vPE 0').get('i').should('have.class', 'fa-plus-circle');
-        cy.drawingBoardPressAddButtonByElementName('node-2017-488_PASQUALE-vPE 0').click({force: true});
-        cy.fillVnfPopup().then(() => {
-          cy.drawingBoardPressAddButtonByElementName('node-2017-488_PASQUALE-vPE 0').click({force: true});
-          cy.fillVnfPopup().then(() => {
-            cy.drawingBoardPressAddButtonByElementName('node-2017-488_PASQUALE-vPE 0').click({force: true});
-            cy.fillVnfPopup().then(() => {
-              cy.drawingBoardNumberOfExistingElementsShouldContains(3);
-            });
-          });
-        });
+        addSameVnfMultipleTimes();
       });
     });
 
@@ -238,6 +243,38 @@ describe('Drawing board', function () {
 
   });
 
+  describe('default max instances value', () => {
+
+    it('when there is no maxCountInstances for vfModule, it can be added unlimited times', () => {
+      let reduxState = getReduxWithVNFS(false);
+      (<any> reduxState.global.flags)['FLAG_2002_UNLIMITED_MAX'] =  true;
+      cy.setReduxState(<any>reduxState);
+      cy.openIframe('app/ui/#/servicePlanning?serviceModelId=6e59c5de-f052-46fa-aa7e-2fca9d674c44');
+      const vfModuleName = 'vf_vgeraldine0..VfVgeraldine..vflorence_gpb..module-2';
+      const vnfName = "VF_vGeraldine 0";
+      cy.addMacroVfModule(vnfName, vfModuleName, 'module-1');
+      cy.addMacroVfModule(vnfName, vfModuleName, 'module-2');
+      cy.addMacroVfModule(vnfName, vfModuleName, 'module-3');
+      cy.getElementByDataTestsId('node-d6557200-ecf2-4641-8094-5393ae3aae60-VF_vGeraldine 0').click();
+      cy.getElementByDataTestsId('node-41708296-e443-4c71-953f-d9a010f059e1-vf_vgeraldine0..VfVgeraldine..vflorence_gpb..module-2').should('have.length', 3);
+
+      //make sure max instances in model info show Unlimited (default)
+      cy.drawingBoardTreeOpenContextMenuByElementDataTestId('node-41708296-e443-4c71-953f-d9a010f059e1-vf_vgeraldine0..VfVgeraldine..vflorence_gpb..module-2', 0)
+        .drawingBoardTreeClickOnContextMenuOptionByName('Edit')
+        .getElementByDataTestsId('model-item-value-max').contains('Unlimited (default)')
+        .getElementByDataTestsId("cancelButton").click();
+    });
+
+    it('when there is no max_instances for VNF, it can be added multiple times ', () => {
+      cy.readFile('cypress/support/jsonBuilders/mocks/jsons/emptyServiceRedux.json').then((reduxState) => {
+        reduxState.global['flags'] = { 'FLAG_2002_UNLIMITED_MAX' : true };
+        delete reduxState.service.serviceHierarchy['2f80c596-27e5-4ca9-b5bb-e03a7fd4c0fd'].vnfs['2017-488_PASQUALE-vPE 0'].properties.max_instances;
+        cy.setReduxState(<any>reduxState);
+        addSameVnfMultipleTimes();
+      });
+    });
+  });
+
   describe('multiple tests', () => {
     it('remove vfModule with missing data should update deploy button status', () => {
       let res = getReduxWithVFModuleMissingData();
@@ -264,6 +301,21 @@ describe('Drawing board', function () {
       cy.updateServiceShouldNotOverrideChild();
     });
 
+
+    it('should show vfModule missong data icon ', () => {
+      const serviceModelId : string = 'f4d84bb4-a416-4b4e-997e-0059973630b9';
+      let res = getReduxWithVNFMissingData();
+      res.service.serviceInstance['f4d84bb4-a416-4b4e-997e-0059973630b9'].vnfs['2017-488_PASQUALE-vPE 0:0001'].vfModules['2017488_pasqualevpe0..2017488PasqualeVpe..PASQUALE_base_vPE_BV..module-0']['2017488_pasqualevpe0..2017488PasqualeVpe..PASQUALE_base_vPE_BV..module-0jkyqv'].isMissingData = true;
+      cy.setReduxState(<any>res);
+      cy.openIframe(`app/ui/#/servicePlanning?serviceModelId=${serviceModelId}`);
+      cy.getElementByDataTestsId('node-040e591e-5d30-4e0d-850f-7266e5a8e013-2017488_pasqualevpe0..2017488PasqualeVpe..PASQUALE_base_vPE_BV..module-0-alert-icon').should('have.class', 'icon-alert');
+
+      cy.getElementByDataTestsId('node-040e591e-5d30-4e0d-850f-7266e5a8e013-2017488_pasqualevpe0..2017488PasqualeVpe..PASQUALE_base_vPE_BV..module-0-menu-btn').eq(1).click({force:true})
+        .getElementByDataTestsId('context-menu-edit').click()
+        .getElementByDataTestsId('form-set').click()
+        .getElementByDataTestsId('node-040e591e-5d30-4e0d-850f-7266e5a8e013-2017488_pasqualevpe0..2017488PasqualeVpe..PASQUALE_base_vPE_BV..module-0-alert-icon').should('not.have.class', 'icon-alert');
+    });
+
     xit('should display service model name', () => {
       cy.readFile('cypress/support/jsonBuilders/mocks/jsons/emptyServiceRedux.json').then((res) => {
         cy.setReduxState(<any>res);
@@ -325,7 +377,7 @@ describe('Drawing board', function () {
         cy.selectDropdownOptionByText('lcpRegion', 'hvf6');
         cy.selectDropdownOptionByText('tenant', 'AIN Web Tool-15-D-testalexandria');
         cy.selectDropdownOptionByText('lineOfBusiness', 'ONAP');
-        cy.selectDropdownOptionByText('platform', 'platform');
+        cy.selectPlatformValue('platform');
         cy.genericFormSubmitForm();
 
         cy.getElementByDataTestsId('node-afacccf6-397d-45d6-b5ae-94c39734b168-2017-388_PASQUALE-vPE 0').contains('<Automatically Assigned>');
@@ -345,8 +397,9 @@ describe('Drawing board', function () {
         cy.selectDropdownOptionByText('productFamily', 'ERICA');
         cy.selectDropdownOptionByText('lcpRegion', 'hvf6');
         cy.selectDropdownOptionByText('tenant', 'AIN Web Tool-15-D-testalexandria');
-        cy.selectDropdownOptionByText('lineOfBusiness', 'ONAP');
-        cy.selectDropdownOptionByText('platform', 'platform');
+        cy.selectDropdownOptionByText('lineOfBusiness', 'ONAP')
+        cy.selectPlatformValue('platform');
+
         cy.genericFormSubmitForm();
 
         cy.getElementByDataTestsId('node-69e09f68-8b63-4cc9-b9ff-860960b5db09-2017-488_PASQUALE-vPE 0').contains(vnfModelName);
@@ -581,8 +634,9 @@ describe('Drawing board', function () {
           "FLAG_NETWORK_TO_ASYNC_INSTANTIATION": false,
           "FLAG_FABRIC_CONFIGURATION_ASSIGNMENTS": true,
           "FLAG_SERVICE_MODEL_CACHE": true,
-          "FLAG_SETTING_DEFAULTS_IN_DRAWING_BOARD": false,
-          "FLAG_1906_COMPONENT_INFO" : false
+          "FLAG_1906_COMPONENT_INFO" : false,
+          "FLAG_2002_VNF_PLATFORM_MULTI_SELECT" : false,
+          "FLAG_2002_UNLIMITED_MAX" : true
         },
         "type": "[FLAGS] Update"
       },
@@ -2209,7 +2263,6 @@ describe('Drawing board', function () {
           "FLAG_FABRIC_CONFIGURATION_ASSIGNMENTS": true,
           "FLAG_SHOW_VERIFY_SERVICE": false,
           "FLAG_SERVICE_MODEL_CACHE": true,
-          "FLAG_SETTING_DEFAULTS_IN_DRAWING_BOARD": true,
           "FLAG_ADD_MSO_TESTAPI_FIELD": true
         },
         "type": "[FLAGS] Update"
@@ -3860,7 +3913,6 @@ describe('Drawing board', function () {
           "FLAG_FABRIC_CONFIGURATION_ASSIGNMENTS": true,
           "FLAG_SHOW_VERIFY_SERVICE": false,
           "FLAG_SERVICE_MODEL_CACHE": true,
-          "FLAG_SETTING_DEFAULTS_IN_DRAWING_BOARD": true,
           "FLAG_ADD_MSO_TESTAPI_FIELD": true
         },
         "type": "[FLAGS] Update"
@@ -5604,7 +5656,6 @@ describe('Drawing board', function () {
           "FLAG_SHOW_ASSIGNMENTS": true,
           "FLAG_FABRIC_CONFIGURATION_ASSIGNMENTS": true,
           "FLAG_DEFAULT_VNF": true,
-          "FLAG_SETTING_DEFAULTS_IN_DRAWING_BOARD": true,
           "FLAG_A_LA_CARTE_AUDIT_INFO": true,
           "FLAG_1810_CR_ADD_CLOUD_OWNER_TO_MSO_REQUEST": true,
           "FLAG_PRESENT_PROVIDER_NETWORKS_ASSOCIATIONS": true,
@@ -6286,7 +6337,7 @@ describe('Drawing board', function () {
     }
   }
 
-  function getReduxWithVNFS(isEcompGeneratedNaming: boolean) {
+  function getReduxWithVNFS(isEcompGeneratedNaming: boolean){
     return {
       "global": {
         "name": null,
@@ -6296,7 +6347,6 @@ describe('Drawing board', function () {
           "FLAG_FABRIC_CONFIGURATION_ASSIGNMENTS": true,
           "FLAG_SHOW_VERIFY_SERVICE": false,
           "FLAG_SERVICE_MODEL_CACHE": true,
-          "FLAG_SETTING_DEFAULTS_IN_DRAWING_BOARD": false,
           "FLAG_ADD_MSO_TESTAPI_FIELD": true,
           "FLAG_SUPPLEMENTARY_FILE": true
         },