I have used return false statement to break the each loop in cypress. But still the loop continue.. Please find the code snippet below:
getRowActionByUrlOrDomain(Value) {
var urlName;
var flag;
cy.get(TBL_BWLIST_ROWS).each(($li, rowindex, $lis) => {
cy.wrap($li).find('td a', { timeout: 9000 }).each(($lidata, index, lis) => {
urlName = $lidata.text().trim()
rowindex = $lis.index($li)
if (urlName.localeCompare(Value.trim()) == 0) {
expect($lidata.text().trim()).to.be.equal(Value.trim())
cy.get(TBL_BWLIST_ROWS + ":nth-child(index)").find('td:nth-of-type(index) a').click()
return false;
}
})
})
}