0
0
Cypresstesting~5 mins

Command timeout vs assertion timeout in Cypress - Quick Revision & Key Differences

Choose your learning style9 modes available
Recall & Review
beginner
What is command timeout in Cypress?
Command timeout is the maximum time Cypress waits for a command to complete before failing the test. It applies to actions like clicking or typing.
Click to reveal answer
beginner
What does assertion timeout mean in Cypress?
Assertion timeout is the time Cypress waits for an assertion to become true before failing the test. It is used when checking conditions like element visibility or text content.
Click to reveal answer
intermediate
How does Cypress handle command timeout differently from assertion timeout?
Command timeout waits for commands to finish (like clicking). Assertion timeout waits for conditions to be met (like element appears). They control different waiting behaviors.
Click to reveal answer
intermediate
Which timeout would affect cy.get('.btn').click() if the button takes time to appear?
The command timeout affects this because Cypress waits for the button to appear and be clickable before performing the click.
Click to reveal answer
intermediate
Which timeout applies to cy.get('.msg').should('contain', 'Success')?
The assertion timeout applies here because Cypress waits for the message to contain 'Success' before failing the test.
Click to reveal answer
In Cypress, what does the command timeout control?
AHow long to wait for an assertion to pass
BHow long to wait for network requests
CHow long to wait for the browser to load
DHow long to wait for a command like click or type to complete
Which timeout is used when Cypress waits for an element to contain specific text?
AAssertion timeout
BNetwork timeout
CPage load timeout
DCommand timeout
If a button is slow to appear, which timeout affects cy.get('.btn').click()?
APage load timeout
BAssertion timeout
CCommand timeout
DNo timeout applies
What happens if an assertion does not pass within the assertion timeout?
ATest retries the command
BTest fails with timeout error
CTest passes anyway
DTest ignores the assertion
Can command timeout and assertion timeout be configured separately in Cypress?
AYes, they have separate settings
BNo, they share the same timeout
COnly command timeout can be configured
DOnly assertion timeout can be configured
Explain the difference between command timeout and assertion timeout in Cypress.
Think about what Cypress waits for in each case.
You got /3 concepts.
    Describe a scenario where command timeout would cause a test to fail but assertion timeout would not.
    Consider waiting for an element before clicking.
    You got /3 concepts.