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

I have configured NTM-Auth-plugin and when i run the cypress So I am facing the issue: Error: Cannot find module 'cypress-ntlm-auth/dist/plugin' #216

Closed
MuhammadJawad1214 opened this issue Sep 20, 2022 · 50 comments

Comments

@MuhammadJawad1214
Copy link

While installing the cypress-NTLM-Auth The dist/plugin is not created. Can any one please help @bjowes
1: I am using Cypress latest version with cucumber and typeScript.
2: I have added commands in cypress/support/e2e as follows
import './commands'
import 'cypress-ntlm-auth/dist/commands';
3: My cypress.config file contains

  const ntlmAuth = require('cypress-ntlm-auth/dist/plugin');
  module.exports = (on, config) => {
  config = ntlmAuth.initNtlmAuth(config);
  return config;
@MuhammadJawad1214
Copy link
Author

image

@bjowes
Copy link
Owner

bjowes commented Sep 20, 2022

Hi @MuhammadJawad1214 - it seems you are using an older plugin setup. It is much simpler with the current versions, you don't need to put anything (related to cypress-ntlm-auth) in cypress.config.js anymore. Importing the commands (as you have done) is enough. See the Readme for detailed instructions.

@MuhammadJawad1214
Copy link
Author

Thanks @bjowes it works But I am facing some new issues
When i use cy.ntlm So it gives me this error : Property 'ntlm' does not exist on type 'cy & CyEventEmitter'.ts(2339)

@bjowes
Copy link
Owner

bjowes commented Sep 20, 2022 via email

@MuhammadJawad1214
Copy link
Author

I have tried to run with the npx cypress-ntlm while ntlm proxy is running but having this error now on cypress browser

cy.visit() failed trying to load:

https://company-url/

We attempted to make an http request to this URL but the request failed without a response.

We received this error at the network level:

Error: ESOCKETTIMEDOUT

Common situations why this would fail:

  • you don't have internet access
  • you forgot to run / boot your web server
  • your web server isn't accessible
  • you have weird network configuration settings on your computer

@MuhammadJawad1214
Copy link
Author

@bjowes this is the screen shot of the error
image

@bjowes
Copy link
Owner

bjowes commented Sep 20, 2022

It is a bit difficult to keep track when there are several separate issues combined in one thread - just hope I don't mix things up.
From the screenshot we know that the cy.ntlm command was successful, so apparently it works despite the TypeScript warning. Why the cy.visit call fails is more difficult to tell. A few thing to look into:

  • Add a cy.visit to some other site, like https://google.com, see if that works.
  • Enable debug logging (see Readme) for cypress-ntlm-auth to see what happens when it tries to connect to your site
  • Check NodeJs version. I would recommend at least version 16 (all higher versions work), but a high enough variant of 14 will work too.

@MuhammadJawad1214
Copy link
Author

I have tried with googlr.com as well here is the screen shot and the verson of node is as well latest

image

@MuhammadJawad1214
Copy link
Author

When i was running ntlm-cypress without the base url
Missing baseUrl in compilerOptions. tsconfig-paths will be skipped
GET // 200 58.247 ms - -
GET /
/assets/index.e931d5c8.css 200 9.062 ms - -
GET //assets/index.1734f018.js 200 179.758 ms - -
GET /cypress/runner/cypress_runner.css 200 37.181 ms - -
GET /chrome-variations/seed?osname=win&channel=stable&milestone=105 200 1671.271 ms - -
GET //assets/Index.3f8a5084.js 200 45.331 ms - -
GET /
/assets/Specs.677a3b56.js 200 77.013 ms - 485
GET //assets/CreateSpecModal.685918fa.css 200 53.479 ms - 368
GET /
/assets/Index.90fb5fd1.css 200 84.276 ms - -
GET //assets/CreateSpecModal.ebcef919.js 200 78.830 ms - -
GET /
/assets/ResultCounts.684dbff1.js 200 106.543 ms - -
GET //assets/user-outline_x16.da14d39e.js 200 49.895 ms - -
GET /
/assets/SpecPatterns.9f294d4e.js 200 99.021 ms - -
GET //assets/settings_x16.c3221102.js 200 114.413 ms - -
GET /
/assets/cypress_s.29af549a.png 200 61.777 ms - 4425
GET //assets/chrome.1b5cb774.svg 200 19.808 ms - -
GET /cypress/runner/cypress_runner.js 200 130.782 ms - -
GET //assets/edge.e54a3dc2.svg 200 66.499 ms - -
GET /
/assets/electron.fb07f5cc.svg 200 74.471 ms - -
GET /cypress/runner/favicon.ico?v2 200 18.037 ms - -
GET /cypress/assets/favicon.png?v2 404 1.519 ms - 136
GET //assets/Runner.56cb4131.css 200 56.231 ms - -
GET /
/assets/Switch.729f664d.js 200 71.723 ms - -
GET //assets/refresh_x16.646b0b34.js 200 103.256 ms - -
GET /
/assets/Runner.52440353.js 200 91.729 ms - -
GET /__cypress/iframes/cypress%5Ce2e%5Cfeatures%5Clogin.feature 200 53.138 ms - 949
POST /service/update2/json?cup2key=12:kMcA9Si_s0FqqKqKbX73r0O2snS1AwCxkMrTLIyhc7E&cup2hreq=830c4469644b800abc9d4eb197feca33bc3c954600db151bfa7735e5265e9b57 200 1608.747 ms - -
▲ [WARNING] Use "cypress/pages/loginPage.ts" instead of "cypress/pages/LoginPage.ts" to avoid issues with case-sensitive file systems [different-path-case]

cypress/e2e/step_definitions/loginSteps.ts:2:26:
  2 │ const loginPage = require("../../pages/LoginPage");
    ╵                           ~~~~~~~~~~~~~~~~~~~~~~~

▲ [WARNING] Use "cypress/pages/loginPage.ts" instead of "cypress/pages/LoginPage.ts" to avoid issues with case-sensitive file systems [different-path-case]

cypress/e2e/step_definitions/login.js:7:26:
  7 │ const loginPage = require("../../pages/LoginPage");
    ╵                           ~~~~~~~~~~~~~~~~~~~~~~~

GET /__cypress/tests?p=cypress%5Csupport%5Ce2e.js 200 3533.892 ms - -
GET /cypress/tests?p=cypress%5Ce2e%5Cfeatures%5Clogin.feature 200 4777.729 ms - -
GET /
/assets/FiraCode-VariableFont_wght.16865a4d.ttf 200 27.621 ms - -
▲ [WARNING] Use "cypress/pages/loginPage.ts" instead of "cypress/pages/LoginPage.ts" to avoid issues with case-sensitive file systems [different-path-case]

cypress/e2e/step_definitions/login.js:7:26:
  7 │ const loginPage = require("../../pages/LoginPage");
    ╵                           ~~~~~~~~~~~~~~~~~~~~~~~

▲ [WARNING] Use "cypress/pages/loginPage.ts" instead of "cypress/pages/LoginPage.ts" to avoid issues with case-sensitive file systems [different-path-case]

cypress/e2e/step_definitions/loginSteps.ts:2:26:
  2 │ const loginPage = require("../../pages/LoginPage");

@MuhammadJawad1214
Copy link
Author

And this one is initializing the base url as well, The cypress browse is just loading and the error is as follows

GET /__cypress/iframes/cypress%5Ce2e%5Cfeatures%5Clogin.feature 200 0.830 ms - 949
GET /__cypress/tests?p=cypress%5Csupport%5Ce2e.js 200 7.489 ms - -
GET /__cypress/tests?p=cypress%5Ce2e%5Cfeatures%5Clogin.feature 200 35.618 ms - -
Missing baseUrl in compilerOptions. tsconfig-paths will be skipped
Internal error occurred during message handling. Please check your implementation. Error [ERR_STREAM_DESTROYED]: Cannot call write after a stream was destroyed
at new NodeError (node:internal/errors:371:5)
at _write (node:internal/streams/writable:321:11)
at Socket.Writable.write (node:internal/streams/writable:334:10)
at Sender.sendFrame (C:\Users\mujawad\AppData\Local\Cypress\Cache\10.7.0\Cypress\resources\app\packages\graphql\node_modules\ws\lib\sender.js:470:20)
at Sender.send (C:\Users\mujawad\AppData\Local\Cypress\Cache\10.7.0\Cypress\resources\app\packages\graphql\node_modules\ws\lib\sender.js:359:12)
at WebSocket.send (C:\Users\mujawad\AppData\Local\Cypress\Cache\10.7.0\Cypress\resources\app\packages\graphql\node_modules\ws\lib\websocket.js:467:18)
at C:\Users\mujawad\AppData\Local\Cypress\Cache\10.7.0\Cypress\resources\app\node_modules\graphql-ws\lib\use\ws.js:77:24
at new Promise (:null:null)
at Object.send (C:\Users\mujawad\AppData\Local\Cypress\Cache\10.7.0\Cypress\resources\app\node_modules\graphql-ws\lib\use\ws.js:74:29)
at Object.next (C:\Users\mujawad\AppData\Local\Cypress\Cache\10.7.0\Cypress\resources\app\node_modules\graphql-ws\lib\server.js:122:46)
at processTicksAndRejections (node:internal/process/task_queues:96:5)
at onMessage (C:\Users\mujawad\AppData\Local\Cypress\Cache\10.7.0\Cypress\resources\app\node_modules\graphql-ws\lib\server.js:209:41)
at WebSocket. (C:\Users\mujawad\AppData\Local\Cypress\Cache\10.7.0\Cypress\resources\app\node_modules\graphql-ws\lib\use\ws.js:82:21)
{
code: 'ERR_STREAM_DESTROYED'
}

@bjowes
Copy link
Owner

bjowes commented Sep 20, 2022

Really wierd that baseUrl should make such a difference. I have also noticed the Missing baseUrl in compilerOptions. warning in the logs, but according to issues at Cypress, this is related to typescript, not to the baseUrl used by cypress itself.
How about debug logs from cypress-ntlm-auth? See https://github.com/bjowes/cypress-ntlm-auth/blob/master/README.md#debugging
Start cypress-ntlm as described, then run the test against google.com. Then the debug logs should not contain any sensitive information so you can post it here.

@MuhammadJawad1214
Copy link
Author

The above two logs are from the cypress-ntlm-auth followed as it is written in README.md file, I will try again and will share the logs with you

@MuhammadJawad1214
Copy link
Author

MuhammadJawad1214 commented Sep 21, 2022

I am using the ntlm plugin as follows for the google, We really don't need the username and pass for google But it our ntlm usage requires and I implemented like that

cy.ntlm(["google.com"], "mujawad", "pass")
cy.visit("https://google.com")

This is the logs from ntlm-auth logs

GET // 200 5.528 ms - -
GET /
/assets/index.e931d5c8.css 200 7.497 ms - -
GET //assets/index.1734f018.js 200 6.454 ms - -
GET /cypress/runner/cypress_runner.css 200 3.147 ms - -
GET //assets/Specs.677a3b56.js 200 6.114 ms - 485
GET /
/assets/Index.90fb5fd1.css 200 4.540 ms - -
GET //assets/Index.3f8a5084.js 200 5.828 ms - -
GET /
/assets/CreateSpecModal.685918fa.css 200 64.539 ms - 368
GET //assets/ResultCounts.684dbff1.js 200 86.700 ms - -
GET /
/assets/CreateSpecModal.ebcef919.js 200 100.925 ms - -
GET //assets/SpecPatterns.9f294d4e.js 200 103.464 ms - -
GET /
/assets/settings_x16.c3221102.js 200 5.344 ms - -
GET //assets/user-outline_x16.da14d39e.js 200 75.109 ms - -
GET /chrome-variations/seed?osname=win&channel=stable&milestone=105 304 2140.424 ms - -
GET /
/assets/cypress_s.29af549a.png 200 58.023 ms - 4425
GET /cypress/runner/cypress_runner.js 200 7.986 ms - -
GET /
/assets/chrome.1b5cb774.svg 200 2.978 ms - -
GET //assets/edge.e54a3dc2.svg 200 53.252 ms - -
GET /
/assets/electron.fb07f5cc.svg 200 56.574 ms - -
GET /cypress/runner/favicon.ico?v2 200 2.755 ms - -
GET /cypress/assets/favicon.png?v2 404 1.605 ms - 136
GET //assets/Runner.56cb4131.css 200 28.380 ms - -
GET /
/assets/Switch.729f664d.js 200 96.407 ms - -
GET //assets/refresh_x16.646b0b34.js 200 105.939 ms - -
GET /
/assets/Runner.52440353.js 200 110.283 ms - -
GET /__cypress/iframes/cypress%5Ce2e%5Cfeatures%5Clogin.feature 200 87.747 ms - 949
POST /service/update2/json?cup2key=12:2cfVDzKPSdDE0-M7tvjIijaRynGnQd1X1RxrNzcjxGg&cup2hreq=5acd60b2c9ad439f455881d0385c5b01357206585991db4669c680026320af3d 200 1885.172 ms - -
GET /__cypress/tests?p=cypress%5Csupport%5Ce2e.js 200 3090.251 ms - -
GET /cypress/tests?p=cypress%5Ce2e%5Cfeatures%5Clogin.feature 200 3589.807 ms - -
GET /
/assets/FiraCode-VariableFont_wght.16865a4d.ttf 200 24.727 ms - -

@MuhammadJawad1214
Copy link
Author

These are the logs of the ntlm-proxy terminal

cypress-ntlm-auth: Certificate validation failed for "registry.npmjs.org:80". ETIMEDOUT
cypress-ntlm-auth: Certificate validation failed for "download.cypress.io:80". ETIMEDOUT
cypress-ntlm-auth: Certificate validation failed for "clientservices.googleapis.com". ETIMEDOUT
cypress-ntlm-auth: Certificate validation failed for "accounts.google.com". ETIMEDOUT
cypress-ntlm-auth: Certificate validation failed for "content-autofill.googleapis.com". ETIMEDOUT
cypress-ntlm-auth: Certificate validation failed for "update.googleapis.com". ETIMEDOUT
cypress-ntlm-auth: Certificate validation failed for "google.com". ETIMEDOUT
cypress-ntlm-auth: Certificate validation failed for "optimizationguide-pa.googleapis.com". ETIMEDOUT
cypress-ntlm-auth: Certificate validation failed for "safebrowsing.googleapis.com". ETIMEDOUT

@bjowes
Copy link
Owner

bjowes commented Sep 21, 2022 via email

@MuhammadJawad1214
Copy link
Author

This is the log as followed your instructions

GET // 200 39.402 ms - -
GET /
/assets/index.e931d5c8.css 200 33.018 ms - -
GET //assets/index.1734f018.js 200 86.895 ms - -
GET /cypress/runner/cypress_runner.css 200 47.720 ms - -
GET //assets/Specs.677a3b56.js 200 71.674 ms - 485
GET /
/assets/Index.90fb5fd1.css 200 3.537 ms - -
GET //assets/Index.3f8a5084.js 200 72.001 ms - -
GET /
/assets/ResultCounts.684dbff1.js 200 5.524 ms - -
GET //assets/CreateSpecModal.ebcef919.js 200 66.732 ms - -
GET /
/assets/SpecPatterns.9f294d4e.js 200 55.697 ms - -
GET //assets/CreateSpecModal.685918fa.css 200 166.158 ms - 368
GET /
/assets/user-outline_x16.da14d39e.js 200 60.317 ms - -
GET //assets/settings_x16.c3221102.js 200 58.879 ms - -
GET /
/assets/cypress_s.29af549a.png 200 48.558 ms - 4425
GET /chrome-variations/seed?osname=win&channel=stable&milestone=105 304 2165.975 ms - -
GET //assets/chrome.1b5cb774.svg 200 56.671 ms - -
GET /
/assets/electron.fb07f5cc.svg 200 70.331 ms - -
GET //assets/edge.e54a3dc2.svg 200 81.997 ms - -
GET /cypress/runner/cypress_runner.js 200 227.908 ms - -
GET /cypress/runner/favicon.ico?v2 200 32.323 ms - -
GET /cypress/assets/favicon.png?v2 404 1.243 ms - 136
GET //assets/Runner.56cb4131.css 200 34.432 ms - -
GET //assets/Switch.729f664d.js 200 50.725 ms - -
GET //assets/Runner.52440353.js 200 64.733 ms - -
GET /
/assets/refresh_x16.646b0b34.js 200 83.636 ms - -
GET /__cypress/iframes/cypress%5Ce2e%5Cfeatures%5Clogin.feature 200 117.186 ms - 949
POST /service/update2/json?cup2key=12:qXNmI1-YMrjK5HPj6kBwKSwgfTK0zuV4_3qao1Y04Ss&cup2hreq=9b0564b3807361de3c920bbf81e9066e523295f487f8109596dc0684409c8c65 200 1791.893 ms - -
GET /__cypress/tests?p=cypress%5Csupport%5Ce2e.js 200 1335.793 ms - -
GET /cypress/tests?p=cypress%5Ce2e%5Cfeatures%5Clogin.feature 200 2263.666 ms - -
GET /
/assets/FiraCode-VariableFont_wght.16865a4d.ttf 200 32.279 ms - -

@MuhammadJawad1214
Copy link
Author

@bjowes and this is my proxy settings
image

@MuhammadJawad1214
Copy link
Author

and this is how i am using this, Please correct me if i am doing wrong any where
image

@MuhammadJawad1214
Copy link
Author

On other side on ntlm-proxy terminal i got certification failed issues:

cypress-ntlm-auth: Certificate validation failed for "registry.npmjs.org:80". ETIMEDOUT
cypress-ntlm-auth: Certificate validation failed for "download.cypress.io:80". ETIMEDOUT
cypress-ntlm-auth: Certificate validation failed for "clientservices.googleapis.com". ETIMEDOUT
cypress-ntlm-auth: Certificate validation failed for "accounts.google.com". ETIMEDOUT
cypress-ntlm-auth: Certificate validation failed for "content-autofill.googleapis.com". ETIMEDOUT
cypress-ntlm-auth: Certificate validation failed for "update.googleapis.com". ETIMEDOUT
cypress-ntlm-auth: Certificate validation failed for "google.com". ETIMEDOUT
cypress-ntlm-auth: Certificate validation failed for "optimizationguide-pa.googleapis.com". ETIMEDOUT
cypress-ntlm-auth: Certificate validation failed for "safebrowsing.googleapis.com". ETIMEDOUT
cypress-ntlm-auth: Certificate validation failed for "vnext.g2claims-dev.genre.com". UNABLE_TO_GET_ISSUER_CERT_LOCALLY

@bjowes
Copy link
Owner

bjowes commented Sep 21, 2022 via email

@MuhammadJawad1214
Copy link
Author

On other side on ntlm-proxy terminal i got certification failed issues:

cypress-ntlm-auth: Certificate validation failed for "registry.npmjs.org:80". ETIMEDOUT cypress-ntlm-auth: Certificate validation failed for "download.cypress.io:80". ETIMEDOUT cypress-ntlm-auth: Certificate validation failed for "clientservices.googleapis.com". ETIMEDOUT cypress-ntlm-auth: Certificate validation failed for "accounts.google.com". ETIMEDOUT cypress-ntlm-auth: Certificate validation failed for "content-autofill.googleapis.com". ETIMEDOUT cypress-ntlm-auth: Certificate validation failed for "update.googleapis.com". ETIMEDOUT cypress-ntlm-auth: Certificate validation failed for "google.com". ETIMEDOUT cypress-ntlm-auth: Certificate validation failed for "optimizationguide-pa.googleapis.com". ETIMEDOUT cypress-ntlm-auth: Certificate validation failed for "safebrowsing.googleapis.com". ETIMEDOUT cypress-ntlm-auth: Certificate validation failed for "vnext.g2claims-dev.genre.com". UNABLE_TO_GET_ISSUER_CERT_LOCALLY

This log is from ntlm-proxy, please check

@MuhammadJawad1214
Copy link
Author

image

@MuhammadJawad1214
Copy link
Author

cy.ntlm() should be called with your target hosts, like ['google.com'] if that is the site you are testing. You are calling it with the address of the ntlm-proxy. This might lead to some unexpected loop in the plugin, I have not tested this scenario. Change cy.ntlm() to your target and try again. You mentioned before that everything worked a few days ago. This test case cannot have worked before, if that was the cy.ntlm call. Also, the logs you are sharing are still from the terminal where you are launching cypress. You need to share the logs from the terminal where you are running ntlm-proxy.

On Wed, Sep 21, 2022 at 1:36 PM MuhammadJawad1214 @.> wrote: On other side on ntlm-proxy terminal i got certification failed issues: cypress-ntlm-auth: Certificate validation failed for " registry.npmjs.org:80". ETIMEDOUT cypress-ntlm-auth: Certificate validation failed for " download.cypress.io:80". ETIMEDOUT cypress-ntlm-auth: Certificate validation failed for " clientservices.googleapis.com". ETIMEDOUT cypress-ntlm-auth: Certificate validation failed for "accounts.google.com". ETIMEDOUT cypress-ntlm-auth: Certificate validation failed for " content-autofill.googleapis.com". ETIMEDOUT cypress-ntlm-auth: Certificate validation failed for " update.googleapis.com". ETIMEDOUT cypress-ntlm-auth: Certificate validation failed for "google.com". ETIMEDOUT cypress-ntlm-auth: Certificate validation failed for " optimizationguide-pa.googleapis.com". ETIMEDOUT cypress-ntlm-auth: Certificate validation failed for " safebrowsing.googleapis.com". ETIMEDOUT cypress-ntlm-auth: Certificate validation failed for " vnext.g2claims-dev.genre.com". UNABLE_TO_GET_ISSUER_CERT_LOCALLY — Reply to this email directly, view it on GitHub <#216 (comment)>, or unsubscribe https://github.com/notifications/unsubscribe-auth/ABCHR3DJWFLRJ5MIVYUGLD3V7LXNTANCNFSM6AAAAAAQQ5IH3I . You are receiving this because you were mentioned.Message ID: @.>

Yes I have tried with the targeted host as well and still the result is the same issue
No few days ago i was having trouble with starting the ntlm-proxy, My cy.ntlm() is not yet working
I am using VPN along with company proxy as well

The log is from ntlm-proxy terminal, I am sharing the new logs as well
image

@bjowes
Copy link
Owner

bjowes commented Sep 21, 2022 via email

@MuhammadJawad1214
Copy link
Author

MuhammadJawad1214 commented Sep 21, 2022

@bjowes Yes I have applied the proxy configuration as described in the documentation and the cy.visit('https://google.com/') is working perfectly fine without ntlm-proxy But in this case I am not having access to my company URL which is running on proxy that's why I am trying to use NTLM-Plugin. Hopes the plugin helps me accessing the Target URL

NOTE: I am using the VPN and proxy to access the targeted website

@bjowes
Copy link
Owner

bjowes commented Sep 21, 2022 via email

@MuhammadJawad1214
Copy link
Author

I am following the ntlm-auth to access the intranet services. In my case I am having the following things
1: I can access the target url without cypress on chrome browser
2: I can other websites on cypress browser
3: I can not access the target url on cypress browser and this is my case.(I am suppose to solve this problem by using your plugin)

can you think btlm-plugin can solve this issue??? @bjowes please guide if am not on a right path

@bjowes
Copy link
Owner

bjowes commented Sep 22, 2022 via email

@MuhammadJawad1214
Copy link
Author

MuhammadJawad1214 commented Sep 22, 2022

I am adding the above comment with some more detailed info. In my case I am having the following things
1: I can access the target url without cypress on chrome browser
2: I can access other websites on cypress browser (Without ntlm-proxy)
3: I can not access the target url on cypress browser (Without using ntlm-proxy) and this is my case.(I am suppose to solve this problem by using your plugin)

The screen shot shows the step 3 case
image

4: I can't access any of the URLs( Even i cannot access google.com as well ) from cypress browser using NTM-Proxy, This is other case with NTLM_Proxy

@MuhammadJawad1214
Copy link
Author

@bjowes Kindly look into this as I am curious to use you plugin as soon as possible

@bjowes
Copy link
Owner

bjowes commented Sep 22, 2022

I did reply by email but for some reason github didn't post it.
We should start with getting cypress to reach your target site, without ntlm-proxy.
Please read this section about corporate proxies, I am quite convinced that you are missing the NO_PROXY setting. Even though this is documented for the plugin, the same settings are required when running cypress standalone.

@MuhammadJawad1214
Copy link
Author

MuhammadJawad1214 commented Sep 22, 2022

Yes i have followed the documentation as well, please check these are my proxy variables in npm config file and in environmental variable file

image

Note: I have also added the host which i am trying to target But it still does not work

@bjowes
Copy link
Owner

bjowes commented Sep 22, 2022

I am not sure how cypress will behave when you have settings for NO_PROXY both as environment variable and as npm config. When running cypress (without plugin), look in the proxy settings and make sure that NO_PROXY these matches the environment variable. Also make sure you don't set ports, it should just be hostnames (and possibly wildcards) in NO_PROXY

@MuhammadJawad1214
Copy link
Author

MuhammadJawad1214 commented Sep 22, 2022

Not resolved yet
I am having the no proxy environmental variable But it show <-loopback> in cypress proxy configuration

image

And when i am using without NTLM-Proxy, So it shows all the no proxy values that i have added

@bjowes
Copy link
Owner

bjowes commented Sep 22, 2022

Not clear what you mean with the last statement. What does the "Proxy bypass list" say when you run cypress open (not cypress-ntlm open)?
<-loopback> is correct when running with the plugin, since the plugin replaces the NO_PROXY setting for cypress.

@MuhammadJawad1214
Copy link
Author

When I run without ntlm proxy, the cypress configuration show the list of no_proxy variables that i have set for them But in case of ntlm-plugin Its not showing the no proxy variables that i have assigned to it

@bjowes
Copy link
Owner

bjowes commented Sep 22, 2022

Ok, but you have different settings for no_proxy in the npm config and in the environment variable. One of them does not include your target site. Which one shows up in cypress?

@bjowes
Copy link
Owner

bjowes commented Sep 22, 2022

To brute force it, try setting NO_PROXY to *
That should make all requests skip the corporate proxy. Reaching google.com will not work but you should definitely reach your target site. If that works, it means that your current NO_PROXY setting does not match your target URL properly

@MuhammadJawad1214
Copy link
Author

Ok, but you have different settings for no_proxy in the npm config and in the environment variable. One of them does not include your target site. Which one shows up in cypress?

I think the system environmental variable shows up in cypress, i have removed the no proxy from npm config file

@MuhammadJawad1214
Copy link
Author

To brute force it, try setting NO_PROXY to * That should make all requests skip the corporate proxy. Reaching google.com will not work but you should definitely reach your target site. If that works, it means that your current NO_PROXY setting does not match your target URL properly

In this case( NO_PROXY = * ) both the target url and other URLs are not working, I have tried this with both NTLM-Plugin and without NTLM-proxy

@bjowes
Copy link
Owner

bjowes commented Sep 23, 2022

Well, this means that when bypassing the corporate proxy, you cannot reach google.com (expected), but you also cannot reach your target site. This makes me doubt that your target site really is reachable without going through the corporate proxy. Could you please confirm this?
One possibility is that there are multiple proxy servers within the network, and different proxy servers should be used for different sites. This kind of advanced setup is supported by Windows, but it is not supported by cypress or the plugin. Cypress and the plugin only supports one corporate proxy. That could work, as long as you only need one for your site, but if your target site uses both internal resources and external resources (from the internet) it will not work, since those resources would need to be loaded through different proxies.

@MuhammadJawad1214
Copy link
Author

is makes me doubt that your target site really is reachable without going through the corporate proxy. Could you please confirm this?

Yes my target website is reachable using VPN without using proxy.

@bjowes
Copy link
Owner

bjowes commented Sep 23, 2022

Please explain "using VPN". I presume you have a VPN client on your machine, and use it to connect to the corporate network. Once connected, you can access the target site (and likely other intranet resources). Correct?
When you say you "reachable without using proxy", how do you test this? If you use the web browser, it will automatically use the proxy settings from Windows. Do you manually disable those and then try to access the site?

@MuhammadJawad1214
Copy link
Author

MuhammadJawad1214 commented Sep 23, 2022

yes you're correct @bjowes, if i am connected to VPN then i can access the target site.

Hmmm I have tried once again So When I turned Off my proxy manually, I will not be able to connect to either of the target site or any other website like google.com, it means that without using proxy i am not able to use the internet on browser

@bjowes
Copy link
Owner

bjowes commented Sep 23, 2022

Yes, and it means that you cannot reach the target site without proxy.
It could also mean that there are different proxies required for different sites.

Try to understand the windows proxy settings in detail to see if this is the case. Usually a "Proxy PAC" file is used for these advanced setups. That file contains logic to find which proxy to use for each site. Or ask someone who knows your corporate network in more detail which proxy is the correct one to use for your target site

@MuhammadJawad1214
Copy link
Author

Yes @bjowes you are right. Basically we are using different proxies for different websites.

So what will be the solution in this case??
If I add the proxy to my "http_proxy" environment variable that is used by the target URL, can it solve the problem?

@MuhammadJawad1214
Copy link
Author

@bjowes have you idea on this regarding this case?

@bjowes
Copy link
Owner

bjowes commented Sep 26, 2022

Thanks for confirming. We could have saved some effort if this was clear from the start.

Cypress and the plugin (and most node.js based things) only supports ONE http proxy.
Your best bet is to replace the current http_proxy setting (and https_proxy if applicable) with only the proxy for your target site. (Also remove it from the no_proxy setting). This will allow cypress and the plugin to reach your target site. However, if your site is also dependent on external resources (such as loading fonts from google), that won't work since cypress and the plugin cannot use the appropriate http_proxy required to reach external resources. If your site works standalone, you should be fine.

@MuhammadJawad1214
Copy link
Author

Finally it works for me, By the way the issue was with the domain password.
Thanks @bjowes for the wonderful plugin and thanks for the support as well.
I am closing the issue

@bjowes
Copy link
Owner

bjowes commented Oct 11, 2022 via email

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

No branches or pull requests

2 participants