Add another vfm-upgrade test

Issue-ID: VID-603

Change-Id: I4690906d3bc660984a0c2269d7151f6151b89940
Signed-off-by: Ittay Stern <ittay.stern@att.com>
diff --git a/vid-webpack-master/cypress/integration/iFrames/viewEditUpgradeVfModule.e2e.ts b/vid-webpack-master/cypress/integration/iFrames/viewEditUpgradeVfModule.e2e.ts
index bea31fc..0d94e60 100644
--- a/vid-webpack-master/cypress/integration/iFrames/viewEditUpgradeVfModule.e2e.ts
+++ b/vid-webpack-master/cypress/integration/iFrames/viewEditUpgradeVfModule.e2e.ts
@@ -79,7 +79,8 @@
 
       mockAsyncBulkResponse();
       cy.initGetAAISubDetails();
-      cy.initVidMock({serviceUuid: serviceUuid, invariantId: serviceInvariantId});
+      cy.initVidMock();
+      cy.mockLatestVersionForService(serviceUuid, serviceInvariantId);
       cy.setReduxState();
       cy.permissionVidMock();
       cy.login();
@@ -91,8 +92,8 @@
 
     it(`should display the more actions button if user is permitted`, function () {
       let SERVICE_INSTANCE_ID="3f93c7cb-2fd0-4557-9514-e189b7b04f9d";
-      let SERVICE_TYPE="VIRTUAL%20USP";
-      cy.visit(`/serviceModels.htm#/instantiate?subscriberId=${SUBSCRIBER_ID}&subscriberName=USP%20VOICE&serviceType=${SERVICE_TYPE}&serviceInstanceId=${SERVICE_INSTANCE_ID}&aaiModelVersionId=${serviceUuid}&isPermitted=true`);
+      let SERVICE_TYPE="TYLER%20SILVIA";
+      cy.visit(`/serviceModels.htm#/instantiate?subscriberId=${SUBSCRIBER_ID}&subscriberName=SILVIA%20ROBBINS&serviceType=${SERVICE_TYPE}&serviceInstanceId=${SERVICE_INSTANCE_ID}&aaiModelVersionId=${serviceUuid}&isPermitted=true`);
 
       cy.get("[data-tests-id='service-instanceId-th-id']").should('contain', SERVICE_INSTANCE_ID);
       cy.getElementByDataTestsId("show-new-screen").should('be.visible').should('have.text', 'More actions').click();
@@ -126,6 +127,67 @@
 
   });
 
+  describe('More UI tests', () => {
+
+    beforeEach(() => {
+      cy.window().then((win) => {win.sessionStorage.clear();});
+      cy.setTestApiParamToVNF();
+      cy.initVidMock();
+      cy.login();
+    });
+
+    afterEach(() => {
+      cy.screenshot();
+    });
+
+    it(`Upgrade a VFModule: another case e2e`, function () {
+
+      const serviceType = 'Emanuel';
+      const subscriberId = 'a9a77d5a-123e-4ca2-9eb9-0b015d2ee0fb';
+      const serviceModelId = '06c415d8-afc2-4bcb-a131-e4db4b8e96ce';
+      const serviceInstanceId = '6196ab1f-2349-4b32-9b6c-cffeb0ccc79c';
+      const serviceInvariantUuid = "b3a1a119-dede-4ed0-b077-2a617fa519a3";
+
+      cy.initDrawingBoardUserPermission();
+
+      cy.route(`**/rest/models/services/${serviceModelId}`,
+        'fixture:../support/jsonBuilders/mocks/jsons/upgradeVfModule/upgrade_vfmodule_e2e__service_model.json')
+      .as('serviceModel2');
+
+      cy.route(`**/aai_get_service_instance_topology/${subscriberId}/${serviceType}/${serviceInstanceId}`,
+        'fixture:../support/jsonBuilders/mocks/jsons/upgradeVfModule/upgrade_vfmodule_e2e__service_instance.json')
+      .as('serviceInstance2');
+
+      cy.route(`**/aai_get_newest_model_version_by_invariant/${serviceInvariantUuid}`,
+        {
+          "modelVersionId": "d9a5b318-187e-476d-97f7-a15687a927a9",
+          "modelName": "xbi test module replace",
+          "modelVersion": "2.0",
+          "distributionStatus": "DISTRIBUTION_COMPLETE_OK",
+          "resourceVersion": "1571769586156",
+          "modelDescription": "test module replacement feature",
+          "orchestrationType": null
+        }
+      ).as("newestModelVersion2");
+
+      cy.openIframe(`app/ui/#/servicePlanning/EDIT?serviceModelId=${serviceModelId}&subscriberId=${subscriberId}&serviceType=${serviceType}&serviceInstanceId=${serviceInstanceId}`);
+
+      upgradeTheVFM('node-04b21d26-9780-4956-8329-b22b049329f4-xbitestmodulereplace0..XbiTestModuleReplace..base_ocg..module-0');
+
+      mockAsyncBulkResponse();
+      cy.getDrawingBoardDeployBtn().click();
+
+      cy.wait('@expectedPostAsyncInstantiation').then(xhr => {
+        cy.readFile('../vid-app-common/src/test/resources/payload_jsons/vfmodule/upgrade_vfmodule_e2e__fe_input_cypress.json').then((expectedResult) => {
+          cy.deepCompare(xhr.request.body, expectedResult);
+        });
+      });
+
+    });
+
+  });
+
+
   function mockAsyncBulkResponse() {
     cy.server().route({
       url: Cypress.config('baseUrl') + '/asyncInstantiation/bulk',
@@ -149,8 +211,8 @@
     }).as("expectLatestServiceModelUpgradeVersion")
   }
 
-  function upgradeTheVFM(): Chainable<any> {
-    return cy.getElementByDataTestsId('node-undefined-dc229cd8-c132-4455-8517-5c1787c18b14-menu-btn').click()
+  function upgradeTheVFM(treeNodeId = 'node-undefined-dc229cd8-c132-4455-8517-5c1787c18b14'): Chainable<any> {
+    return cy.getElementByDataTestsId(`${treeNodeId}-menu-btn`).click()
     .drawingBoardTreeClickOnContextMenuOptionByName("Upgrade");
   }