Bird
0
0

Identify the error in this Cypress assertion:

medium📝 Debug Q6 of 15
Cypress - Assertions
Identify the error in this Cypress assertion:
expect(user.isActive).to.be.true;
AIncorrect property name isActive
BMissing parentheses after true
Cexpect() cannot check booleans
DMissing semicolon at end
Step-by-Step Solution
Solution:
  1. Step 1: Review the assertion syntax for boolean true

    In Cypress, to.be.true requires parentheses: to.be.true().
  2. Step 2: Confirm other parts are correct

    The property name and semicolon are valid; expect() can check booleans.
  3. Final Answer:

    Missing parentheses after true -> Option B
  4. Quick Check:

    Boolean assertions need () after true [OK]
Quick Trick: Use to.be.true() with parentheses for boolean checks [OK]
Common Mistakes:
  • Omitting () after true
  • Assuming expect() can't check booleans
  • Confusing property names

Want More Practice?

15+ quiz questions · All difficulty levels · Free

Free Signup - Practice All Questions
More Cypress Quizzes