diff options
Diffstat (limited to 'vid-webpack-master/cypress/support/steps')
15 files changed, 306 insertions, 1 deletions
diff --git a/vid-webpack-master/cypress/support/steps/drawingBoard/drawingBoardComponentInfo.steps.ts b/vid-webpack-master/cypress/support/steps/drawingBoard/drawingBoardComponentInfo.steps.ts new file mode 100644 index 000000000..2033f060c --- /dev/null +++ b/vid-webpack-master/cypress/support/steps/drawingBoard/drawingBoardComponentInfo.steps.ts @@ -0,0 +1,22 @@ +declare namespace Cypress { + interface Chainable { + assertComponentInfoTitleLabelsAndValues: typeof assertComponentInfoTitleLabelsAndValues + } +} + + + +function assertComponentInfoTitleLabelsAndValues(expectedTitle: string, labelsAndValues: string[][]) : void{ + cy.getElementByDataTestsId('component-info-section-title').should('have.text', expectedTitle); + labelsAndValues.forEach((tuple: string[], index: number, array: string[][]) => { + let label = tuple[0]; + let value = tuple[1]; + cy.getElementByDataTestsId('model-item-label-' + label).should('have.text', label); + cy.getElementByDataTestsId('model-item-value-' + label).should('have.text', value); + }); +} + + + + +Cypress.Commands.add('assertComponentInfoTitleLabelsAndValues', assertComponentInfoTitleLabelsAndValues); diff --git a/vid-webpack-master/cypress/support/steps/drawingBoard/drawingBoardModel.steps.ts b/vid-webpack-master/cypress/support/steps/drawingBoard/drawingBoardModel.steps.ts new file mode 100644 index 000000000..b2b48b268 --- /dev/null +++ b/vid-webpack-master/cypress/support/steps/drawingBoard/drawingBoardModel.steps.ts @@ -0,0 +1,17 @@ +declare namespace Cypress { + interface Chainable { + drawingBoardPressAddButtonByElementName: typeof drawingBoardPressAddButtonByElementName, + drawingBoardNumberOfExistingElementsShouldContains: typeof drawingBoardNumberOfExistingElementsShouldContains + } +} + +function drawingBoardPressAddButtonByElementName(elementName : string) : Chainable<any> { + return cy.getElementByDataTestsId(elementName + '-add-btn'); +} + +function drawingBoardNumberOfExistingElementsShouldContains(expectedElements : number) : void { + cy.getElementByDataTestsId('numberButton').contains(expectedElements); +} + +Cypress.Commands.add('drawingBoardPressAddButtonByElementName', drawingBoardPressAddButtonByElementName); +Cypress.Commands.add('drawingBoardNumberOfExistingElementsShouldContains', drawingBoardNumberOfExistingElementsShouldContains); diff --git a/vid-webpack-master/cypress/support/steps/drawingBoard/drawingBoardTree.steps.ts b/vid-webpack-master/cypress/support/steps/drawingBoard/drawingBoardTree.steps.ts new file mode 100644 index 000000000..0150b44aa --- /dev/null +++ b/vid-webpack-master/cypress/support/steps/drawingBoard/drawingBoardTree.steps.ts @@ -0,0 +1,27 @@ +declare namespace Cypress { + interface Chainable { + drawingBoardTreeOpenContextMenuByElementDataTestId: typeof drawingBoardTreeOpenContextMenuByElementDataTestId, + drawingBoardTreeClickOnContextMenuOptionByName: typeof drawingBoardTreeClickOnContextMenuOptionByName + } +} + +function drawingBoardTreeOpenContextMenuByElementDataTestId(dataTestId : string, index ?: number) : Chainable<any> { + return cy.getElementByDataTestsId(dataTestId + "-menu-btn").eq(index != null ? index : 0).click({force: true}); +} + +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}); + default: + return cy.getElementByDataTestsId('context-menu-duplicate').click({force : true}); + } +} + + +Cypress.Commands.add('drawingBoardTreeOpenContextMenuByElementDataTestId', drawingBoardTreeOpenContextMenuByElementDataTestId); +Cypress.Commands.add('drawingBoardTreeClickOnContextMenuOptionByName', drawingBoardTreeClickOnContextMenuOptionByName); diff --git a/vid-webpack-master/cypress/support/steps/drawingBoard/general.steps.ts b/vid-webpack-master/cypress/support/steps/drawingBoard/general.steps.ts new file mode 100644 index 000000000..5444971b7 --- /dev/null +++ b/vid-webpack-master/cypress/support/steps/drawingBoard/general.steps.ts @@ -0,0 +1,33 @@ +declare namespace Cypress { + interface Chainable { + updateServiceShouldNotOverrideChild: typeof updateServiceShouldNotOverrideChild + openServiceContextMenu: typeof openServiceContextMenu + } +} + +function updateServiceShouldNotOverrideChild() : void { + cy.getElementByDataTestsId('drawing-board-tree').find('.node-content-wrapper').then((elements)=>{ + let numberOfExistingElements = elements.length; + cy.openServiceContextMenu().then(() =>{ + cy.getElementByDataTestsId('context-menu-header-edit-item').click({force : true}).then(()=>{ + cy.genericFormSubmitForm().then(()=>{ + cy.getElementByDataTestsId('drawing-board-tree').find('.node-content-wrapper').then((afterUpdateServiceElements)=>{ + chai.expect(numberOfExistingElements).equal(afterUpdateServiceElements.length); + }); + }); + }); + }); + }); + +} + + +function openServiceContextMenu() : Chainable<any> { + return cy.getElementByDataTestsId('openMenuBtn').click({force: true}); +} + + + + +Cypress.Commands.add('updateServiceShouldNotOverrideChild', updateServiceShouldNotOverrideChild); +Cypress.Commands.add('openServiceContextMenu', openServiceContextMenu); diff --git a/vid-webpack-master/cypress/support/steps/fill.network.step.ts b/vid-webpack-master/cypress/support/steps/fill.network.step.ts new file mode 100644 index 000000000..c981ac4b2 --- /dev/null +++ b/vid-webpack-master/cypress/support/steps/fill.network.step.ts @@ -0,0 +1,19 @@ +// add new command to the existing Cypress interface +declare namespace Cypress { + interface Chainable { + fillNetworkPopup: typeof fillNetworkPopup, + } +} + +function fillNetworkPopup(): Chainable<any> { + cy.selectDropdownOptionByText('productFamily', 'Emanuel'); + cy.selectDropdownOptionByText('lcpRegion', 'hvf6'); + cy.selectDropdownOptionByText('tenant', 'AIN Web Tool-15-D-STTest2'); + cy.selectDropdownOptionByText('lineOfBusiness', 'zzz1'); + cy.selectDropdownOptionByText('platform', 'xxx1'); + return cy.getElementByDataTestsId('form-set').click({force : true}).then((done)=>{ + return done; + }); +} + +Cypress.Commands.add('fillNetworkPopup', fillNetworkPopup); diff --git a/vid-webpack-master/cypress/support/steps/fill.service.popup.step.ts b/vid-webpack-master/cypress/support/steps/fill.service.popup.step.ts new file mode 100644 index 000000000..4595d89fc --- /dev/null +++ b/vid-webpack-master/cypress/support/steps/fill.service.popup.step.ts @@ -0,0 +1,25 @@ + +declare namespace Cypress { + interface Chainable { + fillServicePopup: typeof FillServicePopup + } +} + +function FillServicePopup(): Chainable<any> { + cy.openIframe('/app/ui/#/servicePopup?serviceModelId=2f80c596-27e5-4ca9-b5bb-e03a7fd4c0fd&isCreate=true'); + cy.selectDropdownOptionByText('subscriberName', 'SILVIA ROBBINS'); + cy.selectDropdownOptionByText('serviceType', 'TYLER SILVIA'); + cy.selectDropdownOptionByText('productFamily', 'TYLER SILVIA'); + cy.selectDropdownOptionByText('lcpRegion', 'hvf6'); + cy.selectDropdownOptionByText('tenant', 'AIN Web Tool-15-D-testalexandria'); + cy.selectDropdownOptionByText('aic_zone', 'NFTJSSSS-NFT1'); + cy.selectDropdownOptionByText('project', 'WATKINS'); + cy.selectDropdownOptionByText('owningEntity', 'aaa1'); + cy.selectDropdownOptionByText('rollback', 'Rollback'); + return cy.getElementByDataTestsId('form-set').click({force : true}).then((done)=>{ + return done; + }); + +} + +Cypress.Commands.add('fillServicePopup', FillServicePopup); diff --git a/vid-webpack-master/cypress/support/steps/fill.vfModule.step.ts b/vid-webpack-master/cypress/support/steps/fill.vfModule.step.ts new file mode 100644 index 000000000..d2977832d --- /dev/null +++ b/vid-webpack-master/cypress/support/steps/fill.vfModule.step.ts @@ -0,0 +1,24 @@ +declare namespace Cypress { + interface Chainable { + fillVFModulePopup: typeof FillVFModulePopup + } +} + +function FillVFModulePopup(vnfName: string, vfModuleName: string, instanceName: string, lcpRegion: string, tenant: string, rollback: boolean, sdncPreLoad: boolean): Chainable<any> { + cy.getElementByDataTestsId('node-' + vnfName).click({force: true}); + cy.getElementByDataTestsId('node-' + vfModuleName + '-add-btn').click({force: true}); + cy.getElementByDataTestsId('instanceName').last().type(instanceName, {force: true}); + cy.getElementByDataTestsId('lcpRegion').last().select(lcpRegion); + cy.getElementByDataTestsId('tenant').last().select(tenant); + cy.getElementByDataTestsId('lcpRegion').last().select(lcpRegion); + cy.getElementByDataTestsId('rollback').last().select(String(rollback)); + if (sdncPreLoad) { + cy.getElementByDataTestsId('sdncPreLoad').last().check(); + } + return cy.getElementByDataTestsId('form-set').last().click({force: true}).then((done) => { + return done; + }); + +} + +Cypress.Commands.add('fillVFModulePopup', FillVFModulePopup); diff --git a/vid-webpack-master/cypress/support/steps/fill.vnf.popup.step.ts b/vid-webpack-master/cypress/support/steps/fill.vnf.popup.step.ts new file mode 100644 index 000000000..a5319b80f --- /dev/null +++ b/vid-webpack-master/cypress/support/steps/fill.vnf.popup.step.ts @@ -0,0 +1,30 @@ +// add new command to the existing Cypress interface + + +declare namespace Cypress { + interface Chainable { + fillVnfPopup: typeof FillVnfPopup, + duplicateVnf: typeof DuplicateVnf, + } +} +function FillVnfPopup(): Chainable<any> { + cy.selectDropdownOptionByText('productFamily', 'Emanuel'); + cy.selectDropdownOptionByText('lcpRegion', 'hvf6'); + cy.selectDropdownOptionByText('tenant', 'AIN Web Tool-15-D-STTest2'); + cy.selectDropdownOptionByText('lineOfBusiness', 'zzz1'); + cy.selectDropdownOptionByText('platform', 'xxx1'); + return cy.getElementByDataTestsId('form-set').click({force : true}).then((done)=>{ + return done; + }); +} +function DuplicateVnf( vnfNode: string, amountBefore: number): Chainable<any> { + return cy.getElementByDataTestsId(vnfNode).should('have.length', amountBefore) + .getElementByDataTestsId(vnfNode+"-menu-btn").click({force:true}) + .getElementByDataTestsId('context-menu-duplicate').click({force : true}) + .getTagElementContainsText('button','Duplicate').click({force:true}) + .getElementByDataTestsId(vnfNode).should('have.length', amountBefore+1).then((done)=>{ + return done; + }); +} +Cypress.Commands.add('fillVnfPopup', FillVnfPopup); +Cypress.Commands.add('duplicateVnf', DuplicateVnf); diff --git a/vid-webpack-master/cypress/support/steps/general/clickOutside.step.ts b/vid-webpack-master/cypress/support/steps/general/clickOutside.step.ts new file mode 100644 index 000000000..e3323a125 --- /dev/null +++ b/vid-webpack-master/cypress/support/steps/general/clickOutside.step.ts @@ -0,0 +1,14 @@ +declare namespace Cypress { + interface Chainable { + clickOutside: typeof clickOutside, + } +} + +function clickOutside(testByIdClickElement : string, testBeforeClickOutside : Function, testAfterClickOutside : Function) { + testBeforeClickOutside(); + cy.getElementByDataTestsId(testByIdClickElement).click({force: true}).then(()=>{ + testAfterClickOutside(); + }); +} + +Cypress.Commands.add('clickOutside', clickOutside); diff --git a/vid-webpack-master/cypress/support/steps/general/compareDeepObjects.step.ts b/vid-webpack-master/cypress/support/steps/general/compareDeepObjects.step.ts new file mode 100644 index 000000000..ee5e95a3a --- /dev/null +++ b/vid-webpack-master/cypress/support/steps/general/compareDeepObjects.step.ts @@ -0,0 +1,32 @@ +const { _ } = Cypress; + +declare namespace Cypress { + interface Chainable { + deepCompare: typeof deepCompare, + } +} + +function deepCompare(actual : any, expected : any) { + if(actual !== null && expected !== null){ + let diff : any[] = []; + Cypress._.mergeWith(actual, expected, function (objectValue, sourceValue, key, object, source) { + if ( !(_.isEqual(objectValue, sourceValue)) && (Object(objectValue) !== objectValue)) { + diff.push("key: " +key + ", expected: " + sourceValue + ", actual: " + objectValue); + } + }); + + Cypress._.mergeWith(expected, actual, function (objectValue, sourceValue, key, object, source) { + if ( !(_.isEqual(objectValue, sourceValue)) && (Object(objectValue) !== objectValue)) { + diff.push("key: " +key + ", expected: " + sourceValue + ", actual: " + objectValue); + } + }); + + if(diff.length > 0){ + console.error("diff", diff); + cy.log("The object are not equals", diff); + expect(actual).equals(expected); + } + } +} + +Cypress.Commands.add('deepCompare', deepCompare); diff --git a/vid-webpack-master/cypress/support/steps/genericForm/checkPopover.step.ts b/vid-webpack-master/cypress/support/steps/genericForm/checkPopover.step.ts new file mode 100644 index 000000000..085410ece --- /dev/null +++ b/vid-webpack-master/cypress/support/steps/genericForm/checkPopover.step.ts @@ -0,0 +1,14 @@ +declare namespace Cypress { + interface Chainable { + checkPopoverContentOnMouseEvent: typeof checkPopoverContentOnMouseEvent + } +} + +function checkPopoverContentOnMouseEvent(dataTestId: string, klass: string, mouseEvent: string, index: number) : Chainable<any> { + index = index || 0; + let element = cy.getElementByDataTestsId(dataTestId).eq(index); + element.trigger(mouseEvent).click().get(klass); + return element; +} + +Cypress.Commands.add('checkPopoverContentOnMouseEvent', checkPopoverContentOnMouseEvent); diff --git a/vid-webpack-master/cypress/support/steps/genericForm/genericFormAction.steps.ts b/vid-webpack-master/cypress/support/steps/genericForm/genericFormAction.steps.ts new file mode 100644 index 000000000..9786369cf --- /dev/null +++ b/vid-webpack-master/cypress/support/steps/genericForm/genericFormAction.steps.ts @@ -0,0 +1,12 @@ +declare namespace Cypress { + interface Chainable { + genericFormSubmitForm: typeof genericFormSubmitForm + } +} + +function genericFormSubmitForm() : Chainable<any> { + return cy.getElementByDataTestsId('form-set').click({force: true}); +} + + +Cypress.Commands.add('genericFormSubmitForm', genericFormSubmitForm); diff --git a/vid-webpack-master/cypress/support/steps/login.step.ts b/vid-webpack-master/cypress/support/steps/login.step.ts index f35e6e6b8..a7ed0752e 100644 --- a/vid-webpack-master/cypress/support/steps/login.step.ts +++ b/vid-webpack-master/cypress/support/steps/login.step.ts @@ -32,7 +32,6 @@ function login(): void { currentLoginCookies = res; }); } - } function openIframe(iframeUrl : string): void { diff --git a/vid-webpack-master/cypress/support/steps/menu.step.ts b/vid-webpack-master/cypress/support/steps/menu.step.ts new file mode 100644 index 000000000..a0bfdb6b3 --- /dev/null +++ b/vid-webpack-master/cypress/support/steps/menu.step.ts @@ -0,0 +1,19 @@ +declare namespace Cypress { + interface Chainable { + assertMenuItemsForNode: typeof assertMenuItemsForNode + } +} + function assertMenuItemsForNode(enabledActions: string[], nodeName: string, index: number = 0) : Chainable<any> { + let node = cy.getElementByDataTestsId(nodeName).eq(+index); + node.trigger('mouseover').click().then(()=> { + + //waiting to the menu to appear to catch options that shall not exist but actually exist + cy.get('.ngx-contextmenu').should('exist').then(()=> { + for (let option of ['duplicate', 'showAuditInfo', 'addGroupMember', 'delete', 'undoDelete', 'remove', ...enabledActions]) { + cy.getElementByDataTestsId(`context-menu-${option}`).should(enabledActions.some(s => s === option) ? 'exist' : 'not.exist'); + }}); + }); + return node; +} + +Cypress.Commands.add('assertMenuItemsForNode', assertMenuItemsForNode); diff --git a/vid-webpack-master/cypress/support/steps/openInstanceAuditInfoModal.step.ts b/vid-webpack-master/cypress/support/steps/openInstanceAuditInfoModal.step.ts new file mode 100644 index 000000000..7fc50c111 --- /dev/null +++ b/vid-webpack-master/cypress/support/steps/openInstanceAuditInfoModal.step.ts @@ -0,0 +1,18 @@ +declare namespace Cypress { + interface Chainable { + openInstanceAuditInfoModal: typeof openInstanceAuditInfoModal, + } +} + +function openInstanceAuditInfoModal(iconTextId: string): void { + cy.getElementByDataTestsId(iconTextId).click({force: true}) + .getElementByDataTestsId('context-menu-showAuditInfo').click({force : true}) + .getElementByDataTestsId('audit-info-title').contains('Instantiation Information'); + cy.get('.table-title').contains('MSO status'); + cy.get('#cancelButton').click({force: true}) + +} + + +Cypress.Commands.add('openInstanceAuditInfoModal', openInstanceAuditInfoModal); + |