diff options
Diffstat (limited to 'vid-webpack-master/cypress/support/steps/menu.step.ts')
-rw-r--r-- | vid-webpack-master/cypress/support/steps/menu.step.ts | 19 |
1 files changed, 19 insertions, 0 deletions
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); |