Fix flaky console tests (#208337)

Fixes https://github.com/elastic/kibana/issues/204381

## Summary
The test that verifies tab changes in Console was failing because it was
verifying the presence of the tab content before it was fully loaded.


### Checklist
- [x] [Flaky Test
Runner](https://ci-stats.kibana.dev/trigger_flaky_test_runner/1) was
used on any tests changed

Co-authored-by: Elastic Machine <elasticmachine@users.noreply.github.com>
This commit is contained in:
Sonia Sanz Vivas 2025-01-29 09:09:05 +01:00 committed by GitHub
parent 7b26912385
commit 20ed84d41d
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
3 changed files with 15 additions and 5 deletions

View file

@ -311,6 +311,7 @@ export function Main({ currentTabProp, isEmbeddable = false }: MainProps) {
<EuiSplitPanel.Inner
paddingSize="none"
css={[scrollablePanelStyle, { backgroundColor: euiTheme.colors.body }]}
data-test-subj="consolePanel"
>
{currentTab === SHELL_TAB_ID && (
<Editor

View file

@ -89,8 +89,7 @@ export default function ({ getService, getPageObjects }: FtrProviderContext) {
});
});
// FLAKY: https://github.com/elastic/kibana/issues/204381
describe.skip('tabs navigation', () => {
describe('tabs navigation', () => {
let currentUrl: string;
beforeEach(async () => {
@ -125,6 +124,7 @@ export default function ({ getService, getPageObjects }: FtrProviderContext) {
currentUrl = await browser.getCurrentUrl();
log.debug('Current URL: ' + currentUrl);
expect(currentUrl).to.contain(`/history`);
await PageObjects.header.waitUntilLoadingHasFinished();
expect(await PageObjects.console.isHistoryOpen()).to.be(true);
// Navigate to Config tab via URL
@ -132,6 +132,7 @@ export default function ({ getService, getPageObjects }: FtrProviderContext) {
currentUrl = await browser.getCurrentUrl();
log.debug('Current URL: ' + currentUrl);
expect(currentUrl).to.contain(`/config`);
await PageObjects.header.waitUntilLoadingHasFinished();
expect(await PageObjects.console.isConfigOpen()).to.be(true);
// Navigate to Shell tab via URL
@ -139,6 +140,7 @@ export default function ({ getService, getPageObjects }: FtrProviderContext) {
currentUrl = await browser.getCurrentUrl();
log.debug('Current URL: ' + currentUrl);
expect(currentUrl).to.contain(`/shell`);
await PageObjects.header.waitUntilLoadingHasFinished();
expect(await PageObjects.console.isShellOpen()).to.be(true);
});
});

View file

@ -311,16 +311,23 @@ export class ConsolePageObject extends FtrService {
await this.testSubjects.click('consoleHistoryButton');
}
async isConsoleTabOpen(tabId: string) {
await this.retry.waitFor('console container is displayed', async () => {
return await this.testSubjects.isDisplayed('consolePanel');
});
return await this.testSubjects.exists(tabId);
}
public async isShellOpen() {
return await this.testSubjects.exists('consoleEditorContainer');
return await this.isConsoleTabOpen('consoleEditorContainer');
}
public async isConfigOpen() {
return await this.testSubjects.exists('consoleConfigPanel');
return await this.isConsoleTabOpen('consoleConfigPanel');
}
public async isHistoryOpen() {
return await this.testSubjects.exists('consoleHistoryPanel');
return await this.isConsoleTabOpen('consoleHistoryPanel');
}
public async openSettings() {