Skip to content

Commit

Permalink
[ftr] improve logout for svl functional tests (elastic#176856)
Browse files Browse the repository at this point in the history
## Summary

Closes elastic#175608
Closes elastic#175601

Addressing logout flakiness on CI:
- increase timeout for cloud login screen up to 2 sec
- after loading `bootstrap-anonymous.js` in browser check if we are on
kibana host or cloud login screen; if the last, skip cleanup
Flaky test runner:
- 25x
https://buildkite.com/elastic/kibana-flaky-test-suite-runner/builds/5178
- 25x
https://buildkite.com/elastic/kibana-flaky-test-suite-runner/builds/5179
- 25x
https://buildkite.com/elastic/kibana-flaky-test-suite-runner/builds/5180
  • Loading branch information
dmlemeshko authored and fkanout committed Mar 4, 2024
1 parent 3cf8077 commit 105fbe3
Show file tree
Hide file tree
Showing 3 changed files with 19 additions and 6 deletions.
19 changes: 17 additions & 2 deletions x-pack/test_serverless/functional/page_objects/svl_common_page.ts
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,22 @@ export function SvlCommonPageProvider({ getService, getPageObjects }: FtrProvide
await alert.accept();
}
log.debug(`browser: wait for resource page to be loaded`);
await find.byCssSelector('body > pre', 5000);
// TODO: temporary solution while we don't migrate all functional tests to SAML auth
// On CI sometimes we are redirected to cloud login page, in this case we skip cleanup
const isOnBootstrap = await find.existsByDisplayedByCssSelector('body > pre', 5000);
if (!isOnBootstrap) {
const currentUrl = await browser.getCurrentUrl();
log.debug(`current url: ${currentUrl}`);
if (!currentUrl.includes(deployment.getHostPort())) {
log.debug('Skipping browser state cleanup');
return;
} else {
log.debug('browser: navigate to /bootstrap-anonymous.js #2');
await browser.get(noAuthRequiredUrl);
await find.byCssSelector('body > pre', 5000);
}
}

log.debug(`browser: delete all the cookies`);
await retry.waitForWithTimeout('Browser cookies are deleted', 10000, async () => {
await browser.deleteAllCookies();
Expand Down Expand Up @@ -125,7 +140,7 @@ export function SvlCommonPageProvider({ getService, getPageObjects }: FtrProvide

async forceLogout() {
log.debug('SvlCommonPage.forceLogout');
if (await find.existsByDisplayedByCssSelector('.login-form', 100)) {
if (await find.existsByDisplayedByCssSelector('.login-form', 2000)) {
log.debug('Already on the login page, not forcing anything');
return;
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -13,8 +13,7 @@ export default function ({ getPageObject, getService }: FtrProviderContext) {
const svlCommonNavigation = getPageObject('svlCommonNavigation');
const svlCommonPage = getPageObject('svlCommonPage');

// FLAKY: https://github.com/elastic/kibana/issues/175601
describe.skip('default dataView', function () {
describe('default dataView', function () {
// Error: expected testSubject(kbnOverviewElasticsearchGettingStarted) to exist
this.tags(['failsOnMKI']);
before(async () => {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -19,8 +19,7 @@ export default function ({ getPageObject, getService }: FtrProviderContext) {
const headerPage = getPageObject('header');
const retry = getService('retry');

// FLAKY: https://github.com/elastic/kibana/issues/175608
describe.skip('navigation', function () {
describe('navigation', function () {
before(async () => {
await svlCommonPage.login();
await svlSecNavigation.navigateToLandingPage();
Expand Down

0 comments on commit 105fbe3

Please sign in to comment.