Skip to content

Commit

Permalink
[Response Ops][Cases] Functional tests checking cases view - alerts t…
Browse files Browse the repository at this point in the history
…ab (#208964)

## Summary

Tests missing in #208672
  • Loading branch information
jcger authored Jan 31, 2025
1 parent 52d2b66 commit b6939f1
Showing 1 changed file with 43 additions and 0 deletions.
43 changes: 43 additions & 0 deletions x-pack/test/functional_with_es_ssl/apps/cases/group1/view_case.ts
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,7 @@ export default ({ getPageObject, getService }: FtrProviderContext) => {
const security = getPageObject('security');
const kibanaServer = getService('kibanaServer');
const browser = getService('browser');
const esArchiver = getService('esArchiver');

const hasFocus = async (testSubject: string) => {
const targetElement = await testSubjects.find(testSubject);
Expand Down Expand Up @@ -1074,6 +1075,48 @@ export default ({ getPageObject, getService }: FtrProviderContext) => {
});
});

describe('Tabs - alerts linked to case', () => {
before(async () => {
await esArchiver.loadIfNeeded('x-pack/test/functional/es_archives/rule_registry/alerts');
await cases.navigation.navigateToApp();
const theCase = await cases.api.createCase();
await cases.casesTable.waitForCasesToBeListed();
await retry.try(async () => {
await cases.api.createAttachment({
caseId: theCase.id,
params: {
type: AttachmentType.alert,
alertId: ['NoxgpHkBqbdrfX07MqXV'],
index: '.alerts-observability.apm.alerts',
rule: { id: 'id', name: 'name' },
owner: theCase.owner,
},
});
});
});

after(async () => {
await cases.api.deleteAllCases();
await esArchiver.unload('x-pack/test/functional/es_archives/rule_registry/alerts/');
});

beforeEach(async () => {
await cases.navigation.navigateToApp();
await cases.casesTable.goToFirstListedCase();
await header.waitUntilLoadingHasFinished();
});

it('should show the right amount of alerts linked to a case', async () => {
const visibleText = await testSubjects.getVisibleText('case-view-alerts-stats-badge');
expect(visibleText).to.be('1');
});

it('should render the alerts table when opening the alerts tab', async () => {
await testSubjects.click('case-view-tab-title-alerts');
await testSubjects.existOrFail('alertsStateTableEmptyState');
});
});

describe('Files', () => {
createOneCaseBeforeDeleteAllAfter(getPageObject, getService);

Expand Down

0 comments on commit b6939f1

Please sign in to comment.