Методы test.httpAuth
из fixture.httpAuth
предназначены для указания учетных данных, которые будут использоваться отдельным тестом или прибором, поэтому эти методы следует использовать в контексте test
или fixture
, но не в контекст testController
.
Вы не можете использовать httpAuth
внутри тестового тела.
Пожалуйста, смотрите пример из документации (http://devexpress.github.io/testcafe/documentation/test-api/authentication/http-authentication.html):
fixture `My fixture`
.page `http://example.com`
.httpAuth({
username: 'username',
password: 'Pa$$word',
// Optional parameters, can be required for the NTLM authentication.
domain: 'CORP-DOMAIN',
workstation: 'machine-win10'
});
test('Test1', async t => {}); // Logs in as username
test // Logs in as differentUserName
.httpAuth({
username: 'differentUserName',
password: 'differentPa$$word'
})
('Test2', async t => {});