From ff6099eb3fbb52671d892b766c81eb184b3c3a21 Mon Sep 17 00:00:00 2001 From: Lisa Cawley Date: Mon, 10 Jul 2023 07:50:38 -0700 Subject: [PATCH] [DOCS] Add more automated screenshots for security cases (#161485) --- .../security_cases/list_view.ts | 39 +++++++++++++++++-- 1 file changed, 36 insertions(+), 3 deletions(-) diff --git a/x-pack/test/screenshot_creation/apps/response_ops_docs/security_cases/list_view.ts b/x-pack/test/screenshot_creation/apps/response_ops_docs/security_cases/list_view.ts index ccae6535b01d7..d6156ef208ad6 100644 --- a/x-pack/test/screenshot_creation/apps/response_ops_docs/security_cases/list_view.ts +++ b/x-pack/test/screenshot_creation/apps/response_ops_docs/security_cases/list_view.ts @@ -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 () => { @@ -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', @@ -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 () => { @@ -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); + }); }); }