From 8eaa2ca83590ea659c74d25689cf53df3c65afb7 Mon Sep 17 00:00:00 2001 From: Brian Seeders Date: Wed, 4 Mar 2020 11:29:20 -0500 Subject: [PATCH 1/2] Check for alert dialog when doing a force logout --- .../functional/page_objects/security_page.js | 23 ++++++++++--------- 1 file changed, 12 insertions(+), 11 deletions(-) diff --git a/x-pack/test/functional/page_objects/security_page.js b/x-pack/test/functional/page_objects/security_page.js index 4803596b973bc..5241a45e98a0d 100644 --- a/x-pack/test/functional/page_objects/security_page.js +++ b/x-pack/test/functional/page_objects/security_page.js @@ -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() { @@ -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) { + alert.accept(); + } + return await find.existsByDisplayedByCssSelector('.login-form'); + }); } async clickRolesSection() { From ceaaef8ecb3439a934739b1e68114eacb93335cf Mon Sep 17 00:00:00 2001 From: Brian Seeders Date: Thu, 5 Mar 2020 10:50:23 -0500 Subject: [PATCH 2/2] Add missing await --- x-pack/test/functional/page_objects/security_page.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/x-pack/test/functional/page_objects/security_page.js b/x-pack/test/functional/page_objects/security_page.js index 5241a45e98a0d..4b097b916573d 100644 --- a/x-pack/test/functional/page_objects/security_page.js +++ b/x-pack/test/functional/page_objects/security_page.js @@ -131,7 +131,7 @@ export function SecurityPageProvider({ getService, getPageObjects }) { await retry.waitForWithTimeout('login form', config.get('timeouts.waitFor') * 5, async () => { const alert = await browser.getAlert(); if (alert && alert.accept) { - alert.accept(); + await alert.accept(); } return await find.existsByDisplayedByCssSelector('.login-form'); });