I'm using Cypress and I want to to exit from a each loop that contains a promise.
cy.get('div').find('div.myclass').each(el => {
cy.get(el).find('span#myclass').then(span => {
const myText = Cypress.$(span).clone().children().remove().end().text().trim();
if (myText === 'somethings') {
cy.get(el).as('mySection');
// ### HERE I WANT TO EXIT ###
}
});
});
Can someone help me?