Bird
0
0

Find the problem in this Cypress code snippet:

medium📝 Debug Q7 of 15
Cypress - Assertions
Find the problem in this Cypress code snippet:
cy.get('.btn').should('be.visible', true)
AMissing 'exist' assertion before 'be.visible'
BSelector '.btn' is invalid
C'should' cannot be chained after 'get'
D'be.visible' does not take a second argument
Step-by-Step Solution
Solution:
  1. Step 1: Review 'be.visible' assertion syntax

    should('be.visible') does not accept any argument; it simply checks visibility.
  2. Step 2: Identify incorrect argument usage

    Passing true as second argument is invalid and causes error.
  3. Final Answer:

    'be.visible' does not take a second argument -> Option D
  4. Quick Check:

    'be.visible' has no parameters [OK]
Quick Trick: Don't pass arguments to 'be.visible' [OK]
Common Mistakes:
  • Passing true/false to 'be.visible'
  • Confusing 'be.visible' with 'have.text'
  • Assuming 'exist' is required before 'be.visible'

Want More Practice?

15+ quiz questions · All difficulty levels · Free

Free Signup - Practice All Questions
More Cypress Quizzes