Hi I am working with cypress for UI testing. Based on user we do have additional button on the page.
Is there a way cypress can look for a button and run the commands if button is present and skip the command if button is absent thus preventing from element not found error.
<div class="btn btn-success" id="editButton">Edit</div>
Cypress code is
if (!cy.get('div[id=editButton]')) {
this.skip();
} else {
cy.get('div[id=editButton]').click();
}
And yet cypress throws element not found error.