0
0
Cypresstesting~10 mins

Multiple assertions chaining 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 check if the element is visible.

Cypress
cy.get('.submit-button').[1]('be.visible')
Drag options to blanks, or click blank then click option'
Afind
Bclick
Cshould
Dwait
Attempts:
3 left
💡 Hint
Common Mistakes
Using click instead of should for assertions.
Using find which searches for child elements, not for assertions.
2fill in blank
medium

Complete the code to chain assertions checking if the element is visible and contains text 'Submit'.

Cypress
cy.get('.submit-button').should('be.visible').[1]('contain', 'Submit')
Drag options to blanks, or click blank then click option'
Await
Bshould
Cclick
Dfind
Attempts:
3 left
💡 Hint
Common Mistakes
Using click instead of should for assertions.
Using wait which pauses test but does not assert.
3fill in blank
hard

Fix the error in the code to correctly chain assertions for visibility and CSS color.

Cypress
cy.get('.alert').should('be.visible').[1]('have.css', 'color', 'rgb(255, 0, 0)')
Drag options to blanks, or click blank then click option'
Ashould
Bwait
Cfind
Dclick
Attempts:
3 left
💡 Hint
Common Mistakes
Using click or wait instead of should.
Using find which searches for child elements.
4fill in blank
hard

Fill both blanks to chain assertions checking if the input is visible and has value 'test'.

Cypress
cy.get('input#username').[1]('be.visible').[2]('have.value', 'test')
Drag options to blanks, or click blank then click option'
Ashould
Bclick
Dwait
Attempts:
3 left
💡 Hint
Common Mistakes
Using click or wait instead of should.
Using different commands for each assertion.
5fill in blank
hard

Fill all three blanks to chain assertions checking if the button is visible, enabled, and contains text 'Save'.

Cypress
cy.get('button.save').[1]('be.visible').[2]('be.enabled').[3]('contain', 'Save')
Drag options to blanks, or click blank then click option'
Aclick
Bshould
Attempts:
3 left
💡 Hint
Common Mistakes
Using click instead of should.
Mixing commands instead of chaining should.