diff options
author | Yoav Schneiderman <yoav.schneiderman@intl.att.com> | 2020-01-22 11:07:00 +0200 |
---|---|---|
committer | Yoav Schneiderman <yoav.schneiderman@intl.att.com> | 2020-01-27 17:36:26 +0200 |
commit | 3f216a5ba38d70c193256f05c634093da9599984 (patch) | |
tree | 29bb202d705bf1426d3cda3c4ac98c59b84fb0d7 /vid-webpack-master/cypress | |
parent | 212806afa99581acd7618add8be958d945690867 (diff) |
When feature toggle is active then SDNC preload files is enable.
Issue-ID: VID-752
Change-Id: I96ef914bfe37d82da20085227b930523fcdba8fc
Signed-off-by: Yoav Schneiderman <yoav.schneiderman@intl.att.com>
Diffstat (limited to 'vid-webpack-master/cypress')
7 files changed, 213 insertions, 73 deletions
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 d1bee9c70..f7419ef33 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,7 +34,7 @@ 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'); @@ -47,7 +47,7 @@ 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() @@ -66,10 +66,10 @@ describe('Drawing Board: Instantiation Templates', function () { // check instance name not change if empty - editNode('node-21ae311e-432f-4c54-b855-446d0b8ded72-vProbe_NC_VNF 0', 0) + cy.editNode('node-21ae311e-432f-4c54-b855-446d0b8ded72-vProbe_NC_VNF 0', 0) .clearInput('instanceName'); cy.getElementByDataTestsId('form-set').click({force: true}).then((done) => { - editNode('node-21ae311e-432f-4c54-b855-446d0b8ded72-vProbe_NC_VNF 0', 0) + cy.editNode('node-21ae311e-432f-4c54-b855-446d0b8ded72-vProbe_NC_VNF 0', 0) .getElementByDataTestsId('instanceName').should('be.empty') }); }); @@ -77,8 +77,8 @@ describe('Drawing Board: Instantiation Templates', function () { 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() @@ -89,10 +89,10 @@ describe('Drawing Board: Instantiation Templates', function () { 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') @@ -102,14 +102,14 @@ 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') @@ -126,7 +126,7 @@ describe('Drawing Board: Instantiation Templates', function () { 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() @@ -140,7 +140,7 @@ 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"; @@ -153,7 +153,7 @@ describe('Drawing Board: Instantiation Templates', function () { cy.drawingBoardPressAddButtonByElementName(`node-${module1CustomizationId}`) .click({force: true}); - editNode(`node-c09e4530-8fd8-418f-9483-2f57ce927b05-${module1CustomizationId}`, 1); + cy.editNode(`node-c09e4530-8fd8-418f-9483-2f57ce927b05-${module1CustomizationId}`, 1); cy.clearInput("instanceName"); cy.typeToInput("instanceName", newVfModuleName); cy.selectDropdownOptionByText('lcpRegion', 'hvf6'); @@ -196,8 +196,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", @@ -217,7 +217,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(); @@ -229,7 +229,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"); @@ -237,7 +237,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(); } @@ -266,7 +266,7 @@ describe('Drawing Board: Instantiation Templates', function () { 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'); @@ -276,9 +276,9 @@ describe('Drawing Board: Instantiation Templates', function () { 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", ]; @@ -295,7 +295,7 @@ 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') @@ -341,58 +341,14 @@ const vnfPath2 = [ "vnfs", "vProbe_NC_VNF 0_1" ]; -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'); -} - -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() } @@ -465,6 +421,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/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/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/jsons/flags.cypress.json b/vid-webpack-master/cypress/support/jsonBuilders/mocks/jsons/flags.cypress.json index bd9fb9025..e2b9d8ad7 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 @@ -23,5 +23,5 @@ "FLAG_2004_INSTANTIATION_TEMPLATES_POPUP" : false, "FLAG_2002_UNLIMITED_MAX" : true, "FLAG_2004_CREATE_ANOTHER_INSTANCE_FROM_TEMPLATE": true, - "FLAG_2006_USER_PERMISSIONS_BY_OWNING_ENTITY": true + "FLAG_2006_VFM_SDNC_PRELOAD_FILES" : true } 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/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" +} |