0
0
Cypresstesting~10 mins

App Actions pattern 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 visit the homepage using Cypress.

Cypress
cy.[1]('/')
Drag options to blanks, or click blank then click option'
Aclick
Bget
Cvisit
Dcontains
Attempts:
3 left
💡 Hint
Common Mistakes
Using 'click' instead of 'visit' to load a page.
Using 'get' which selects elements, not pages.
2fill in blank
medium

Complete the code to create an action that clicks a button with id 'submit'.

Cypress
cy.get('#submit').[1]()
Drag options to blanks, or click blank then click option'
Atype
Bvisit
Ccontains
Dclick
Attempts:
3 left
💡 Hint
Common Mistakes
Using 'type' which is for typing text, not clicking.
Using 'visit' which is for loading pages.
3fill in blank
hard

Fix the error in the action that types 'hello' into an input with class 'name'.

Cypress
cy.get('.name').[1]('hello')
Drag options to blanks, or click blank then click option'
Atype
Bclick
Cvisit
Dcontains
Attempts:
3 left
💡 Hint
Common Mistakes
Using 'click' instead of 'type' for input fields.
Using 'visit' which is unrelated to typing.
4fill in blank
hard

Fill both blanks to create an action that checks if a button with text 'Submit' is visible.

Cypress
cy.contains('Submit').[1]().should('[2]')
Drag options to blanks, or click blank then click option'
Aclick
Bbe.visible
Cbe.enabled
Dshould
Attempts:
3 left
💡 Hint
Common Mistakes
Using 'should' as an action instead of an assertion.
Using 'be.enabled' instead of 'be.visible' for visibility check.
5fill in blank
hard

Fill all three blanks to create an action that types 'test' into input with id 'email', then asserts it contains 'test'.

Cypress
cy.get('#email').[1]('test').should('[2]', [3])
Drag options to blanks, or click blank then click option'
Atype
Binclude
C'test'
Dclick
Attempts:
3 left
💡 Hint
Common Mistakes
Using 'click' instead of 'type' to enter text.
Using wrong assertion like 'be.visible' instead of 'include'.