← Back to library
Cypresswaitintermediatev10+
Retry an assertion with a custom timeout
Override the default 4-second retry window to wait longer for slow DOM updates.
1it('toast disappears and status becomes Ready', () => {
2 cy.visit('/notifications');
3 cy.get('[data-testid="trigger-btn"]').click();
4
5 cy.get('[data-testid="toast"]').should('be.visible');
6
7 // Pass a timeout option to extend the default 4 s retry window
8 cy.get('[data-testid="toast"]', { timeout: 10_000 }).should('not.exist');
9
10 // Use a should callback to assert on derived/computed values
11 cy.get('[data-testid="status"]').should(($el) => {
12 expect($el.text().trim()).to.equal('Ready');
13 });
14});#timeout#retry#custom wait#should#polling