bjowes / cypress-ntlm-auth

Windows authentication plugin for Cypress
MIT License
54 stars 9 forks source link

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 closed 1 year ago

MuhammadJawad1214 commented 1 year ago

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 commented 1 year ago

image

bjowes commented 1 year ago

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 commented 1 year ago

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 commented 1 year ago

Try to run it, I think it still works. The error you are seeing is a typescript error, meaning it could not locate the command types for the plugin. I can take a look at that later.

On Tue, Sep 20, 2022 at 1:22 PM MuhammadJawad1214 @.***> wrote:

Thanks @bjowes https://github.com/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)

— Reply to this email directly, view it on GitHub https://github.com/bjowes/cypress-ntlm-auth/issues/216#issuecomment-1252210146, or unsubscribe https://github.com/notifications/unsubscribe-auth/ABCHR3E2DJLN2HZWZDDCFYLV7GM6TANCNFSM6AAAAAAQQ5IH3I . You are receiving this because you were mentioned.Message ID: @.***>

MuhammadJawad1214 commented 1 year ago

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:

MuhammadJawad1214 commented 1 year ago

@bjowes this is the screen shot of the error image

bjowes commented 1 year ago

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:

MuhammadJawad1214 commented 1 year ago

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

image

MuhammadJawad1214 commented 1 year ago

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 commented 1 year ago

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 commented 1 year ago

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 commented 1 year ago

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 commented 1 year ago

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 commented 1 year ago

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 commented 1 year ago

You need to set the DEBUG variable in the ntlm-proxy terminal, before starting it. The interesting logs will end up there. When running without external ntlm-proxy, all logs end up in the cypress-ntlm terminal.

On Wed, Sep 21, 2022 at 9:35 AM MuhammadJawad1214 @.***> wrote:

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

— Reply to this email directly, view it on GitHub https://github.com/bjowes/cypress-ntlm-auth/issues/216#issuecomment-1253320897, or unsubscribe https://github.com/notifications/unsubscribe-auth/ABCHR3A2PZG2HQTVFXZHJ2LV7K3EDANCNFSM6AAAAAAQQ5IH3I . You are receiving this because you were mentioned.Message ID: @.***>

MuhammadJawad1214 commented 1 year ago

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 commented 1 year ago

@bjowes and this is my proxy settings image

MuhammadJawad1214 commented 1 year ago

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

MuhammadJawad1214 commented 1 year ago

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 commented 1 year ago

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 https://github.com/bjowes/cypress-ntlm-auth/issues/216#issuecomment-1253580841, or unsubscribe https://github.com/notifications/unsubscribe-auth/ABCHR3DJWFLRJ5MIVYUGLD3V7LXNTANCNFSM6AAAAAAQQ5IH3I . You are receiving this because you were mentioned.Message ID: @.***>

MuhammadJawad1214 commented 1 year ago

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 commented 1 year ago

image

MuhammadJawad1214 commented 1 year ago

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 commented 1 year ago

ETIMEDOUT looks better than socket error. My best bet is your company proxy. Try running cypress without the plugin, can you do cy.visit('https://google.com')? If no, you are missing company proxy configuration. See https://docs.cypress.io/guides/references/proxy-configuration#Set-a-proxy-on-Windows In short, you need to set HTTP_PROXY environment variable to the URL of your corporate proxy. Do this before you launch cypress-ntlm, and the plugin will adjust the settings to cypress automatically. Note: If the corporate proxy also requires windows authentication, neither cypress nor this plugin will work :(

On Wed, Sep 21, 2022 at 2:24 PM MuhammadJawad1214 @.***> wrote:

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. … <#m-654911907380230631> 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 http://registry.npmjs.org:80". ETIMEDOUT cypress-ntlm-auth: Certificate validation failed for " download.cypress.io:80 http://download.cypress.io:80". ETIMEDOUT cypress-ntlm-auth: Certificate validation failed for " clientservices.googleapis.com http://clientservices.googleapis.com". ETIMEDOUT cypress-ntlm-auth: Certificate validation failed for "accounts.google.com http://accounts.google.com". ETIMEDOUT cypress-ntlm-auth: Certificate validation failed for " content-autofill.googleapis.com http://content-autofill.googleapis.com". ETIMEDOUT cypress-ntlm-auth: Certificate validation failed for " update.googleapis.com http://update.googleapis.com". ETIMEDOUT cypress-ntlm-auth: Certificate validation failed for "google.com http://google.com". ETIMEDOUT cypress-ntlm-auth: Certificate validation failed for " optimizationguide-pa.googleapis.com http://optimizationguide-pa.googleapis.com". ETIMEDOUT cypress-ntlm-auth: Certificate validation failed for " safebrowsing.googleapis.com http://safebrowsing.googleapis.com". ETIMEDOUT cypress-ntlm-auth: Certificate validation failed for " vnext.g2claims-dev.genre.com http://vnext.g2claims-dev.genre.com". UNABLE_TO_GET_ISSUER_CERT_LOCALLY — Reply to this email directly, view it on GitHub <#216 (comment) https://github.com/bjowes/cypress-ntlm-auth/issues/216#issuecomment-1253580841>, or unsubscribe https://github.com/notifications/unsubscribe-auth/ABCHR3DJWFLRJ5MIVYUGLD3V7LXNTANCNFSM6AAAAAAQQ5IH3I 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: image] https://user-images.githubusercontent.com/113983022/191502890-ad6a60a1-4dc9-4c28-b2ee-f3e4898c5550.png

— Reply to this email directly, view it on GitHub https://github.com/bjowes/cypress-ntlm-auth/issues/216#issuecomment-1253633860, or unsubscribe https://github.com/notifications/unsubscribe-auth/ABCHR3EVIYJL4PJMZYHKP6DV7L5A3ANCNFSM6AAAAAAQQ5IH3I . You are receiving this because you were mentioned.Message ID: @.***>

MuhammadJawad1214 commented 1 year ago

@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 commented 1 year ago

Could you please describe your use case in more detail what do you mean that you don’t have access to “my company URL”?

Simply put, if you can use a browser (no cypress), access your target site and enter your credentials in the login prompt, and this works, then the plug-in can help you to remove the login step (which is not compatible with automated testing). That is the only purpose of the plug-in. If you cannot reach the target URL through manual means, the plug-in won’t help.

ons 21 sep. 2022 kl. 15:09 skrev MuhammadJawad1214 @.***

:

@bjowes https://github.com/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 using NTLM-Plugin. Hopes the plugin helps me accessing the Target URL

— Reply to this email directly, view it on GitHub https://github.com/bjowes/cypress-ntlm-auth/issues/216#issuecomment-1253688066, or unsubscribe https://github.com/notifications/unsubscribe-auth/ABCHR3GUMIBJ4TUZNW4LY5LV7MCJDANCNFSM6AAAAAAQQ5IH3I . You are receiving this because you were mentioned.Message ID: @.***>

-- /Björn W

Skickat från min iPhone

MuhammadJawad1214 commented 1 year ago

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 commented 1 year ago

From that description, it seems like the correct use case. When you state that cypress can access other websites but not the target url, how does cypress respond? Do you get a login prompt or something else? If you get a login prompt, then the plugin should help. If you get some other network error, you first need to resolve that. A network error could for instance be caused by the corporate proxy, if the target url server is inside your network and connections should not pass through the corporate proxy. If this is the case, you need to add the hostname of the target url (and any other internal hostnames it uses) to the NO_PROXY environment variable before starting the ntlm-proxy. This will ensure that connections to the hosts in NO_PROXY will not be passed through the corporate proxy.

On Thu, Sep 22, 2022 at 7:32 AM MuhammadJawad1214 @.***> wrote:

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 https://github.com/bjowes please guide if am not on a right path

— Reply to this email directly, view it on GitHub https://github.com/bjowes/cypress-ntlm-auth/issues/216#issuecomment-1254548069, or unsubscribe https://github.com/notifications/unsubscribe-auth/ABCHR3CYVPDYCAB5MBXQBP3V7PVNTANCNFSM6AAAAAAQQ5IH3I . You are receiving this because you were mentioned.Message ID: @.***>

MuhammadJawad1214 commented 1 year ago

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 commented 1 year ago

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

bjowes commented 1 year ago

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 commented 1 year ago

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 commented 1 year ago

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 commented 1 year ago

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 commented 1 year ago

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 commented 1 year ago

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 commented 1 year ago

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 commented 1 year ago

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 commented 1 year ago

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 commented 1 year ago

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 commented 1 year ago

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 commented 1 year ago

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 commented 1 year ago

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 commented 1 year ago

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 commented 1 year ago

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 commented 1 year ago

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 commented 1 year ago

@bjowes have you idea on this regarding this case?

bjowes commented 1 year ago

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 commented 1 year ago

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 commented 1 year ago

Ok, but let’s start with getting cypress to reach the target url. Did you look into the NO_PROXY setting?

tors 22 sep. 2022 kl. 08:52 skrev MuhammadJawad1214 < @.***>:

I am just updating the above comment. 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)

[image: image] https://user-images.githubusercontent.com/113983022/191677479-e0e1eb65-3019-4357-baaf-71d951fc7f8d.png

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

— Reply to this email directly, view it on GitHub https://github.com/bjowes/cypress-ntlm-auth/issues/216#issuecomment-1254603968, or unsubscribe https://github.com/notifications/unsubscribe-auth/ABCHR3BR4CSILZXK2B3P3RDV7P6ZTANCNFSM6AAAAAAQQ5IH3I . You are receiving this because you were mentioned.Message ID: @.***>

-- /Björn W

Skickat från min iPhone