Automatic retry helps tests try again if something is not ready yet. This makes tests more stable and less likely to fail because of small delays.
Automatic retry mechanism in Cypress
cy.get('selector').should('be.visible')
Cypress automatically retries commands like cy.get() and assertions like should() until they pass or timeout.
You do not need to write loops for retry; Cypress handles it for you.
cy.get('#submit-button').should('be.enabled')
cy.contains('Loading...').should('not.exist')
cy.get('.alert').should('have.text', 'Success')
This test visits a page, waits automatically for a delayed button to appear and be enabled, clicks it, and then checks the result text.
describe('Automatic retry example', () => { it('waits for button to be clickable', () => { cy.visit('https://example.cypress.io') cy.get('#delayed-button').should('be.visible').and('be.enabled') cy.get('#delayed-button').click() cy.get('#result').should('contain', 'Clicked') }) })
Cypress retries commands and assertions up to the default timeout (usually 4 seconds).
You can change the timeout with options like { timeout: 10000 } to wait longer if needed.
Automatic retry reduces flaky tests caused by slow loading or animations.
Automatic retry makes tests wait and try again until conditions are met.
Cypress handles retry for commands and assertions without extra code.
This helps tests be more reliable and less flaky.