diff options
author | Ittay Stern <ittay.stern@att.com> | 2020-01-27 19:10:41 +0000 |
---|---|---|
committer | Gerrit Code Review <gerrit@onap.org> | 2020-01-27 19:10:41 +0000 |
commit | ae5156453ebf0c8c81c5aa2f791bb527dbf344ad (patch) | |
tree | 595da72e11ad39a2fbea2e72a0abf16c9efd1b90 /vid-webpack-master/cypress/support/steps/drawingBoard | |
parent | 79a8f61035752620b50a0fb42d98361f21962cd9 (diff) | |
parent | 3f216a5ba38d70c193256f05c634093da9599984 (diff) |
Merge "When feature toggle is active then SDNC preload files is enable."
Diffstat (limited to 'vid-webpack-master/cypress/support/steps/drawingBoard')
-rw-r--r-- | vid-webpack-master/cypress/support/steps/drawingBoard/drawingBoardRecreate.steps.ts | 52 | ||||
-rw-r--r-- | vid-webpack-master/cypress/support/steps/drawingBoard/general.steps.ts | 37 |
2 files changed, 87 insertions, 2 deletions
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); |