Cypress · Middle · Question 52 of 77
How do you get a cookie value to assert on it?
- 1
document.cookieread directly in the spec - 2
cy.get('cookie:session').should('exist') - 3
cy.getCookie('session').should('exist')
Show the answer
Correct answer: cy.getCookie('session').should('exist')
Explanation
cy.getCookie yields an object with value, httpOnly, secure and more, so security flags can be checked.