From 6f900cc45d7dd7f97430812b86b5c1d1693c8ae3 Mon Sep 17 00:00:00 2001 From: Ittay Stern Date: Wed, 29 Aug 2018 17:01:32 +0300 Subject: merge from ecomp a88f0072 - Modern UI Issue-ID: VID-378 Change-Id: Ibcb23dd27f550cf32ce2fe0239f0f496ae014ff6 Signed-off-by: Ittay Stern --- vid-webpack-master/cypress/support/steps/menu.step.ts | 19 +++++++++++++++++++ 1 file changed, 19 insertions(+) create mode 100644 vid-webpack-master/cypress/support/steps/menu.step.ts (limited to 'vid-webpack-master/cypress/support/steps/menu.step.ts') 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 { + 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); -- cgit 1.2.3-korg