0
0
Cypresstesting~10 mins

First Cypress test - 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 in a Cypress test.

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

Complete the code to check if the page contains the text 'Welcome'.

Cypress
cy.contains('[1]')
Drag options to blanks, or click blank then click option'
AWelcome
BHello
CSubmit
DLogin
Attempts:
3 left
💡 Hint
Common Mistakes
Using unrelated text like 'Submit' or 'Login' which may not be on the page.
Misspelling the text inside contains.
3fill in blank
hard

Fix the error in the code to click a button with id 'submit-btn'.

Cypress
cy.get('#submit-btn').[1]()
Drag options to blanks, or click blank then click option'
Atype
Bclick
Cvisit
Dcontains
Attempts:
3 left
💡 Hint
Common Mistakes
Using 'type' which is for typing text, not clicking.
Using 'visit' which loads pages, not clicks buttons.
4fill in blank
hard

Fill both blanks to check if an input with name 'email' is visible and then type an email address.

Cypress
cy.get('input[name="email"]').[1]('be.visible').[2]('user@example.com')
Drag options to blanks, or click blank then click option'
Ashould
Bclick
Ctype
Dcontains
Attempts:
3 left
💡 Hint
Common Mistakes
Using 'click' instead of 'should' to check visibility.
Using 'contains' instead of 'type' to enter text.
5fill in blank
hard

Fill all three blanks to write a test that visits the page, clicks a button with class 'start', and checks if the URL includes '/dashboard'.

Cypress
cy.[1]('https://example.com')
cy.get('.start').[2]()
cy.url().[3]('include', '/dashboard')
Drag options to blanks, or click blank then click option'
Avisit
Bclick
Cshould
Dcontains
Attempts:
3 left
💡 Hint
Common Mistakes
Using 'contains' instead of 'should' for URL assertion.
Using 'type' instead of 'click' to press the button.