bjowes / cypress-ntlm-auth

Windows authentication plugin for Cypress
MIT License
55 stars 10 forks source link

Do not run in CI/CD #115

Closed varunpradhan closed 3 years ago

varunpradhan commented 4 years ago

When I integrated it to CI/CD pipeline, I get an error :

sh: 1: start: not found

image

varunpradhan commented 4 years ago

The same command runs perfectly fine on cli.

bjowes commented 4 years ago

Are you sure your CI machine is running windows? From the paths in the logs, it looks like a linux machine. The startup scripts for cypress-ntlm are slightly different for linux, see the readme for examples.

varunpradhan commented 4 years ago

Ya I was running in ubuntu. Now I have changed to windows but it is not authenticating and giving 401 error. In my PC it is working.

image

bjowes commented 4 years ago

Are you using SSO or setting specific users with cy.ntlm()?

If you are using SSO, keep in mind that the user account executing the tests is the one used by ntlm-proxy to sign in to your test site. Does that user have access?

varunpradhan commented 4 years ago

It's not SSO, but yes there is proxy bypass applied on that server. So when I go to LAN settings of that server via Internet Options, we have set up a bypass proxy. Do we need to apply those bypass proxy settings also while running the scripts separately?

I have the proxy settings applied to environment variables. Do I need to do any other settings?

This is the environment proxy setting applied:

image

Below is the code:

image

I have also checked that manually too if I try to run the Cypress scripts (by opening up test runner), it is failing to authenticate. But I am able to log in without Cypress in a browser from the same server.

bjowes commented 4 years ago

Depending on if external (outside the Intranet) are used by your test site, you need to mimic the proxy settings of that machine. Set HTTP_PROXY before starting cypress-ntlm. (If a different https proxy address is used, set HTTPS_PROXY too)

However, I don’t think this should give you 401 issues, rather timeout issues if the external resources can’t be reached.

Check the debug log of ntlm-proxy. You should see the handshake sequence against your test site in the logs. If that is failing, please submit the logs. If you don’t see the handshake, double check your config.

tors 21 maj 2020 kl. 01:52 skrev Varun Pradhan notifications@github.com:

It's not SSO, but yes there is proxy bypass applied on that server. So when I go to LAN settings of that server via Internet Options, we have set up a bypass proxy. Do we need to apply those bypass proxy settings also while running the scripts separately?

— You are receiving this because you commented.

Reply to this email directly, view it on GitHub https://github.com/bjowes/cypress-ntlm-auth/issues/115#issuecomment-631797305, or unsubscribe https://github.com/notifications/unsubscribe-auth/ABCHR3BM5BXRZEV7HTBCEFDRSRULFANCNFSM4M4QKMGQ .

-- /Björn W

Skickat från min iPhone

varunpradhan commented 4 years ago

@bjowes Below is the debug log:

image

bjowes commented 4 years ago

Well, everything looks fine in that log. Each NTLM handshake succeeds. So there must be some other resource that causes it.

Run the tests manually with a GUI (cypress open). Open the developer tools. Check the js console or the network tab to find which requests are returning 401. I would guess that there are additional hosts that you need to configure with cy.ntlm().

bjowes commented 3 years ago

Closing due to lack of activity - please reopen if more support is needed