0
0
Cypresstesting~10 mins

it blocks for test cases 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 create a test block using Cypress.

Cypress
describe('My First Test', () => {
  it('[1]', () => {
    cy.visit('https://example.com')
  })
})
Drag options to blanks, or click blank then click option'
Aopens the browser
Bchecks the homepage loads
Cruns the test
Dstarts the server
Attempts:
3 left
💡 Hint
Common Mistakes
Using a vague or unrelated string inside the it block
Leaving the it block description empty
2fill in blank
medium

Complete the code to visit a URL inside an it block.

Cypress
it('visits the page', () => {
  cy.[1]('https://example.com')
})
Drag options to blanks, or click blank then click option'
Avisit
Bclick
Cget
Dtype
Attempts:
3 left
💡 Hint
Common Mistakes
Using cy.click() instead of cy.visit()
Using cy.get() which selects elements, not pages
3fill in blank
hard

Fix the error in the it block to correctly check the page title.

Cypress
it('checks the title', () => {
  cy.title().[1]('eq', 'Example Domain')
})
Drag options to blanks, or click blank then click option'
Aclick
Bget
Cvisit
Dshould
Attempts:
3 left
💡 Hint
Common Mistakes
Using get which selects elements, not assertions
Using visit or click which are unrelated here
4fill in blank
hard

Fill both blanks to select an element and check its text.

Cypress
it('checks header text', () => {
  cy.[1]('h1').[2]('contain', 'Welcome')
})
Drag options to blanks, or click blank then click option'
Aget
Bshould
Cclick
Dvisit
Attempts:
3 left
💡 Hint
Common Mistakes
Using click instead of get
Using visit instead of should
5fill in blank
hard

Fill all three blanks to write a test that types into an input and checks its value.

Cypress
it('types in input and checks value', () => {
  cy.[1]('input[name="username"]').[2]('user123')
  cy.[3]('input[name="username"]').should('have.value', 'user123')
})
Drag options to blanks, or click blank then click option'
Aget
Binvoke
Ctype
Attempts:
3 left
💡 Hint
Common Mistakes
Using invoke instead of type
Not selecting the element before typing