-
Notifications
You must be signed in to change notification settings - Fork 3.2k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
cy.setCookie always sets the same cookie if you pass the same options object #2701
Comments
Yes, this is a bug. We are mutating the object instead of cloning it as we should be. |
@jennifer-shehane - I ran into this recently as well. Any chance something like this might come out within the next release? Looking forward to a fix on this and #1321 (#2685 ?) |
I'm taking a look right now! Not sure if it'll get in the next release, but we'll do our best. |
This comment has been minimized.
This comment has been minimized.
The code for this is done in cypress-io/cypress#2707, but has yet to be released. |
Released in |
cy.setCookie
always sets the same cookie if you pass the same options object.Current behavior:
Calling
cy.setCookie
multiple times always sets the same cookie as the first call if you pass the same options object each time. For example, the following sets two cookies named "foo" and "baz".The Cypress log shows the names and values of all three cookies I tried to create, but the console shows that only two cookies were created:
The cookies section in the Chrome dev tools also shows only two cookies, "foo" and "baz":
The "apple" cookie was never created. The call to
cy.setCookie('apple', 'banana', options);
just set the "foo" cookie again.Desired behavior:
If I call
cy.setCookie
twice with different cookie names and values, but use the same options object in both calls, I expect to create two separate cookies.Steps to reproduce:
See code snippet above.
Versions
Cypress 3.0.3, Mac OS 10.13.6, Chrome 70.0.3538.77
The text was updated successfully, but these errors were encountered: