aboutsummaryrefslogtreecommitdiffstats
path: root/vid-webpack-master/cypress/support/steps/drawingBoard/general.steps.ts
blob: 5444971b7e1f8858b04c4f58e4c48a5ae24ea967 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
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);