Retry-ability

Learn how Cypress retries commands and assertions to avoid flakes. In addition, learn how we can use retry-ability to our advantage.

One of the core features of Cypress is its ability to retry commands several times to reduce the likelihood of flakes. As discussed previously in the “Consistent Results” lesson, Cypress takes several measures to battle the most common causes of flakes, such as:

  • Half-loaded application state.
  • Elements that are not available, covered, or disabled.
  • Flakes caused by animations.

Retrying commands and assertions

To battle all of this, Cypress retries both commands and assertions alike. The commands are Cypress calls that execute either a user behavior or get an element:

Get hands-on with 1200+ tech skills courses.