forked from elastic/kibana
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
[Cases] Automate serverless security screenshots (elastic#174556)
- Loading branch information
Showing
7 changed files
with
179 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
18 changes: 18 additions & 0 deletions
18
x-pack/test_serverless/functional/test_suites/security/config.screenshots.ts
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,18 @@ | ||
/* | ||
* Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one | ||
* or more contributor license agreements. Licensed under the Elastic License | ||
* 2.0; you may not use this file except in compliance with the Elastic License | ||
* 2.0. | ||
*/ | ||
|
||
import { createTestConfig } from '../../config.base'; | ||
|
||
export default createTestConfig({ | ||
serverlessProject: 'security', | ||
testFiles: [require.resolve('./screenshot_creation')], | ||
junit: { | ||
reportName: 'Serverless Security Screenshot Creation', | ||
}, | ||
|
||
esServerArgs: ['xpack.ml.ad.enabled=false', 'xpack.ml.dfa.enabled=false'], | ||
}); |
14 changes: 14 additions & 0 deletions
14
x-pack/test_serverless/functional/test_suites/security/screenshot_creation/index.ts
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,14 @@ | ||
/* | ||
* Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one | ||
* or more contributor license agreements. Licensed under the Elastic License | ||
* 2.0; you may not use this file except in compliance with the Elastic License | ||
* 2.0. | ||
*/ | ||
|
||
import { FtrProviderContext } from '../../../ftr_provider_context'; | ||
|
||
export default function ({ loadTestFile }: FtrProviderContext) { | ||
describe('Screenshots - serverless security UI', function () { | ||
loadTestFile(require.resolve('./response_ops_docs')); | ||
}); | ||
} |
20 changes: 20 additions & 0 deletions
20
...less/functional/test_suites/security/screenshot_creation/response_ops_docs/cases/index.ts
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,20 @@ | ||
/* | ||
* Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one | ||
* or more contributor license agreements. Licensed under the Elastic License | ||
* 2.0; you may not use this file except in compliance with the Elastic License | ||
* 2.0. | ||
*/ | ||
|
||
import { FtrProviderContext } from '../../../../../ftr_provider_context'; | ||
|
||
export default function ({ loadTestFile, getService }: FtrProviderContext) { | ||
const browser = getService('browser'); | ||
|
||
describe('security cases', function () { | ||
before(async () => { | ||
await browser.setWindowSize(1920, 1080); | ||
}); | ||
|
||
loadTestFile(require.resolve('./list_view')); | ||
}); | ||
} |
96 changes: 96 additions & 0 deletions
96
.../functional/test_suites/security/screenshot_creation/response_ops_docs/cases/list_view.ts
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,96 @@ | ||
/* | ||
* Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one | ||
* or more contributor license agreements. Licensed under the Elastic License | ||
* 2.0; you may not use this file except in compliance with the Elastic License | ||
* 2.0. | ||
*/ | ||
|
||
import { SECURITY_SOLUTION_OWNER } from '@kbn/cases-plugin/common'; | ||
import { CaseSeverity } from '@kbn/cases-plugin/common/types/domain'; | ||
import { FtrProviderContext } from '../../../../../ftr_provider_context'; | ||
import { navigateToCasesApp } from '../../../../../../shared/lib/cases'; | ||
|
||
export default function ({ getPageObject, getPageObjects, getService }: FtrProviderContext) { | ||
const cases = getService('cases'); | ||
const pageObjects = getPageObjects(['common', 'header', 'svlCommonPage']); | ||
const svlCases = getService('svlCases'); | ||
const svlCommonScreenshots = getService('svlCommonScreenshots'); | ||
const screenshotDirectories = ['response_ops_docs', 'security_cases']; | ||
const testSubjects = getService('testSubjects'); | ||
const owner = SECURITY_SOLUTION_OWNER; | ||
let caseIdSuspiciousEmail: string; | ||
|
||
describe('list view', function () { | ||
before(async () => { | ||
await svlCases.api.createCase( | ||
svlCases.api.getPostCaseRequest(owner, { | ||
title: 'Unusual processes identified', | ||
tags: ['linux', 'os processes'], | ||
description: 'Test.', | ||
owner, | ||
severity: CaseSeverity.HIGH, | ||
}) | ||
); | ||
|
||
const caseSuspiciousEmail = await svlCases.api.createCase( | ||
svlCases.api.getPostCaseRequest(owner, { | ||
title: 'Suspicious emails reported', | ||
tags: ['email', 'phishing'], | ||
description: 'Several employees have received suspicious emails from an unknown address.', | ||
owner, | ||
}) | ||
); | ||
caseIdSuspiciousEmail = caseSuspiciousEmail.id; | ||
|
||
await svlCases.api.createCase( | ||
svlCases.api.getPostCaseRequest(owner, { | ||
title: 'Malware investigation', | ||
tags: ['malware'], | ||
description: 'Test.', | ||
owner, | ||
severity: CaseSeverity.MEDIUM, | ||
}) | ||
); | ||
}); | ||
|
||
after(async () => { | ||
await svlCases.api.deleteAllCaseItems(); | ||
await pageObjects.svlCommonPage.forceLogout(); | ||
}); | ||
|
||
beforeEach(async () => { | ||
await pageObjects.svlCommonPage.login(); | ||
}); | ||
|
||
it('cases list screenshot', async () => { | ||
await navigateToCasesApp(getPageObject, getService, owner); | ||
await pageObjects.header.waitUntilLoadingHasFinished(); | ||
await svlCommonScreenshots.takeScreenshot('cases-home-page', screenshotDirectories); | ||
}); | ||
|
||
it('case settings screenshot', async () => { | ||
await navigateToCasesApp(getPageObject, getService, owner); | ||
await testSubjects.click('configure-case-button'); | ||
await pageObjects.header.waitUntilLoadingHasFinished(); | ||
await svlCommonScreenshots.takeScreenshot('case-settings', screenshotDirectories); | ||
}); | ||
|
||
it('case detail screenshot', async () => { | ||
await pageObjects.common.navigateToUrlWithBrowserHistory( | ||
'securitySolution', | ||
`/cases/${caseIdSuspiciousEmail}`, | ||
undefined | ||
); | ||
await pageObjects.header.waitUntilLoadingHasFinished(); | ||
await testSubjects.existOrFail('case-view-title'); | ||
const collapseNav = await testSubjects.find('euiCollapsibleNavButton'); | ||
await collapseNav.click(); | ||
await svlCommonScreenshots.takeScreenshot('cases-ui-open', screenshotDirectories, 1400, 1024); | ||
const filesTab = await testSubjects.find('case-view-tab-title-files'); | ||
await filesTab.click(); | ||
await cases.casesFilesTable.addFile(require.resolve('./testfile.png')); | ||
await testSubjects.getVisibleText('cases-files-name-link'); | ||
await svlCommonScreenshots.takeScreenshot('cases-files', screenshotDirectories, 1400, 1024); | ||
}); | ||
}); | ||
} |
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
30 changes: 30 additions & 0 deletions
30
...serverless/functional/test_suites/security/screenshot_creation/response_ops_docs/index.ts
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,30 @@ | ||
/* | ||
* Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one | ||
* or more contributor license agreements. Licensed under the Elastic License | ||
* 2.0; you may not use this file except in compliance with the Elastic License | ||
* 2.0. | ||
*/ | ||
|
||
import { FtrProviderContext } from '../../../../ftr_provider_context'; | ||
|
||
export default function ({ getService, loadTestFile }: FtrProviderContext) { | ||
const browser = getService('browser'); | ||
const ml = getService('ml'); | ||
|
||
describe('response ops docs', function () { | ||
this.tags(['responseOps']); | ||
|
||
before(async () => { | ||
await ml.testResources.setKibanaTimeZoneToUTC(); | ||
await ml.testResources.disableKibanaAnnouncements(); | ||
await browser.setWindowSize(1920, 1080); | ||
}); | ||
|
||
after(async () => { | ||
await ml.testResources.resetKibanaTimeZone(); | ||
await ml.testResources.resetKibanaAnnouncements(); | ||
}); | ||
|
||
loadTestFile(require.resolve('./cases')); | ||
}); | ||
} |