Bird
0
0

Given this Cypress test snippet:

medium📝 Predict Output Q13 of 15
Cypress - Navigation and URL
Given this Cypress test snippet:
cy.visit('/home')
cy.get('a#profile-link').click()
cy.url().should('include', '/profile')

What does this test verify?
AThat the profile link exists but does not navigate
BThat the profile page loads without clicking
CThat clicking the profile link changes URL to include '/profile'
DThat the home page URL includes '/profile'
Step-by-Step Solution
Solution:
  1. Step 1: Analyze test steps

    The test visits '/home', clicks the link with id 'profile-link', then checks the URL includes '/profile'.
  2. Step 2: Understand assertion meaning

    The assertion confirms the URL changed after clicking, meaning navigation to profile page succeeded.
  3. Final Answer:

    That clicking the profile link changes URL to include '/profile' -> Option C
  4. Quick Check:

    Click changes URL to /profile [OK]
Quick Trick: Click then check URL change to confirm navigation [OK]
Common Mistakes:
  • Thinking URL changes without clicking
  • Assuming link existence means navigation
  • Confusing initial visit URL with post-click URL

Want More Practice?

15+ quiz questions · All difficulty levels · Free

Free Signup - Practice All Questions
More Cypress Quizzes