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 () => {