0
0
Cypresstesting~10 mins

Dual 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 chain two Cypress commands correctly.

Cypress
cy.get('button').[1]()
Drag options to blanks, or click blank then click option'
Avisit
Btype
Cshould
Dclick
Attempts:
3 left
💡 Hint
Common Mistakes
Using type on a button element causes an error.
Using visit is for navigating to a URL, not clicking.
2fill in blank
medium

Complete the code to assert the button contains the correct text.

Cypress
cy.get('button').[1]('contain.text', 'Submit')
Drag options to blanks, or click blank then click option'
Ashould
Btype
Ccontains
Dclick
Attempts:
3 left
💡 Hint
Common Mistakes
Using contains as a chained command after cy.get is incorrect here.
Using click does not check text content.
3fill in blank
hard

Fix the error in chaining commands to type text and then assert the input value.

Cypress
cy.get('input').[1]('Hello').should('have.value', 'Hello')
Drag options to blanks, or click blank then click option'
Aclick
Bcontains
Ctype
Dselect
Attempts:
3 left
💡 Hint
Common Mistakes
Using click does not input text.
Using contains is for finding elements, not typing.
4fill in blank
hard

Fill both blanks to chain commands that select a dropdown option and then verify the selected value.

Cypress
cy.get('select').[1]('Option1').[2]('have.value', 'Option1')
Drag options to blanks, or click blank then click option'
Aselect
Bshould
Cclick
Dtype
Attempts:
3 left
💡 Hint
Common Mistakes
Using click on a select element does not select an option.
Using type is not appropriate for dropdowns.
5fill in blank
hard

Fill all three blanks to chain commands that find a checkbox, check it, and assert it is checked.

Cypress
cy.get('input[type=checkbox]').[1]().[2]('be.checked').[3]('exist')
Drag options to blanks, or click blank then click option'
Acheck
Bshould
Cand
Dclick
Attempts:
3 left
💡 Hint
Common Mistakes
Using check without parentheses causes syntax errors.
Not chaining assertions properly leads to test failures.