0
0
Cypresstesting~5 mins

Automatic retry mechanism in Cypress - Cheat Sheet & Quick Revision

Choose your learning style9 modes available
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?
AThe test immediately fails without retrying.
BCypress retries the command until it passes or times out.
CCypress skips the command and continues.
DThe test pauses and waits for manual input.
Which of these commands does Cypress retry automatically?
Acy.task()
Bcy.log()
Ccy.exec()
Dcy.get()
How can you increase the retry timeout for a specific command?
ABy adding <code>{ timeout: value }</code> option to the command
BBy changing the global Cypress config only
CBy adding <code>cy.wait()</code> before the command
DBy disabling retries in Cypress
What is the default timeout for retries in Cypress?
A4 seconds
B10 seconds
C1 second
DNo timeout, retries forever
Why should you avoid using fixed waits instead of relying on automatic retries?
AFixed waits are required for retries to work.
BFixed waits make tests faster.
CFixed waits slow down tests and can cause flakiness.
DAutomatic retries do not work with dynamic content.
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.