From a127521c4c982887be6ad454f8fa68560c2b50eb Mon Sep 17 00:00:00 2001 From: Coen Warmer Date: Mon, 1 May 2023 10:54:22 +0200 Subject: [PATCH 1/2] Retry waiting for Add to new case option --- .../apps/observability/pages/alerts/add_to_case.ts | 11 ++++++----- 1 file changed, 6 insertions(+), 5 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(); From 4df29a3d2469f42cd7ca8b82735e17c87419f08c Mon Sep 17 00:00:00 2001 From: Coen Warmer Date: Mon, 1 May 2023 11:11:36 +0200 Subject: [PATCH 2/2] Attempt to harden calls to Case API --- .../observability/pages/cases/case_details.ts | 33 +++++++++++-------- 1 file changed, 19 insertions(+), 14 deletions(-) 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 () => {