Skip to content Skip to footer

NTLM authentication for Cypress

Install the cypress-ntlm-auth package by using the below commandsnpm install –save-dev cypress-ntlm-auth

After successfully installing the plugin, we can see the NTLM information in the package.json file

The --save-dev flag stores cypress-ntlm-auth as a development dependency suitable for a testing utility.

Commands

In the file cypress/support/commands.js (or .ts) add this lineimport “cypress-ntlm-auth/dist/commands”;

Refer to the below example 

Create a function in utility > common.js & use it in another spec file

NOTE: Make sure the HOSTNAME is correct.

See the below example: Import in the spec file and use that function

Now, we are done with our configuration.

The most convenient way to start Cypress with NTLM authentication isnpx cypress-ntlm open

EXAMPLE – Error Message: Not properly configured for NTLM

EXAMPLE – Success Message: Properly configured for NTLM

That is it! Thank you very much for reading!

Refer URL: https://www.npmjs.com/package/cypress-ntlm-auth