UNPKG

qe-fe-automation

Version:
24 lines (22 loc) 633 B
export class CypressCommands { static clickIfExist(selector: string, timeout?: Cypress.Timeoutable): void { cy.get('body').then((body) => { if (body.find(selector).length > 0) { cy.get(selector, timeout).click(); } }); } static checkIfExist(selector: string): void { cy.get('body').then((body) => { if (body.find(selector).length > 0) { return true; } return false; }); } static verifyListContainsText(selector: string, list: string[]): void { cy.get(selector).each((item, index) => { cy.wrap(item).should('contain.text', list[index]); }); } }