0
0
Cypresstesting~10 mins

Why Cypress auto-retries reduce flakiness - Test Your Understanding

Choose your learning style9 modes available
Practice - 5 Tasks
Answer the questions below
1fill in blank
easy

Complete the code to make Cypress wait and retry the assertion automatically.

Cypress
cy.get('.button').should('[1]')
Drag options to blanks, or click blank then click option'
Await
Bhave
Cbe.visible
Dcontain
Attempts:
3 left
💡 Hint
Common Mistakes
Using 'wait' instead of 'be.visible' causes syntax errors.
Using 'contain' checks text, not visibility.
2fill in blank
medium

Complete the code to retry clicking a button until it becomes enabled.

Cypress
cy.get('#submit').should('not.be.disabled').[1]()
Drag options to blanks, or click blank then click option'
Aclick
Btype
Cwait
Dfocus
Attempts:
3 left
💡 Hint
Common Mistakes
Using 'type' tries to enter text, which is invalid for buttons.
Using 'wait' does not perform the click action.
3fill in blank
hard

Fix the error in the code to properly retry the assertion that the element contains text.

Cypress
cy.get('.message').should('[1]', 'Hello')
Drag options to blanks, or click blank then click option'
Ahave.text
Bcontain
Ccontains.text
Dhas.text
Attempts:
3 left
💡 Hint
Common Mistakes
Using 'have.text' requires exact match, which may cause flakiness.
Using 'contains.text' is not a valid Cypress assertion.
4fill in blank
hard

Fill both blanks to create a retrying assertion that checks the element's CSS property.

Cypress
cy.get('.alert').should('[1]', '[2]', 'red')
Drag options to blanks, or click blank then click option'
Ahave.css
Bcontain
Ccolor
Dbackground-color
Attempts:
3 left
💡 Hint
Common Mistakes
Using 'contain' instead of 'have.css' causes assertion failure.
Using 'color' instead of 'background-color' checks wrong property.
5fill in blank
hard

Fill all three blanks to create a retrying test that waits for an API call and asserts its status.

Cypress
cy.intercept('GET', '/users').as('[1]');
cy.wait('@[2]').its('[3]').should('eq', 200);
Drag options to blanks, or click blank then click option'
AgetUsers
BusersCall
Cresponse.statusCode
Dresponse
Attempts:
3 left
💡 Hint
Common Mistakes
Using different alias names causes wait to fail.
Checking 'response' instead of 'response.statusCode' does not assert status code.