From d1240d332502605657bf4a2b01f92f599557deab Mon Sep 17 00:00:00 2001 From: Carlos Crespo Date: Wed, 16 Aug 2023 14:13:22 +0200 Subject: [PATCH] [Infra UI] Unskip alerts flyout test (#163919) closes [#157712](https://github.com/elastic/kibana/issues/157712) closes [#157767](https://github.com/elastic/kibana/issues/157767) closes [#157711](https://github.com/elastic/kibana/issues/157711) ## Summary Unskips "alerts flyouts" test. What cause the test to fail was possibly solved by https://github.com/elastic/kibana/pull/162896 ### How to test ``` yarn test:ftr:server --config x-pack/test/functional/apps/infra/config.ts ``` ``` node scripts/functional_test_runner --config=x-pack/test/functional/apps/infra/config.ts --include x-pack/test/functional/apps/infra/home_page.ts ``` https://buildkite.com/elastic/kibana-flaky-test-suite-runner/builds/2888 --------- Co-authored-by: Kibana Machine <42973632+kibanamachine@users.noreply.github.com> --- .../test/functional/apps/infra/home_page.ts | 5 ++-- .../page_objects/infra_home_page.ts | 28 ++++++++++++++++--- 2 files changed, 26 insertions(+), 7 deletions(-) diff --git a/x-pack/test/functional/apps/infra/home_page.ts b/x-pack/test/functional/apps/infra/home_page.ts index 79fa4d0eea06e..7fedb18db416c 100644 --- a/x-pack/test/functional/apps/infra/home_page.ts +++ b/x-pack/test/functional/apps/infra/home_page.ts @@ -199,8 +199,7 @@ export default ({ getPageObjects, getService }: FtrProviderContext) => { }); }); - // FLAKY: https://github.com/elastic/kibana/issues/157711 - describe.skip('alerts flyouts', () => { + describe('alerts flyouts', () => { before(async () => { await esArchiver.load('x-pack/test/functional/es_archives/infra/metrics_and_logs'); await pageObjects.common.navigateToApp('infraOps'); @@ -217,7 +216,7 @@ export default ({ getPageObjects, getService }: FtrProviderContext) => { await pageObjects.infraHome.closeAlertFlyout(); }); - it('should open and close inventory alert flyout', async () => { + it('should open and close metrics threshold alert flyout', async () => { await pageObjects.infraHome.openMetricsThresholdAlertFlyout(); await pageObjects.infraHome.closeAlertFlyout(); }); diff --git a/x-pack/test/functional/page_objects/infra_home_page.ts b/x-pack/test/functional/page_objects/infra_home_page.ts index f9f088b106375..aed3558cfdcb4 100644 --- a/x-pack/test/functional/page_objects/infra_home_page.ts +++ b/x-pack/test/functional/page_objects/infra_home_page.ts @@ -335,20 +335,40 @@ export function InfraHomePageProvider({ getService, getPageObjects }: FtrProvide await testSubjects.missingOrFail('metrics-alert-menu'); }, + async dismissDatePickerTooltip() { + const isTooltipOpen = await testSubjects.exists(`waffleDatePickerIntervalTooltip`, { + timeout: 1000, + }); + + if (isTooltipOpen) { + await testSubjects.click(`waffleDatePickerIntervalTooltip`); + } + }, + async openInventoryAlertFlyout() { + await this.dismissDatePickerTooltip(); await testSubjects.click('infrastructure-alerts-and-rules'); await testSubjects.click('inventory-alerts-menu-option'); - await testSubjects.click('inventory-alerts-create-rule'); + + // forces date picker tooltip to close in case it pops up after Alerts and rules opens + await testSubjects.moveMouseTo('contextMenuPanelTitleButton'); + + await retry.tryForTime(1000, () => testSubjects.click('inventory-alerts-create-rule')); await testSubjects.missingOrFail('inventory-alerts-create-rule', { timeout: 30000 }); - await testSubjects.find('euiFlyoutCloseButton'); }, async openMetricsThresholdAlertFlyout() { + await this.dismissDatePickerTooltip(); await testSubjects.click('infrastructure-alerts-and-rules'); await testSubjects.click('metrics-threshold-alerts-menu-option'); - await testSubjects.click('metrics-threshold-alerts-create-rule'); + + // forces date picker tooltip to close in case it pops up after Alerts and rules opens + await testSubjects.moveMouseTo('contextMenuPanelTitleButton'); + + await retry.tryForTime(1000, () => + testSubjects.click('metrics-threshold-alerts-create-rule') + ); await testSubjects.missingOrFail('metrics-threshold-alerts-create-rule', { timeout: 30000 }); - await testSubjects.find('euiFlyoutCloseButton'); }, async closeAlertFlyout() {