Practice - 5 Tasks
Answer the questions below
1fill in blank
easyComplete the code to visit the homepage using Cypress.
Cypress
cy.[1]('/')
Drag options to blanks, or click blank then click option'
Attempts:
3 left
💡 Hint
Common Mistakes
Using 'click' instead of 'visit' to load a page.
Using 'get' which selects elements, not pages.
✗ Incorrect
The visit command loads a page by URL in Cypress.
2fill in blank
mediumComplete 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'
Attempts:
3 left
💡 Hint
Common Mistakes
Using 'type' which is for typing text, not clicking.
Using 'visit' which is for loading pages.
✗ Incorrect
The click command simulates a user clicking the button.
3fill in blank
hardFix 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'
Attempts:
3 left
💡 Hint
Common Mistakes
Using 'click' instead of 'type' for input fields.
Using 'visit' which is unrelated to typing.
✗ Incorrect
The type command inputs text into form fields.
4fill in blank
hardFill 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'
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.
✗ Incorrect
The click triggers the button, but to check visibility, use should('be.visible').
5fill in blank
hardFill 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'
Attempts:
3 left
💡 Hint
Common Mistakes
Using 'click' instead of 'type' to enter text.
Using wrong assertion like 'be.visible' instead of 'include'.
✗ Incorrect
Use type to enter text, then should('include', 'test') to assert the input contains the text.