[Response Ops][Cases] Functional tests checking cases view - alerts tab (#208964)

## Summary

Tests missing in https://github.com/elastic/kibana/pull/208672
This commit is contained in:
Julian Gernun 2025-01-31 14:00:57 +01:00 committed by GitHub
parent 52d2b66922
commit b6939f1dda
No known key found for this signature in database
GPG key ID: B5690EEEBB952194

View file

@ -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);
@ -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);