Open flotwig opened 5 years ago
Any update here?
All products I'm testing have digest on as default, so this feature would be greatly appreciated.
I am eagerly awaiting this feature to be able to complete my move away from selenium.
As a workaround for this issue, if you are able to obtain the digest auth cookie by authenticating with curl first (using --digest and --user), then you can store the cookie with -c and save it to an environment variable. You can set the cookie like this in your test, using cypress' built in setCookie() command:
cy.setCookie(`${Cypress.env('COOKIE_NAME')}`, `${Cypress.env('COOKIE_VALUE')}`)
As a workaround for this issue, if you are able to obtain the digest auth cookie by authenticating with curl first (using --digest and --user), then you can store the cookie with -c and save it to an environment variable. You can set the cookie like this in your test, using cypress' built in setCookie() command:
cy.setCookie(`${Cypress.env('COOKIE_NAME')}`, `${Cypress.env('COOKIE_VALUE')}`)
@wclem4 I don't have experience with curl so pardon my ignorance but can cypress trigger curl commands or would I need to run the curl command before running my cypress tests?
not that I know of @RonManR
I personally put it in a script and sourced it before I ran the cypress test runner. I had curl saving the cookie to a file, then another line parsing the file for the name and the value and setting those values to the envs.
You may be able to use their cy.exec() and run curl in that command if you really want to contain it all in cypress. Not sure if that is a good route to go though.
@wclem4 Interesting! I will try this. Right now we configure our devices to use basic auth instead, and custom commands to pass the username/password when using cy.visit(). This would definitely be closer to an actual use case.
We did a workaround by using a custom header to bypass the auth on the server. Funny thing - it works with headless electron mode but in the browser mode, digest auth is still required.
@khamer1410 Could you give an example of how you solved this? Would it be possible to create a solution that works with any server? The tests run on a collection of servers so we would need a solution that could smoothly be applied to all of them.
Current behavior:
Cypress does not support HTTP Digest authentication in cy.visit:
https://stackoverflow.com/questions/56804599/manually-enter-auth-credentials-in-dialog
Desired behavior:
Cypress supports digest authentication in cy.visit:
Versions
Cypress 3.3.2
Related issues
850 - add in-browser support for NTLM authentication
1255 - add in-browser support for Kerberos authentication