Skip to content

Commit

Permalink
Attempt at fix for flaky Cases FTR tests (#156248)
Browse files Browse the repository at this point in the history
  • Loading branch information
CoenWarmer authored May 1, 2023
1 parent 4e88645 commit e6366c0
Show file tree
Hide file tree
Showing 2 changed files with 25 additions and 19 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -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 () => {
Expand All @@ -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({
Expand All @@ -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();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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 () => {
Expand All @@ -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 () => {
Expand Down

0 comments on commit e6366c0

Please sign in to comment.