-
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
Firefox/docker: cy.setCookie() does not work #20015
Comments
Hey @con-cso, we have a number of tests for |
Sure can, here you go: |
Hi, did you manage to reproduce the behavior? |
Thanks for the super nice example, and I've verified that the behavior is weird as you describe. I'm going to try to dig into it in more detail tomorrow morning, just commenting now to let you know it's on my radar. |
Ok, so here's what I have so So the short version is that this is because of So the workaround is fairly simple - Add ".com" (or ".stuff" or whatever) to the end of your other container's hostname and Cypress' base URL. The long version is that this related to https://bugzilla.mozilla.org/show_bug.cgi?id=1517993 - the error is occurring directly in Firefox when we a attempt to set a cookie on a domain that FF doesn't recognize as valid. I suspect you could reproduce this outside of docker if you registered your server to "foo-bar" in /etc/hosts, but docker is an easy way to trigger that by accident. It would be possible to figure out exactly what's happening and add safeguards to cypress, but it's going to be fairly low on our priority list. Are you able to apply the workaround? |
Thank you very much for looking into this! I can confirm using a domain name including a dot instead of a simple hostname resolves the issue. Since we control our CI configuration, I can implement the fix no problem. I don't know the RFCs well enough to say whether this is a bug or a feature, but I could not find any note about this restriction in them. At least this is here now to help others running into this by accident. |
Current behavior
(see #17539 for details)
We are running our CI using
With chrome and electron, this setup works perfectly fine. Firefox fails on every
cy.setCookie()
call, however.Please prioritize as this completely prevents us from running Firefox tests. Thanks!
Desired behavior
cy.setCookie
should work in Firefox if the domain is not "localhost".Test code to reproduce
simply call
cy.setCookie("foo", "bar")
in combination withcypress run -b firefox -c baseUrl=https://${SERVICE_ALIAS}
Cypress Version
9.3.1
Other
No response
The text was updated successfully, but these errors were encountered: