Skip to content

Commit

Permalink
[DOCS] Add more automated screenshots for security cases (#161485)
Browse files Browse the repository at this point in the history
  • Loading branch information
lcawl authored Jul 10, 2023
1 parent 31b28a0 commit ff6099e
Showing 1 changed file with 36 additions and 3 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -7,12 +7,18 @@

import { CaseSeverity } from '@kbn/cases-plugin/common/api';
import { FtrProviderContext } from '../../../ftr_provider_context';
import { createAndUploadFile } from '../../../../cases_api_integration/common/lib/api';
import { SECURITY_SOLUTION_FILE_KIND } from '../../../../cases_api_integration/common/lib/constants';

export default function ({ getPageObject, getService, getPageObjects }: FtrProviderContext) {
const cases = getService('cases');
const commonScreenshots = getService('commonScreenshots');
const screenshotDirectories = ['response_ops_docs', 'security_cases'];
const pageObjects = getPageObjects(['common', 'header']);
const screenshotDirectories = ['response_ops_docs', 'security_cases'];
const supertest = getService('supertest');
const testSubjects = getService('testSubjects');
let caseIdSuspiciousEmail: string;
let caseOwnerSuspiciousEmail: string;

describe('list view', function () {
before(async () => {
Expand All @@ -24,12 +30,14 @@ export default function ({ getPageObject, getService, getPageObjects }: FtrProvi
severity: CaseSeverity.HIGH,
});

await cases.api.createCase({
const caseSuspiciousEmail = await cases.api.createCase({
title: 'Suspicious emails reported',
tags: ['email', 'phishing'],
description: 'Test.',
description: 'Several employees have received suspicious emails from an unknown address.',
owner: 'securitySolution',
});
caseIdSuspiciousEmail = caseSuspiciousEmail.id;
caseOwnerSuspiciousEmail = caseSuspiciousEmail.owner;

await cases.api.createCase({
title: 'Malware investigation',
Expand All @@ -38,6 +46,20 @@ export default function ({ getPageObject, getService, getPageObjects }: FtrProvi
owner: 'securitySolution',
severity: CaseSeverity.MEDIUM,
});

await createAndUploadFile({
supertest,
createFileParams: {
name: 'testfile',
kind: SECURITY_SOLUTION_FILE_KIND,
mimeType: 'image/png',
meta: {
caseIds: [caseIdSuspiciousEmail],
owner: [caseOwnerSuspiciousEmail],
},
},
data: 'abc',
});
});

after(async () => {
Expand All @@ -49,5 +71,16 @@ export default function ({ getPageObject, getService, getPageObjects }: FtrProvi
await pageObjects.header.waitUntilLoadingHasFinished();
await commonScreenshots.takeScreenshot('cases-home-page', screenshotDirectories, 1700, 1024);
});

it('case details screenshot', async () => {
await pageObjects.common.navigateToApp('security', {
path: `cases/${caseIdSuspiciousEmail}`,
});
await commonScreenshots.takeScreenshot('cases-ui-open', screenshotDirectories, 1400, 1024);

const filesTab = await testSubjects.find('case-view-tab-title-files');
await filesTab.click();
await commonScreenshots.takeScreenshot('cases-files', screenshotDirectories, 1400, 1024);
});
});
}

0 comments on commit ff6099e

Please sign in to comment.