Bird
0
0

You want to test that after reloading the page without cache, a specific cookie named 'session_id' is cleared. Which Cypress code snippet correctly achieves this?

hard📝 Application Q15 of 15
Cypress - Navigation and URL
You want to test that after reloading the page without cache, a specific cookie named 'session_id' is cleared. Which Cypress code snippet correctly achieves this?
Acy.reload(true).getCookie('session_id').should('not.exist')
Bcy.reload(false).getCookie('session_id').should('not.exist')
Ccy.reload().getCookie('session_id').should('exist')
Dcy.reload({cache: false}).getCookie('session_id').should('not.exist')
Step-by-Step Solution
Solution:
  1. Step 1: Reload page without cache

    Use cy.reload(true) to force reload without cache, which can clear cookies.
  2. Step 2: Check cookie existence after reload

    Use getCookie('session_id').should('not.exist') to assert the cookie is cleared.
  3. Final Answer:

    cy.reload(true).getCookie('session_id').should('not.exist') -> Option A
  4. Quick Check:

    Reload no cache + check cookie cleared = C [OK]
Quick Trick: Use true in reload() to clear cache and cookies [OK]
Common Mistakes:
  • Using false to reload without cache
  • Expecting cookie to exist after reload without cache
  • Passing object instead of boolean to reload

Want More Practice?

15+ quiz questions · All difficulty levels · Free

Free Signup - Practice All Questions
More Cypress Quizzes