Closed sjbarbosa closed 1 year ago
How to set CYPRESS_NTLM_AUTH_API
and CYPRESS_NTLM_AUTH_PROXY
?
Those are set by cypress-ntlm automatically. They can be set if there is a need to have the same ports used every time, but otherwise it is not needed.
How is the github action started? From the error message it seems that cypress is started with the cypress
command rather than with cypress-ntlm
.
When executing in that environment you likely want cypress-ntlm run
rather than open
since run is for headless execution.
@bjowes I added this yml file on my repo
name: Cypress Tests
on: [push]
jobs:
Cypress-Test:
runs-on: windows-latest
steps:
- name: Checkout
uses: actions/checkout@v3
- name: Run Cypress Test
uses: cypress-io/github-action@v5
with:
command: cypress-ntlm run
browser: chrome
Then I had this error Error: Unable to locate executable file: cypress-ntlm. Please verify either the file path exists or the file can be found within a directory specified by the PATH environment variable. Also verify the file has a valid extension for an executable file.
You are using the pre-made cypress action for GitHub. By default it will run cypress, not cypress-ntlm. It might be possible to adapt it to run cypress-ntlm, and you seem to be on the right track by using https://github.com/cypress-io/github-action#custom-test-command
From the examples in the docs I would expect that command should be
npx cypress-ntlm run
It is strange though that you didn't get another error message from your attempt, because the message you received means that cypress was started normally. It shouldn't have started at all if the custom command was actually used. Maybe it is a fallback feature, or the custom command feature is flaky.
Also note, you are specifying the browser after the command in your YAML. The docs state that that option (and many others) are ignored when you use the custom command - such settings would need to be put directly into the custom command.
Personally I would probably have used a plain npm action instead and gone from there.
When running on Github Actions, I'm getting this error:
Error: The cypress-ntlm-auth plugin must be loaded before using this method
package.json
"scripts": { "ntlm-proxy": "start /min \"ntlm-proxy\" cmd /c npx ntlm-proxy", "cypress-ntlm": "npm run ntlm-proxy && (cypress-ntlm open & ntlm-proxy-exit)", "test": "npm run cypress-ntlm" }
test.js
cy.ntlm(['myurl.com'], username, password); cy.visit('https://myurl.com', {failOnStatusCode: false});