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

Websocket doesn't use SESSION cookie set by a cy.request #29398

Open
Lexa-tech opened this issue Apr 24, 2024 · 0 comments
Open

Websocket doesn't use SESSION cookie set by a cy.request #29398

Lexa-tech opened this issue Apr 24, 2024 · 0 comments
Labels
stage: needs investigating Someone from Cypress needs to look at this

Comments

@Lexa-tech
Copy link

Current behavior

Hello, I would like to open a WebSocket connection in a test file with the Native Javascript WebSocket API, but the authentication is failing.
The WebSocket has to use a session cookie to authenticate to the server. The cookie is set by a previous cy.request to the login API, but it is not reused and added to the headers when I'm opening the Websocket connection. The domain of the Websocket is the same that the domain of the cookie.
Is it a normal behaviour or a bug ?

Desired behavior

I expect that opening a Websocket connection could use the cookie, and have the same behaviour than in the Browser.

Test code to reproduce

cy.request to login to myserver.com
cookie is set for the myserver.com domain (I can see it in the debug tools)
new Websocket('wss://myserver.com') failed to authenticate because the cookie is not sent in the Headers.

Cypress Version

13.6.0

Node version

18.9.0

Operating System

Windows

Debug Logs

No response

Other

No response

@jennifer-shehane jennifer-shehane added the stage: needs investigating Someone from Cypress needs to look at this label Apr 24, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
stage: needs investigating Someone from Cypress needs to look at this
Projects
None yet
Development

No branches or pull requests

2 participants