Practice - 5 Tasks
Answer the questions below
1fill in blank
easyComplete 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'
Attempts:
3 left
💡 Hint
Common Mistakes
Using 'exist' instead of 'be.visible' does not guarantee visibility.
Using 'contain.text' when checking visibility.
✗ Incorrect
The 'should' command with 'be.visible' retries until the element is visible.
2fill in blank
mediumComplete 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'
Attempts:
3 left
💡 Hint
Common Mistakes
Using 'type' on a button element causes an error.
Using 'submit' without a form context.
✗ Incorrect
The 'click' command retries until the button is enabled and then clicks it.
3fill in blank
hardFix 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'
Attempts:
3 left
💡 Hint
Common Mistakes
Using 'have.text' causes failure if text is not exact.
Using invalid assertion names like 'text.include'.
✗ Incorrect
The correct assertion is 'contain.text' to retry until the element contains the text 'Success'.
4fill in blank
hardFill 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'
Attempts:
3 left
💡 Hint
Common Mistakes
Using 'focus' does not retry the command.
Using 'exist' instead of 'be.visible' does not guarantee visibility.
✗ Incorrect
Clicking the input focuses it, and 'should' with 'be.visible' retries until visible before typing.
5fill in blank
hardFill 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'
Attempts:
3 left
💡 Hint
Common Mistakes
Using 'click' instead of 'check' may not work reliably for checkboxes.
Not asserting 'be.checked' after checking.
✗ Incorrect
First assert visibility, then check the box, then assert it is checked to ensure retry-ability.