From d2663dbb7dbf3c9c0f362c22f637c5546012ec4a Mon Sep 17 00:00:00 2001 From: Francesco Fagnani Date: Fri, 11 Jul 2025 13:36:24 +0200 Subject: [PATCH] [Rules] Fixed serverless rules test (#227442) It closes #225813. It closes #225800. It closes #224460. When clicking on the `Alerts` side nav button for some reason the navigation was sometimes not happening and the test was stuck in looking for the `manageRulesPageButton` but without trying clicking the `Alerts` button again. Also worth mentioning that I was able to reproduce this only starting the server pointing to a Kibana build I previously created, I couldn't reproduce the issue running the server with the local Kibana. (cherry picked from commit 89a2343a0d7e5b19f77ed9918616a503ec2103fa) --- .../observability/rules/custom_threshold_consumer.ts | 7 +++++-- .../test_suites/observability/rules/es_query_consumer.ts | 7 +++++-- 2 files changed, 10 insertions(+), 4 deletions(-) diff --git a/x-pack/test_serverless/functional/test_suites/observability/rules/custom_threshold_consumer.ts b/x-pack/test_serverless/functional/test_suites/observability/rules/custom_threshold_consumer.ts index 5bb8f298df9ed..a9128cbdad0d9 100644 --- a/x-pack/test_serverless/functional/test_suites/observability/rules/custom_threshold_consumer.ts +++ b/x-pack/test_serverless/functional/test_suites/observability/rules/custom_threshold_consumer.ts @@ -24,8 +24,11 @@ export default ({ getPageObject, getService }: FtrProviderContext) => { function createCustomThresholdRule({ ruleName }: { ruleName: string }) { it('navigates to the rules page', async () => { - await svlCommonNavigation.sidenav.clickLink({ text: 'Alerts' }); - await testSubjects.click('manageRulesPageButton'); + await retry.try(async () => { + await svlCommonNavigation.sidenav.clickLink({ text: 'Alerts' }); + expect(await testSubjects.exists('manageRulesPageButton')).toBeTruthy(); + await testSubjects.click('manageRulesPageButton'); + }); }); it('should open the rule creation flyout', async () => { diff --git a/x-pack/test_serverless/functional/test_suites/observability/rules/es_query_consumer.ts b/x-pack/test_serverless/functional/test_suites/observability/rules/es_query_consumer.ts index 37d4535b4f16f..ac059b0e46133 100644 --- a/x-pack/test_serverless/functional/test_suites/observability/rules/es_query_consumer.ts +++ b/x-pack/test_serverless/functional/test_suites/observability/rules/es_query_consumer.ts @@ -24,8 +24,11 @@ export default ({ getPageObject, getService }: FtrProviderContext) => { function createESQueryRule({ ruleName }: { ruleName: string }) { it('navigates to the rules page', async () => { - await svlCommonNavigation.sidenav.clickLink({ text: 'Alerts' }); - await testSubjects.click('manageRulesPageButton'); + await retry.try(async () => { + await svlCommonNavigation.sidenav.clickLink({ text: 'Alerts' }); + expect(await testSubjects.exists('manageRulesPageButton')).toBeTruthy(); + await testSubjects.click('manageRulesPageButton'); + }); }); it('should open the rule creation flyout', async () => {