From e6366c0432eff18a1c7a0e81b684c756e56060f2 Mon Sep 17 00:00:00 2001 From: Coen Warmer Date: Mon, 1 May 2023 13:22:00 +0200 Subject: [PATCH] Attempt at fix for flaky Cases FTR tests (#156248) --- .../observability/pages/alerts/add_to_case.ts | 11 ++++--- .../observability/pages/cases/case_details.ts | 33 +++++++++++-------- 2 files changed, 25 insertions(+), 19 deletions(-) diff --git a/x-pack/test/observability_functional/apps/observability/pages/alerts/add_to_case.ts b/x-pack/test/observability_functional/apps/observability/pages/alerts/add_to_case.ts index 40cfb2977850e..e43305267ffb0 100644 --- a/x-pack/test/observability_functional/apps/observability/pages/alerts/add_to_case.ts +++ b/x-pack/test/observability_functional/apps/observability/pages/alerts/add_to_case.ts @@ -12,8 +12,7 @@ export default ({ getService, getPageObjects }: FtrProviderContext) => { const observability = getService('observability'); const retry = getService('retry'); - // Failing: See https://github.com/elastic/kibana/issues/154726 - describe.skip('Observability alerts / Add to case >', function () { + describe('Observability alerts / Add to case >', function () { this.tags('includeFirefox'); before(async () => { @@ -26,7 +25,7 @@ export default ({ getService, getPageObjects }: FtrProviderContext) => { await esArchiver.unload('x-pack/test/functional/es_archives/observability/alerts'); }); - describe('When user has all priviledges for cases', () => { + describe('When user has all privileges for cases', () => { before(async () => { await observability.users.setTestUserRole( observability.users.defineBasicObservabilityRole({ @@ -49,8 +48,10 @@ export default ({ getService, getPageObjects }: FtrProviderContext) => { }); }); - it('opens a flyout when Add to new case is clicked', async () => { - await observability.alerts.addToCase.addToNewCaseButtonClick(); + it('opens a flyout when "Add to new case" is clicked', async () => { + await retry.try(async () => { + await observability.alerts.addToCase.addToNewCaseButtonClick(); + }); await retry.try(async () => { await observability.alerts.addToCase.getCreateCaseFlyoutOrFail(); diff --git a/x-pack/test/observability_functional/apps/observability/pages/cases/case_details.ts b/x-pack/test/observability_functional/apps/observability/pages/cases/case_details.ts index 96e989a9173e7..2fe088f795154 100644 --- a/x-pack/test/observability_functional/apps/observability/pages/cases/case_details.ts +++ b/x-pack/test/observability_functional/apps/observability/pages/cases/case_details.ts @@ -16,6 +16,7 @@ export default ({ getPageObjects, getService }: FtrProviderContext) => { const observability = getService('observability'); const find = getService('find'); const PageObjects = getPageObjects(['common', 'header']); + const retry = getService('retry'); describe('Observability cases', () => { before(async () => { @@ -38,25 +39,29 @@ export default ({ getPageObjects, getService }: FtrProviderContext) => { ); const owner = 'observability'; - const caseData = await cases.api.createCase({ - title: 'Sample case', - owner, - }); - await cases.api.createAttachment({ - caseId: caseData.id, - params: { - alertId: ['alert-id'], - index: ['.internal.alerts-observability.alerts-default-000001'], - rule: { id: 'rule-id', name: 'My rule name' }, - type: CommentType.alert, + await retry.try(async () => { + const caseData = await cases.api.createCase({ + title: 'Sample case', owner, - }, + }); + await cases.api.createAttachment({ + caseId: caseData.id, + params: { + alertId: ['alert-id'], + index: ['.internal.alerts-observability.alerts-default-000001'], + rule: { id: 'rule-id', name: 'My rule name' }, + type: CommentType.alert, + owner, + }, + }); }); }); after(async () => { - await cases.api.deleteAllCases(); - await observability.users.restoreDefaultTestUserRole(); + await retry.try(async () => { + await cases.api.deleteAllCases(); + await observability.users.restoreDefaultTestUserRole(); + }); }); it('should link to observability rule pages in case details', async () => {