1 import ObjectLike = Cypress.ObjectLike;
3 describe('Drawing Board: Instantiation Templates', function () {
5 describe('Instantiation templates ', () => {
8 cy.clearSessionStorage();
9 cy.setTestApiParamToVNF();
11 cy.initGetAAISubDetails();
13 cy.initDrawingBoardUserPermission();
16 mockAsyncBulkResponse();
23 describe('Load Page and Deploy', () => {
25 it(`Given a stored template - when click "deploy" - then a coherent request should be sent upon deploy`, () => {
27 loadDrawingBoardWithRecreateMode();
30 cy.getElementByDataTestsId("node-vProbe_NC_VNF 0").should('be.visible');
31 assertThatBodyFromDeployRequestEqualsToTemplateFromBackEnd();
34 it('View a template’s details as expected', ()=> {
36 loadDrawingBoardWithRecreateMode();
39 cy.drawingBoardTreeOpenContextMenuByElementDataTestId("node-21ae311e-432f-4c54-b855-446d0b8ded72-vProbe_NC_VNF 0")
40 .drawingBoardTreeClickOnContextMenuOptionByName('Edit')
41 .getElementByDataTestsId("instanceName").should('have.value', 'hvf6arlba007')
42 .getElementByDataTestsId("productFamily").should('contain', 'Emanuel')
43 .getElementByDataTestsId("tenant").should('contain', 'DN5242-Nov21-T1')
44 .getElementByDataTestsId("lcpRegion").should('contain', 'hvf6')
45 .getElementByDataTestsId("lineOfBusiness").should('contain', 'zzz1')
46 .getElementByDataTestsId("rollback").should('contain', 'Rollback')
47 .checkPlatformValue('xxx1')
48 .getElementByDataTestsId("cancelButton").click();
50 cy.drawingBoardTreeOpenContextMenuByElementDataTestId("node-c5b26cc1-a66f-4b69-aa23-6abc7c647c88-vprobe_nc_vnf0..VprobeNcVnf..FE_base_module..module-0")
51 .drawingBoardTreeClickOnContextMenuOptionByName('Edit')
52 .getElementByDataTestsId("instanceName").should('have.value', 'hvf6arlba007_lba_Base_01')
53 .getElementByDataTestsId("lcpRegion").should('contain', 'hvf6')
54 .getElementByDataTestsId("tenant").should('contain', 'DN5242-Nov21-T1')
55 .getElementByDataTestsId("rollback").should('contain', 'Rollback')
56 .getElementByDataTestsId("cancelButton").click();
58 cy.drawingBoardTreeOpenContextMenuByElementDataTestId("node-c09e4530-8fd8-418f-9483-2f57ce927b05-vprobe_nc_vnf0..VprobeNcVnf..FE_Add_On_Module_vlbagent_eph..module-1")
59 .drawingBoardTreeClickOnContextMenuOptionByName('Edit')
60 .getElementByDataTestsId("lcpRegion").should('contain', 'hvf6')
61 .getElementByDataTestsId("tenant").should('contain', 'DN5242-Nov21-T1')
62 .getElementByDataTestsId("rollback").should('contain', 'Rollback')
63 .getElementByDataTestsId("cancelButton").click();
67 assertThatBodyFromDeployRequestEqualsToTemplateFromBackEnd();
70 it(`Edit the service`, function () {
72 loadDrawingBoardWithRecreateMode();
74 cy.openServiceContextMenu()
75 .getElementByDataTestsId("context-menu-header-edit-item").click()
76 .getElementByDataTestsId("instanceName").should('have.value', 'vProbe_NC_Service_DG_new_SI')
77 .getElementByDataTestsId("subscriberName").should('contain', 'SILVIA ROBBINS')
78 .getElementByDataTestsId("serviceType").should('contain', 'TYLER SILVIA')
79 .getElementByDataTestsId("owningEntity").should('contain', 'WayneHolland')
80 .getElementByDataTestsId("project").should('contain', 'WATKINS')
81 .getElementByDataTestsId("rollback").should('contain', 'Rollback');
91 function loadDrawingBoardWithRecreateMode() {
92 const serviceModelId = '6cfeeb18-c2b0-49df-987a-da47493c8e38';
93 const templateUuid = "46390edd-7100-46b2-9f18-419bd24fb60b";
95 const drawingBoardAction = `RECREATE`;
96 const templateTopologyEndpoint = "templateTopology";
97 cy.route(`**/rest/models/services/${serviceModelId}`,
98 'fixture:../support/jsonBuilders/mocks/jsons/instantiationTemplates/templates__service_model.json')
101 cy.route(`**/asyncInstantiation/${templateTopologyEndpoint}/${templateUuid}`,
102 'fixture:../../../vid-automation/src/test/resources/asyncInstantiation/templates__instance_template.json')
103 .as('templateTopology');
107 cy.openIframe(`app/ui/#/servicePlanning/${drawingBoardAction}` +
108 `?jobId=${templateUuid}` +
109 `&serviceModelId=${serviceModelId}`);
111 cy.wait('@serviceModel');
112 cy.wait('@templateTopology');
115 function assertThatBodyFromDeployRequestEqualsToTemplateFromBackEnd() {
116 cy.getDrawingBoardDeployBtn().click();
117 cy.wait('@expectedPostAsyncInstantiation').then(xhr => {
118 cy.readFile('../vid-automation/src/test/resources/asyncInstantiation/templates__instance_template.json').then((expectedResult) => {
119 convertRollbackOnFailureValueFromStringToBoolean(expectedResult);
121 let xhrBodyWithoutIsDirtyField = removeIsDirtyFieldFromXhrRequestBody(xhr);
122 cy.deepCompare(xhrBodyWithoutIsDirtyField, expectedResult);
127 //We use this function because the deployService() on drawing-board-header.component class
128 // changes rollbackOnFailure value from string type to boolean.
129 function convertRollbackOnFailureValueFromStringToBoolean(expectedResult: any) {
130 expectedResult.rollbackOnFailure = Boolean(expectedResult.rollbackOnFailure);
133 function removeIsDirtyFieldFromXhrRequestBody(xhr : any) {
134 let xhrTempBody = JSON.parse(JSON.stringify(xhr.request.body));
135 delete xhrTempBody.isDirty;
139 function mockAsyncBulkResponse() {
141 url: Cypress.config('baseUrl') + '/asyncInstantiation/bulk',
145 }).as("expectedPostAsyncInstantiation");