Test Cases Addition and Fixes
[vid.git] / vid-webpack-master / cypress / integration / iFrames / instantiation-templates.e2e.ts
1 import * as _ from "lodash";
2 import {PropertyPath} from "lodash";
3
4 describe('Drawing Board: Instantiation Templates', function () {
5
6   describe('Instantiation templates ', () => {
7
8     beforeEach(() => {
9       cy.clearSessionStorage();
10       cy.setTestApiParamToGR();
11       cy.initAAIMock();
12       cy.initGetAAISubDetails();
13       cy.initVidMock();
14       cy.initDrawingBoardUserPermission();
15       cy.login();
16
17       mockAsyncBulkResponse();
18     });
19
20     afterEach(() => {
21       cy.screenshot();
22     });
23
24     describe('Load Page and Deploy', () => {
25
26       it(`Given a stored template - when click "deploy" - then a coherent request should be sent upon deploy`, () => {
27
28         cy.loadDrawingBoardWithRecreateMode(templateWithVnfSetup);
29
30         // Then...
31         cy.getElementByDataTestsId("node-vProbe_NC_VNF 0").should('be.visible');
32         assertThatBodyFromDeployRequestEqualsToTemplateFromBackEnd();
33       });
34
35       it('Given a template - User can remove existing VNF', () => {
36
37         cy.loadDrawingBoardWithRecreateMode(templateWithVnfSetup);
38
39         removeVNFWithVFModules('node-21ae311e-432f-4c54-b855-446d0b8ded72-vProbe_NC_VNF 0');
40         removeVNFWithVFModules('node-21ae311e-432f-4c54-b855-446d0b8ded72-vProbe_NC_VNF 0');
41
42         cy.getDrawingBoardDeployBtn().click();
43         cy.wait('@expectedPostAsyncInstantiation').then(xhr => {
44           cy.deepCompare(bodyOf(xhr).vnfs, {});
45         });
46
47       });
48
49       it('Given a template - User can add new VNF', () => {
50         cy.loadDrawingBoardWithRecreateMode(templateWithVnfSetup);
51         // add new node
52         addNewNode('node-vProbe_NC_VNF 0-add-btn')
53           .fillVnfPopup()
54           .getDrawingBoardDeployBtn().click()
55           .wait('@expectedPostAsyncInstantiation').then(xhr => {
56           const vnfRequest = bodyOf(xhr).vnfs['vProbe_NC_VNF 0_2'];
57
58           expect(vnfRequest.action).equals("Create");
59           expect(vnfRequest.rollbackOnFailure).equals("true");
60           expect(vnfRequest.originalName).equals("vProbe_NC_VNF 0");
61           expect(vnfRequest.productFamilyId).equals("a9a77d5a-123e-4ca2-9eb9-0b015d2ee0fb");
62           expect(vnfRequest.lcpCloudRegionId).equals("hvf6");
63           expect(vnfRequest.lineOfBusiness).equals("zzz1");
64           expect(vnfRequest.platformName).equals("xxx1");
65           expect(vnfRequest.tenantId).equals("229bcdc6eaeb4ca59d55221141d01f8e");
66
67
68           // check instance name not change if empty
69           cy.editNode('node-21ae311e-432f-4c54-b855-446d0b8ded72-vProbe_NC_VNF 0', 0)
70             .clearInput('instanceName');
71           cy.getElementByDataTestsId('form-set').click({force: true}).then((done) => {
72             cy.editNode('node-21ae311e-432f-4c54-b855-446d0b8ded72-vProbe_NC_VNF 0', 0)
73               .getElementByDataTestsId('instanceName').should('be.empty')
74           });
75         });
76       });
77
78       it('Given a template - User can Duplicate VNF', () => {
79         const numberOfDuplicate: number = 4;
80         cy.loadDrawingBoardWithRecreateMode(templateWithVnfSetup);
81         cy.nodeAction('node-21ae311e-432f-4c54-b855-446d0b8ded72-vProbe_NC_VNF 0', 'Duplicate')
82           .getElementByDataTestsId('duplicate-amount-vfmodules').select(numberOfDuplicate.toString())
83           .getTagElementContainsText('button', 'Duplicate').click()
84           .getDrawingBoardDeployBtn().click()
85           .wait('@expectedPostAsyncInstantiation').then(xhr => {
86           expect(Object.keys(bodyOf(xhr).vnfs).length).equals(numberOfDuplicate + 2);
87         });
88       });
89
90       it('Given a stored template - when "edit" vnf and vfmodules are opened - then template’s details are visible as expected and deploy without changes', () => {
91
92         cy.loadDrawingBoardWithRecreateMode(templateWithVnfSetup);
93
94         // Then...
95         cy.editNode("node-21ae311e-432f-4c54-b855-446d0b8ded72-vProbe_NC_VNF 0")
96           .getElementByDataTestsId("instanceName").should('have.value', 'hvf6arlba007')
97           .getElementByDataTestsId("productFamily").should('contain', 'Emanuel')
98           .getElementByDataTestsId("tenant").should('contain', 'DN5242-Nov21-T1')
99           .getElementByDataTestsId("lcpRegion").should('contain', 'hvf6')
100           .getElementByDataTestsId("rollback").should('contain', 'Rollback')
101           cy.checkLobValue('zzz1')
102           cy.checkPlatformValue(`xxx1`)
103           .getElementByDataTestsId("cancelButton").click();
104
105         cy.editNode("node-c5b26cc1-a66f-4b69-aa23-6abc7c647c88-vprobe_nc_vnf0..VprobeNcVnf..FE_base_module..module-0")
106           .getElementByDataTestsId("instanceName").should('have.value', 'hvf6arlba007_lba_Base_01')
107           .getElementByDataTestsId("rollback").should('contain', 'Rollback')
108           .getElementByDataTestsId("cancelButton").click();
109
110         cy.editNode("node-c09e4530-8fd8-418f-9483-2f57ce927b05-vprobe_nc_vnf0..VprobeNcVnf..FE_Add_On_Module_vlbagent_eph..module-1")
111           .getElementByDataTestsId("instanceName").should('have.value', 'my_hvf6arlba007_lba_dj_01')
112           .getElementByDataTestsId("volumeGroupName").should('have.value', 'my_special_hvf6arlba007_lba_dj_01_vol')
113           .getElementByDataTestsId("rollback").should('contain', 'Rollback')
114           .getElementByDataTestsId("sdncPreLoad").should('have.value', 'on')
115           .getElementByDataTestsId("cancelButton").click();
116
117         assertThatBodyFromDeployRequestEqualsToTemplateFromBackEnd([
118           {path: [...vnfPath, "vnfStoreKey"], value: "vProbe_NC_VNF 0"}, // side-effect
119           {path: [...vnfPath2, "vnfStoreKey"], value: "vProbe_NC_VNF 0_1"},
120         ]);
121       });
122
123       it(`Given a stored template - when "edit" service is opened - then template’s details are visible as expected`, function () {
124
125         cy.loadDrawingBoardWithRecreateMode(templateWithVnfSetup);
126
127         cy.openServiceContextMenu()
128           .getElementByDataTestsId("context-menu-header-edit-item").click()
129           .getElementByDataTestsId("instanceName").should('have.value', 'vProbe_NC_Service_DG_new_SI')
130           .getElementByDataTestsId("subscriberName").should('contain', 'SILVIA ROBBINS')
131           .getElementByDataTestsId("serviceType").should('contain', 'TYLER SILVIA')
132           .getElementByDataTestsId("owningEntity").should('contain', 'WayneHolland')
133           .getElementByDataTestsId("project").should('contain', 'WATKINS')
134           .getElementByDataTestsId("rollback").should('contain', 'Rollback');
135
136       });
137
138       it(`Given a stored template - add one VfModule, edit its details, and deploy - deploy is added with the vfModule details`, () => {
139         cy.loadDrawingBoardWithRecreateMode(templateWithVnfSetup);
140
141         let newVfModuleName = "new.vfmodule.name";
142         let module1ModelId = "VprobeNcVnf..FE_Add_On_Module_vlbagent_eph..module-1";
143         let module1CustomizationId = `vprobe_nc_vnf0..${module1ModelId}`;
144
145         // Click target VNF on right tree
146         cy.getElementByDataTestsId('node-21ae311e-432f-4c54-b855-446d0b8ded72-vProbe_NC_VNF 0').first().click();
147
148         // Click [+] vfModule on left tree
149         cy.drawingBoardPressAddButtonByElementName(`node-${module1CustomizationId}`)
150           .click({force: true});
151
152         cy.editNode(`node-c09e4530-8fd8-418f-9483-2f57ce927b05-${module1CustomizationId}`, 1);
153         cy.clearInput("instanceName");
154         cy.typeToInput("instanceName", newVfModuleName);
155         cy.getElementByDataTestsId('form-set').click();
156
157         // Then...
158         cy.getReduxState().then((state) => {
159           let vfModules_1Path = [
160             ...vnfPath, "vfModules", module1CustomizationId,
161           ];
162
163           let vfModules_0Path = [
164             ...vnfPath, "vfModules", "vprobe_nc_vnf0..VprobeNcVnf..FE_base_module..module-0"
165           ];
166
167           let serviceInstanceElementOnRedux = state.service.serviceInstance[(templateWithVnfSetup.serviceModelId)];
168           let latestVfModule_1Path = findPathOfLatestVfModule(serviceInstanceElementOnRedux, vfModules_1Path);
169           // This is a funny merge, as values are already there, but that way ensures
170           // the values that selected are really deployed, while limiting the cost of
171           // maintenance, by taking other vfModule's fields as granted.
172           let latestVfModule_1ExpectedValue = _.merge(
173             _.get(serviceInstanceElementOnRedux, latestVfModule_1Path),
174             {
175               instanceName: newVfModuleName,
176               volumeGroupName: `${newVfModuleName}_vol`
177             }
178           );
179
180           // const vnfPath = [
181           //   "vnfs", "vProbe_NC_VNF 0"
182           // ];
183
184           let vfModule_1 = [
185             ...vfModules_1Path, "vprobe_nc_vnf0..VprobeNcVnf..FE_Add_On_Module_vlbagent_eph..module-1yprvi"
186           ]
187           let vfModule_0 = [
188             ...vfModules_0Path, 'vprobe_nc_vnf0..VprobeNcVnf..FE_base_module..module-0ahubg'
189           ]
190
191           assertThatBodyFromDeployRequestEqualsToTemplateFromBackEnd([
192             {path: [...vnfPath, "vnfStoreKey"], value: "vProbe_NC_VNF 0"},   // side-effect
193             {path: [...vnfPath2, "vnfStoreKey"], value: "vProbe_NC_VNF 0_1"},
194             {path: ["existingNames", newVfModuleName], value: ""},
195             {path: ["existingNames", `${newVfModuleName}_vol`], value: ""},
196             {path: latestVfModule_1Path, value: latestVfModule_1ExpectedValue},
197             {path: ["validationCounter"], value: null},  // side-effect
198             {path: [...vfModule_1, "position"], value: 2},
199             {path: [...vfModule_0, "position"], value: 1},
200           ]);
201         });
202
203       });
204
205       it('Given a template - User can remove existing vfmodule', function () {
206
207         cy.loadDrawingBoardWithRecreateMode(templateWithVnfSetup);
208         cy.nodeAction('node-c09e4530-8fd8-418f-9483-2f57ce927b05-vprobe_nc_vnf0..VprobeNcVnf..FE_Add_On_Module_vlbagent_eph..module-1', 'Remove');
209         let removed_vfModule_Path = [
210           ...vnfPath, "vfModules",
211           "vprobe_nc_vnf0..VprobeNcVnf..FE_Add_On_Module_vlbagent_eph..module-1",
212         ];
213
214         assertThatBodyFromDeployRequestEqualsToTemplateFromBackEnd([
215           {path: [...vnfPath, "vnfStoreKey"], value: "vProbe_NC_VNF 0"}, // side-effect
216           {path: [...vnfPath2, "vnfStoreKey"], value: "vProbe_NC_VNF 0_1"},
217           {path: [...removed_vfModule_Path], value: undefined},
218         ]);
219       });
220
221       [
222         {desc: "with changes", modifySomeValues: true},
223         {desc: "without changes", modifySomeValues: false},
224       ].forEach((testCase) => {
225
226         it(`Given a stored template - edit service vnf and vfmodule ${testCase.desc} - deploy request should be ${testCase.desc}`, function () {
227
228           cy.loadDrawingBoardWithRecreateMode(templateWithVnfSetup);
229
230           //edit service
231           cy.openServiceContextMenu();
232           cy.getElementByDataTestsId("context-menu-header-edit-item").click();
233           if (testCase.modifySomeValues) {
234             cy.clearInput("instanceName");
235             cy.typeToInput("instanceName", "different.instance.name");
236           }
237           cy.getElementByDataTestsId('form-set').click();
238
239           // edit vnf
240           cy.editNode("node-21ae311e-432f-4c54-b855-446d0b8ded72-vProbe_NC_VNF 0");
241           if (testCase.modifySomeValues) {
242             cy.selectPlatformValue(`platform`);
243             cy.selectDropdownOptionByText("tenant", "CESAR-100-D-spjg61909");
244           }
245           cy.getElementByDataTestsId('form-set').click();
246
247           //edit vf module
248           cy.editNode("node-c5b26cc1-a66f-4b69-aa23-6abc7c647c88-vprobe_nc_vnf0..VprobeNcVnf..FE_base_module..module-0");
249           if (testCase.modifySomeValues) {
250             cy.getElementByDataTestsId('sdncPreLoad').click();
251           }
252           cy.getElementByDataTestsId('form-set').click();
253           // Then...
254           let vfModule_0Path = [
255             ...vnfPath, "vfModules",
256             "vprobe_nc_vnf0..VprobeNcVnf..FE_base_module..module-0",
257             "vprobe_nc_vnf0..VprobeNcVnf..FE_base_module..module-0ahubg",
258           ];
259
260           assertThatBodyFromDeployRequestEqualsToFile(testCase.modifySomeValues ? [
261             {path: ["instanceName"], value: "different.instance.name"},
262             {path: ["existingNames", "vprobe_nc_service_dg_new_si"], value: undefined},
263             {path: ["existingNames", "different.instance.name"], value: ""},
264
265             {path: [...vnfPath, "platformName"], value: "xxx1,platform"},
266             {path: [...vnfPath, "tenantId"], value: "f2f3830e4c984d45bcd00e1a04158a79"},
267
268             {path: [...vfModule_0Path, "sdncPreLoad"], value: true},
269             {path: [...vfModule_0Path, "pauseInstantiation"], value: null}
270           ] : []);
271         })
272
273       });
274
275       it(`Given a stored template of Network - - it is loaded`, () => {
276
277         cy.loadDrawingBoardWithRecreateModeNetwork(templateWithNetworkSetup);
278
279         // Then...
280         cy.getElementByDataTestsId("node-SR-IOV Provider 2-1").should('be.visible');
281         cy.getElementByDataTestsId("node-SR-IOV Provider 2-2").should('be.visible');
282         assertThatBodyFromDeployRequestEqualsToTemplateFromBackEnd_network();
283       });
284
285       it(`Given a stored template of Network - User can remove existing network`, () => {
286
287         cy.loadDrawingBoardWithRecreateModeNetwork(templateWithNetworkSetup);
288
289         cy.nodeAction('node-01f4c475-3f89-4f00-a2f4-39a873dba0ae-SR-IOV Provider 2-1', 'Remove');
290         let removed_network_Path = [
291           "networks", "SR-IOV Provider 2-1",
292         ];
293
294         let removed_network_counter_Path = [
295           "existingNetworksCounterMap", "f6b6d141-0d4c-427d-ad35-797f3d1abe71",
296         ];
297
298         assertThatBodyFromDeployRequestEqualsToTemplateFromBackEnd_network([
299           {path: removed_network_Path, value: undefined},
300           {path: removed_network_counter_Path, value: 0},
301         ]);
302       });
303
304       it('Given a template - User can add a new network', () => {
305
306         cy.loadDrawingBoardWithRecreateModeNetwork(templateWithNetworkSetup);
307
308         // add new node
309         addNewNode('node-SR-IOV Provider 2-1-add-btn')
310           .fillNetworkPopup()
311           .getDrawingBoardDeployBtn().click()
312           .wait('@expectedPostAsyncInstantiation').then(xhr => {
313           const networkRequest = bodyOf(xhr).networks['SR-IOV Provider 2-1_1'];
314
315           expect(networkRequest.action).equals("Create");
316           expect(networkRequest.rollbackOnFailure).equals("true");
317           expect(networkRequest.originalName).equals("SR-IOV Provider 2-1");
318           expect(networkRequest.productFamilyId).equals("a9a77d5a-123e-4ca2-9eb9-0b015d2ee0fb");
319           expect(networkRequest.lcpCloudRegionId).equals("hvf6");
320           expect(networkRequest.lineOfBusiness).equals("zzz1");
321           expect(networkRequest.platformName).equals("xxx1");
322           expect(networkRequest.tenantId).equals("229bcdc6eaeb4ca59d55221141d01f8e");
323         });
324       });
325     });
326   });
327 });
328
329 let apiTestResources = '../vid-automation/src/test/resources/asyncInstantiation/';
330
331 const templateWithVnfSetup = {
332   serviceModelId: '6cfeeb18-c2b0-49df-987a-da47493c8e38',
333   instanceTemplateFile: apiTestResources + 'templates__instance_template.json',
334   instanceTemplateSetWithoutModifyFile: apiTestResources + 'templates__instance_from_template__set_without_modify1.json',
335   serviceModelFile: '../support/jsonBuilders/mocks/jsons/instantiationTemplates/templates__service_model.json',
336 };
337
338 const templateWithNetworkSetup = {
339   serviceModelId: 'a1a14610-ee40-4049-8007-0608a20dd1fa',
340   instanceTemplateFile: apiTestResources + 'templates__instance_template_network.json',
341   serviceModelFile: '../support/jsonBuilders/mocks/jsons/instantiationTemplates/templates__service_model_network.json',
342 };
343
344 const vnfPath = [
345   "vnfs", "vProbe_NC_VNF 0"
346 ];
347
348 const vnfPath2 = [
349   "vnfs", "vProbe_NC_VNF 0_1"
350 ];
351
352
353
354 function addNewNode(dataTestId: string) {
355   return cy.getElementByDataTestsId(dataTestId).click({force: true})
356 }
357
358 function removeVNFWithVFModules(dataTestId: string) {
359   return cy.nodeAction(dataTestId, 'Remove')
360     .getTagElementContainsText('button', 'Remove VNF').click()
361 }
362
363 function assertThatBodyFromDeployRequestEqualsToTemplateFromBackEnd(deviationFromExpected: { path: PropertyPath, value: any }[] = []) {
364   assertThatBodyFromDeployRequestEqualsToTemplateFromBackEndInternal(templateWithVnfSetup.instanceTemplateFile, deviationFromExpected);
365 }
366
367 function assertThatBodyFromDeployRequestEqualsToTemplateFromBackEnd_network(deviationFromExpected: { path: PropertyPath, value: any }[] = []) {
368   assertThatBodyFromDeployRequestEqualsToTemplateFromBackEndInternal(templateWithNetworkSetup.instanceTemplateFile, deviationFromExpected);
369 }
370
371 function assertThatBodyFromDeployRequestEqualsToTemplateFromBackEndInternal(filePathOfExpected: string, deviationFromExpected: { path: PropertyPath; value: any }[]) {
372   cy.getDrawingBoardDeployBtn().click();
373   cy.wait('@expectedPostAsyncInstantiation').then(xhr => {
374     cy.readFile(filePathOfExpected).then((expectedResult) => {
375       convertRollbackOnFailureValueFromStringToBoolean(expectedResult);
376
377       let xhrBodyWithoutIsDirtyField = removeIsDirtyFieldFromXhrRequestBody(xhr);
378       setDeviationInExpected(expectedResult, deviationFromExpected);
379       cy.deepCompare(xhrBodyWithoutIsDirtyField, expectedResult);
380     });
381   });
382 }
383
384
385 function assertThatBodyFromDeployRequestEqualsToFile(deviationFromExpected: { path: PropertyPath, value: any }[] = []) {
386   cy.getDrawingBoardDeployBtn().click();
387   cy.wait('@expectedPostAsyncInstantiation').then(xhr => {
388
389     cy.readFile(templateWithVnfSetup.instanceTemplateSetWithoutModifyFile).then((expectedResult) => {
390       setDeviationInExpected(expectedResult, deviationFromExpected);
391       let actualObj = xhr.request.body;
392       // @ts-ignore
393       let actual_vprobe_0 = xhr.request.body['vnfs']['vProbe_NC_VNF 0']['vfModules'];
394       // @ts-ignore
395       let actual_vprobe_1 = xhr.request.body['vnfs']['vProbe_NC_VNF 0_1']['vfModules'];
396       actual_vprobe_0['vprobe_nc_vnf0..VprobeNcVnf..FE_base_module..module-0']['vprobe_nc_vnf0..VprobeNcVnf..FE_base_module..module-0ahubg'].pauseInstantiation = null;
397       actual_vprobe_0['vprobe_nc_vnf0..VprobeNcVnf..FE_Add_On_Module_vlbagent_eph..module-1']['vprobe_nc_vnf0..VprobeNcVnf..FE_Add_On_Module_vlbagent_eph..module-1yprvi'].pauseInstantiation = null;
398       actual_vprobe_1['vprobe_nc_vnf0..VprobeNcVnf..FE_base_module..module-0']['vprobe_nc_vnf0..VprobeNcVnf..FE_base_module..module-0ahubg'].pauseInstantiation = null;
399       actual_vprobe_1['vprobe_nc_vnf0..VprobeNcVnf..FE_Add_On_Module_vlbagent_eph..module-1']['vprobe_nc_vnf0..VprobeNcVnf..FE_Add_On_Module_vlbagent_eph..module-1yprvi'].pauseInstantiation = null;
400
401       actual_vprobe_0['vprobe_nc_vnf0..VprobeNcVnf..FE_base_module..module-0']['vprobe_nc_vnf0..VprobeNcVnf..FE_base_module..module-0ahubg'].position = null;
402       actual_vprobe_0['vprobe_nc_vnf0..VprobeNcVnf..FE_Add_On_Module_vlbagent_eph..module-1']['vprobe_nc_vnf0..VprobeNcVnf..FE_Add_On_Module_vlbagent_eph..module-1yprvi'].position = null;
403       actual_vprobe_1['vprobe_nc_vnf0..VprobeNcVnf..FE_base_module..module-0']['vprobe_nc_vnf0..VprobeNcVnf..FE_base_module..module-0ahubg'].position = null;
404       actual_vprobe_1['vprobe_nc_vnf0..VprobeNcVnf..FE_Add_On_Module_vlbagent_eph..module-1']['vprobe_nc_vnf0..VprobeNcVnf..FE_Add_On_Module_vlbagent_eph..module-1yprvi'].position = null;
405       let vnfs = expectedResult['vnfs'];
406       let expected_vProbe_NC_VNF_0_vfModules = vnfs['vProbe_NC_VNF 0']['vfModules'];
407       let expected_vProbe_NC_VNF_0_1_vfModules = vnfs['vProbe_NC_VNF 0_1']['vfModules'];
408       expected_vProbe_NC_VNF_0_vfModules['vprobe_nc_vnf0..VprobeNcVnf..FE_base_module..module-0']['vprobe_nc_vnf0..VprobeNcVnf..FE_base_module..module-0ahubg'].position = null;
409       expected_vProbe_NC_VNF_0_vfModules['vprobe_nc_vnf0..VprobeNcVnf..FE_Add_On_Module_vlbagent_eph..module-1']['vprobe_nc_vnf0..VprobeNcVnf..FE_Add_On_Module_vlbagent_eph..module-1yprvi'].position = null;
410       expected_vProbe_NC_VNF_0_1_vfModules['vprobe_nc_vnf0..VprobeNcVnf..FE_base_module..module-0']['vprobe_nc_vnf0..VprobeNcVnf..FE_base_module..module-0ahubg'].position = null;
411       expected_vProbe_NC_VNF_0_1_vfModules['vprobe_nc_vnf0..VprobeNcVnf..FE_Add_On_Module_vlbagent_eph..module-1']['vprobe_nc_vnf0..VprobeNcVnf..FE_Add_On_Module_vlbagent_eph..module-1yprvi'].position = null;
412       expected_vProbe_NC_VNF_0_vfModules['vprobe_nc_vnf0..VprobeNcVnf..FE_base_module..module-0']['vprobe_nc_vnf0..VprobeNcVnf..FE_base_module..module-0ahubg'].pauseInstantiation = null;
413       expected_vProbe_NC_VNF_0_vfModules['vprobe_nc_vnf0..VprobeNcVnf..FE_Add_On_Module_vlbagent_eph..module-1']['vprobe_nc_vnf0..VprobeNcVnf..FE_Add_On_Module_vlbagent_eph..module-1yprvi'].pauseInstantiation = null;
414       expected_vProbe_NC_VNF_0_1_vfModules['vprobe_nc_vnf0..VprobeNcVnf..FE_base_module..module-0']['vprobe_nc_vnf0..VprobeNcVnf..FE_base_module..module-0ahubg'].pauseInstantiation = null;
415       expected_vProbe_NC_VNF_0_1_vfModules['vprobe_nc_vnf0..VprobeNcVnf..FE_Add_On_Module_vlbagent_eph..module-1']['vprobe_nc_vnf0..VprobeNcVnf..FE_Add_On_Module_vlbagent_eph..module-1yprvi'].pauseInstantiation = null;
416       cy.deepCompare(xhr.request.body, expectedResult);
417     });
418
419   });
420 }
421
422 function bodyOf(xhr: Cypress.WaitXHR) {
423   return JSON.parse(JSON.stringify(xhr.request.body));
424 }
425
426 function setDeviationInExpected(expectedResult: any, deviations: { path: PropertyPath; value: any }[]) {
427   for (const deviation of deviations) {
428     _.set(expectedResult, deviation.path, deviation.value);
429   }
430 }
431
432 function findPathOfLatestVfModule(serviceInstanceElementFromRedux: any, vfModulesContainerPath: string[]) {
433   let latestVfModuleRandomlySelectedKey: string = _.last(_.keys(
434     _.get(serviceInstanceElementFromRedux, vfModulesContainerPath)
435   )) as string;
436
437   return [...vfModulesContainerPath, latestVfModuleRandomlySelectedKey];
438 }
439
440 //We use this function because the deployService() on drawing-board-header.component class
441 // changes rollbackOnFailure value from string type to boolean.
442 function convertRollbackOnFailureValueFromStringToBoolean(expectedResult: any) {
443   expectedResult.rollbackOnFailure = Boolean(expectedResult.rollbackOnFailure);
444 }
445
446 function removeIsDirtyFieldFromXhrRequestBody(xhr: any) {
447   let xhrTempBody = bodyOf(xhr);
448   delete xhrTempBody.isDirty;
449   return xhrTempBody;
450 }
451
452 function mockAsyncBulkResponse() {
453   cy.server().route({
454     url: Cypress.config('baseUrl') + '/asyncInstantiation/bulk',
455     method: 'POST',
456     status: 200,
457     response: true,
458   }).as("expectedPostAsyncInstantiation");
459 }
460