0
0
Cypresstesting~10 mins

Retry-ability of commands in Cypress - Interactive Code Practice

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

Complete the code to retry the command until the element is visible.

Cypress
cy.get('.submit-button').should([1])
Drag options to blanks, or click blank then click option'
A'be.enabled'
B'exist'
C'be.visible'
D'contain.text'
Attempts:
3 left
💡 Hint
Common Mistakes
Using 'exist' instead of 'be.visible' does not guarantee visibility.
Using 'contain.text' when checking visibility.
2fill in blank
medium

Complete the code to retry clicking the button until it is enabled.

Cypress
cy.get('#save-btn').should('be.enabled').[1]()
Drag options to blanks, or click blank then click option'
Asubmit
Bclick
Ctype
Dcheck
Attempts:
3 left
💡 Hint
Common Mistakes
Using 'type' on a button element causes an error.
Using 'submit' without a form context.
3fill in blank
hard

Fix the error in the code to retry assertion until the text appears.

Cypress
cy.get('.message').should([1], 'Success')
Drag options to blanks, or click blank then click option'
A'have.text'
B'text.include'
C'include.text'
D'contain.text'
Attempts:
3 left
💡 Hint
Common Mistakes
Using 'have.text' causes failure if text is not exact.
Using invalid assertion names like 'text.include'.
4fill in blank
hard

Fill both blanks to retry until the input is visible and then type 'hello'.

Cypress
cy.get('input[name="username"]').[1]().should([2]).type('hello')
Drag options to blanks, or click blank then click option'
Afocus
Bclick
C'be.visible'
D'exist'
Attempts:
3 left
💡 Hint
Common Mistakes
Using 'focus' does not retry the command.
Using 'exist' instead of 'be.visible' does not guarantee visibility.
5fill in blank
hard

Fill all three blanks to retry until the checkbox is visible, check it, and verify it is checked.

Cypress
cy.get('#agree').should([1]).[2]().should([3])
Drag options to blanks, or click blank then click option'
A'be.visible'
Bcheck
C'be.checked'
Dclick
Attempts:
3 left
💡 Hint
Common Mistakes
Using 'click' instead of 'check' may not work reliably for checkboxes.
Not asserting 'be.checked' after checking.