diff options
Diffstat (limited to 'vid-webpack-master/cypress')
27 files changed, 482 insertions, 221 deletions
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 fa628d4b5..3b42a1ca1 100644 --- a/vid-webpack-master/cypress/integration/iFrames/ala-carte.e2e.ts +++ b/vid-webpack-master/cypress/integration/iFrames/ala-carte.e2e.ts @@ -215,15 +215,20 @@ describe('A la carte', function () { }); }); - it(`VFModule a-la-carte`, () => { - var timeBomb = new Date('12/09/2018'); - if (new Date() < timeBomb) { - return; - } + it(`Add ALaCarte VfModule Without LcpRegion Tenant Id And Legacy`, () => { + addAlacarteVfmoduleByFlag(true, 'redux-a-la-carte-no-lcp-tenant.json'); + }); + + it(`Add ALaCarte VfModule With LcpRegion Tenant Id And Legacy`, () => { + addAlacarteVfmoduleByFlag(false, 'redux-a-la-carte.json'); + }); + + function addAlacarteVfmoduleByFlag (flag: boolean, expectedJsonFile: string) { cy.readFile('cypress/support/jsonBuilders/mocks/jsons/emptyServiceRedux.json').then((res) => { cy.setTestApiParamToGR(); res.service.serviceHierarchy['2f80c596-27e5-4ca9-b5bb-e03a7fd4c0fd'].service.vidNotions.instantiationType = 'ALaCarte'; res.service.serviceHierarchy['2f80c596-27e5-4ca9-b5bb-e03a7fd4c0fd'].service.inputs = null; + res.global['flags'] = { 'FLAG_2006_VFMODULE_TAKES_TENANT_AND_REGION_FROM_VNF' : flag }; cy.setReduxState(<any>res); cy.openIframe('app/ui/#/servicePlanning?serviceModelId=2f80c596-27e5-4ca9-b5bb-e03a7fd4c0fd'); @@ -241,31 +246,30 @@ describe('A la carte', function () { '2017488_pasqualevpe0..2017488PasqualeVpe..PASQUALE_vPFE_BV..module-2', ]; - cy.addALaCarteVfModule(vnfName, vfModulesNames[0], 'mimazepubi', 'hvf6', '', 'AINWebTool-15-D-iftach', false, false, false) + cy.addALaCarteVfModule(vnfName, vfModulesNames[0], 'mimazepubi', 'hvf6', '', 'AINWebTool-15-D-iftach', false, false, false, flag) + .then(() => { + cy.addALaCarteVfModule(vnfName, vfModulesNames[1], 'puwesovabe', 'AAIAIC25', 'my region', 'USP-SIP-IC-24335-T-01', true, true, false, flag) .then(() => { - cy.addALaCarteVfModule(vnfName, vfModulesNames[1], 'puwesovabe', 'AAIAIC25', 'my region', 'USP-SIP-IC-24335-T-01', true, true, false) - .then(() => { - cy.addALaCarteVfModule(vnfName, vfModulesNames[2], 'bnmgtrx', 'hvf6', '', 'AINWebTool-15-D-iftach', false, false, true) - .then(() => { - cy.getReduxState().then((state) => { - const vfModules = state.service.serviceInstance['2f80c596-27e5-4ca9-b5bb-e03a7fd4c0fd'].vnfs[vnfName].vfModules; - cy.readFile('../vid-automation/src/test/resources/a-la-carte/redux-a-la-carte.json').then((file) => { - 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]); - } - }); - }); - }); + cy.addALaCarteVfModule(vnfName, vfModulesNames[2], 'bnmgtrx', 'hvf6', '', 'AINWebTool-15-D-iftach', false, false, true, flag) + .then(() => { + cy.getReduxState().then((state) => { + const vfModules = state.service.serviceInstance['2f80c596-27e5-4ca9-b5bb-e03a7fd4c0fd'].vnfs[vnfName].vfModules; + cy.readFile('../vid-automation/src/test/resources/a-la-carte/' + expectedJsonFile).then((file) => { + 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]); + } + }); }); + }); }); + }); }); }); }); - }); - + }; function changeServiceEcompNamingToTrue(obj: ServiceModel) { obj.service.serviceEcompNaming = "true"; @@ -283,8 +287,5 @@ describe('A la carte', function () { .get('.error').contains(INSTANCE_NAME_NOT_MANDATORY_MESSAGE); } - - - }); }); diff --git a/vid-webpack-master/cypress/integration/iFrames/browse-sdc.e2e.ts b/vid-webpack-master/cypress/integration/iFrames/browse-sdc.e2e.ts index 427696561..b1671a4e5 100644 --- a/vid-webpack-master/cypress/integration/iFrames/browse-sdc.e2e.ts +++ b/vid-webpack-master/cypress/integration/iFrames/browse-sdc.e2e.ts @@ -63,13 +63,13 @@ describe('Browse SDC', function () { }); - it(`browse sdc should open instantiation template modal if service hasTemplate is true`, function () { + it(`browse sdc should open instantiation template modal if service isInstantiationTemplateExists is true`, function () { const SERVICE_MODEL_ID: string = '74fa72dd-012b-49c3-800d-06b12bcaf1a0'; cy.readFile('cypress/support/jsonBuilders/mocks/jsons/bug616888/list-services.json').then((res) => { - res.services = res.services.map((service: { uuid: string, hasTemplate: boolean }) => { + res.services = res.services.map((service: { uuid: string, isInstantiationTemplateExists: boolean }) => { if (service.uuid === SERVICE_MODEL_ID) { - service.hasTemplate = true; + service.isInstantiationTemplateExists = true; } return service; }); @@ -98,6 +98,45 @@ describe('Browse SDC', function () { }); }); + it(`browse sdc open create new service instance flow`, function () { + const MACRO_FOR_NEW_FLOW_ID: string = '745d1bf1-9ed1-413f-8111-f1e984ad63fb'; + + cy.initGetAAISubDetails(); + + cy.readFile('cypress/support/jsonBuilders/mocks/jsons/aaiGetModelsByServiceType.json').then((res) => { + jsonBuilderAndMock.basicJson(res, + Cypress.config('baseUrl') + '/aai_get_models_by_service_type/**', + 200, + 0, + 'aaiGetModelByServiceType'); + }); + + cy.readFile('cypress/support/jsonBuilders/mocks/jsons/bug616888/Dror_service1806_Macro1.json').then((res) => { + jsonBuilderAndMock.basicJson(res, + Cypress.config('baseUrl') + '/rest/models/services/' + MACRO_FOR_NEW_FLOW_ID, + 200, + 0, + 'MACRO_FOR_NEW_FLOW'); + }); + + cy.get('span').contains('Create New Service Instance').click({force: true}) + .selectDropdownOptionByText('subscriberName', 'SILVIA ROBBINS'); + cy.get('button').contains('Submit').click({force: true}); + cy.selectDropdownOptionByText('serviceType', 'TYLER SILVIA'); + cy.get('button').contains('Submit').click({force: true}); + cy.wait("@aaiGetModelByServiceType").then(() => { + cy.getElementByDataTestsId('deploy-' + MACRO_FOR_NEW_FLOW_ID).click({force: true}); + cy.get('button').contains('Deploy').eq(0).click({force: true}); + cy.get('iframe').then(function ($iframe) { + expect($iframe.attr('src')).to.contain(`app/ui/#/servicePopup?serviceModelId=74fa72dd-012b-49c3-800d-06b12bcaf1a0`); + }); + }); + + cy.visit("welcome.htm"); //relaod page to not break the following tests + + }); + + it(`browse sdc of service without instantiationType open aLaCarte popup`, function () { const VERY_OLD_SERVICE_UUID: string = "09c476c7-91ae-44b8-a731-04d8d8fa3695"; const TEST_MOCKS_PATH = "cypress/support/jsonBuilders/mocks/jsons/bug_aLaCarteServiceWrongPopup/"; diff --git a/vid-webpack-master/cypress/integration/iFrames/drawingBoard.e2e.ts b/vid-webpack-master/cypress/integration/iFrames/drawingBoard.e2e.ts index cf870b7b9..4a8b89a2c 100644 --- a/vid-webpack-master/cypress/integration/iFrames/drawingBoard.e2e.ts +++ b/vid-webpack-master/cypress/integration/iFrames/drawingBoard.e2e.ts @@ -350,7 +350,7 @@ describe('Drawing board', function () { cy.drawingBoardTreeClickOnContextMenuOptionByName('Remove'); cy.get('.title').contains('Remove VNF'); - cy.get('.sdc-button').contains('Remove VNF').click(); + cy.get('.custom-button').contains('Remove VNF').click(); // assert vfModules are disabled after remove parent vnf cy.get('.tree-node-disabled div[data-tests-id="node-2017488_pasqualevpe0..2017488PasqualeVpe..PASQUALE_vRE_BV..module-1"]') .should('be.visible'); @@ -6762,7 +6762,7 @@ describe('Drawing board', function () { "supplementaryFile_hidden_content": "{\r\n \"name\": \"a\",\r\n \"value\": \"32\"\r\n}", "supplementaryFileContent": { "name": "a", - "value": "32" + "value": "32" }, "supplementaryFileName": "sample.json", "instanceParams": [ diff --git a/vid-webpack-master/cypress/integration/iFrames/instantiation-templates.e2e.ts b/vid-webpack-master/cypress/integration/iFrames/instantiation-templates.e2e.ts index 5afcc9748..bb2c01abd 100644 --- a/vid-webpack-master/cypress/integration/iFrames/instantiation-templates.e2e.ts +++ b/vid-webpack-master/cypress/integration/iFrames/instantiation-templates.e2e.ts @@ -25,7 +25,7 @@ describe('Drawing Board: Instantiation Templates', function () { it(`Given a stored template - when click "deploy" - then a coherent request should be sent upon deploy`, () => { - loadDrawingBoardWithRecreateMode(); + cy.loadDrawingBoardWithRecreateMode(templateWithVnfSetup); // Then... cy.getElementByDataTestsId("node-vProbe_NC_VNF 0").should('be.visible'); @@ -34,9 +34,10 @@ describe('Drawing Board: Instantiation Templates', function () { it('Given a template - User can remove existing VNF', () => { - loadDrawingBoardWithRecreateMode(); + cy.loadDrawingBoardWithRecreateMode(templateWithVnfSetup); removeVNFWithVFModules('node-21ae311e-432f-4c54-b855-446d0b8ded72-vProbe_NC_VNF 0'); + removeVNFWithVFModules('node-21ae311e-432f-4c54-b855-446d0b8ded72-vProbe_NC_VNF 0'); cy.getDrawingBoardDeployBtn().click(); cy.wait('@expectedPostAsyncInstantiation').then(xhr => { @@ -46,43 +47,52 @@ describe('Drawing Board: Instantiation Templates', function () { }); it('Given a template - User can add new VNF', () => { - loadDrawingBoardWithRecreateMode(); + cy.loadDrawingBoardWithRecreateMode(templateWithVnfSetup); // add new node addNewNode('node-vProbe_NC_VNF 0-add-btn') .fillVnfPopup() .getDrawingBoardDeployBtn().click() .wait('@expectedPostAsyncInstantiation').then(xhr => { - const vnfRequest = bodyOf(xhr).vnfs['vProbe_NC_VNF 0_1']; - - expect(vnfRequest.action).equals("Create"); - expect(vnfRequest.rollbackOnFailure).equals("true"); - expect(vnfRequest.originalName).equals("vProbe_NC_VNF 0"); - expect(vnfRequest.productFamilyId).equals("a9a77d5a-123e-4ca2-9eb9-0b015d2ee0fb"); - expect(vnfRequest.lcpCloudRegionId).equals("hvf6"); - expect(vnfRequest.lineOfBusiness).equals("zzz1"); - expect(vnfRequest.platformName).equals("xxx1"); - expect(vnfRequest.tenantId).equals("229bcdc6eaeb4ca59d55221141d01f8e"); + const vnfRequest = bodyOf(xhr).vnfs['vProbe_NC_VNF 0_2']; + + expect(vnfRequest.action).equals("Create"); + expect(vnfRequest.rollbackOnFailure).equals("true"); + expect(vnfRequest.originalName).equals("vProbe_NC_VNF 0"); + expect(vnfRequest.productFamilyId).equals("a9a77d5a-123e-4ca2-9eb9-0b015d2ee0fb"); + expect(vnfRequest.lcpCloudRegionId).equals("hvf6"); + expect(vnfRequest.lineOfBusiness).equals("zzz1"); + expect(vnfRequest.platformName).equals("xxx1"); + expect(vnfRequest.tenantId).equals("229bcdc6eaeb4ca59d55221141d01f8e"); + + + // check instance name not change if empty + cy.editNode('node-21ae311e-432f-4c54-b855-446d0b8ded72-vProbe_NC_VNF 0', 0) + .clearInput('instanceName'); + cy.getElementByDataTestsId('form-set').click({force: true}).then((done) => { + cy.editNode('node-21ae311e-432f-4c54-b855-446d0b8ded72-vProbe_NC_VNF 0', 0) + .getElementByDataTestsId('instanceName').should('be.empty') + }); }); }); it('Given a template - User can Duplicate VNF', () => { const numberOfDuplicate: number = 4; - loadDrawingBoardWithRecreateMode(); - nodeAction('node-21ae311e-432f-4c54-b855-446d0b8ded72-vProbe_NC_VNF 0', 'Duplicate') + cy.loadDrawingBoardWithRecreateMode(templateWithVnfSetup); + cy.nodeAction('node-21ae311e-432f-4c54-b855-446d0b8ded72-vProbe_NC_VNF 0', 'Duplicate') .getElementByDataTestsId('duplicate-amount-vfmodules').select(numberOfDuplicate.toString()) .getTagElementContainsText('button', 'Duplicate').click() .getDrawingBoardDeployBtn().click() .wait('@expectedPostAsyncInstantiation').then(xhr => { - expect(Object.keys(bodyOf(xhr).vnfs).length).equals(numberOfDuplicate + 1); + expect(Object.keys(bodyOf(xhr).vnfs).length).equals(numberOfDuplicate + 2); }); }); it('Given a stored template - when "edit" vnf and vfmodules are opened - then template’s details are visible as expected and deploy without changes', () => { - loadDrawingBoardWithRecreateMode(); + cy.loadDrawingBoardWithRecreateMode(templateWithVnfSetup); // Then... - editNode("node-21ae311e-432f-4c54-b855-446d0b8ded72-vProbe_NC_VNF 0") + cy.editNode("node-21ae311e-432f-4c54-b855-446d0b8ded72-vProbe_NC_VNF 0") .getElementByDataTestsId("instanceName").should('have.value', 'hvf6arlba007') .getElementByDataTestsId("productFamily").should('contain', 'Emanuel') .getElementByDataTestsId("tenant").should('contain', 'DN5242-Nov21-T1') @@ -92,30 +102,27 @@ describe('Drawing Board: Instantiation Templates', function () { .checkPlatformValue('xxx1') .getElementByDataTestsId("cancelButton").click(); - editNode("node-c5b26cc1-a66f-4b69-aa23-6abc7c647c88-vprobe_nc_vnf0..VprobeNcVnf..FE_base_module..module-0") + cy.editNode("node-c5b26cc1-a66f-4b69-aa23-6abc7c647c88-vprobe_nc_vnf0..VprobeNcVnf..FE_base_module..module-0") .getElementByDataTestsId("instanceName").should('have.value', 'hvf6arlba007_lba_Base_01') - .getElementByDataTestsId("lcpRegion").should('contain', 'hvf6') - .getElementByDataTestsId("tenant").should('contain', 'DN5242-Nov21-T1') .getElementByDataTestsId("rollback").should('contain', 'Rollback') .getElementByDataTestsId("cancelButton").click(); - editNode("node-c09e4530-8fd8-418f-9483-2f57ce927b05-vprobe_nc_vnf0..VprobeNcVnf..FE_Add_On_Module_vlbagent_eph..module-1") + cy.editNode("node-c09e4530-8fd8-418f-9483-2f57ce927b05-vprobe_nc_vnf0..VprobeNcVnf..FE_Add_On_Module_vlbagent_eph..module-1") .getElementByDataTestsId("instanceName").should('have.value', 'my_hvf6arlba007_lba_dj_01') .getElementByDataTestsId("volumeGroupName").should('have.value', 'my_special_hvf6arlba007_lba_dj_01_vol') - .getElementByDataTestsId("lcpRegion").should('contain', 'hvf6') - .getElementByDataTestsId("tenant").should('contain', 'DN5242-Nov21-T1') .getElementByDataTestsId("rollback").should('contain', 'Rollback') .getElementByDataTestsId("sdncPreLoad").should('have.value', 'on') .getElementByDataTestsId("cancelButton").click(); assertThatBodyFromDeployRequestEqualsToTemplateFromBackEnd([ {path: [...vnfPath, "vnfStoreKey"], value: "vProbe_NC_VNF 0"}, // side-effect + {path: [...vnfPath2, "vnfStoreKey"], value: "vProbe_NC_VNF 0_1"}, ]); }); it(`Given a stored template - when "edit" service is opened - then template’s details are visible as expected`, function () { - loadDrawingBoardWithRecreateMode(); + cy.loadDrawingBoardWithRecreateMode(templateWithVnfSetup); cy.openServiceContextMenu() .getElementByDataTestsId("context-menu-header-edit-item").click() @@ -129,25 +136,23 @@ describe('Drawing Board: Instantiation Templates', function () { }); it(`Given a stored template - add one VfModule, edit its details, and deploy - deploy is added with the vfModule details`, () => { - loadDrawingBoardWithRecreateMode(); + cy.loadDrawingBoardWithRecreateMode(templateWithVnfSetup); let newVfModuleName = "new.vfmodule.name"; let module1ModelId = "VprobeNcVnf..FE_Add_On_Module_vlbagent_eph..module-1"; let module1CustomizationId = `vprobe_nc_vnf0..${module1ModelId}`; // Click target VNF on right tree - cy.getElementByDataTestsId('node-21ae311e-432f-4c54-b855-446d0b8ded72-vProbe_NC_VNF 0').click(); + cy.getElementByDataTestsId('node-21ae311e-432f-4c54-b855-446d0b8ded72-vProbe_NC_VNF 0').first().click(); // Click [+] vfModule on left tree cy.drawingBoardPressAddButtonByElementName(`node-${module1CustomizationId}`) .click({force: true}); - editNode(`node-c09e4530-8fd8-418f-9483-2f57ce927b05-${module1CustomizationId}`, 1); - cy.clearInput("instanceName"); - cy.typeToInput("instanceName", newVfModuleName); - cy.selectDropdownOptionByText('lcpRegion', 'hvf6'); - cy.selectDropdownOptionByText('tenant', 'DN5242-Nov21-T1'); - cy.getElementByDataTestsId('form-set').click(); + cy.editNode(`node-c09e4530-8fd8-418f-9483-2f57ce927b05-${module1CustomizationId}`, 1); + cy.clearInput("instanceName"); + cy.typeToInput("instanceName", newVfModuleName); + cy.getElementByDataTestsId('form-set').click(); // Then... cy.getReduxState().then((state) => { @@ -166,13 +171,12 @@ describe('Drawing Board: Instantiation Templates', function () { { instanceName: newVfModuleName, volumeGroupName: `${newVfModuleName}_vol`, - lcpCloudRegionId: "hvf6", - tenantId: "4914ab0ab3a743e58f0eefdacc1dde77", } ); assertThatBodyFromDeployRequestEqualsToTemplateFromBackEnd([ {path: [...vnfPath, "vnfStoreKey"], value: "vProbe_NC_VNF 0"}, // side-effect + {path: [...vnfPath2, "vnfStoreKey"], value: "vProbe_NC_VNF 0_1"}, {path: ["existingNames", newVfModuleName], value: ""}, {path: ["existingNames", `${newVfModuleName}_vol`], value: ""}, {path: latestVfModule_1Path, value: latestVfModule_1ExpectedValue}, @@ -184,8 +188,8 @@ describe('Drawing Board: Instantiation Templates', function () { it('Given a template - User can remove existing vfmodule', function () { - loadDrawingBoardWithRecreateMode(); - nodeAction('node-c09e4530-8fd8-418f-9483-2f57ce927b05-vprobe_nc_vnf0..VprobeNcVnf..FE_Add_On_Module_vlbagent_eph..module-1', 'Remove'); + cy.loadDrawingBoardWithRecreateMode(templateWithVnfSetup); + cy.nodeAction('node-c09e4530-8fd8-418f-9483-2f57ce927b05-vprobe_nc_vnf0..VprobeNcVnf..FE_Add_On_Module_vlbagent_eph..module-1', 'Remove'); let removed_vfModule_Path = [ ...vnfPath, "vfModules", "vprobe_nc_vnf0..VprobeNcVnf..FE_Add_On_Module_vlbagent_eph..module-1", @@ -193,6 +197,7 @@ describe('Drawing Board: Instantiation Templates', function () { assertThatBodyFromDeployRequestEqualsToTemplateFromBackEnd([ {path: [...vnfPath, "vnfStoreKey"], value: "vProbe_NC_VNF 0"}, // side-effect + {path: [...vnfPath2, "vnfStoreKey"], value: "vProbe_NC_VNF 0_1"}, {path: [...removed_vfModule_Path], value: undefined}, ]); }); @@ -204,7 +209,7 @@ describe('Drawing Board: Instantiation Templates', function () { it(`Given a stored template - edit service vnf and vfmodule ${testCase.desc} - deploy request should be ${testCase.desc}`, function () { - loadDrawingBoardWithRecreateMode(); + cy.loadDrawingBoardWithRecreateMode(templateWithVnfSetup); //edit service cy.openServiceContextMenu(); @@ -216,7 +221,7 @@ describe('Drawing Board: Instantiation Templates', function () { cy.getElementByDataTestsId('form-set').click(); // edit vnf - editNode("node-21ae311e-432f-4c54-b855-446d0b8ded72-vProbe_NC_VNF 0"); + cy.editNode("node-21ae311e-432f-4c54-b855-446d0b8ded72-vProbe_NC_VNF 0"); if (testCase.modifySomeValues) { cy.selectPlatformValue('platform'); cy.selectDropdownOptionByText("tenant", "CESAR-100-D-spjg61909"); @@ -224,7 +229,7 @@ describe('Drawing Board: Instantiation Templates', function () { cy.getElementByDataTestsId('form-set').click(); //edit vf module - editNode("node-c5b26cc1-a66f-4b69-aa23-6abc7c647c88-vprobe_nc_vnf0..VprobeNcVnf..FE_base_module..module-0"); + cy.editNode("node-c5b26cc1-a66f-4b69-aa23-6abc7c647c88-vprobe_nc_vnf0..VprobeNcVnf..FE_base_module..module-0"); if (testCase.modifySomeValues) { cy.getElementByDataTestsId('sdncPreLoad').click(); } @@ -251,9 +256,9 @@ describe('Drawing Board: Instantiation Templates', function () { }); - it(`Given a stored template of Network - - it is loaded`, () => { + it(`Given a stored template of Network - - it is loaded`, () => { - loadDrawingBoardWithRecreateModeNetwork(); + cy.loadDrawingBoardWithRecreateModeNetwork(templateWithNetworkSetup); // Then... cy.getElementByDataTestsId("node-SR-IOV Provider 2-1").should('be.visible'); @@ -261,11 +266,11 @@ describe('Drawing Board: Instantiation Templates', function () { assertThatBodyFromDeployRequestEqualsToTemplateFromBackEnd_network(); }); - it(`Given a stored template of Network - User can remove existing network`, () => { + it(`Given a stored template of Network - User can remove existing network`, () => { - loadDrawingBoardWithRecreateModeNetwork(); + cy.loadDrawingBoardWithRecreateModeNetwork(templateWithNetworkSetup); - nodeAction('node-01f4c475-3f89-4f00-a2f4-39a873dba0ae-SR-IOV Provider 2-1', 'Remove'); + cy.nodeAction('node-01f4c475-3f89-4f00-a2f4-39a873dba0ae-SR-IOV Provider 2-1', 'Remove'); let removed_network_Path = [ "networks", "SR-IOV Provider 2-1", ]; @@ -282,13 +287,13 @@ describe('Drawing Board: Instantiation Templates', function () { it('Given a template - User can add a new network', () => { - loadDrawingBoardWithRecreateModeNetwork(); + cy.loadDrawingBoardWithRecreateModeNetwork(templateWithNetworkSetup); // add new node addNewNode('node-SR-IOV Provider 2-1-add-btn') - .fillNetworkPopup() - .getDrawingBoardDeployBtn().click() - .wait('@expectedPostAsyncInstantiation').then(xhr => { + .fillNetworkPopup() + .getDrawingBoardDeployBtn().click() + .wait('@expectedPostAsyncInstantiation').then(xhr => { const networkRequest = bodyOf(xhr).networks['SR-IOV Provider 2-1_1']; expect(networkRequest.action).equals("Create"); @@ -324,58 +329,18 @@ const vnfPath = [ "vnfs", "vProbe_NC_VNF 0" ]; -function loadDrawingBoardWithRecreateMode() { - loadDrawingBoardWithRecreateModeInternal( - '../../' + templateWithVnfSetup.instanceTemplateFile, - templateWithVnfSetup.serviceModelId, - templateWithVnfSetup.serviceModelFile); -} - -function loadDrawingBoardWithRecreateModeNetwork() { - loadDrawingBoardWithRecreateModeInternal( - '../../' + templateWithNetworkSetup.instanceTemplateFile, - templateWithNetworkSetup.serviceModelId, - templateWithNetworkSetup.serviceModelFile); -} - -function loadDrawingBoardWithRecreateModeInternal(instanceTemplate: string, serviceModelIdToLoad: any, serviceModel: string) { - const templateUuid = "46390edd-7100-46b2-9f18-419bd24fb60b"; - - const drawingBoardAction = `RECREATE`; - const templateTopologyEndpoint = "templateTopology"; - cy.route(`**/rest/models/services/${serviceModelIdToLoad}`, - 'fixture:' + serviceModel) - .as('serviceModel'); - - cy.route(`**/instantiationTemplates/${templateTopologyEndpoint}/${templateUuid}`, - 'fixture:' + instanceTemplate) - .as('templateTopology'); - - // When... - - cy.openIframe(`app/ui/#/servicePlanning/${drawingBoardAction}` + - `?jobId=${templateUuid}` + - `&serviceModelId=${serviceModelIdToLoad}`); - - cy.wait('@serviceModel'); - cy.wait('@templateTopology'); -} +const vnfPath2 = [ + "vnfs", "vProbe_NC_VNF 0_1" +]; -function nodeAction(dataTestId: string, action: string, index ?: number) { - return cy.drawingBoardTreeOpenContextMenuByElementDataTestId(dataTestId, index) - .drawingBoardTreeClickOnContextMenuOptionByName(action) -} -function editNode(dataTestId: string, index ?: number) { - return nodeAction(dataTestId, 'Edit', index); -} function addNewNode(dataTestId: string) { return cy.getElementByDataTestsId(dataTestId).click({force: true}) } function removeVNFWithVFModules(dataTestId: string) { - return nodeAction(dataTestId, 'Remove') + return cy.nodeAction(dataTestId, 'Remove') .getTagElementContainsText('button', 'Remove VNF').click() } @@ -448,6 +413,7 @@ function mockAsyncBulkResponse() { url: Cypress.config('baseUrl') + '/asyncInstantiation/bulk', method: 'POST', status: 200, - response: "[]", + response: true, }).as("expectedPostAsyncInstantiation"); } + diff --git a/vid-webpack-master/cypress/integration/iFrames/instantiation.templates.modal.e2e.ts b/vid-webpack-master/cypress/integration/iFrames/instantiation.templates.modal.e2e.ts index 0db1b099a..f76babe76 100644 --- a/vid-webpack-master/cypress/integration/iFrames/instantiation.templates.modal.e2e.ts +++ b/vid-webpack-master/cypress/integration/iFrames/instantiation.templates.modal.e2e.ts @@ -71,7 +71,7 @@ describe('Template', () => { cy.route(Cypress.config('baseUrl') + "/getuserID", 'us16807000'); - cy.openPopupIframe('/app/ui/#/servicePopup?serviceModelId=2f80c596-27e5-4ca9-b5bb-e03a7fd4c0fd&isCreate=true&hasTemplate=true'); + cy.openPopupIframe('/app/ui/#/servicePopup?serviceModelId=2f80c596-27e5-4ca9-b5bb-e03a7fd4c0fd&isCreate=true&isInstantiationTemplateExists=true'); }); @@ -94,17 +94,15 @@ describe('Template', () => { cy.get(`#header-instantiationStatus`).contains('Instantiation Status'); cy.get(`#header-region`).contains('Region'); cy.get(`#header-tenant`).contains('Tenant'); - cy.get(`#header-aicZone`).contains('AIC Zone'); // check table body row cy.getElementByDataTestsId(`userId-${templateJobIdFromE2EFile}`).contains('16807000'); - cy.getElementByDataTestsId(`createDate-${templateJobIdFromE2EFile}`).contains('2019-12-26 11:57:05'); + cy.getElementByDataTestsId(`createDate-${templateJobIdFromE2EFile}`).contains(/2019-12-26 [0-9]{1,2}:57:05/); //timezone insensitive cy.getElementByDataTestsId(`instanceName-${templateJobIdFromE2EFile}`).contains('SERVICE_NAME'); cy.getElementByDataTestsId(`instantiationStatus-${templateJobIdFromE2EFile}`).contains('IN_PROGRESS'); cy.getElementByDataTestsId(`summary-${templateJobIdFromE2EFile}`).contains('vnf: 1, vfModule: 2, volumeGroup: 1'); cy.getElementByDataTestsId(`region-${templateJobIdFromE2EFile}`).contains('hvf3 (SOMENAME)'); cy.getElementByDataTestsId(`tenant-${templateJobIdFromE2EFile}`).contains('greatTenant'); - cy.getElementByDataTestsId(`aicZone-${templateJobIdFromE2EFile}`).contains('NFTJSSSS-NFT1'); //check load button is disabled diff --git a/vid-webpack-master/cypress/integration/iFrames/retry.e2e.ts b/vid-webpack-master/cypress/integration/iFrames/retry.e2e.ts index e544720a7..693e5f51a 100644 --- a/vid-webpack-master/cypress/integration/iFrames/retry.e2e.ts +++ b/vid-webpack-master/cypress/integration/iFrames/retry.e2e.ts @@ -39,6 +39,7 @@ describe('Retry Page', function () { res.vnfs["2017-388_PASQUALE-vPE 0"].action = 'Create'; res.vnfs["2017-488_PASQUALE-vPE 0"].action = 'Create'; res.networks["ExtVL 0"].action = 'Create'; + res.networks["ExtVL 0"].isFailed = true; res.networks["ExtVL 0"].statusMessage = 'Network instantiation failed message'; // Adding VFModule with isFailed. @@ -56,7 +57,7 @@ describe('Retry Page', function () { cy.openIframe(`app/ui/#/servicePlanning/RETRY_EDIT?serviceModelId=${SERVICE_MODEL_ID}&subscriberId=${SUBSCRIBER_ID}&serviceType=${SERVICE_TYPE}&serviceInstanceId=${SERVICE_INSTANCE_ID}&jobId=${JOB_ID}`); - cy.getElementByDataTestsId('node-69e09f68-8b63-4cc9-b9ff-860960b5db09-2017-488_PASQUALE-vPE 0').click(); + cy.getElementByDataTestsId('node-69e09f68-8b63-4cc9-b9ff-860960b5db09-2017-488_PASQUALE-vPE 0').eq(0).click(); cy.get('.failed-msg').should('have.length', 5); cy.get('.newIcon').should('have.length', 4); @@ -112,6 +113,7 @@ describe('Retry Page', function () { // Adding VFModule with isFailed. res.vnfs["2017-488_PASQUALE-vPE 0"].vfModules["2017488_pasqualevpe0..2017488PasqualeVpe..PASQUALE_base_vPE_BV..module-0"]["2017488_pasqualevpe0..2017488PasqualeVpe..PASQUALE_base_vPE_BV..module-0uvfot"].isFailed = true; res.vnfs["2017-488_PASQUALE-vPE 0"].vfModules["2017488_pasqualevpe0..2017488PasqualeVpe..PASQUALE_base_vPE_BV..module-0"]["2017488_pasqualevpe0..2017488PasqualeVpe..PASQUALE_base_vPE_BV..module-0uvfot"].action = 'Create'; + res.networks["ExtVL 0"].isFailed = true; cy.readFile('cypress/support/jsonBuilders/mocks/jsons/responceForFailedInstance.json').then((res) => { jsonBuilderAndMock.basicJson( @@ -133,7 +135,7 @@ describe('Retry Page', function () { cy.openIframe(`app/ui/#/servicePlanning/RETRY?serviceModelId=${SERVICE_MODEL_ID}&subscriberId=${SUBSCRIBER_ID}&serviceType=${SERVICE_TYPE}&serviceInstanceId=${SERVICE_INSTANCE_ID}&jobId=${JOB_ID}`); - cy.getElementByDataTestsId('node-69e09f68-8b63-4cc9-b9ff-860960b5db09-2017-488_PASQUALE-vPE 0').click(); + cy.getElementByDataTestsId('node-69e09f68-8b63-4cc9-b9ff-860960b5db09-2017-488_PASQUALE-vPE 0').eq(0).click(); cy.get('.failed-msg').should('have.length', 4); cy.get('.newIcon').should('have.length', 4); diff --git a/vid-webpack-master/cypress/integration/iFrames/sdncPreload.e2e.ts b/vid-webpack-master/cypress/integration/iFrames/sdncPreload.e2e.ts new file mode 100644 index 000000000..877506cad --- /dev/null +++ b/vid-webpack-master/cypress/integration/iFrames/sdncPreload.e2e.ts @@ -0,0 +1,92 @@ +describe('SDNC preload ', () => { + + beforeEach(() => { + cy.clearSessionStorage(); + cy.setTestApiParamToGR(); + cy.initAAIMock(); + cy.initGetAAISubDetails(); + cy.initVidMock(); + cy.initDrawingBoardUserPermission(); + cy.login(); + }); + + afterEach(() => { + cy.screenshot(); + }); + + it('feature toggle is on and SDNC is checked then SDNC preload file is enable : upload success' , () => { + mockPreloadResult(true, 200); + cy.loadDrawingBoardWithRecreateMode(templateWithVnfSetup); + cy.editNode("node-c09e4530-8fd8-418f-9483-2f57ce927b05-vprobe_nc_vnf0..VprobeNcVnf..FE_Add_On_Module_vlbagent_eph..module-1"); + checkUploadLinkLogic(); + + uploadFile().then(() => { + cy.get('.sdc-modal__content').should('contain', 'The pre-load file(s) have been uploaded successfully.'); + cy.getElementByDataTestsId('button-ok').click() + .getElementByDataTestsId('sdnc_pereload_upload_link').should('contain', 'Upload another') + }); + }); + + it('feature toggle is on and SDNC is checked then SDNC preload file is enable : upload fail', () => { + mockPreloadResult(false, 200); + cy.loadDrawingBoardWithRecreateMode(templateWithVnfSetup); + + cy.editNode("node-c09e4530-8fd8-418f-9483-2f57ce927b05-vprobe_nc_vnf0..VprobeNcVnf..FE_Add_On_Module_vlbagent_eph..module-1"); + checkUploadLinkLogic(); + + uploadFile().then(() => { + cy.get('.sdc-modal__content').should('contain', 'Failed to upload one or more of the files, please retry.'); + cy.getElementByDataTestsId('button-ok').click() + .getElementByDataTestsId('sdnc_pereload_upload_link').should('contain', 'Upload') + }); + }); +}); + + +let apiTestResources = '../vid-automation/src/test/resources/asyncInstantiation/'; + +const templateWithVnfSetup = { + serviceModelId: '6cfeeb18-c2b0-49df-987a-da47493c8e38', + instanceTemplateFile: apiTestResources + 'templates__instance_template.json', + instanceTemplateSetWithoutModifyFile: apiTestResources + 'templates__instance_from_template__set_without_modify1.json', + serviceModelFile: '../support/jsonBuilders/mocks/jsons/instantiationTemplates/templates__service_model.json', +}; + +function mockAsyncBulkResponse() { + cy.server().route({ + url: Cypress.config('baseUrl') + '/asyncInstantiation/bulk', + method: 'POST', + status: 200, + response: true, + }).as("expectedPostAsyncInstantiation"); +} + +function mockPreloadResult(response: boolean, status?: number) { + cy.server().route({ + url: Cypress.config('baseUrl') + '/preload', + method: 'POST', + status: status ? status : 200, + response: response, + }).as("preload"); +} + + +function uploadFile() { + // @ts-ignore + return new Promise((resolve) => { + const fileName = '../support/uploadFiles/sdncPreLoadFileExample.json'; + cy.fixture(fileName).then(fileContent => { + // @ts-ignore + cy.get('input[type=file]').eq(0).upload({fileContent, fileName, mimeType: 'application/json'}).then(() => { + resolve(); + }); + }) + }); +} + +function checkUploadLinkLogic() { + cy.getElementByDataTestsId('sdnc_pereload_upload_link').should('contain', 'Upload').should('not.have.class', 'disabled') + .getElementByDataTestsId('sdncPreLoad').click() + .getElementByDataTestsId('sdnc_pereload_upload_link').should('contain', 'Upload').should('have.class', 'disabled') + .getElementByDataTestsId('sdncPreLoad').click() +} diff --git a/vid-webpack-master/cypress/integration/iFrames/service.popup.e2e.ts b/vid-webpack-master/cypress/integration/iFrames/service.popup.e2e.ts index 4b27ad008..06f5a23b5 100644 --- a/vid-webpack-master/cypress/integration/iFrames/service.popup.e2e.ts +++ b/vid-webpack-master/cypress/integration/iFrames/service.popup.e2e.ts @@ -36,7 +36,7 @@ describe('Service popup', function () { res1.global.flags = {}; res1.global.flags["FLAG_2004_INSTANTIATION_TEMPLATES_POPUP"] = true; cy.setReduxState(<any>res1); - cy.openPopupIframe('/app/ui/#/servicePopup?serviceModelId=2f80c596-27e5-4ca9-b5bb-e03a7fd4c0fd&isCreate=true&hasTemplate=true'); + cy.openPopupIframe('/app/ui/#/servicePopup?serviceModelId=2f80c596-27e5-4ca9-b5bb-e03a7fd4c0fd&isCreate=true&isInstantiationTemplateExists=true'); cy.getElementByDataTestsId('templateButton').should('be.visible') }); }); @@ -95,13 +95,6 @@ describe('Service popup', function () { }); }); - it('when open service popup should show showPrevious button', () => { - cy.openPopupIframe('/app/ui/#/servicePopup?serviceModelId=2f80c596-27e5-4ca9-b5bb-e03a7fd4c0fd&isCreate=true'); - cy.getElementByDataTestsId('ShowPreviousInstancesButton').contains('Previous Instantiation').click(); - - }) - - }); }); diff --git a/vid-webpack-master/cypress/integration/iFrames/viewEditUpgradeVfModule.e2e.ts b/vid-webpack-master/cypress/integration/iFrames/viewEditUpgradeVfModule.e2e.ts index 09734472c..ad15ce383 100644 --- a/vid-webpack-master/cypress/integration/iFrames/viewEditUpgradeVfModule.e2e.ts +++ b/vid-webpack-master/cypress/integration/iFrames/viewEditUpgradeVfModule.e2e.ts @@ -16,6 +16,8 @@ export const initServicePlanning = function (viewOrEdit: string, customModelFile } cy.readFile('../vid-automation/src/test/resources/aaiGetInstanceTopology/ServiceTreeWithMultipleChildren_serviceModel.json').then((res) => { + res.service.instantiationType = "A-La-Carte"; + res.service.vidNotions.instantiationType = "ALaCarte"; jsonBuilderAndMock.basicJson( res, Cypress.config('baseUrl') + "/rest/models/services/6e59c5de-f052-46fa-aa7e-2fca9d674c44", @@ -133,7 +135,7 @@ describe('View Edit Page: Upgrade VFModule', function () { beforeEach(() => { cy.clearSessionStorage(); - cy.setTestApiParamToVNF(); + cy.setTestApiParamToGR(); cy.initVidMock(); cy.login(); }); @@ -200,8 +202,9 @@ describe('View Edit Page: Upgrade VFModule', function () { } function verifyMenuActionUpgradeDoesNotExist() { - cy.getElementByDataTestsId('node-undefined-dc229cd8-c132-4455-8517-5c1787c18b14-menu-btn').click() - .getElementByDataTestsId('context-menu-upgrade').should('not.exist'); + cy.getElementByDataTestsId('node-522159d5-d6e0-4c2a-aa44-5a542a12a830-vf_vgeraldine0..VfVgeraldine..vflorence_vlc..module-1-menu-btn').click().then(() => { + cy.getElementByDataTestsId('context-menu-upgrade').should('not.exist'); + }); } function setLatestVersionMockToEmptyResponse(serviceUuid: string) { diff --git a/vid-webpack-master/cypress/integration/iFrames/viewOnlyDrawingBoard.e2e.ts b/vid-webpack-master/cypress/integration/iFrames/viewOnlyDrawingBoard.e2e.ts index 60b2e123d..de5facf89 100644 --- a/vid-webpack-master/cypress/integration/iFrames/viewOnlyDrawingBoard.e2e.ts +++ b/vid-webpack-master/cypress/integration/iFrames/viewOnlyDrawingBoard.e2e.ts @@ -113,13 +113,13 @@ describe('View only drawing board', function () { cy.getElementByDataTestsId('node-2017488_pasqualevpe0..2017488PasqualeVpe..PASQUALE_vRE_BV..module-1').find(`[data-tests-id='node-type-indicator']`).should('have.text', 'M'); //testing right side - cy.getElementByDataTestsId('node-69e09f68-8b63-4cc9-b9ff-860960b5db09-2017-488_PASQUALE-vPE 0').find(`[data-tests-id='node-type-indicator']`).should('have.text', 'VNF'); - cy.getElementByDataTestsId('node-69e09f68-8b63-4cc9-b9ff-860960b5db09-2017-488_PASQUALE-vPE 0').click({force: true}); + cy.getElementByDataTestsId('node-69e09f68-8b63-4cc9-b9ff-860960b5db09-2017-488_PASQUALE-vPE 0').find(`[data-tests-id='node-type-indicator']`).should('have.length', 3).and('have.text', 'VNFVNFVNF'); + cy.getElementByDataTestsId('node-69e09f68-8b63-4cc9-b9ff-860960b5db09-2017-488_PASQUALE-vPE 0').eq(0).click({force: true}); cy.getElementByDataTestsId('node-f8360508-3f17-4414-a2ed-6bc71161e8db-2017488_pasqualevpe0..2017488PasqualeVpe..PASQUALE_base_vPE_BV..module-0').eq(0).find(`[data-tests-id='node-type-indicator']`).should('have.text', 'M'); //check vnf node tree sub header - cy.getElementByDataTestsId('node-69e09f68-8b63-4cc9-b9ff-860960b5db09-2017-488_PASQUALE-vPE 0').find("[data-tests-id='status-property-orchStatus']").should('have.text', 'Created'); - cy.getElementByDataTestsId('node-69e09f68-8b63-4cc9-b9ff-860960b5db09-2017-488_PASQUALE-vPE 0').find("[data-tests-id='status-property-provStatus']").should('have.text', ''); + cy.getElementByDataTestsId('node-69e09f68-8b63-4cc9-b9ff-860960b5db09-2017-488_PASQUALE-vPE 0').find("[data-tests-id='status-property-orchStatus']").eq(0).should('have.text', 'Created'); + cy.getElementByDataTestsId('node-69e09f68-8b63-4cc9-b9ff-860960b5db09-2017-488_PASQUALE-vPE 0').find("[data-tests-id='status-property-provStatus']").eq(0).should('have.text', ''); cy.getElementByDataTestsId('node-69e09f68-8b63-4cc9-b9ff-860960b5db09-2017-488_PASQUALE-vPE 0').find("[data-tests-id='status-property-inMaint']").should('not.exist'); //check vf Module node tree sub header diff --git a/vid-webpack-master/cypress/integration/iFrames/vnfGroups.e2e.ts b/vid-webpack-master/cypress/integration/iFrames/vnfGroups.e2e.ts index dc1b4bbf2..a0882f5bf 100644 --- a/vid-webpack-master/cypress/integration/iFrames/vnfGroups.e2e.ts +++ b/vid-webpack-master/cypress/integration/iFrames/vnfGroups.e2e.ts @@ -12,7 +12,7 @@ describe('Vnf Groups', function () { cy.initAAIMock(); cy.initVidMock(); cy.permissionVidMock(); - cy.setTestApiParamToVNF(); + cy.setTestApiParamToGR(); cy.login(); }); @@ -20,6 +20,42 @@ describe('Vnf Groups', function () { cy.screenshot(); }); + function updateObject(obj: any, key: string, val: any, value:any) { + return JSON.parse(JSON.stringify(obj) + .replace(new RegExp(`"${key}":"${val}"`), `"${key}":"${value}"`)) + } + + function buildReduxStateWithServiceRespone(res: any, serviceId:string, isEcompGeneratedNaming:boolean) :void { + res = updateObject(res, "ecomp_generated_naming", !isEcompGeneratedNaming, isEcompGeneratedNaming); + cy.window().then((win) => { + win.sessionStorage.setItem('reduxState', JSON.stringify({ + "global": { + "name": null + }, + "service": { + "serviceHierarchy": { + [serviceId] : res + }, + "serviceInstance": { + [serviceId]: { + "modelInfo" : { + "modelVersionId" : serviceId + }, + "existingVNFCounterMap": {}, + "existingVnfGroupCounterMap": {}, + "existingNetworksCounterMap": {}, + "vnfs": {}, + "vnfGroups": {}, + "isEcompGeneratedNaming": isEcompGeneratedNaming, + "existingNames": {}, + "vidNotions": res.service.vidNotions + } + } + } + })); + }); + } + describe('Vnf Group model basic view', function () { it('Vnf group open new view edit', function () { @@ -36,7 +72,7 @@ describe('Vnf Groups', function () { "ServiceWithVnfGroup", ); - cy.buildReduxStateWithServiceRespone(res, serviceId, false); + buildReduxStateWithServiceRespone(res, serviceId, false); cy.openIframe('app/ui/#/servicePlanning?serviceModelId=' + serviceId); cy.getElementByDataTestsId('node-' + groupName).find(`[data-tests-id='node-type-indicator']`).contains('G'); cy.getElementByDataTestsId('node-' + groupName).contains('' + groupName); diff --git a/vid-webpack-master/cypress/integration/iFrames/vrf.e2e.ts b/vid-webpack-master/cypress/integration/iFrames/vrf.e2e.ts index 6700ff425..529d96a3b 100644 --- a/vid-webpack-master/cypress/integration/iFrames/vrf.e2e.ts +++ b/vid-webpack-master/cypress/integration/iFrames/vrf.e2e.ts @@ -480,7 +480,7 @@ describe('Drawing board : VRF', function () { "rollbackOnFailure": "true", "aicZoneName": null, "owningEntityName": "WayneHolland", - "testApi": "VNF_API", + "testApi": "GR_API", "modelInfo": { "modelInvariantId": "dfc2c44c-2429-44ca-ae26-1e6dc1f207fb", "modelVersionId": "f028b2e2-7080-4b13-91b2-94944d4c42d8", diff --git a/vid-webpack-master/cypress/integration/shared/spinner.e2e.ts b/vid-webpack-master/cypress/integration/shared/spinner.e2e.ts index 51e084b32..a64644087 100644 --- a/vid-webpack-master/cypress/integration/shared/spinner.e2e.ts +++ b/vid-webpack-master/cypress/integration/shared/spinner.e2e.ts @@ -32,7 +32,7 @@ describe('Spinner', function () { "error 500 asyncInstantiation"); cy.openIframe('app/ui/#/instantiationStatus'); - cy.get('.sdc-loader') + cy.get('.custom-loader') .and('be.visible'); }); diff --git a/vid-webpack-master/cypress/pipeline/group1.txt b/vid-webpack-master/cypress/pipeline/group1.txt index 217efa122..a9b5aef46 100644 --- a/vid-webpack-master/cypress/pipeline/group1.txt +++ b/vid-webpack-master/cypress/pipeline/group1.txt @@ -1,11 +1,10 @@ +cypress/integration/iFrames/ala-carte.e2e.ts cypress/integration/iFrames/auditInfo.modal.e2e.ts cypress/integration/iFrames/browse-sdc.e2e.ts +cypress/integration/iFrames/changeManagement.e2e.ts cypress/integration/iFrames/collectionResource.e2e.ts +cypress/integration/iFrames/commitDialog.e2e.ts cypress/integration/iFrames/drawingBoard.e2e.ts +cypress/integration/iFrames/instantiation-templates.e2e.ts +cypress/integration/iFrames/instantiation.templates.modal.e2e.ts cypress/integration/iFrames/instantiationStatus.e2e.ts -cypress/integration/iFrames/network.popup.e2e.ts -cypress/integration/iFrames/permission.e2e.ts -cypress/integration/iFrames/pnf.e2e.ts -cypress/integration/iFrames/resume.e2e.ts -cypress/integration/iFrames/retry.e2e.ts -cypress/integration/iFrames/viewEdit.e2e.ts diff --git a/vid-webpack-master/cypress/pipeline/run_group2.sh b/vid-webpack-master/cypress/pipeline/run_group2.sh deleted file mode 100644 index 43cfbc63f..000000000 --- a/vid-webpack-master/cypress/pipeline/run_group2.sh +++ /dev/null @@ -1,17 +0,0 @@ -#!/usr/bin/env bash - -. $HOME/.nvm/nvm.sh - -set -x - -CYPRESS_HOME_DIR=$1 -TESTS_GROUP_FILE_1=cypress/pipeline/group1.txt -TESTS_GROUP_FILE=cypress/pipeline/group2.generated.txt - -cd ${CYPRESS_HOME_DIR} - -# make group2 by "negating" group1.txt -ls -1 cypress/integration/*/*.e2e.ts | comm -3 - ${TESTS_GROUP_FILE_1} > ${TESTS_GROUP_FILE} - -cat ${TESTS_GROUP_FILE} -npm run cypress:headless --max-old-space-size=4096 -- --spec=$(cat ${TESTS_GROUP_FILE} | tr '\n' ',') diff --git a/vid-webpack-master/cypress/pipeline/run_groupRemain.sh b/vid-webpack-master/cypress/pipeline/run_groupRemain.sh new file mode 100644 index 000000000..51c30411d --- /dev/null +++ b/vid-webpack-master/cypress/pipeline/run_groupRemain.sh @@ -0,0 +1,17 @@ +#!/usr/bin/env bash + +. $HOME/.nvm/nvm.sh + +set -x + +CYPRESS_HOME_DIR=$1 +REMAIN_TESTS_FILE=cypress/pipeline/remain.generated.txt +ALL_TESTS_IN_GROUPS_FILE=cypress/pipeline/all_tests.txt + +cd ${CYPRESS_HOME_DIR} +cat cypress/pipeline/group?.txt | sort > ${ALL_TESTS_IN_GROUPS_FILE} +# make group2 by "negating" group1.txt +ls -1 cypress/integration/*/*.e2e.ts | comm -3 - ${ALL_TESTS_IN_GROUPS_FILE} > ${REMAIN_TESTS_FILE} + +cat ${REMAIN_TESTS_FILE} +npm run cypress:headless --max-old-space-size=4096 -- --spec=$(cat ${REMAIN_TESTS_FILE} | tr '\n' ',') diff --git a/vid-webpack-master/cypress/support/application/application.session.actions.ts b/vid-webpack-master/cypress/support/application/application.session.actions.ts index c054b2640..9126ae1a4 100644 --- a/vid-webpack-master/cypress/support/application/application.session.actions.ts +++ b/vid-webpack-master/cypress/support/application/application.session.actions.ts @@ -5,7 +5,6 @@ declare namespace Cypress { clearSessionStorage: typeof clearSessionStorage; setTestApiParamToGR: typeof setTestApiParamToGR; setTestApiParamToVNF: typeof setTestApiParamToVNF; - buildReduxStateWithServiceRespone: typeof buildReduxStateWithServiceRespone; } } @@ -44,42 +43,8 @@ function setTestApiParamToVNF() : void { }); } -function updateObject(obj: any, key: string, val: any, value:any) { - return JSON.parse(JSON.stringify(obj) - .replace(new RegExp(`"${key}":"${val}"`), `"${key}":"${value}"`)) -} - -function buildReduxStateWithServiceRespone(res: any, serviceId:string, isEcompGeneratedNaming:boolean) :void { - res = updateObject(res, "ecomp_generated_naming", !isEcompGeneratedNaming, isEcompGeneratedNaming); - cy.window().then((win) => { - win.sessionStorage.setItem('reduxState', JSON.stringify({ - "global": { - "name": null - }, - "service": { - "serviceHierarchy": { - [serviceId] : res - }, - "serviceInstance": { - [serviceId]: { - "existingVNFCounterMap": {}, - "existingVnfGroupCounterMap": {}, - "existingNetworksCounterMap": {}, - "vnfs": {}, - "vnfGroups": {}, - "isEcompGeneratedNaming": isEcompGeneratedNaming, - "existingNames": {}, - "vidNotions": res.service.vidNotions - } - } - } - })); - }); -} - Cypress.Commands.add('setReduxState', setReduxState); Cypress.Commands.add('getReduxState', getReduxState); Cypress.Commands.add('clearSessionStorage', clearSessionStorage); Cypress.Commands.add('setTestApiParamToGR', setTestApiParamToGR); Cypress.Commands.add('setTestApiParamToVNF',setTestApiParamToVNF); -Cypress.Commands.add('buildReduxStateWithServiceRespone', buildReduxStateWithServiceRespone); diff --git a/vid-webpack-master/cypress/support/index.js b/vid-webpack-master/cypress/support/index.js index 5062f5100..d9e64c0f5 100644 --- a/vid-webpack-master/cypress/support/index.js +++ b/vid-webpack-master/cypress/support/index.js @@ -15,6 +15,7 @@ // Import commands.js using ES2015 syntax: import './commands'; +import 'cypress-file-upload'; import './steps/login.step'; import './steps/fill.service.popup.step'; import './steps/fill.vnf.popup.step'; @@ -36,12 +37,14 @@ import './steps/drawingBoard/drawingBoardModel.steps'; import './steps/drawingBoard/drawingBoardTree.steps'; import './steps/genericForm/genericFormAction.steps'; import './steps/genericForm/popupViewport.step'; -import './steps/drawingBoard/drawingBoardHeader.steps'; import './steps/drawingBoard/general.steps'; +import './steps/drawingBoard/drawingBoardRecreate.steps'; +import './steps/drawingBoard/drawingBoardHeader.steps'; import './steps/general/clickOutside.step'; import './steps/drawingBoard/drawingBoardComponentInfo.steps'; import './steps/genericForm/checkPopover.step'; + // Alternatively you can use CommonJS syntax: // require('./commands') diff --git a/vid-webpack-master/cypress/support/jsonBuilders/mocks/aai.mock.ts b/vid-webpack-master/cypress/support/jsonBuilders/mocks/aai.mock.ts index ae60361c2..807a3bcda 100644 --- a/vid-webpack-master/cypress/support/jsonBuilders/mocks/aai.mock.ts +++ b/vid-webpack-master/cypress/support/jsonBuilders/mocks/aai.mock.ts @@ -9,6 +9,7 @@ declare namespace Cypress { initActiveVPNs : typeof initActiveVPNs; initGetAAISubDetails : typeof initGetAAISubDetails; initAAIServices: typeof initAAIServices; + initGetModelByServiceType: typeof initGetModelByServiceType; } } @@ -48,6 +49,19 @@ function initGetAAISubDetails(response? : JSON) : void { }); } +function initGetModelByServiceType(response? : JSON) : void { + cy.readFile('cypress/support/jsonBuilders/mocks/jsons/aaiSubDetails.json').then((res) => { + cy.server() + .route({ + method: 'GET', + status: 200, + url: Cypress.config('baseUrl') + "/aai_get_models_by_service_type/**", + response: response ? response : res + }).as('aai-sub-details') + }); +} + + function initAlaCarteService(response? : JSON) : void { cy.readFile('cypress/support/jsonBuilders/mocks/jsons/a-la-carteService.json').then((res) => { cy.server() @@ -156,6 +170,7 @@ Cypress.Commands.add('initSearchVNFMemebers', initSearchVNFMemebers); Cypress.Commands.add('initActiveNetworks', initActiveNetworks); Cypress.Commands.add('initActiveVPNs', initActiveVPNs); Cypress.Commands.add('initAAIServices', initAAIServices); +Cypress.Commands.add('initGetModelByServiceType', initGetModelByServiceType); diff --git a/vid-webpack-master/cypress/support/jsonBuilders/mocks/jsons/aaiGetModelsByServiceType.json b/vid-webpack-master/cypress/support/jsonBuilders/mocks/jsons/aaiGetModelsByServiceType.json new file mode 100644 index 000000000..2540650ce --- /dev/null +++ b/vid-webpack-master/cypress/support/jsonBuilders/mocks/jsons/aaiGetModelsByServiceType.json @@ -0,0 +1,58 @@ +{ + "inventory-response-item": [ + { + "service-subscription": { + "service-type": "TYLER SILVIA", + "resource-version": "1494001841964" + }, + "extra-properties": {}, + "inventory-response-items": { + "inventory-response-item":[ + { + "model-name": "RG_11-18_vccf_srvc", + "service-instance": { + "service-instance-id": "b9769e8f-70aa-4b05-8988-64044aa63498", + "service-instance-name": "TestCharlie", + "model-invariant-id": "4af418a9-c2f5-4fae-a577-b69d6341eee8", + "model-version-id": "745d1bf1-9ed1-413f-8111-f1e984ad63fb", + "resource-version": "1494002070115" + }, + "extra-properties": { + "extra-property": [ + { + "property-name": "model-ver.model-description", + "property-value": "Service for vccf" + }, + { + "property-name": "model-ver.model-version-id", + "property-value": "745d1bf1-9ed1-413f-8111-f1e984ad63fb" + }, + { + "property-name": "model-ver.model-name", + "property-value": "RG_11-18_vccf_srvc" + }, + { + "property-name": "model.model-type", + "property-value": "service" + }, + { + "property-name": "model.model-invariant-id", + "property-value": "4af418a9-c2f5-4fae-a577-b69d6341eee8" + }, + { + "property-name": "model.model-description" + }, + { + "property-name": "model-ver.model-version", + "property-value": "1.0" + } + ] + } + } + ] + } + } + ] +} + + diff --git a/vid-webpack-master/cypress/support/jsonBuilders/mocks/jsons/defect710619/expectedResumeWithVGResults.json b/vid-webpack-master/cypress/support/jsonBuilders/mocks/jsons/defect710619/expectedResumeWithVGResults.json index d10c2bd32..d0c734bc2 100644 --- a/vid-webpack-master/cypress/support/jsonBuilders/mocks/jsons/defect710619/expectedResumeWithVGResults.json +++ b/vid-webpack-master/cypress/support/jsonBuilders/mocks/jsons/defect710619/expectedResumeWithVGResults.json @@ -17,7 +17,7 @@ }, "requestParameters": { "userParams": [], - "testApi": "VNF_API", + "testApi": "GR_API", "usePreload": false }, "cloudConfiguration": { diff --git a/vid-webpack-master/cypress/support/jsonBuilders/mocks/jsons/flags.cypress.json b/vid-webpack-master/cypress/support/jsonBuilders/mocks/jsons/flags.cypress.json index 531bad3b4..d9602d139 100644 --- a/vid-webpack-master/cypress/support/jsonBuilders/mocks/jsons/flags.cypress.json +++ b/vid-webpack-master/cypress/support/jsonBuilders/mocks/jsons/flags.cypress.json @@ -19,9 +19,10 @@ "FLAG_1911_INSTANTIATION_ORDER_BUTTON_IN_ASYNC_ALACARTE": false, "FLAG_2002_VNF_PLATFORM_MULTI_SELECT" : true, "FLAG_2002_VFM_UPGRADE_ADDITIONAL_OPTIONS": true, - "FLAG_2004_TEMP_BUTTON_TO_INSTANTIATION_STATUS_FILTER": true, "FLAG_2004_INSTANTIATION_STATUS_FILTER": true, "FLAG_2004_INSTANTIATION_TEMPLATES_POPUP" : false, "FLAG_2002_UNLIMITED_MAX" : true, - "FLAG_2004_CREATE_ANOTHER_INSTANCE_FROM_TEMPLATE": true + "FLAG_2004_CREATE_ANOTHER_INSTANCE_FROM_TEMPLATE": true, + "FLAG_2006_VFM_SDNC_PRELOAD_FILES" : true, + "FLAG_2006_VFMODULE_TAKES_TENANT_AND_REGION_FROM_VNF": true } diff --git a/vid-webpack-master/cypress/support/jsonBuilders/mocks/jsons/vnfGroupBasicServiceInstance.json b/vid-webpack-master/cypress/support/jsonBuilders/mocks/jsons/vnfGroupBasicServiceInstance.json index bc37b6bed..847ebf0d5 100644 --- a/vid-webpack-master/cypress/support/jsonBuilders/mocks/jsons/vnfGroupBasicServiceInstance.json +++ b/vid-webpack-master/cypress/support/jsonBuilders/mocks/jsons/vnfGroupBasicServiceInstance.json @@ -32,7 +32,7 @@ "subscriberName":"SILVIA ROBBINS", "owningEntityName":"WayneHolland", "rollbackOnFailure":"true", - "testApi": "VNF_API", + "testApi": "GR_API", "isALaCarte":true, "action": "Create" } diff --git a/vid-webpack-master/cypress/support/steps/drawingBoard/drawingBoardRecreate.steps.ts b/vid-webpack-master/cypress/support/steps/drawingBoard/drawingBoardRecreate.steps.ts new file mode 100644 index 000000000..16f418bc9 --- /dev/null +++ b/vid-webpack-master/cypress/support/steps/drawingBoard/drawingBoardRecreate.steps.ts @@ -0,0 +1,52 @@ +declare namespace Cypress { + interface Chainable { + loadDrawingBoardWithRecreateMode: typeof loadDrawingBoardWithRecreateMode , + loadDrawingBoardWithRecreateModeNetwork: typeof loadDrawingBoardWithRecreateModeNetwork, + loadDrawingBoardWithRecreateModeInternal: typeof loadDrawingBoardWithRecreateModeInternal + } +} + +function loadDrawingBoardWithRecreateMode(templateWithVnfSetup : any) { + cy.loadDrawingBoardWithRecreateModeInternal( + '../../' + templateWithVnfSetup.instanceTemplateFile, + templateWithVnfSetup.serviceModelId, + templateWithVnfSetup.serviceModelFile); +} + +function loadDrawingBoardWithRecreateModeNetwork(templateWithNetworkSetup : any) { + cy.loadDrawingBoardWithRecreateModeInternal( + '../../' + templateWithNetworkSetup.instanceTemplateFile, + templateWithNetworkSetup.serviceModelId, + templateWithNetworkSetup.serviceModelFile); +} + +function loadDrawingBoardWithRecreateModeInternal(instanceTemplate: string, serviceModelIdToLoad: any, serviceModel: string) { + const templateUuid = "46390edd-7100-46b2-9f18-419bd24fb60b"; + + const drawingBoardAction = `RECREATE`; + const templateTopologyEndpoint = "templateTopology"; + cy.route(`**/rest/models/services/${serviceModelIdToLoad}`, + 'fixture:' + serviceModel) + .as('serviceModel'); + + cy.route(`**/instantiationTemplates/${templateTopologyEndpoint}/${templateUuid}`, + 'fixture:' + instanceTemplate) + .as('templateTopology'); + + // When... + + cy.openIframe(`app/ui/#/servicePlanning/${drawingBoardAction}` + + `?jobId=${templateUuid}` + + `&serviceModelId=${serviceModelIdToLoad}`); + + cy.wait('@serviceModel'); + cy.wait('@templateTopology'); +} + + + + + +Cypress.Commands.add('loadDrawingBoardWithRecreateMode', loadDrawingBoardWithRecreateMode); +Cypress.Commands.add('loadDrawingBoardWithRecreateModeNetwork', loadDrawingBoardWithRecreateModeNetwork); +Cypress.Commands.add('loadDrawingBoardWithRecreateModeInternal', loadDrawingBoardWithRecreateModeInternal); diff --git a/vid-webpack-master/cypress/support/steps/drawingBoard/general.steps.ts b/vid-webpack-master/cypress/support/steps/drawingBoard/general.steps.ts index 8d2bb8a24..797fff095 100644 --- a/vid-webpack-master/cypress/support/steps/drawingBoard/general.steps.ts +++ b/vid-webpack-master/cypress/support/steps/drawingBoard/general.steps.ts @@ -1,7 +1,10 @@ declare namespace Cypress { interface Chainable { updateServiceShouldNotOverrideChild: typeof updateServiceShouldNotOverrideChild - openServiceContextMenu: typeof openServiceContextMenu + openServiceContextMenu: typeof openServiceContextMenu, + drawingBoardTreeClickOnContextMenuOptionByName : typeof drawingBoardTreeClickOnContextMenuOptionByName, + nodeAction: typeof nodeAction, + editNode : typeof editNode } } @@ -18,7 +21,6 @@ function updateServiceShouldNotOverrideChild() : void { }); }); }); - } @@ -26,5 +28,36 @@ function openServiceContextMenu() : Chainable<any> { return cy.getElementByDataTestsId('openMenuBtn').click({force: true}); } +function nodeAction(dataTestId: string, action: string, index ?: number) { + return cy.drawingBoardTreeOpenContextMenuByElementDataTestId(dataTestId, index) + .drawingBoardTreeClickOnContextMenuOptionByName(action) +} + +function drawingBoardTreeClickOnContextMenuOptionByName(optionName : string) : Chainable<any> { + switch (optionName) { + case 'Duplicate': + return cy.getElementByDataTestsId('context-menu-duplicate').click({force : true}); + case 'Remove': + return cy.getElementByDataTestsId('context-menu-remove').click({force : true}); + case 'Edit': + return cy.getElementByDataTestsId('context-menu-edit').click({force : true}); + case 'Delete': + return cy.getElementByDataTestsId('context-menu-delete').trigger('mouseover').click(); + case 'Upgrade': + return cy.getElementByDataTestsId('context-menu-upgrade').trigger('mouseover').click(); + case 'Undo Upgrade': + return cy.getElementByDataTestsId('context-menu-undoUpgrade').trigger('mouseover').click(); + default: + return cy.getElementByDataTestsId('context-menu-duplicate').click({force : true}); + } +} + +function editNode(dataTestId: string, index ?: number) { + return cy.nodeAction(dataTestId, 'Edit', index); +} + Cypress.Commands.add('updateServiceShouldNotOverrideChild', updateServiceShouldNotOverrideChild); Cypress.Commands.add('openServiceContextMenu', openServiceContextMenu); +Cypress.Commands.add('drawingBoardTreeClickOnContextMenuOptionByName', drawingBoardTreeClickOnContextMenuOptionByName); +Cypress.Commands.add('nodeAction', nodeAction); +Cypress.Commands.add('editNode', editNode); diff --git a/vid-webpack-master/cypress/support/steps/fill.vfModule.step.ts b/vid-webpack-master/cypress/support/steps/fill.vfModule.step.ts index b87e773f9..cfb8a050a 100644 --- a/vid-webpack-master/cypress/support/steps/fill.vfModule.step.ts +++ b/vid-webpack-master/cypress/support/steps/fill.vfModule.step.ts @@ -34,7 +34,7 @@ function addMacroVfModule(vnfName: string, vfModuleName: string, instanceName: s } function addALaCarteVfModule(vnfName: string, vfModuleName: string, instanceName: string, lcpRegion: string, legacyRegion: string, - tenant: string, rollback: boolean, sdncPreLoad: boolean, deleteVgName: boolean): Chainable<any> { + tenant: string, rollback: boolean, sdncPreLoad: boolean, deleteVgName: boolean, flag: 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(() => { @@ -42,11 +42,13 @@ function addALaCarteVfModule(vnfName: string, vfModuleName: string, instanceName cy.getElementByDataTestsId('volumeGroupName').clear(); } }).then(() => { - cy.selectDropdownOptionByText('lcpRegion', lcpRegion); - if (legacyRegion) { - cy.typeToInput("lcpRegionText", legacyRegion); + if(!flag) { + cy.selectDropdownOptionByText('lcpRegion', lcpRegion); + if (legacyRegion) { + cy.typeToInput("lcpRegionText", legacyRegion); + } + cy.selectDropdownOptionByText('tenant', tenant); } - cy.selectDropdownOptionByText('tenant', tenant); cy.selectDropdownOptionByText('rollback', String(rollback)); if (sdncPreLoad) { cy.getElementByDataTestsId('sdncPreLoad').check(); diff --git a/vid-webpack-master/cypress/support/uploadFiles/sdncPreLoadFileExample.json b/vid-webpack-master/cypress/support/uploadFiles/sdncPreLoadFileExample.json new file mode 100644 index 000000000..c317c4183 --- /dev/null +++ b/vid-webpack-master/cypress/support/uploadFiles/sdncPreLoadFileExample.json @@ -0,0 +1,3 @@ +{ + "comment" : "invalid file, just for upload mock file" +} |