/** * Get an element by its label * * ex: cy.getByLabel('input', 'Search') */ Cypress.Commands.add( 'getByLabel', (selector, label) => { return cy.contains('label', label) .parent() .find(selector) }) /** * */ Cypress.Commands.add( 'containing', { prevSubject: true }, (subject, rx) => { return subject.filter(() => { return rx.test(Cypress.$(this).text()) }) } )