jeudi 18 mars 2021

Testcafe issues with OKTA OAuth login page

We use OKTA to login to our portal. Users visit our website page, where they click Login, then we redirect them to OKTA login page. Once they enter the credentials and authenticate themselves we redirect users to our portal home page. For some reason Testcafe fails the test as in it cannot find the HTML element after the login. I can see the running test enter credentials but does not navigate to our portal home page. This is not the experience when I browse myself. Is there some additional settings for OAuth?

let testURL:string = 'https://mysite/home';

const myUserRole = Role('https://mysite/login', async t => {
    await t
    .click(Selector('#btnLogin')) // click on the login link , takes to OKTA login page
    .typeText(Selector('#okta-signin-username'),"username")
    .typeText(Selector('#okta-signin-password'),"password")
    .click(Selector('#okta-signin-submit'));
});

fixture('Test1')
.page(testURL)
test('Create new records', async t => {

    await t
    .useRole(myUserRole)    // the login process
    .click(Selector('#myelement'));   // <<<<<<<<<<<<<<<< cannot find this element
});

Aucun commentaire:

Enregistrer un commentaire