-
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
After updating to Cypress 10.4.0 localStorage and sessionStorage are not populated with part of login happening in cy.origin() and login process fails #23075
Comments
There was a huge develop->master merge in the last 24hrs. #23065 |
@Wilhop Thanks for logging the issue. Can you provide additional details on the behavior and can you provide a reproducible example? I put together this example repo and am unable to reproduce the issue you are seeing. The local storage is being saved correctly and consistently when comparing 10.3.1 and 10.4.0 when using |
I tried to narrow the problem down a bit by making the login just a test without a cy.session(). I tried removing cy.origin() out of the picture as well, but chromeWebSecurity: false in cypress.config.js is not woking anymore - is this normal in version 10.4? Problem persists: it seems that localStorage and sessionStorage are never being populated in Cypress 10.4 in our login workflow. The logic is quite complex, but basically when we return from the second domain in Azure login service wrapped in cy.origin() -> the application starts populating both localStorage and sessionStorage. I'm not sure how I could give a working example without giving real addresses and login information. The test below works in Cypress 10.3.1 and fails in 10.4. In 10.4 when I observe the storages with DevTools while running Cypress test, it never gets the values needed. I'm quite sure it has something to do with cy.origin() and getting back from it, but I could be very wrong.
|
HI @Wilhop. I see the issue is still persisting for you, but were you able to produce the issue in @emilyrohrbough 's example repo? |
@AtofStryker Just making sure I understand correctly: Thanks in advance, I'm not that familiar with open-source projects (yet) :) |
@Wilhop, yes, the ideal/best option is to try and reproduce your issue in the example repo by adding the code that is closest to your test-code (or your test code if possible). The simplest reproducible example is best to isolate and identify the root-cause. |
Also if there is a workaround cy.origin() in 10.4, then I'd be happy to try it out. Our whole Cypress test suite is broken because we have no way of logging in. To get working tests the suit was downgraded to 10.3.1. |
@Wilhop I have a possible hunch that might be related to this #23132 (comment). Would you be able to run with |
I cleaned up a small portion of the logs with verbose:proxy:http. Some differences in the log I noticed just before the test fails:
Logs just before the point where newer version fails, from Cypress 10.3.1
Example logs from just before the test starts to fail, from Cypress 10.4
I'll try to get a full log, but there is just so much data in the log and the amount of cleaning without losing data integrity is surprisingly high :) |
@Wilhop this is incredibly useful. I think we have enough here to get an idea what is happening. In addition, what I can try to do is try to reproduce this with an azure B2C app and see if I can reproduce the missing cookie. |
Not sure if this has something to do with this issue, but while trying to debug our problem I noticed I couldn't log any of the "x-ms-*" cookies. cy.getCookie() finds other cookies, but it didn't find the cookies that had "myappb2c.b2clogin.com" Domain-value. Cookies |
@Wilhop any idea if those are http only cookies? Cypress does a few things to manage cross origin cookies on the server, which are applied to requests but eventually synced with the browser. My guess is a) they're httponly cookies b) haven't been synced yet or c) its a part of the cookie bug we are seeing here. |
@emilyrohrbough is this PR: #23503 the fix for this issue? |
@rlam3 That PR is not the fix for this issue. Sorry! 😢 |
@Wilhop We released some cookie changes today with |
@AtofStryker I can happily confirm that after updating 10.8.0 the login is now working and cookies/storages are preserved. Was the fix this item on the release notes? I believe the issue can be closed, hopefully not introduced again :) |
That's great!
That is the fix I believe should have solved this issue, and it looks like it does! We have further cookie improvements coming in future releases, but right now this fix gets us over the hump.
Awesome. I am going to close this out but if you run into any other issues just let us know! |
Current behavior
Before Cypress 10.4 update, the test framework had the current workflow:
Problem with part 4: now after Cypress 10.4 update, when it returns from the secondary domain, it looks like both localStorage and sessionStorage are emptied, thus the test cannot continue without the data stored in both of the storages.
Desired behavior
cy.session() should preserve localStorage and sessionStorage as documented.
Test code to reproduce
../support/commands.ts
Cypress Version
10.4.0
Other
This worked fine until 10.3.2
The text was updated successfully, but these errors were encountered: