From 51068521b8e85eb756ec1f5d37b3e677127055fb Mon Sep 17 00:00:00 2001 From: Faisal Kanout Date: Thu, 14 Sep 2023 17:33:58 +0200 Subject: [PATCH] [AO] Fix flaky test (#166179) ## Summary It fixes https://github.com/elastic/kibana/issues/165619 ## Notes: - The issue wasn't related to the `/_alertSummary` endpoint and wouldn't be fixed after merging the new update from ResponsOps PR. (tested here with a clone PR https://github.com/elastic/kibana/pull/166273) - The failing test is so little flaky only **0.5%** , after each update I run the flaky-test-runner to run 400 times. - The issue seems related to three things that has been done: - Waiting for the rule details page to load - Use LogThreshold instead of the Uptime rule - The mocking lib seems to miss the mock sometimes with Uptime and makes the real function be called without a `featureIds` ## DoD - The PR has been tested 2 x 400 = 800 times with 0 fails -> https://buildkite.com/elastic/kibana-flaky-test-suite-runner/builds/3100 --- .../apps/observability/pages/rule_details_page.ts | 11 +++++++---- 1 file changed, 7 insertions(+), 4 deletions(-) diff --git a/x-pack/test/observability_functional/apps/observability/pages/rule_details_page.ts b/x-pack/test/observability_functional/apps/observability/pages/rule_details_page.ts index 5f09137850a2d..f7f9b1eb9ff00 100644 --- a/x-pack/test/observability_functional/apps/observability/pages/rule_details_page.ts +++ b/x-pack/test/observability_functional/apps/observability/pages/rule_details_page.ts @@ -36,8 +36,7 @@ export default ({ getService }: FtrProviderContext) => { return true; } - // FLAKY: https://github.com/elastic/kibana/issues/165619 - describe.skip('Observability Rule Details page', function () { + describe('Observability Rule Details page', function () { this.tags('includeFirefox'); let uptimeRuleId: string; @@ -149,10 +148,14 @@ export default ({ getService }: FtrProviderContext) => { describe('Alert summary widget component', () => { before(async () => { - await observability.alerts.common.navigateToRuleDetailsByRuleId(uptimeRuleId); + await observability.alerts.common.navigateToRuleDetailsByRuleId(logThresholdRuleId); + await retry.waitFor( + 'Rule details to be visible', + async () => await testSubjects.exists('ruleDetails') + ); }); - it('shows component on the rule detils page', async () => { + it('shows component on the rule details page', async () => { await observability.components.alertSummaryWidget.getCompactComponentSelectorOrFail(); const timeRangeTitle =