Cypress retries commands and assertions automatically until they succeed or a timeout occurs. This helps handle delays in UI rendering or network responses, making tests less flaky.
cy.get('button#submit').should('be.enabled')
Cypress retries the assertion 'should be enabled' until it passes or times out. Since the button becomes enabled after 2 seconds, the test passes.
The 'should' assertion retries until the condition is met or times out. 'should not.exist' waits for the spinner to be removed, reducing flakiness.
If the element's text changes and then disappears quickly, Cypress retries but may fail if the text is not stable long enough.
Cypress auto-retry waits dynamically until the condition is met or timeout, reducing flakiness and speeding tests. Fixed waits pause for a set time regardless of app state.