/ cypress / support / helpers / modal.helper.ts
modal.helper.ts
 1  export class ModalHelpers {
 2    public static setAmount(amount: number, max?: boolean) {
 3      cy.get('[data-cy=Modal]').find('[data-cy=actionButton]').should('be.visible').should;
 4      cy.wait(2000); //there is no way to know when real max amount will upload by UI
 5      if (max) {
 6        cy.get('[data-cy=Modal]').find('button:contains("Max")').click();
 7      } else {
 8        cy.get('[data-cy=Modal] input').first().clear().type(amount.toString());
 9      }
10    }
11  
12    public static getApy() {
13      return cy
14        .get('[data-cy=Modal]')
15        .find('[data-cy=apy]')
16        .then(($val) => {
17          return parseFloat($val.text());
18        });
19    }
20    public static getApyOld() {
21      return cy
22        .get('[data-cy=Modal]')
23        .find('[data-cy=apy]')
24        .first()
25        .then(($val) => {
26          return parseFloat($val.text());
27        });
28    }
29    public static getApyNew() {
30      return cy
31        .get('[data-cy=Modal]')
32        .find('[data-cy=apy]')
33        .last()
34        .then(($val) => {
35          return parseFloat($val.text());
36        });
37    }
38  }