Test.httpAuth Method

Specifies the credentials for HTTP Basic and Windows (NTLM) authentication.

test.httpAuth(credentials) → this
Parameter Type Description
credentials Object Contains credentials used for authentication.

The credentials parameter has the following properties.

Parameter Type Description
username String The user name for the account.
password String The password for the account.
domain (optional) String The domain name.
workstation (optional) String The workstation's ID in the local network.

The credentials parameter requires username and password. For NTLM authentication, the server may require additional information, such as the workstation ID and the domain name.

TestCafe uses credentials specified with test.httpAuth for all requests that require authentication in the test. To specify credentials for all tests in a fixture, use the fixture.httpAuth method.