Test.httpAuth Method

Specifies test-wide credentials for HTTP Basic and Windows (NTLM) authentication.

Browsers do not display native browser authentication prompts when TestCafe authenticates the user.

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 Username
password String Password
domain (optional) String Domain name.
workstation (optional) String The workstation’s local network ID

The username and password properties are mandatory. Windows (NTLM) authentication may require additional information, such as workstation ID and domain name.

To specify credentials for all tests in a fixture, use the fixture.httpAuth method.