mercredi 27 mai 2020

TestCafe How to authenticate Active Directory Windows Security prompt in Internet Explorer

Authentication to the website I am testing happens via Active Directory (AD). Normally you are redirected from the website URL to the active directory page which will look like this:

enter image description here

The above is how it looks on Chrome, FireFox and Edge. Login using Roles works perfectly.

However, this does not work on Internet Explorer. On IE, instead of being redirected to the page, you are prompted with the following Windows Security prompt

enter image description here

I have tried using httpAuth to authenticate instead, but without luck:

fixture `Login Tests`
    .page `https://myurl.com`

test
    .httpAuth({
        username: "myusrename",
        password: "mypassword", 
        domain: 'MYDOMAIN'
    })("Sign in with valid credentials successfully signs in", async t => {
        await t
            .expect(Selector("title").innerText).eql("ExpectedTitle")
});

The above test works (when using roles) in all the other browsers:

test("Sign In with valid credentials successfully  logs in", async t => {
        await t
            .useRole(validAccount)
            .expect(Selector("title").innerText).eql("HRCore")
});

When running the test in IEs, the prompt does not appear as opposed to opening IE myself and navigating to the URL. In the TestCafe IE instance, all I see is a blank website (redirected to the AD URL).

Aucun commentaire:

Enregistrer un commentaire