From f792671ae247a931f34d902e9276202b5016ef9a Mon Sep 17 00:00:00 2001 From: Ittay Stern Date: Sun, 7 Jul 2019 19:23:03 +0300 Subject: Merge from ecomp 718fd196 - Modern UI Issue-ID: VID-378 Change-Id: I2736b98426e324ec3aa233b034229ba84d99839f Signed-off-by: Ittay Stern --- .../cypress/integration/iFrames/vnf.update.e2e.ts | 94 ++++++++++++++++++++++ 1 file changed, 94 insertions(+) create mode 100644 vid-webpack-master/cypress/integration/iFrames/vnf.update.e2e.ts (limited to 'vid-webpack-master/cypress/integration/iFrames/vnf.update.e2e.ts') diff --git a/vid-webpack-master/cypress/integration/iFrames/vnf.update.e2e.ts b/vid-webpack-master/cypress/integration/iFrames/vnf.update.e2e.ts new file mode 100644 index 000000000..4d2d7dbaf --- /dev/null +++ b/vid-webpack-master/cypress/integration/iFrames/vnf.update.e2e.ts @@ -0,0 +1,94 @@ +/// +import {JsonBuilder} from '../../support/jsonBuilders/jsonBuilder'; +import {ServiceModel} from '../../support/jsonBuilders/models/service.model'; +import {AsyncInstantiationModel} from "../../support/jsonBuilders/models/asyncInstantiation.model"; + +describe('Delete vnf instance', function () { + let jsonBuilderAndMock: JsonBuilder = new JsonBuilder(); + + let jsonBuilderInstantiationBuilder: JsonBuilder = new JsonBuilder(); + + beforeEach(() => { + cy.window().then((win) => { + win.sessionStorage.clear(); + cy.preventErrorsOnLoading(); + cy.initAAIMock(); + cy.initVidMock(); + cy.initZones(); + cy.permissionVidMock(); + cy.login(); + }); + }); + + afterEach(() => { + cy.screenshot(); + }); + + it(`Update vnf - add 1 delete 1`, function () { + const SUBSCRIBER_ID: string = "e433710f-9217-458d-a79d-1c7aff376d89"; + const SERVICE_TYPE: string = "TYLER SILVIA"; + const SERVICE_INSTANCE_ID: string = "f8791436-8d55-4fde-b4d5-72dd2cf13cfb"; + const SERVICE_MODEL_ID: string = '6b528779-44a3-4472-bdff-9cd15ec93450'; + + cy.server().route({ + url: Cypress.config('baseUrl') + '/asyncInstantiation/bulk', + method: 'POST', + status: 200, + response: "[]", + }).as("expectedPostAsyncInstantiation"); + + cy.readFile('/cypress/support/jsonBuilders/mocks/jsons/serviceModels/ecompNamingFalseModel.json').then((res) => { + res.service.vidNotions.instantiationType = 'ALaCarte'; + jsonBuilderAndMock.basicJson( + res, + Cypress.config('baseUrl') + "/rest/models/services/6b528779-44a3-4472-bdff-9cd15ec93450", + 200, + 0, + "ecompNamingFalseModel", + ) + }); + + cy.readFile('../vid-automation/src/test/resources/aaiGetInstanceTopology/getServiceInstanceTopologyResult.json').then((res) => { + res.networks = {}; + res.isALaCarte = true; + res.instanceId = "f8791436-8d55-4fde-b4d5-72dd2cf13cfb"; + + const vnf = res.vnfs['2017-488_PASQUALE-vPE 0']; + vnf.instanceId = "VNF_INSTANCE_ID"; + vnf.vfModules['2017488_pasqualevpe0..2017488PasqualeVpe..PASQUALE_base_vPE_BV..module-0']['2017488_pasqualevpe0..2017488PasqualeVpe..PASQUALE_base_vPE_BV..module-0uvfot'].instanceId = "VF_MODULE_BASE_INSTANCE_ID"; + vnf.vfModules['2017488_pasqualevpe0..2017488PasqualeVpe..PASQUALE_vRE_BV..module-1']['2017488_pasqualevpe0..2017488PasqualeVpe..PASQUALE_vRE_BV..module-1fshmc'].instanceId = "VF_MODULE_INSTANCE_ID"; + + jsonBuilderAndMock.basicJson( + res, + Cypress.config('baseUrl') + "/aai_get_service_instance_topology/e433710f-9217-458d-a79d-1c7aff376d89/TYLER SILVIA/f8791436-8d55-4fde-b4d5-72dd2cf13cfb", + 200, 0, + "initServiceInstanceTopology", + ) + }); + + cy.openIframe(`app/ui/#/servicePlanning/EDIT?serviceModelId=${SERVICE_MODEL_ID}&subscriberId=${SUBSCRIBER_ID}&serviceType=${SERVICE_TYPE}&serviceInstanceId=${SERVICE_INSTANCE_ID}`); + + // add a vnf on update mode + cy.drawingBoardPressAddButtonByElementName('node-2017-388_PASQUALE-vPE 0').click({force: true}); + cy.selectDropdownOptionByText('rollback', 'Rollback'); + cy.fillVnfPopup(); + + // delete VNF + cy.drawingBoardTreeOpenContextMenuByElementDataTestId('node-69e09f68-8b63-4cc9-b9ff-860960b5db09-2017-488_PASQUALE-vPE 0', 0) + .drawingBoardTreeClickOnContextMenuOptionByName('Delete'); + + // update service + cy.getDrawingBoardDeployBtn().click(); + + cy.getReduxState().then((state) => { + const vnf = state.service.serviceInstance[SERVICE_MODEL_ID].vnfs["2017-388_PASQUALE-vPE 0_1"]; + cy.wait('@expectedPostAsyncInstantiation').then(xhr => { + cy.readFile('../vid-automation/src/test/resources/asyncInstantiation/vidRequestDelete1Create1Vnf.json').then((expectedResult) => { + expectedResult.vnfs["2017-388_PASQUALE-vPE 0_1"].trackById = vnf.trackById; + cy.deepCompare(xhr.request.body, expectedResult); + }); + }); + }); + }); + +}); -- cgit 1.2.3-korg