Reputation: 11
I have a cookie with several objects, namely path, secure status, and httponly status, that I need to set alongside the actual value of the cookie. While the Cypress guide does specifically state that such objects can be passed in, there is no example of a command with passed in objects for a novice like me to follow.
Can someone provide an example?
Already tried...
cy.setcookie('cookieName', 'value', 'path=/', 'Httponly=true', 'Secure=true')
cy.setcookie('cookieName', 'value', path='/', Httponly=true, Secure=true)
Upvotes: 1
Views: 1250
Reputation: 5871
The third parameter should be an options
object, just a normal plain old Javascript object. That would look like this in your example:
cy.setcookie('cookieName', 'value', {
path: '/',
httpOnly: true,
secure: true
})
Upvotes: 4