I have below issue in cypress:
- Get all table cells of a particular column containing a button.
- Iterate over each cell --> locate button within that cell.
- click on that button.
- wait for modal dialog to appear
- accept on modal and wait for it to disappear.
- wait for a notification to appear and then disappear.
- move to next cell element / iteration
Code that I have so far:
cy.get("tr[some attribute]").each(($element, $index, $list) => {
cy.wrap($element).find("button").click();
cy.get(".modal-dialog").should('be.visible');
cy.get(".modal-dialog button[type='submit']").should('be.visible').click();
cy.get("toast").should('be.visible').as('@toast')
cy.get('@toast').should('not.be.visible')
})
Issues Here:
- The cypress doesn't waits for the first iteration to finish and runs all iteration. I can see multiple modal-dialogs opened up.
- Cypress asynchronously clicks on all the buttons without waiting for previous iteration to finish.
- cypress fails on step where it expects toast to disappear although i can see the toast message is not there.
Thanks in advance!