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