Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Attempt at fix for flaky Cases FTR tests #156248

Merged
merged 2 commits into from
May 1, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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