Bird
0
0

Find the mistake in this Cypress navigation test:

medium📝 Debug Q6 of 15
Cypress - Navigation and URL
Find the mistake in this Cypress navigation test:
cy.visit('/profile')
cy.get('button#edit').click()
cy.url.should('include', '/edit')
Acy.url is missing parentheses to call the function
Bcy.get selector is incorrect syntax
Ccy.visit URL is invalid
Dclick() is missing parentheses
Step-by-Step Solution
Solution:
  1. Step 1: Review cy.url usage

    cy.url() is a function and must be called with parentheses.
  2. Step 2: Identify the error

    The test uses cy.url.should(...) instead of cy.url().should(...).
  3. Final Answer:

    cy.url is missing parentheses to call the function -> Option A
  4. Quick Check:

    Always call cy.url() as a function before assertions [OK]
Quick Trick: cy.url() requires parentheses before assertions [OK]
Common Mistakes:
  • Forgetting parentheses after cy.url
  • Misusing click() without parentheses

Want More Practice?

15+ quiz questions · All difficulty levels · Free

Free Signup - Practice All Questions
More Cypress Quizzes