1 declare namespace Cypress {
3 drawingBoardTreeOpenContextMenuByElementDataTestId: typeof drawingBoardTreeOpenContextMenuByElementDataTestId,
4 drawingBoardTreeClickOnContextMenuOptionByName: typeof drawingBoardTreeClickOnContextMenuOptionByName,
5 nodeWithLineThrough: typeof nodeWithLineThrough,
6 nodeWithoutLineThrough: typeof nodeWithoutLineThrough,
7 IsDeleteTagShownOnNode: typeof IsDeleteTagShownOnNode,
8 IsDeleteTagNotShownOnNode: typeof IsDeleteTagNotShownOnNode,
9 isNodeDeleted: typeof isNodeDeleted,
10 isNodeNotDeleted: typeof isNodeNotDeleted
14 function drawingBoardTreeOpenContextMenuByElementDataTestId(dataTestId : string, index ?: number) : Chainable<any> {
15 return cy.getElementByDataTestsId(dataTestId + "-menu-btn").eq(index != null ? index : 0).click({force: true});
18 function drawingBoardTreeClickOnContextMenuOptionByName(optionName : string) : Chainable<any> {
21 return cy.getElementByDataTestsId('context-menu-duplicate').click({force : true});
23 return cy.getElementByDataTestsId('context-menu-remove').click({force : true});
25 return cy.getElementByDataTestsId('context-menu-edit').click({force : true});
27 return cy.getElementByDataTestsId('context-menu-delete').trigger('mouseover').click();
29 return cy.getElementByDataTestsId('context-menu-upgrade').trigger('mouseover').click();
31 return cy.getElementByDataTestsId('context-menu-undoUpgrade').trigger('mouseover').click();
33 return cy.getElementByDataTestsId('context-menu-duplicate').click({force : true});
37 function isNodeDeleted(index: number)
39 cy.get('.tree-node').eq(1).find('[data-tests-id="node-name"]').eq(index).should('have.css', 'text-decoration').and('contain', 'line-through');
40 cy.getElementByDataTestsId('delete-status-type').eq(index).should("contain.text", "Delete").should("contain.css", "opacity", "1");
43 function isNodeNotDeleted(index: number)
45 cy.get('.tree-node').eq(1).find('[data-tests-id="node-name"]').eq(index).should('have.css', 'text-decoration').and('not.contain', 'line-through');
46 cy.getElementByDataTestsId('delete-status-type').eq(index).should("contain.text", "Delete").should("contain.css", "opacity", "0");
48 function nodeWithLineThrough(index: number)
50 cy.getElementByDataTestsId('node-name').eq(index).should('have.css', 'text-decoration').and('contain', 'line-through')
53 function nodeWithoutLineThrough(index: number)
55 cy.getElementByDataTestsId('node-name').eq(index).should('have.css', 'text-decoration').and('not.contain', 'line-through')
59 function IsDeleteTagShownOnNode(index: number)
61 cy.getElementByDataTestsId('delete-status-type').eq(index).should("contain.text", "Delete").should("contain.css", "opacity", "1");
64 function IsUpgradeTagShownOnNode(index: number)
66 cy.getElementByDataTestsId('upgrade-status-type').eq(index).should("contain.text", "Upgrade").should("contain.css", "opacity", "1");
69 function IsDeleteTagNotShownOnNode(index: number)
71 cy.getElementByDataTestsId('delete-status-type').eq(index).should("contain.text", "Delete").should("contain.css", "opacity", "0");
74 Cypress.Commands.add('drawingBoardTreeOpenContextMenuByElementDataTestId', drawingBoardTreeOpenContextMenuByElementDataTestId);
75 Cypress.Commands.add('drawingBoardTreeClickOnContextMenuOptionByName', drawingBoardTreeClickOnContextMenuOptionByName);
76 Cypress.Commands.add('nodeWithLineThrough', nodeWithLineThrough);
77 Cypress.Commands.add('nodeWithoutLineThrough', nodeWithoutLineThrough);
78 Cypress.Commands.add('IsDeleteTagShownOnNode', IsDeleteTagShownOnNode);
79 Cypress.Commands.add('IsDeleteTagNotShownOnNode', IsDeleteTagNotShownOnNode);
80 Cypress.Commands.add('isNodeDeleted', isNodeDeleted);
81 Cypress.Commands.add('isNodeNotDeleted', isNodeNotDeleted);