Skip to content

Commit

Permalink
fix flaky logout > login navigation
Browse files Browse the repository at this point in the history
  • Loading branch information
dmlemeshko committed Sep 25, 2023
1 parent 79cdcdc commit a1dffd4
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 2 deletions.
8 changes: 7 additions & 1 deletion x-pack/test/functional/page_objects/security_page.ts
Original file line number Diff line number Diff line change
Expand Up @@ -323,7 +323,13 @@ export class SecurityPageObject extends FtrService {
if (alert?.accept) {
await alert.accept();
}
return !(await this.browser.getCurrentUrl()).includes('/logout');

if (this.config.get('serverless')) {
// Logout might trigger multiple redirects, but in the end we expect the Cloud login page
return await this.find.existsByDisplayedByCssSelector('.login-form-password', 5000);
} else {
return !(await this.browser.getCurrentUrl()).includes('/logout');
}
});
}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ import { FtrProviderContext } from '../ftr_provider_context';
export function SvlCommonPageProvider({ getService, getPageObjects }: FtrProviderContext) {
const testSubjects = getService('testSubjects');
const config = getService('config');
const pageObjects = getPageObjects(['security']);
const pageObjects = getPageObjects(['security', 'common']);
const retry = getService('retry');
const kibanaServer = getService('kibanaServer');
const log = getService('log');
Expand All @@ -25,6 +25,9 @@ export function SvlCommonPageProvider({ getService, getPageObjects }: FtrProvide
async login() {
await pageObjects.security.forceLogout({ waitForLoginPage: false });

// adding sleep to settle down logout
await pageObjects.common.sleep(2500);

await retry.waitForWithTimeout(
'Login successfully via API',
10_000,
Expand Down

0 comments on commit a1dffd4

Please sign in to comment.