add test that verify delete and upgrade of the not upgraded vfm's
[vid.git] / vid-webpack-master / cypress / integration / iFrames / viewEditUpgradeVfModule.e2e.ts
index 0973447..6fb6675 100644 (file)
@@ -16,6 +16,8 @@ export const initServicePlanning = function (viewOrEdit: string, customModelFile
   }
 
   cy.readFile('../vid-automation/src/test/resources/aaiGetInstanceTopology/ServiceTreeWithMultipleChildren_serviceModel.json').then((res) => {
+    res.service.instantiationType = "A-La-Carte";
+    res.service.vidNotions.instantiationType = "ALaCarte";
     jsonBuilderAndMock.basicJson(
       res,
       Cypress.config('baseUrl') + "/rest/models/services/6e59c5de-f052-46fa-aa7e-2fca9d674c44",
@@ -133,7 +135,7 @@ describe('View Edit Page: Upgrade VFModule', function () {
 
     beforeEach(() => {
       cy.clearSessionStorage();
-      cy.setTestApiParamToVNF();
+      cy.setTestApiParamToGR();
       cy.initVidMock();
       cy.login();
     });
@@ -142,6 +144,52 @@ describe('View Edit Page: Upgrade VFModule', function () {
       cy.screenshot();
     });
 
+    it(`Delete not upgraded VFM and upgrade another in a single click`, () => {
+
+      const serviceType = 'Emanuel';
+      const subscriberId = 'a9a77d5a-123e-4ca2-9eb9-0b015d2ee0fb';
+      const serviceModelId = 'a243da28-c11e-45a8-9f26-0284a9a789bc';
+      const serviceInstanceId = 'b153e8ce-2d00-4466-adc0-14bad70f150c';
+      const serviceInvariantUuid = "dd5a69b7-c50c-4dde-adc2-966b79bb8fd6";
+
+      cy.initDrawingBoardUserPermission();
+      cy.route(`**/rest/models/services/${serviceModelId}`,
+        'fixture:../support/jsonBuilders/mocks/jsons/deleteVfModule/delete_vfmodule_model.json')
+      .as('serviceModel2');
+
+      cy.route(`**/aai_get_service_instance_topology/${subscriberId}/${serviceType}/${serviceInstanceId}`,
+        'fixture:../support/jsonBuilders/mocks/jsons/deleteVfModule/delete_vfmodule_service_instance.json')
+      .as('serviceInstance2');
+
+      cy.route(`**/aai_get_newest_model_version_by_invariant/${serviceInvariantUuid}`, {
+          "modelVersionId": "a243da28-c11e-45a8-9f26-0284a9a789bc",
+          "modelName": "CHARLOTTE 01222020 Svc",
+          "modelVersion": "4.0",
+          "distributionStatus": "DISTRIBUTION_COMPLETE_OK",
+          "resourceVersion": "1580246673596",
+          "modelDescription": "test model for VF module replacement",
+          "orchestrationType": null
+        }
+      ).as("newestModelVersion2");
+
+      cy.openIframe(`app/ui/#/servicePlanning/EDIT?serviceModelId=${serviceModelId}&subscriberId=${subscriberId}&serviceType=${serviceType}&serviceInstanceId=${serviceInstanceId}`);
+
+      deleteTheVfm(`node-c449aaf8-2467-41a9-9015-730ab48ca19b-mdns012220200..Mdns01222020..dns_az_01..module-1`);
+
+      upgradeTheVFM(`node-04b21d26-9780-4956-8329-b22b049329f4-xbitestmodulereplace0..XbiTestModuleReplace..base_ocg..module-0`, false);
+
+      cy.getElementByDataTestsId('delete-status-type').contains('Delete');
+
+      mockAsyncBulkResponse();
+      cy.getDrawingBoardDeployBtn().click();
+
+      cy.wait('@expectedPostAsyncInstantiation').then(xhr => {
+                    cy.readFile('../vid-app-common/src/test/resources/payload_jsons/vfmodule/delete_vfmodule_expected_bulk.json').then((expectedResult) => {
+                      cy.deepCompare(xhr.request.body, expectedResult);
+                    });
+                  });
+    });
+
     it(`Upgrade a VFModule: another case e2e`, function () {
 
       const serviceType = 'Emanuel';
@@ -187,6 +235,50 @@ describe('View Edit Page: Upgrade VFModule', function () {
 
     });
 
+    it(`Upgrade a VFModule: upgrade vfmodule when upgraded already service, vnf and borther vfmodule e2e`, function () {
+
+      const serviceType = 'Emanuel';
+      const subscriberId = 'a9a77d5a-123e-4ca2-9eb9-0b015d2ee0fb';
+      const serviceModelId = 'a243da28-c11e-45a8-9f26-0284a9a789bc';
+      const serviceInstanceId = 'b153e8ce-2d00-4466-adc0-14bad70f150c';
+      const serviceInvariantUuid = "dd5a69b7-c50c-4dde-adc2-966b79bb8fd6";
+
+      cy.initDrawingBoardUserPermission();
+
+      cy.route(`**/rest/models/services/${serviceModelId}`,
+        'fixture:../support/jsonBuilders/mocks/jsons/upgradeVfModule/upgrade_vfmodule_when_service_vnf_and_brother_vfmodule_alredy_upgraded_e2e__service_model.json')
+      .as('serviceModel2');
+
+      cy.route(`**/aai_get_service_instance_topology/${subscriberId}/${serviceType}/${serviceInstanceId}`,
+        'fixture:../support/jsonBuilders/mocks/jsons/upgradeVfModule/upgrade_vfmodule_when_service_vnf_and_brother_vfmodule_alredy_upgraded_e2e__service_instance.json')
+      .as('serviceInstance2');
+
+      cy.route(`**/aai_get_newest_model_version_by_invariant/${serviceInvariantUuid}`, {
+          "modelVersionId": "a243da28-c11e-45a8-9f26-0284a9a789bc",
+          "modelName": "CHARLOTTE 01222020 Svc",
+          "modelVersion": "3.0",
+          "distributionStatus": "DISTRIBUTION_COMPLETE_OK",
+          "resourceVersion": "1580246673596",
+          "modelDescription": "test model for VF module replacement",
+          "orchestrationType": null
+        }
+      ).as("newestModelVersion2");
+
+      cy.openIframe(`app/ui/#/servicePlanning/EDIT?serviceModelId=${serviceModelId}&subscriberId=${subscriberId}&serviceType=${serviceType}&serviceInstanceId=${serviceInstanceId}`);
+
+      upgradeTheVFM('node-3412fe1f-e103-4777-90c0-f66d888f4bed-mdns012220200..Mdns01222020..dns_az_01..module-1', true);
+
+      mockAsyncBulkResponse();
+      cy.getDrawingBoardDeployBtn().click();
+
+      cy.wait('@expectedPostAsyncInstantiation').then(xhr => {
+        cy.readFile('../vid-app-common/src/test/resources/payload_jsons/vfmodule/upgrade_vfmodule_not_related_to_current_model_e2e__fe_input_cypress.json').then((expectedResult) => {
+          cy.deepCompare(xhr.request.body, expectedResult);
+        });
+      });
+
+    });
+
   });
 
 
@@ -200,8 +292,9 @@ describe('View Edit Page: Upgrade VFModule', function () {
   }
 
   function verifyMenuActionUpgradeDoesNotExist() {
-    cy.getElementByDataTestsId('node-undefined-dc229cd8-c132-4455-8517-5c1787c18b14-menu-btn').click()
-    .getElementByDataTestsId('context-menu-upgrade').should('not.exist');
+    cy.getElementByDataTestsId('node-522159d5-d6e0-4c2a-aa44-5a542a12a830-vf_vgeraldine0..VfVgeraldine..vflorence_vlc..module-1-menu-btn').click().then(() => {
+      cy.getElementByDataTestsId('context-menu-upgrade').should('not.exist');
+    });
   }
 
   function setLatestVersionMockToEmptyResponse(serviceUuid: string) {
@@ -213,6 +306,11 @@ describe('View Edit Page: Upgrade VFModule', function () {
     }).as("expectLatestServiceModelUpgradeVersion");
   }
 
+  function deleteTheVfm(treeNodeId: string) {
+    cy.getElementByDataTestsId(`${treeNodeId}-menu-btn`).click()
+    .drawingBoardTreeClickOnContextMenuOptionByName("Delete");
+  }
+
   function upgradeTheVFM(treeNodeId: string, shouldVGCheckboxExist :boolean) {
     cy.getElementByDataTestsId(`${treeNodeId}-menu-btn`).click()
     .drawingBoardTreeClickOnContextMenuOptionByName("Upgrade");