bjowes / cypress-ntlm-auth

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

Unable to authenticate running cypress ntlm #218

Closed 600rob closed 1 year ago

600rob commented 2 years ago

Hi Im trying to get this plug into work with cypress version 10 on an angular application, windows auth. Ive installed the plugin successfully but when I run my test, it fails on

const validationResult = ConfigValidator.validate(ntlmConfig); if (!validationResult.ok) { throw new Error(validationResult.message); }

Resulting in the following error from the cypress test runner:

'Username contains invalid characters or is too long'

Im attempting to navigate to the url using the following approach

cy.ntlm(['localhost:1234'], 'ABC\firstname.lastmane', 'password') cy.visit('https://localhost:1234')

note my username contains a single \ in the string.

i.e ‘ABC\firstname.lasname’

Ive double checked that my username is correct by entering the user credentials manually in the windows authentication pop up and that works okay.

Tried running the tests without ntlm and i get slightly different result in that the app does not load properly. (probably due to not authenticating) but i think

Do you have any suggestions on what the issue may be? p.s. apologies for raising this as an issue as i imagine this is probably more of a config/setup thing on my side but ive not been able to find an answer online.

bjowes commented 2 years ago

Hi, The form ABC\username is actually a combination of domain name and user name. The domain name is often not required, but you can specify it as a fourth argument to cy.ntlm. Don't include it in the username argument. So your example would become: cy.ntlm(['localhost:1234'], 'firstname.lastmane', 'password', 'ABC')

On Wed, Sep 28, 2022 at 6:40 PM 600rob @.***> wrote:

Hi Im trying to get this plug into work with cypress version 10 on an angular application, windows auth. Ive installed the plugin successfully but when I run my test, it fails on

const validationResult = ConfigValidator.validate(ntlmConfig); if (!validationResult.ok) { throw new Error(validationResult.message); }

Resulting in the following error from the cypress test runner:

'Username contains invalid characters or is too long'

Im attempting to navigate to the url using the following approach

cy.ntlm(['localhost:1234'], 'ABC\firstname.lastmane', 'password') cy.visit('https://localhost:1234')

note my username contains a single \ in the string.

i.e ‘ABC\firstname.lasname’

Ive double checked that my username is correct by entering the user credentials manually in the windows authentication pop up and that works okay.

Tried running the tests without ntlm and i get slightly different result in that the app does not load properly. (probably due to not authenticating) but i think

Do you have any suggestions on what the issue may be? p.s i appreciate this is probably not an actual issue but ive not been able to find an answer online

— Reply to this email directly, view it on GitHub https://github.com/bjowes/cypress-ntlm-auth/issues/218, or unsubscribe https://github.com/notifications/unsubscribe-auth/ABCHR3CIN547QOYWBEB2JD3WARYI3ANCNFSM6AAAAAAQX62YUU . You are receiving this because you are subscribed to this thread.Message ID: @.***>

bjowes commented 1 year ago

Closing, please reopen if the problem persists.