From bc13d8f95615e22577741d4a0dd3942942abc0ff Mon Sep 17 00:00:00 2001 From: Jiawei Wu <74562234+JiaweiWu@users.noreply.github.com> Date: Fri, 6 Sep 2024 14:18:31 -0700 Subject: [PATCH] [Response Ops] Fix Flaky Stack Alerts Page E2E Test (#192045) ## Summary Resolves: https://github.com/elastic/kibana/issues/184882 ### Checklist - [x] [Unit or functional tests](https://www.elastic.co/guide/en/kibana/master/development-tests.html) were updated or added to match the most common scenarios Co-authored-by: Elastic Machine --- .../triggers_actions_ui/stack_alerts_page.ts | 19 +++++++++++-------- 1 file changed, 11 insertions(+), 8 deletions(-) diff --git a/x-pack/test/functional_with_es_ssl/apps/triggers_actions_ui/stack_alerts_page.ts b/x-pack/test/functional_with_es_ssl/apps/triggers_actions_ui/stack_alerts_page.ts index 5fa3a6cc0d9a3..3bf9bde7ea644 100644 --- a/x-pack/test/functional_with_es_ssl/apps/triggers_actions_ui/stack_alerts_page.ts +++ b/x-pack/test/functional_with_es_ssl/apps/triggers_actions_ui/stack_alerts_page.ts @@ -98,8 +98,7 @@ export default ({ getPageObjects, getService }: FtrProviderContext) => { }); }); - // FLAKY: https://github.com/elastic/kibana/issues/184882 - describe.skip('Loads the page', () => { + describe('Loads the page', () => { beforeEach(async () => { await security.testUser.restoreDefaults(); await pageObjects.common.navigateToUrl( @@ -141,10 +140,11 @@ export default ({ getPageObjects, getService }: FtrProviderContext) => { firstSolutionFilter = quickFilters .filter((_: number, f: any) => f.attribs['data-test-subj'].endsWith('rule types')) .first(); - expect(firstSolutionFilter).to.not.be(null); + + expect(typeof firstSolutionFilter?.attr('data-test-subj')).to.be('string'); }); - await testSubjects.click(firstSolutionFilter!.attr('data-test-subj')); + await testSubjects.click(firstSolutionFilter.attr('data-test-subj')); await retry.try(async () => { const appliedFilters = await pageObjects.triggersActionsUI.getAlertsPageAppliedFilters(); @@ -165,9 +165,11 @@ export default ({ getPageObjects, getService }: FtrProviderContext) => { f.attribs['data-test-subj'].includes('Security rule types') ) .first(); - expect(filter).to.not.be(null); + + expect(typeof filter?.attr('data-test-subj')).to.be('string'); }); - await testSubjects.click(filter!.attr('data-test-subj')); + + await testSubjects.click(filter.attr('data-test-subj')); await retry.try(async () => { quickFilters = await pageObjects.triggersActionsUI.getAlertsPageQuickFilters(); @@ -196,10 +198,11 @@ export default ({ getPageObjects, getService }: FtrProviderContext) => { return testSubj.includes('rule types') && !testSubj.includes('Security'); }) .first(); - expect(filter).to.not.be(null); + + expect(typeof filter?.attr('data-test-subj')).to.be('string'); }); - await testSubjects.click(filter!.attr('data-test-subj')); + await testSubjects.click(filter.attr('data-test-subj')); await retry.try(async () => { quickFilters = await pageObjects.triggersActionsUI.getAlertsPageQuickFilters();