I want to save a cookie value using Cypress, but unfortunately I always get undefined in the log console using this code
let cookieValue;
cy.getCookie('SOME_COOKIE')
.should('have.property', 'value')
.then((cookie) => {
cookieValue = cookie.value;
})
cy.log(cookieValue);
When I try this
let cookieValue;
cy.getCookie('SOME_COOKIE')
.should('have.property', 'value', 'Dummy value')
.then((cookie) => {
cookieValue = cookie.value;
})
cy.log(cookieValue);
I can see the actual value I want in the error message.
I want to save a cookie value using Cypress, but unfortunately I always get undefined in the log console using this code
let cookieValue;
cy.getCookie('SOME_COOKIE')
.should('have.property', 'value')
.then((cookie) => {
cookieValue = cookie.value;
})
cy.log(cookieValue);
When I try this
let cookieValue;
cy.getCookie('SOME_COOKIE')
.should('have.property', 'value', 'Dummy value')
.then((cookie) => {
cookieValue = cookie.value;
})
cy.log(cookieValue);
I can see the actual value I want in the error message.
Share Improve this question asked Mar 14, 2019 at 17:10 ounisounis 431 silver badge4 bronze badges 2- If it solved your problem, please accept the answer, it could be really helpful for other users landing here with the same issue