Skip to content
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

Fix regression in 3.5.0 where a cy.visit that changes superdoma… #5702

Merged
merged 11 commits into from
Nov 26, 2019

Conversation

flotwig
Copy link
Contributor

@flotwig flotwig commented Nov 14, 2019

User facing changelog

  • Fixed a regression in 3.5.0 where a cy.visit that changes superdomain would incorrectly clear cookies of other domains.
  • cy.visits that cause a superdomain change will now result in 2 requests to your origin server. This should not affect tests, as tests will still re-run on a superdomain change.

Additional details

  • created a sandbox repo to test Chrome cookies scenarios using Puppeteer: https://github.com/flotwig/google-chrome-behavior-tests
    • we are handling simple single-Set-Cookie flows correctly
  • failure with cookies without whitelist in a cy.visit when redirected to a HTTP URL can set cookies on lots of redirects, ending with different domain: with localhost baseUrl
    • seems to be missing all cookies from non-localhost (quux.bar.net)
    • passes under cy.request, passes under same domain, passes under cy.request+same domain
    • issue occurs when superdomain changes - if you cy.visit the baseurl right before this test, it passes! otherwise the cookies from the alternate domain are wiped!
  • having trouble reproducing the issues users are mentioning with cookies in cy.request

How has the user experience changed?

PR Tasks

  • Have tests been added/updated?
  • Has the original issue been tagged with a release in ZenHub?

@cypress-bot
Copy link
Contributor

cypress-bot bot commented Nov 14, 2019

Thanks for the contribution! Below are some guidelines Cypress uses when doing PR reviews.

  • Please write [WIP] in the title of your Pull Request if your PR is not ready for review - someone will review your PR as soon as the [WIP] is removed.
  • Please familiarize yourself with the PR Review Checklist and feel free to make updates on your PR based on these guidelines.

PR Review Checklist

If any of the following requirements can't be met, leave a comment in the review selecting 'Request changes', otherwise 'Approve'.

User Experience

  • The feature/bugfix is self-documenting from within the product.
  • The change provides the end user with a way to fix their problem (no dead ends).

Functionality

  • The code works and performs its intended function with the correct logic.
  • Performance has been factored in (for example, the code cleans up after itself to not cause memory leaks).
  • The code guards against edge cases and invalid input and has tests to cover it.

Maintainability

  • The code is readable (too many nested 'if's are a bad sign).
  • Names used for variables, methods, etc, clearly describe their function.
  • The code is easy to understood and there are relevant comments explaining.
  • New algorithms are documented in the code with link(s) to external docs (flowcharts, w3c, chrome, firefox).
  • There are comments containing link(s) to the addressed issue (in tests and code).

Quality

  • The change does not reimplement code.
  • There's not a module from the ecosystem that should be used instead.
  • There is no redundant or duplicate code.
  • There are no irrelevant comments left in the code.
  • Tests are testing the code’s intended functionality in the best way possible.

Internal

  • The original issue has been tagged with a release in ZenHub.

@cypress
Copy link

cypress bot commented Nov 14, 2019



Test summary

3515 0 45 0


Run details

Project cypress
Status Passed
Commit 8a468b4
Started Nov 26, 2019 6:20 PM
Ended Nov 26, 2019 6:24 PM
Duration 03:34 💡
OS Linux Debian - 9.8
Browser Multiple

View run in Cypress Dashboard ➡️


This comment has been generated by cypress-bot as a result of this project's GitHub integration settings. You can manage this integration in this project's settings in the Cypress Dashboard

@flotwig flotwig changed the title [WIP] fix multiple set-cookies Fix regression in 3.5.0 where a cy.visit that changes superdomain would incorrectly clear cookies of other domains Nov 19, 2019
@flotwig
Copy link
Contributor Author

flotwig commented Nov 19, 2019

@brian-mann there isn't an open issue for this AFAIK, think we should merge this in anyways? it definitely fixes some issue... people might not even know they have this issue

@brian-mann
Copy link
Member

@flotwig definitely needs a corresponding issue opened. The regression fix is easily describable and should be noted in the issue.

@flotwig
Copy link
Contributor Author

flotwig commented Nov 20, 2019

@flotwig definitely needs a corresponding issue opened. The regression fix is easily describable and should be noted in the issue.

Created one: #5756

@brian-mann
Copy link
Member

Removing the superdomain stitching may in fact fix other esoteric issues that are open - but they may be very hard to find...

The superdomain visit buffering is likely the cause of other difficult to understand/debug issues due to the state changes that happen. This could have manifested itself in situations where Cypress changes the superdomain - but then does not serve itself correctly (instead it would proxy to the real origin server). Another possible candidate would be seeing the "Cypress did not launch this browser" message about not being able to connect to the automation extension.

@flotwig and @jennifer-shehane might be worth peaking around / searching through issues to see if we can find others that fixing this will close.

brian-mann
brian-mann previously approved these changes Nov 26, 2019
@flotwig flotwig changed the title Fix regression in 3.5.0 where a cy.visit that changes superdomain would incorrectly clear cookies of other domains Fix regression in 3.5.0 where a cy.visit that changes superdoma… Nov 26, 2019
@flotwig flotwig merged commit 4c194fc into develop Nov 26, 2019
@flotwig flotwig deleted the issue-5688-multi-set-cookie branch January 24, 2022 18:18
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Since 3.5.0, a cy.visit that changes superdomain incorrectly clears cookies of other domains.
2 participants