I have an App that loads a report i am trying to time. The app auto redirects to microsoft SSO where i enter the username and password. I can run the test on a single VU fine, but when i ramp it up to the desired 8 users i start seeing errors like these, likely at the redirect:
: execution context changed; most likely because of a navigation
: getting new document handle: getting document element handle: execution context changed; most likely because of a navigation
I see some of the navigation based waits are not implemented yet and unsure of how to proceed. I’m using the new promise framework as shown on Browser Module Documentation instead of awaits.
Any help would be appreciated.
The script:
page
.goto(‘https://MyAppUrl’, {
waitUntil: ‘networkidle’,
timeout: 30000
})
.then(() => {
return Promise.all([
console.log(‘waiting for login’),
page.waitForLoadState(‘networkidle’, {timeout: 30000}),
]).then(() => {
// Wait for redirect to SSO login page complete
return Promise.all([
//enter Username only
page.waitForSelector(‘input[name=“loginfmt”]’, {timeout: 30000}),
page.locator(‘input[name=“loginfmt”]’).type(‘user@domain.com’),
page.locator(‘input[value=“Next”]’).click(),
]).then(() => {
return Promise.all([
//wait for password field to display and enter the values
page.waitForSelector(‘div[id=“displayName”]’, {state: ‘visible’}),
page.locator(‘input[name=“passwd”]’).focus(),
page.locator(‘input[name=“passwd”]’).type(‘verySecurePassword’),
page.locator(‘input[value=“Sign in”]’).click(),
page.waitForNavigation(),
page.waitForLoadState(‘networkidle’),