Closed RuslanAisin closed 1 year ago
When using the cy.ntlm, cy.ntlmSso or cy.ntlmReset commands, they look for the environment variable CYPRESS_NTLM_AUTH_API
, which is set automatically when you can use cypress-ntlm. It is not set when starting ntlm-proxy.
Likely, the easiest way for you to get this working is to set CYPRESS_NTLM_AUTH_API
to some port that is free in your docker instance, for instance set it to http://localhost:54800
. This forces ntlm-proxy to use that port (it will crash if it is occupied) and cy.ntlm etc will know how to reach ntlm-proxy.
Thank you for response, I add ENV in Dockerfile
ENV CYPRESS_NTLM_AUTH_API="http://localhost:54800"
and run command
npx ntlm-proxy & cypress-cloud --browser chrome --record --parallel --ci-build-id manual-Staging-test-993 --key key
but have the same error
{
12:16:23 configApiUrl: 'http://127.0.0.1:54800',
12:16:23 ntlmProxyUrl: 'http://127.0.0.1:35205'
12:16:23 }
12:16:23
12:16:23 ====================================================================================================
12:16:23
12:16:23 Discovered 111 spec files
12:16:23 Tags: false; Group: false; Parallel: true; Batch Size: 3
12:16:23 Connecting to cloud orchestration service...
12:16:23 Run URL: http://sorry-cypress.*******/run/3f69084b05f6c612f303eff6c83dfd8a
12:16:23
12:16:23 ====================================================================================================
12:16:23
12:16:23 Running: cypress/e2e/Positive case.spec.js (1/111)
12:16:23 [337:0525/121622.795775:ERROR:zygote_host_impl_linux.cc(263)] Failed to adjust OOM score of renderer with pid 504: Permission denied (13)
12:16:23
12:16:23 DevTools listening on ws://127.0.0.1:34047/devtools/browser/e3cab2d7-7d88-4944-8c0e-a341d86805f4
12:16:23 [504:0525/121622.852296:ERROR:gpu_memory_buffer_support_x11.cc(44)] dri3 extension not supported.
12:16:24
12:16:24 ====================================================================================================
12:16:24
12:16:24 (Run Starting)
12:16:24
12:16:24 ┌────────────────────────────────────────────────────────────────────────────────────────────────┐
12:16:24 │ Cypress: 12.13.0 │
12:16:24 │ Browser: Chrome 113 (headless) │
12:16:24 │ Node Version: v16.17.0 (/usr/local/bin/node) │
12:16:24 │ Specs: 1 found (Positive case.spec.js) │
12:16:24 │ Searched: cypress/e2e/Positive case.spec.js │
12:16:24 └────────────────────────────────────────────────────────────────────────────────────────────────┘
12:16:24
12:16:24
12:16:24 ────────────────────────────────────────────────────────────────────────────────────────────────────
12:16:24
12:16:24 Running: Positive case.spec.js (1 of 1)
12:16:24 setting the browser window size to 2000 1450
12:16:31
12:16:31
12:16:31 Positive case
12:16:32 (Attempt 1 of 2) Positive case
12:16:32 1) Positive case
12:16:32
12:16:32
12:16:32 0 passing (993ms)
12:16:32 1 failing
12:16:32
12:16:32 1) Positive case
12:16:32 Positive case
12:16:32 Error: The cypress-ntlm-auth plugin must be loaded before using this method
Sorry, I missed a few additional variables that must be set. The complete list:
# set before starting ntlm-proxy
CYPRESS_NTLM_AUTH_API="http://localhost:54800"
CYPRESS_NTLM_AUTH_PROXY="http://localhost:54801"
# set after ntlm-proxy but before calling cypress
HTTP_PROXY="http://localhost:54801"
HTTPS_PROXY="http://localhost:54801"
NO_PROXY="<-loopback>"
The last three affects how several apps/tools communicate with HTTP servers, in particular if they are built in Node.js. Ideally those three should only be in effect during the execution of cypress, if you need to run any cleanup tasks after the tests you might unset them first. In theory other apps can communicate through the NTLM proxy too, but just to rule out potential issues you can avoid that.
Amazing! Thats good working. Thanks a lot! 👍
Hello, I tryed run command in CI
npx ntlm-proxy &
with commandcypress-cloud
for parallel testing, but I getError: The cypress-ntlm-auth plugin must be loaded before using this method
On the one hand I sussesful run tests with commandnpx cypress-ntlm run
but cant use parallel run on the other hand cypress-cloud cant get ntlm auth. Can we solve it? my Dockerfilerun command - npx ntlm-proxy & cypress-cloud --record --parallel --ci-build-id Staging-test --key test
{ 13:34:43 configApiUrl: 'http://127.0.0.1:44835', 13:34:43 ntlmProxyUrl: 'http://127.0.0.1:39229' 13:34:43 } 13:34:43 13:34:43 ==================================================================================================== 13:34:43 13:34:43 Discovered 111 spec files 13:34:43 Tags: false; Group: false; Parallel: true; Batch Size: 3 13:34:43 Connecting to cloud orchestration service... 13:34:44 Run URL: http://sorry-cypress.************su:80/run/ 13:34:44 13:34:44 ==================================================================================================== 13:34:44 13:34:44 Running: cypress/e2e/test_positive.spec.js (1/111) 13:34:45 [330:0523/133445.065580:ERROR:zygote_host_impl_linux.cc(263)] Failed to adjust OOM score of renderer with pid 494: Permission denied (13) 13:34:45 13:34:45 DevTools listening on ws://127.0.0.1:43687/devtools/browser/1f2e995a-f7ea-49de-b85e-6d939df4e77c 13:34:45 [494:0523/133445.105270:ERROR:gpu_memory_buffer_support_x11.cc(44)] dri3 extension not supported. 13:34:49 13:34:49 ==================================================================================================== 13:34:49 13:34:49 (Run Starting) 13:34:49 13:34:49 ┌────────────────────────────────────────────────────────────────────────────────────────────────┐ 13:34:49 │ Cypress: 12.12.0 │ 13:34:49 │ Browser: Electron 106 (headless) │ 13:34:49 │ Node Version: v16.17.0 (/usr/local/bin/node) │ 13:34:49 │ Specs: 1 found (test_positive.spec.js) │ 13:34:49 │ Searched: cypress/e2e/test_positive.spec.js │ 13:34:49 └────────────────────────────────────────────────────────────────────────────────────────────────┘ 13:34:49 13:34:49 13:34:49 ──────────────────────────────────────────────────────────────────────────────────────────────────── 13:34:49 13:34:49 Running: test_positive.spec.js (1 of 1) 13:34:49 setting the browser window size to 2000 1450 13:34:49 [330:0523/133449.897514:ERROR:zygote_host_impl_linux.cc(263)] Failed to adjust OOM score of renderer with pid 599: Permission denied (13) 13:34:50 [530:0523/133450.014377:ERROR:socket_posix.cc(93)] CreatePlatformSocket() failed: Address family not supported by protocol (97) 13:34:50 [530:0523/133450.195004:ERROR:socket_posix.cc(93)] CreatePlatformSocket() failed: Address family not supported by protocol (97) 13:34:50 [530:0523/133450.352178:ERROR:socket_posix.cc(93)] CreatePlatformSocket() failed: Address family not supported by protocol (97) 13:34:50 [530:0523/133450.358167:ERROR:socket_posix.cc(93)] CreatePlatformSocket() failed: Address family not supported by protocol (97) 13:34:50 [530:0523/133450.872632:ERROR:socket_posix.cc(93)] CreatePlatformSocket() failed: Address family not supported by protocol (97) 13:34:51 [530:0523/133450.997916:ERROR:socket_posix.cc(93)] CreatePlatformSocket() failed: Address family not supported by protocol (97) 13:34:51 [530:0523/133451.008799:ERROR:socket_posix.cc(93)] CreatePlatformSocket() failed: Address family not supported by protocol (97) 13:34:51 [530:0523/133451.017283:ERROR:socket_posix.cc(93)] CreatePlatformSocket() failed: Address family not supported by protocol (97) 13:34:51 [530:0523/133451.214635:ERROR:socket_posix.cc(93)] CreatePlatformSocket() failed: Address family not supported by protocol (97) 13:34:59 13:34:59 13:34:59 Test 13:35:00 13:35:00 0 passing (867ms) 13:35:00 1 failing 13:35:00 13:35:00 1) Test 13:35:00 Positive case: 13:35:00 Error: The cypress-ntlm-auth plugin must be loaded before using this method 13:35:00 at Context.ntlm (webpack:////usr/local/lib/node_modules/cypress-ntlm-auth/dist/commands/index.js:35:0) 13:35:00
checked docker image
node@cypress-run-tests-staging-test-b2w8d:/usr/local/lib/node_modules/cypress-ntlm-auth/dist/commands$ cat index.js
file is presentin cypress/support/e2e.js
import "/usr/local/lib/node_modules/cypress-ntlm-auth/dist/commands";