This is the code snippet I have
cy.get('[data-testid="userRecords"]')
.each((record) => {
if (record.find('[data-testid="delete"]').is(":enabled"))
{
cy.wrap(record).find('[data-testid="delete"]').click()
if (someValue == 1)
{
cy.get('[data-testid="test"]').should("be.visible");
}
else
{
cy.get('[data-tstid="anotherTest"]').should("be.not.exist")
}
return false;
}
The goal I am trying to achieve here is that if the outer if
statement is entered, then I want to break the each
loop.
Can someone guide me why I am not able to exit the each
loop?