summaryrefslogtreecommitdiffstats
path: root/vid-webpack-master/cypress/support/steps/drawingBoard/general.steps.ts
blob: 8d2bb8a246a180f33f7adc46d12959251053ff7a (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
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);