Recall & Review
beginner
What is the purpose of the automatic retry mechanism in Cypress?
It helps Cypress automatically retry commands and assertions until they pass or a timeout occurs, making tests more stable and reliable.
Click to reveal answer
beginner
Which Cypress commands benefit from automatic retries?
Commands like
cy.get(), cy.contains(), and assertions such as should() are automatically retried until they pass or timeout.Click to reveal answer
intermediate
How does Cypress decide when to stop retrying a command?
Cypress stops retrying when the command or assertion passes or when the default timeout (usually 4 seconds) is reached.
Click to reveal answer
intermediate
How can you customize the retry timeout in Cypress?
You can set a custom timeout by passing the
{ timeout: milliseconds } option to commands, for example: cy.get('.btn', { timeout: 10000 }) retries for 10 seconds.Click to reveal answer
beginner
Why is automatic retry better than adding manual waits in tests?
Automatic retry waits only as long as needed for the condition to pass, making tests faster and less flaky compared to fixed manual waits.
Click to reveal answer
What happens if a Cypress command fails initially?
✗ Incorrect
Cypress automatically retries commands and assertions until they pass or the timeout is reached.
Which of these commands does Cypress retry automatically?
✗ Incorrect
cy.get() is retried automatically; commands like cy.log() do not retry.How can you increase the retry timeout for a specific command?
✗ Incorrect
You can pass a
timeout option directly to commands to customize retry duration.What is the default timeout for retries in Cypress?
✗ Incorrect
By default, Cypress retries commands for up to 4 seconds before failing.
Why should you avoid using fixed waits instead of relying on automatic retries?
✗ Incorrect
Fixed waits add unnecessary delay and can cause flaky tests; automatic retries wait only as long as needed.
Explain how Cypress automatic retry mechanism improves test reliability.
Think about how waiting for elements or conditions works in real life.
You got /4 concepts.
Describe how to customize retry timeout for a Cypress command and why you might do it.
Consider a slow website or network delay scenario.
You got /3 concepts.