Adding feature:  Replace vfmodule

Issue-ID: VID-603
Change-Id: I59068a0979d6fb733e4243c8f78921f396dc9d17
Signed-off-by: Einat Vinouze <einat.vinouze@intl.att.com>
Signed-off-by: Amichai Hemli <amichai.hemli@intl.att.com>
Signed-off-by: Ittay Stern <ittay.stern@att.com>
diff --git a/vid-webpack-master/cypress/integration/iFrames/ala-carte.e2e.ts b/vid-webpack-master/cypress/integration/iFrames/ala-carte.e2e.ts
index 13c4464..3e90e2b 100644
--- a/vid-webpack-master/cypress/integration/iFrames/ala-carte.e2e.ts
+++ b/vid-webpack-master/cypress/integration/iFrames/ala-carte.e2e.ts
@@ -7,7 +7,11 @@
 describe('A la carte', function () {
   describe('check service name', () => {
     let jsonBuilderAAIService: JsonBuilder<ServiceModel> = new JsonBuilder<ServiceModel>();
-
+    const SERVICE_ID: string = '4d71990b-d8ad-4510-ac61-496288d9078e';
+    const SERVICE_INVARIANT_ID: string = 'd27e42cf-087e-4d31-88ac-6c4b7585f800';
+    const INSTANCE_NAME_MANDATORY_MESSAGE: string = 'Missing data ("Instance Name" and 3 other fields';
+    const INSTANCE_NAME_NOT_MANDATORY_MESSAGE: string = 'Missing data ("Subscriber Name" and 2 other fields)';
+    const CONFIRM_BUTTON: string = 'confirmButton';
 
     beforeEach(() => {
       cy.window().then((win) => {
@@ -15,7 +19,7 @@
         cy.setReduxState();
         cy.preventErrorsOnLoading();
         cy.initAAIMock();
-        cy.initVidMock();
+        cy.initVidMock({serviceUuid:SERVICE_ID, invariantId: SERVICE_INVARIANT_ID});
         cy.initAlaCarteService();
         cy.initZones();
         cy.login();
@@ -26,16 +30,12 @@
       cy.screenshot();
     });
 
-    const SERVICE_ID: string = '4d71990b-d8ad-4510-ac61-496288d9078e';
-    const INSTANCE_NAME_MANDATORY_MESSAGE: string = 'Missing data ("Instance Name" and 3 other fields';
-    const INSTANCE_NAME_NOT_MANDATORY_MESSAGE: string = 'Missing data ("Subscriber Name" and 2 other fields)';
-    const CONFIRM_BUTTON: string = 'confirmButton';
 
 
     it(`service name should be mandatory : serviceEcompNaming = true`, ()=> {
       cy.readFile('/cypress/support/jsonBuilders/mocks/jsons/basicService.json').then((res) => {
         jsonBuilderAAIService.basicJson(res,
-          Cypress.config('baseUrl') + '/rest/models/services/4d71990b-d8ad-4510-ac61-496288d9078e',
+          Cypress.config('baseUrl') + '/rest/models/services/' + SERVICE_ID,
           200,
           0,
           SERVICE_ID + ' - service',
@@ -130,10 +130,10 @@
               cy.getReduxState().then((state) => {
 
                 const vnf = state.service.serviceInstance['2f80c596-27e5-4ca9-b5bb-e03a7fd4c0fd'].vnfs['2017-488_PASQUALE-vPE 0'];
-
                 cy.readFile('../vid-automation/src/test/resources/a-la-carte/redux-a-la-carte.json').then((file) => {
                   file.vnfs['2017-488_PASQUALE-vPE 0'].trackById = vnf.trackById;
                   file.vnfs['2017-488_PASQUALE-vPE 0'].vfModules = {};
+                  file.vnfs['2017-488_PASQUALE-vPE 0'].upgradedVFMSonsCounter = 0;
                   cy.deepCompare(vnf, file.vnfs['2017-488_PASQUALE-vPE 0'])
                 });
               });
@@ -232,6 +232,7 @@
                             for (let vfModulesName of vfModulesNames) {
                               const vfModule = vfModules[vfModulesName];
                               let vfModuleObject = vfModule[Object.keys(vfModule)[0]];
+                              file.vnfs[vnfName].vfModules[vfModulesName][vfModulesName].action = "Create";
                               cy.deepCompare(vfModuleObject, file.vnfs[vnfName].vfModules[vfModulesName][vfModulesName]);
                             }
                           });
@@ -261,7 +262,7 @@
         .get('.error').contains(INSTANCE_NAME_NOT_MANDATORY_MESSAGE);
     }
 
-    function addVfModule(vnfName: string, vfModuleName: string, instanceName: string, lcpRegion: string, legacyRegion: string, tenant: string, rollback: boolean, sdncPreLoad: boolean, deleteVgName: boolean): Chainable<any> {
+    function addVfModule (vnfName: string, vfModuleName: string, instanceName: string, lcpRegion: string, legacyRegion: string, tenant: string, rollback: boolean, sdncPreLoad: boolean, deleteVgName: boolean): Chainable<any> {
       return cy.getElementByDataTestsId('node-' + vnfName).click({force: true}).then(() => {
         cy.getElementByDataTestsId('node-' + vfModuleName + '-add-btn').click({force: true}).then(() => {
           cy.getElementByDataTestsId('instanceName').clear().type(instanceName, {force: true}).then(() => {
@@ -284,5 +285,6 @@
       });
     }
 
+
   });
 });