Skip to content

Commit

Permalink
Check for alert dialog when doing a force logout (#59329) (#59594)
Browse files Browse the repository at this point in the history
Co-authored-by: Elastic Machine <elasticmachine@users.noreply.github.com>
  • Loading branch information
brianseeders and elasticmachine authored Mar 10, 2020
1 parent 5005434 commit c8a5b63
Showing 1 changed file with 12 additions and 11 deletions.
23 changes: 12 additions & 11 deletions x-pack/test/functional/page_objects/security_page.js
Original file line number Diff line number Diff line change
Expand Up @@ -110,12 +110,7 @@ export function SecurityPageProvider({ getService, getPageObjects }) {
}

await userMenu.clickLogoutButton();

await retry.waitForWithTimeout(
'login form',
config.get('timeouts.waitFor') * 5,
async () => await find.existsByDisplayedByCssSelector('.login-form')
);
await this.waitForLoginForm();
}

async forceLogout() {
Expand All @@ -129,11 +124,17 @@ export function SecurityPageProvider({ getService, getPageObjects }) {
const url = PageObjects.common.getHostPort() + '/logout';
await browser.get(url);
log.debug('Waiting on the login form to appear');
await retry.waitForWithTimeout(
'login form',
config.get('timeouts.waitFor') * 5,
async () => await find.existsByDisplayedByCssSelector('.login-form')
);
await this.waitForLoginForm();
}

async waitForLoginForm() {
await retry.waitForWithTimeout('login form', config.get('timeouts.waitFor') * 5, async () => {
const alert = await browser.getAlert();
if (alert && alert.accept) {
await alert.accept();
}
return await find.existsByDisplayedByCssSelector('.login-form');
});
}

async clickRolesSection() {
Expand Down

0 comments on commit c8a5b63

Please sign in to comment.