mirror of
https://github.com/elastic/kibana.git
synced 2025-04-24 01:38:56 -04:00
[Security Solution] ~200 ways to decrease flakiness in Cypress (#157387)
This PR addresses Cypress parallelisation in Security Solution scope. It is a first step in improving e2e tests reliability and gives us a solid foundation for further work on flakiness and run times. With this PR each CI job starts 3 instances of ES, kibana and Cypress runner in isolation. Other issues addressed in this PR: - Use click() instead of trigger('click') in all Cypress tests. - Use testIsolation in all Cypress tests. - login before each test to ensure that the correct user is always logged in. Also, with test isolation enabled, login should be required before each test. - use visit() instead of cy.visit() in some cases so that tests wait for the page to fully load before executing. - Cypress e2e tests are no longer compatible with Firefox (or any non-Chromium based browser) due to using cypress-real-events - Removes uses of cypress-pipe. Tests that used cypress-pipe in order to retry click events will no longer retry click events. - Fixes an error related to test files being overwritten by Webpack file processing --------- Co-authored-by: Patryk Kopycinski <contact@patrykkopycinski.com> Co-authored-by: kibanamachine <42973632+kibanamachine@users.noreply.github.com>
This commit is contained in:
parent
3d05fc6ada
commit
c9658bf238
214 changed files with 2482 additions and 1523 deletions
|
@ -38,13 +38,11 @@ disabled:
|
|||
- x-pack/test/security_solution_cypress/cases_cli_config.ts
|
||||
- x-pack/test/security_solution_cypress/ccs_config.ts
|
||||
- x-pack/test/security_solution_cypress/cli_config.ts
|
||||
- x-pack/test/security_solution_cypress/cli_config_parallel.ts
|
||||
- x-pack/test/security_solution_cypress/cli_config_investigations_parallel.ts
|
||||
- x-pack/test/security_solution_cypress/config.firefox.ts
|
||||
- x-pack/test/security_solution_cypress/config.ts
|
||||
- x-pack/test/security_solution_cypress/response_ops_cli_config.ts
|
||||
- x-pack/test/security_solution_cypress/upgrade_config.ts
|
||||
- x-pack/test/security_solution_cypress/visual_config.ts
|
||||
- x-pack/test/threat_intelligence_cypress/visual_config.ts
|
||||
- x-pack/test/threat_intelligence_cypress/cli_config_parallel.ts
|
||||
- x-pack/test/threat_intelligence_cypress/config.ts
|
||||
|
|
|
@ -5,6 +5,7 @@ steps:
|
|||
queue: n2-4-spot
|
||||
depends_on: build
|
||||
timeout_in_minutes: 120
|
||||
parallelism: 2
|
||||
retry:
|
||||
automatic:
|
||||
- exit_status: '-1'
|
||||
|
|
|
@ -5,6 +5,7 @@ steps:
|
|||
queue: n2-4-spot
|
||||
depends_on: build
|
||||
timeout_in_minutes: 120
|
||||
parallelism: 4
|
||||
retry:
|
||||
automatic:
|
||||
- exit_status: '-1'
|
||||
|
|
|
@ -5,7 +5,7 @@ steps:
|
|||
queue: n2-4-spot
|
||||
depends_on: build
|
||||
timeout_in_minutes: 120
|
||||
parallelism: 4
|
||||
parallelism: 15
|
||||
retry:
|
||||
automatic:
|
||||
- exit_status: '-1'
|
||||
|
|
|
@ -2,16 +2,15 @@
|
|||
|
||||
set -euo pipefail
|
||||
|
||||
source .buildkite/scripts/common/util.sh
|
||||
|
||||
.buildkite/scripts/bootstrap.sh
|
||||
node scripts/build_kibana_platform_plugins.js
|
||||
source .buildkite/scripts/steps/functional/common.sh
|
||||
|
||||
export JOB=kibana-defend-workflows-cypress
|
||||
export KIBANA_INSTALL_DIR=${KIBANA_BUILD_LOCATION}
|
||||
|
||||
Xvfb -screen 0 1680x946x24 :99 &
|
||||
|
||||
export DISPLAY=:99
|
||||
|
||||
echo "--- Defend Workflows Cypress tests"
|
||||
|
||||
node scripts/functional_tests \
|
||||
--debug --bail \
|
||||
--config x-pack/test/defend_workflows_cypress/cli_config.ts
|
||||
|
||||
yarn --cwd x-pack/plugins/security_solution cypress:dw:run
|
||||
|
|
|
@ -5,10 +5,12 @@ set -euo pipefail
|
|||
source .buildkite/scripts/steps/functional/common.sh
|
||||
|
||||
export JOB=kibana-security-solution-chrome
|
||||
export KIBANA_INSTALL_DIR=${KIBANA_BUILD_LOCATION}
|
||||
|
||||
Xvfb -screen 0 1680x946x24 :99 &
|
||||
|
||||
export DISPLAY=:99
|
||||
|
||||
echo "--- Response Ops Cypress Tests on Security Solution"
|
||||
|
||||
node scripts/functional_tests \
|
||||
--debug --bail \
|
||||
--kibana-install-dir "$KIBANA_BUILD_LOCATION" \
|
||||
--config x-pack/test/security_solution_cypress/response_ops_cli_config.ts
|
||||
yarn --cwd x-pack/plugins/security_solution cypress:run:respops
|
||||
|
|
|
@ -5,10 +5,12 @@ set -euo pipefail
|
|||
source .buildkite/scripts/steps/functional/common.sh
|
||||
|
||||
export JOB=kibana-security-solution-chrome
|
||||
export KIBANA_INSTALL_DIR=${KIBANA_BUILD_LOCATION}
|
||||
|
||||
Xvfb -screen 0 1680x946x24 :99 &
|
||||
|
||||
export DISPLAY=:99
|
||||
|
||||
echo "--- Response Ops Cases Cypress Tests on Security Solution"
|
||||
|
||||
node scripts/functional_tests \
|
||||
--debug --bail \
|
||||
--kibana-install-dir "$KIBANA_BUILD_LOCATION" \
|
||||
--config x-pack/test/security_solution_cypress/cases_cli_config.ts
|
||||
yarn --cwd x-pack/plugins/security_solution cypress:run:cases
|
||||
|
|
|
@ -5,12 +5,12 @@ set -euo pipefail
|
|||
source .buildkite/scripts/steps/functional/common.sh
|
||||
|
||||
export JOB=kibana-security-solution-chrome
|
||||
export CLI_NUMBER=${CLI_NUMBER:-$((BUILDKITE_PARALLEL_JOB+1))}
|
||||
export CLI_COUNT=${CLI_COUNT:-$BUILDKITE_PARALLEL_JOB_COUNT}
|
||||
export KIBANA_INSTALL_DIR=${KIBANA_BUILD_LOCATION}
|
||||
|
||||
Xvfb :99 -screen 0 1600x1200x24 &
|
||||
|
||||
export DISPLAY=:99
|
||||
|
||||
echo "--- Security Solution tests (Chrome)"
|
||||
|
||||
node scripts/functional_tests \
|
||||
--debug --bail \
|
||||
--kibana-install-dir "$KIBANA_BUILD_LOCATION" \
|
||||
--config x-pack/test/security_solution_cypress/cli_config_parallel.ts
|
||||
yarn --cwd x-pack/plugins/security_solution cypress:run
|
||||
|
|
|
@ -5,12 +5,13 @@ set -euo pipefail
|
|||
source .buildkite/scripts/steps/functional/common.sh
|
||||
|
||||
export JOB=kibana-security-solution-chrome
|
||||
export CLI_NUMBER=${CLI_NUMBER:-$((BUILDKITE_PARALLEL_JOB+1))}
|
||||
export CLI_COUNT=${CLI_COUNT:-$BUILDKITE_PARALLEL_JOB_COUNT}
|
||||
export KIBANA_INSTALL_DIR=${KIBANA_BUILD_LOCATION}
|
||||
|
||||
echo "--- Security Solution tests (Chrome)"
|
||||
|
||||
node scripts/functional_tests \
|
||||
--debug --bail \
|
||||
--kibana-install-dir "$KIBANA_BUILD_LOCATION" \
|
||||
--config x-pack/test/security_solution_cypress/cli_config_investigations_parallel.ts
|
||||
Xvfb :99 -screen 0 1600x1200x24 &
|
||||
|
||||
export DISPLAY=:99
|
||||
|
||||
echo "--- Investigations Cypress Tests on Security Solution"
|
||||
|
||||
yarn --cwd x-pack/plugins/security_solution cypress:investigations:run
|
||||
|
|
11
package.json
11
package.json
|
@ -1000,6 +1000,7 @@
|
|||
"@bazel/ibazel": "^0.16.2",
|
||||
"@bazel/typescript": "4.6.2",
|
||||
"@cypress/code-coverage": "^3.10.0",
|
||||
"@cypress/grep": "^3.1.5",
|
||||
"@cypress/snapshot": "^2.1.7",
|
||||
"@cypress/webpack-preprocessor": "^5.12.2",
|
||||
"@elastic/eslint-plugin-eui": "0.0.2",
|
||||
|
@ -1349,6 +1350,7 @@
|
|||
"chance": "1.0.18",
|
||||
"chromedriver": "^113.0.0",
|
||||
"clean-webpack-plugin": "^3.0.0",
|
||||
"cli-table3": "^0.6.1",
|
||||
"compression-webpack-plugin": "^4.0.0",
|
||||
"copy-webpack-plugin": "^6.0.2",
|
||||
"cpy": "^8.1.1",
|
||||
|
@ -1360,10 +1362,9 @@
|
|||
"cypress-axe": "^1.4.0",
|
||||
"cypress-file-upload": "^5.0.8",
|
||||
"cypress-multi-reporters": "^1.6.3",
|
||||
"cypress-pipe": "^2.0.0",
|
||||
"cypress-react-selector": "^3.0.0",
|
||||
"cypress-real-events": "^1.7.6",
|
||||
"cypress-recurse": "^1.31.2",
|
||||
"cypress-real-events": "^1.8.1",
|
||||
"cypress-recurse": "^1.35.1",
|
||||
"date-fns": "^2.29.3",
|
||||
"debug": "^2.6.9",
|
||||
"delete-empty": "^2.0.0",
|
||||
|
@ -1439,8 +1440,8 @@
|
|||
"minimist": "^1.2.6",
|
||||
"mocha": "^10.1.0",
|
||||
"mocha-junit-reporter": "^2.0.2",
|
||||
"mochawesome": "^7.0.1",
|
||||
"mochawesome-merge": "^4.2.1",
|
||||
"mochawesome": "^7.1.3",
|
||||
"mochawesome-merge": "^4.3.0",
|
||||
"mock-fs": "^5.1.2",
|
||||
"ms-chromium-edge-driver": "^0.5.1",
|
||||
"multistream": "^4.1.0",
|
||||
|
|
|
@ -6,6 +6,7 @@
|
|||
* Side Public License, v 1.
|
||||
*/
|
||||
|
||||
import { v4 as uuid } from 'uuid';
|
||||
import { defineConfig } from 'cypress';
|
||||
import wp from '@cypress/webpack-preprocessor';
|
||||
|
||||
|
@ -15,9 +16,12 @@ export function defineCypressConfig(options?: Cypress.ConfigOptions<any>) {
|
|||
e2e: {
|
||||
...options?.e2e,
|
||||
setupNodeEvents(on, config) {
|
||||
on(
|
||||
'file:preprocessor',
|
||||
wp({
|
||||
on('file:preprocessor', (file) => {
|
||||
const id = uuid();
|
||||
// Fix an issue with running Cypress parallel
|
||||
file.outputPath = file.outputPath.replace(/^(.*\/)(.*?)(\..*)$/, `$1$2.${id}$3`);
|
||||
|
||||
return wp({
|
||||
webpackOptions: {
|
||||
resolve: {
|
||||
extensions: ['.ts', '.tsx', '.js'],
|
||||
|
@ -39,8 +43,8 @@ export function defineCypressConfig(options?: Cypress.ConfigOptions<any>) {
|
|||
],
|
||||
},
|
||||
},
|
||||
})
|
||||
);
|
||||
})(file);
|
||||
});
|
||||
|
||||
const external = options?.e2e?.setupNodeEvents;
|
||||
if (external) {
|
||||
|
|
|
@ -19,9 +19,9 @@ import { ProcRunner } from './proc_runner';
|
|||
* @param {async Function} fn
|
||||
* @return {Promise<undefined>}
|
||||
*/
|
||||
export async function withProcRunner(
|
||||
export async function withProcRunner<T = void>(
|
||||
log: ToolingLog,
|
||||
fn: (procs: ProcRunner) => Promise<void>
|
||||
fn: (procs: ProcRunner) => Promise<T>
|
||||
): Promise<void> {
|
||||
const procs = new ProcRunner(log);
|
||||
|
||||
|
|
|
@ -14,6 +14,7 @@ export { startServersCli, startServers } from './src/functional_tests/start_serv
|
|||
// @internal
|
||||
export { runTestsCli, runTests } from './src/functional_tests/run_tests';
|
||||
|
||||
export { runElasticsearch, runKibanaServer } from './src/functional_tests/lib';
|
||||
export { getKibanaCliArg, getKibanaCliLoggers } from './src/functional_tests/lib/kibana_cli_args';
|
||||
|
||||
export type {
|
||||
|
|
|
@ -192,6 +192,7 @@ export const schema = Joi.object()
|
|||
elasticsearch: urlPartsSchema({
|
||||
requiredKeys: ['port'],
|
||||
}),
|
||||
fleetserver: urlPartsSchema(),
|
||||
})
|
||||
.default(),
|
||||
|
||||
|
|
|
@ -19,6 +19,7 @@ interface RunElasticsearchOptions {
|
|||
config: Config;
|
||||
onEarlyExit?: (msg: string) => void;
|
||||
logsDir?: string;
|
||||
name?: string;
|
||||
}
|
||||
|
||||
interface CcsConfig {
|
||||
|
@ -63,13 +64,13 @@ function getEsConfig({
|
|||
export async function runElasticsearch(
|
||||
options: RunElasticsearchOptions
|
||||
): Promise<() => Promise<void>> {
|
||||
const { log, logsDir } = options;
|
||||
const { log, logsDir, name } = options;
|
||||
const config = getEsConfig(options);
|
||||
|
||||
if (!config.ccsConfig) {
|
||||
const node = await startEsNode({
|
||||
log,
|
||||
name: 'ftr',
|
||||
name: name ?? 'ftr',
|
||||
logsDir,
|
||||
config,
|
||||
});
|
||||
|
@ -81,7 +82,7 @@ export async function runElasticsearch(
|
|||
const remotePort = await getPort();
|
||||
const remoteNode = await startEsNode({
|
||||
log,
|
||||
name: 'ftr-remote',
|
||||
name: name ?? 'ftr-remote',
|
||||
logsDir,
|
||||
config: {
|
||||
...config,
|
||||
|
@ -92,7 +93,7 @@ export async function runElasticsearch(
|
|||
|
||||
const localNode = await startEsNode({
|
||||
log,
|
||||
name: 'ftr-local',
|
||||
name: name ?? 'ftr-local',
|
||||
logsDir,
|
||||
config: {
|
||||
...config,
|
||||
|
|
|
@ -1,9 +1,13 @@
|
|||
{
|
||||
"plugins": ["cypress"],
|
||||
"extends": [
|
||||
"plugin:cypress/recommended"
|
||||
],
|
||||
"env": {
|
||||
"cypress/globals": true
|
||||
},
|
||||
"rules": {
|
||||
"cypress/no-force": "warn",
|
||||
"import/no-extraneous-dependencies": "off"
|
||||
}
|
||||
}
|
||||
|
|
|
@ -440,9 +440,6 @@ taken into consideration until another solution is implemented:
|
|||
|
||||
Remember that minimizing the number of times the web page is loaded, we minimize as well the execution time.
|
||||
|
||||
### Cypress-pipe
|
||||
It is very common in the code to don't have click handlers regitered. In this specific case, please use [Cypress pipe](https://www.cypress.io/blog/2019/01/22/when-can-the-test-click/).
|
||||
|
||||
### CCS test specific
|
||||
When testing CCS we want to put our focus in making sure that our `Source` instance is receiving properly the data that comes from the `Remote` instances, as well as the data is displayed as we expect on the `Source`.
|
||||
|
||||
|
|
|
@ -11,13 +11,16 @@ export default defineCypressConfig({
|
|||
defaultCommandTimeout: 60000,
|
||||
execTimeout: 60000,
|
||||
pageLoadTimeout: 60000,
|
||||
responseTimeout: 60000,
|
||||
screenshotsFolder: '../../../target/kibana-security-solution/cypress/screenshots',
|
||||
trashAssetsBeforeRuns: false,
|
||||
video: false,
|
||||
videosFolder: '../../../target/kibana-security-solution/cypress/videos',
|
||||
viewportHeight: 946,
|
||||
viewportWidth: 1680,
|
||||
numTestsKeptInMemory: 10,
|
||||
e2e: {
|
||||
baseUrl: 'http://localhost:5601',
|
||||
experimentalRunAllSpecs: true,
|
||||
experimentalMemoryManagement: true,
|
||||
},
|
||||
});
|
||||
|
|
|
@ -14,7 +14,7 @@ export default defineCypressConfig({
|
|||
pageLoadTimeout: 150000,
|
||||
numTestsKeptInMemory: 0,
|
||||
retries: {
|
||||
runMode: 2,
|
||||
runMode: 1,
|
||||
},
|
||||
screenshotsFolder: '../../../target/kibana-security-solution/cypress/screenshots',
|
||||
trashAssetsBeforeRuns: false,
|
||||
|
@ -24,5 +24,7 @@ export default defineCypressConfig({
|
|||
viewportWidth: 1680,
|
||||
e2e: {
|
||||
baseUrl: 'http://localhost:5601',
|
||||
experimentalMemoryManagement: true,
|
||||
specPattern: './cypress/e2e/**/*.cy.ts',
|
||||
},
|
||||
});
|
||||
|
|
|
@ -19,6 +19,7 @@ import { ATTACH_ALERT_TO_CASE_BUTTON, ATTACH_TO_NEW_CASE_BUTTON } from '../../sc
|
|||
import { LOADING_INDICATOR } from '../../screens/security_header';
|
||||
|
||||
const loadDetectionsPage = (role: ROLES) => {
|
||||
login(role);
|
||||
waitForPageWithoutDateRange(ALERTS_URL, role);
|
||||
waitForAlertsToPopulate();
|
||||
};
|
||||
|
@ -35,7 +36,6 @@ describe('Alerts timeline', () => {
|
|||
|
||||
context('Privileges: read only', () => {
|
||||
beforeEach(() => {
|
||||
login(ROLES.reader);
|
||||
loadDetectionsPage(ROLES.reader);
|
||||
});
|
||||
|
||||
|
@ -54,7 +54,6 @@ describe('Alerts timeline', () => {
|
|||
|
||||
context('Privileges: can crud', () => {
|
||||
beforeEach(() => {
|
||||
login(ROLES.platform_engineer);
|
||||
loadDetectionsPage(ROLES.platform_engineer);
|
||||
cy.get(LOADING_INDICATOR).should('not.exist'); // on CI, waitForPageToBeLoaded fails because the loading icon can't be found
|
||||
});
|
||||
|
|
|
@ -23,9 +23,10 @@ describe('attach timeline to case', () => {
|
|||
context('without cases created', () => {
|
||||
before(() => {
|
||||
cleanKibana();
|
||||
login();
|
||||
});
|
||||
|
||||
beforeEach(() => {
|
||||
login();
|
||||
deleteTimelines();
|
||||
createTimeline(getTimeline()).then((response) => {
|
||||
cy.wrap(response.body.data.persistTimeline.timeline).as('myTimeline');
|
||||
|
@ -60,6 +61,7 @@ describe('attach timeline to case', () => {
|
|||
|
||||
context('with cases created', () => {
|
||||
before(() => {
|
||||
login();
|
||||
deleteTimelines();
|
||||
createTimeline(getTimeline()).then((response) =>
|
||||
cy.wrap(response.body.data.persistTimeline.timeline.savedObjectId).as('timelineId')
|
||||
|
@ -67,6 +69,10 @@ describe('attach timeline to case', () => {
|
|||
createCase(getCase1()).then((response) => cy.wrap(response.body.id).as('caseId'));
|
||||
});
|
||||
|
||||
beforeEach(() => {
|
||||
login();
|
||||
});
|
||||
|
||||
it('attach timeline to an existing case', function () {
|
||||
visitTimeline(this.timelineId);
|
||||
attachTimelineToExistingCase();
|
||||
|
|
|
@ -33,7 +33,9 @@ describe('Cases connector incident fields', () => {
|
|||
cleanKibana();
|
||||
login();
|
||||
});
|
||||
|
||||
beforeEach(() => {
|
||||
login();
|
||||
cy.intercept('GET', '/api/cases/configure/connectors/_find', getMockConnectorsResponse());
|
||||
cy.intercept('POST', `/api/actions/connector/${getConnectorIds().sn}/_execute`, (req) => {
|
||||
const response =
|
||||
|
|
|
@ -48,10 +48,10 @@ describe('Cases connectors', () => {
|
|||
|
||||
before(() => {
|
||||
cleanKibana();
|
||||
login();
|
||||
});
|
||||
|
||||
beforeEach(() => {
|
||||
login();
|
||||
deleteCases();
|
||||
cy.intercept('GET', `${snConnector.URL}/api/x_elas2_inc_int/elastic_api/health*`, {
|
||||
statusCode: 200,
|
||||
|
@ -59,7 +59,7 @@ describe('Cases connectors', () => {
|
|||
});
|
||||
|
||||
cy.intercept('POST', '/api/actions/connector').as('createConnector');
|
||||
cy.intercept('PATCH', '/api/cases/configure/*', (req) => {
|
||||
cy.intercept({ method: '+(POST|PATCH)', url: '/api/cases/configure' }, (req) => {
|
||||
const connector = req.body.connector;
|
||||
req.reply((res) => {
|
||||
res.send(200, { ...configureResult, connector });
|
||||
|
|
|
@ -49,7 +49,7 @@ import {
|
|||
fillCasesMandatoryfields,
|
||||
filterStatusOpen,
|
||||
} from '../../tasks/create_new_case';
|
||||
import { loginWithUser, visitWithoutDateRange } from '../../tasks/login';
|
||||
import { loginWithUser, visit, visitWithoutDateRange } from '../../tasks/login';
|
||||
|
||||
import { CASES_URL, OVERVIEW_URL } from '../../urls/navigation';
|
||||
|
||||
|
@ -121,7 +121,7 @@ describe('Cases', () => {
|
|||
cy.get(TIMELINE_DESCRIPTION).contains(this.mycase.timeline.description);
|
||||
cy.get(TIMELINE_QUERY).should('have.text', this.mycase.timeline.query);
|
||||
|
||||
cy.visit(OVERVIEW_URL);
|
||||
visit(OVERVIEW_URL);
|
||||
cy.get(OVERVIEW_CASE_NAME).should('have.text', this.mycase.name);
|
||||
cy.get(OVERVIEW_CASE_DESCRIPTION).should(
|
||||
'have.text',
|
||||
|
|
|
@ -17,13 +17,7 @@ import {
|
|||
fillCasesMandatoryfields,
|
||||
filterStatusOpen,
|
||||
} from '../../tasks/create_new_case';
|
||||
import {
|
||||
login,
|
||||
loginWithUser,
|
||||
logout,
|
||||
visitHostDetailsPage,
|
||||
visitWithUser,
|
||||
} from '../../tasks/login';
|
||||
import { login, loginWithUser, visitWithUser } from '../../tasks/login';
|
||||
import {
|
||||
createUsersAndRoles,
|
||||
deleteUsersAndRoles,
|
||||
|
@ -38,7 +32,6 @@ import {
|
|||
} from '../../tasks/privileges';
|
||||
|
||||
import { CASES_URL } from '../../urls/navigation';
|
||||
import { openSourcerer } from '../../tasks/sourcerer';
|
||||
const usersToCreate = [
|
||||
secAllUser,
|
||||
secReadCasesAllUser,
|
||||
|
@ -46,12 +39,6 @@ const usersToCreate = [
|
|||
secAllCasesOnlyReadDeleteUser,
|
||||
];
|
||||
const rolesToCreate = [secAll, secReadCasesAll, secAllCasesNoDelete, secAllCasesOnlyReadDelete];
|
||||
// needed to generate index pattern
|
||||
const visitSecuritySolution = () => {
|
||||
visitHostDetailsPage();
|
||||
openSourcerer();
|
||||
logout();
|
||||
};
|
||||
|
||||
const testCase: TestCaseWithoutTimeline = {
|
||||
name: 'This is the title of the case',
|
||||
|
@ -64,9 +51,7 @@ const testCase: TestCaseWithoutTimeline = {
|
|||
describe('Cases privileges', () => {
|
||||
before(() => {
|
||||
cleanKibana();
|
||||
login();
|
||||
createUsersAndRoles(usersToCreate, rolesToCreate);
|
||||
visitSecuritySolution();
|
||||
});
|
||||
|
||||
after(() => {
|
||||
|
@ -74,6 +59,7 @@ describe('Cases privileges', () => {
|
|||
});
|
||||
|
||||
beforeEach(() => {
|
||||
login();
|
||||
deleteCases();
|
||||
});
|
||||
|
||||
|
|
|
@ -14,7 +14,7 @@ import {
|
|||
} from '../../screens/entity_analytics';
|
||||
import {
|
||||
deleteRiskScore,
|
||||
intercepInstallRiskScoreModule,
|
||||
interceptInstallRiskScoreModule,
|
||||
waitForInstallRiskScoreModule,
|
||||
} from '../../tasks/api_calls/risk_scores';
|
||||
import { findSavedObjects } from '../../tasks/api_calls/risk_scores/saved_objects';
|
||||
|
@ -40,6 +40,7 @@ describe('Enable risk scores', () => {
|
|||
});
|
||||
|
||||
beforeEach(() => {
|
||||
login();
|
||||
deleteRiskScore({ riskScoreEntity: RiskScoreEntity.host, spaceId });
|
||||
deleteRiskScore({ riskScoreEntity: RiskScoreEntity.user, spaceId });
|
||||
visit(ENTITY_ANALYTICS_URL);
|
||||
|
@ -55,7 +56,7 @@ describe('Enable risk scores', () => {
|
|||
});
|
||||
|
||||
it('should install host risk score successfully', () => {
|
||||
intercepInstallRiskScoreModule();
|
||||
interceptInstallRiskScoreModule();
|
||||
clickEnableRiskScore(RiskScoreEntity.host);
|
||||
waitForInstallRiskScoreModule();
|
||||
|
||||
|
@ -89,7 +90,7 @@ describe('Enable risk scores', () => {
|
|||
});
|
||||
|
||||
it('should install user risk score successfully', () => {
|
||||
intercepInstallRiskScoreModule();
|
||||
interceptInstallRiskScoreModule();
|
||||
clickEnableRiskScore(RiskScoreEntity.user);
|
||||
waitForInstallRiskScoreModule();
|
||||
|
||||
|
|
|
@ -52,11 +52,11 @@ const END_DATE = 'Jan 19, 2019 @ 20:33:29.186';
|
|||
describe('Entity Analytics Dashboard', () => {
|
||||
before(() => {
|
||||
cleanKibana();
|
||||
login();
|
||||
});
|
||||
|
||||
describe('Without data', () => {
|
||||
beforeEach(() => {
|
||||
login();
|
||||
visit(ENTITY_ANALYTICS_URL);
|
||||
});
|
||||
|
||||
|
@ -76,6 +76,7 @@ describe('Entity Analytics Dashboard', () => {
|
|||
});
|
||||
|
||||
beforeEach(() => {
|
||||
login();
|
||||
visit(ENTITY_ANALYTICS_URL);
|
||||
});
|
||||
|
||||
|
@ -100,6 +101,7 @@ describe('Entity Analytics Dashboard', () => {
|
|||
});
|
||||
|
||||
beforeEach(() => {
|
||||
login();
|
||||
visit(ENTITY_ANALYTICS_URL);
|
||||
});
|
||||
|
||||
|
@ -123,6 +125,7 @@ describe('Entity Analytics Dashboard', () => {
|
|||
});
|
||||
|
||||
beforeEach(() => {
|
||||
login();
|
||||
visit(ENTITY_ANALYTICS_URL);
|
||||
});
|
||||
|
||||
|
@ -167,6 +170,7 @@ describe('Entity Analytics Dashboard', () => {
|
|||
});
|
||||
|
||||
beforeEach(() => {
|
||||
login();
|
||||
visit(ALERTS_URL);
|
||||
waitForAlertsToPopulate();
|
||||
visit(ENTITY_ANALYTICS_URL);
|
||||
|
@ -209,6 +213,7 @@ describe('Entity Analytics Dashboard', () => {
|
|||
});
|
||||
|
||||
beforeEach(() => {
|
||||
login();
|
||||
visit(ENTITY_ANALYTICS_URL);
|
||||
});
|
||||
|
||||
|
@ -253,6 +258,7 @@ describe('Entity Analytics Dashboard', () => {
|
|||
});
|
||||
|
||||
beforeEach(() => {
|
||||
login();
|
||||
visit(ALERTS_URL);
|
||||
waitForAlertsToPopulate();
|
||||
visit(ENTITY_ANALYTICS_URL);
|
||||
|
@ -300,6 +306,7 @@ describe('Entity Analytics Dashboard', () => {
|
|||
});
|
||||
|
||||
beforeEach(() => {
|
||||
login();
|
||||
visit(ENTITY_ANALYTICS_URL);
|
||||
});
|
||||
|
||||
|
|
|
@ -43,6 +43,7 @@ describe('Upgrade risk scores', () => {
|
|||
});
|
||||
|
||||
beforeEach(() => {
|
||||
login();
|
||||
deleteRiskScore({ riskScoreEntity: RiskScoreEntity.host, spaceId });
|
||||
deleteRiskScore({ riskScoreEntity: RiskScoreEntity.user, spaceId });
|
||||
installLegacyRiskScoreModule(RiskScoreEntity.host, spaceId);
|
||||
|
@ -87,11 +88,11 @@ versions.forEach((version) =>
|
|||
describe(`handles version ${version} upgrades`, () => {
|
||||
before(() => {
|
||||
cleanKibana();
|
||||
login();
|
||||
createRule(getNewRule({ rule_id: 'rule1' }));
|
||||
});
|
||||
|
||||
beforeEach(() => {
|
||||
login();
|
||||
createRule(getNewRule({ rule_id: 'rule1' }));
|
||||
deleteRiskScore({ riskScoreEntity: RiskScoreEntity.host, spaceId });
|
||||
deleteRiskScore({ riskScoreEntity: RiskScoreEntity.user, spaceId });
|
||||
installLegacyRiskScoreModule(RiskScoreEntity.host, spaceId, version);
|
||||
|
|
|
@ -29,6 +29,9 @@ describe('Create DataView runtime field', () => {
|
|||
before(() => {
|
||||
deleteRuntimeField('security-solution-default', alertRunTimeField);
|
||||
deleteRuntimeField('security-solution-default', timelineRuntimeField);
|
||||
});
|
||||
|
||||
beforeEach(() => {
|
||||
login();
|
||||
});
|
||||
|
||||
|
|
|
@ -59,11 +59,9 @@ describe('Sourcerer', () => {
|
|||
});
|
||||
|
||||
describe('Default scope', () => {
|
||||
before(() => {
|
||||
login();
|
||||
});
|
||||
beforeEach(() => {
|
||||
cy.clearLocalStorage();
|
||||
login();
|
||||
visit(HOSTS_URL);
|
||||
});
|
||||
|
||||
|
@ -134,11 +132,9 @@ describe('Sourcerer', () => {
|
|||
});
|
||||
});
|
||||
describe('Timeline scope', () => {
|
||||
before(() => {
|
||||
login();
|
||||
});
|
||||
beforeEach(() => {
|
||||
cy.clearLocalStorage();
|
||||
login();
|
||||
visit(TIMELINES_URL);
|
||||
});
|
||||
|
||||
|
@ -201,10 +197,13 @@ describe('Timeline scope', () => {
|
|||
cy.wrap(response.body.data.persistTimeline.timeline.savedObjectId).as('auditbeatTimelineId')
|
||||
);
|
||||
});
|
||||
|
||||
beforeEach(() => {
|
||||
login();
|
||||
visit(TIMELINES_URL);
|
||||
refreshUntilAlertsIndexExists();
|
||||
});
|
||||
|
||||
it('Modifies timeline to alerts only, and switches to different saved timeline without issue', function () {
|
||||
openTimelineById(this.timelineId).then(() => {
|
||||
cy.get(SOURCERER.badgeAlerts).should(`not.exist`);
|
||||
|
|
|
@ -24,10 +24,14 @@ import {
|
|||
} from '../../screens/search_bar';
|
||||
import { TOASTER } from '../../screens/alerts_detection_rules';
|
||||
|
||||
describe('Histogram legend hover actions', { testIsolation: false }, () => {
|
||||
describe('Histogram legend hover actions', () => {
|
||||
const ruleConfigs = getNewRule();
|
||||
|
||||
before(() => {
|
||||
cleanKibana();
|
||||
});
|
||||
|
||||
beforeEach(() => {
|
||||
login();
|
||||
createRule(getNewRule({ rule_id: 'new custom rule' }));
|
||||
visit(ALERTS_URL);
|
||||
|
@ -52,7 +56,7 @@ describe('Histogram legend hover actions', { testIsolation: false }, () => {
|
|||
);
|
||||
cy.get(ALERTS_COUNT).should('not.exist');
|
||||
|
||||
cy.get(GLOBAL_SEARCH_BAR_FILTER_ITEM_DELETE).trigger('click');
|
||||
cy.get(GLOBAL_SEARCH_BAR_FILTER_ITEM_DELETE).click();
|
||||
cy.get(GLOBAL_SEARCH_BAR_FILTER_ITEM).should('not.exist');
|
||||
});
|
||||
|
||||
|
|
|
@ -16,6 +16,7 @@ import { createRule, deleteCustomRule } from '../../tasks/api_calls/rules';
|
|||
import { getCallOut, waitForCallOutToBeShown } from '../../tasks/common/callouts';
|
||||
|
||||
const loadPageAsPlatformEngineerUser = (url: string) => {
|
||||
login(ROLES.soc_manager);
|
||||
waitForPageWithoutDateRange(url, ROLES.soc_manager);
|
||||
waitForPageTitleToBeShown();
|
||||
};
|
||||
|
@ -30,10 +31,9 @@ describe('Detections > Need Admin Callouts indicating an admin is needed to migr
|
|||
before(() => {
|
||||
// First, we have to open the app on behalf of a privileged user in order to initialize it.
|
||||
// Otherwise the app will be disabled and show a "welcome"-like page.
|
||||
login(ROLES.platform_engineer);
|
||||
login();
|
||||
visitWithoutDateRange(ALERTS_URL);
|
||||
// After that we can login as a soc manager.
|
||||
login(ROLES.soc_manager);
|
||||
waitForPageTitleToBeShown();
|
||||
});
|
||||
|
||||
context(
|
||||
|
@ -51,6 +51,7 @@ describe('Detections > Need Admin Callouts indicating an admin is needed to migr
|
|||
});
|
||||
});
|
||||
});
|
||||
|
||||
context('On Detections home page', () => {
|
||||
beforeEach(() => {
|
||||
loadPageAsPlatformEngineerUser(ALERTS_URL);
|
||||
|
|
|
@ -43,6 +43,7 @@ describe('CTI Enrichment', () => {
|
|||
});
|
||||
|
||||
beforeEach(() => {
|
||||
login();
|
||||
visitWithoutDateRange(DETECTIONS_RULE_MANAGEMENT_URL);
|
||||
goToRuleDetails();
|
||||
});
|
||||
|
@ -155,6 +156,12 @@ describe('CTI Enrichment', () => {
|
|||
esArchiverLoad('threat_indicator2');
|
||||
});
|
||||
|
||||
beforeEach(() => {
|
||||
login();
|
||||
visitWithoutDateRange(DETECTIONS_RULE_MANAGEMENT_URL);
|
||||
goToRuleDetails();
|
||||
});
|
||||
|
||||
after(() => {
|
||||
esArchiverUnload('threat_indicator2');
|
||||
});
|
||||
|
|
|
@ -34,7 +34,6 @@ describe('Enrichment', () => {
|
|||
before(() => {
|
||||
cleanKibana();
|
||||
esArchiverLoad('risk_users');
|
||||
login();
|
||||
});
|
||||
|
||||
after(() => {
|
||||
|
@ -46,6 +45,7 @@ describe('Enrichment', () => {
|
|||
esArchiverLoad('risk_hosts');
|
||||
deleteAlertsAndRules();
|
||||
createRule(getNewRule({ rule_id: 'rule1' }));
|
||||
login();
|
||||
visit(ALERTS_URL);
|
||||
waitForAlertsToPopulate();
|
||||
});
|
||||
|
|
|
@ -16,11 +16,13 @@ import { createRule, deleteCustomRule } from '../../tasks/api_calls/rules';
|
|||
import { getCallOut, waitForCallOutToBeShown, dismissCallOut } from '../../tasks/common/callouts';
|
||||
|
||||
const loadPageAsReadOnlyUser = (url: string) => {
|
||||
login(ROLES.reader);
|
||||
waitForPageWithoutDateRange(url, ROLES.reader);
|
||||
waitForPageTitleToBeShown();
|
||||
};
|
||||
|
||||
const loadPageAsPlatformEngineer = (url: string) => {
|
||||
login(ROLES.platform_engineer);
|
||||
waitForPageWithoutDateRange(url, ROLES.platform_engineer);
|
||||
waitForPageTitleToBeShown();
|
||||
};
|
||||
|
@ -40,11 +42,9 @@ describe('Detections > Callouts', () => {
|
|||
before(() => {
|
||||
// First, we have to open the app on behalf of a privileged user in order to initialize it.
|
||||
// Otherwise the app will be disabled and show a "welcome"-like page.
|
||||
login(ROLES.platform_engineer);
|
||||
login();
|
||||
visitWithoutDateRange(ALERTS_URL);
|
||||
|
||||
// After that we can login as a read-only user.
|
||||
login(ROLES.reader);
|
||||
waitForPageTitleToBeShown();
|
||||
});
|
||||
|
||||
context('indicating read-only access to resources', () => {
|
||||
|
@ -111,6 +111,7 @@ describe('Detections > Callouts', () => {
|
|||
|
||||
context('On Rules Management page', () => {
|
||||
beforeEach(() => {
|
||||
login(ROLES.platform_engineer);
|
||||
loadPageAsPlatformEngineer(DETECTIONS_RULE_MANAGEMENT_URL);
|
||||
});
|
||||
|
||||
|
|
|
@ -17,12 +17,12 @@ import { createTimeline } from '../../tasks/timelines';
|
|||
|
||||
describe('Ransomware Detection Alerts', () => {
|
||||
before(() => {
|
||||
login();
|
||||
esArchiverLoad('ransomware_detection');
|
||||
});
|
||||
|
||||
describe('Ransomware display in Alerts Section', () => {
|
||||
beforeEach(() => {
|
||||
login();
|
||||
visit(ALERTS_URL);
|
||||
waitForAlertsToPopulate();
|
||||
});
|
||||
|
@ -46,8 +46,8 @@ describe('Ransomware Detection Alerts', () => {
|
|||
|
||||
describe('Ransomware in Timelines', () => {
|
||||
before(() => {
|
||||
login();
|
||||
visit(TIMELINES_URL);
|
||||
|
||||
createTimeline();
|
||||
});
|
||||
|
||||
|
|
|
@ -10,19 +10,23 @@ import { login, visit } from '../../tasks/login';
|
|||
|
||||
import { ALERTS_URL, TIMELINES_URL } from '../../urls/navigation';
|
||||
import { ALERTS_HISTOGRAM_SERIES, ALERT_RULE_NAME, MESSAGE } from '../../screens/alerts';
|
||||
import { esArchiverLoad } from '../../tasks/es_archiver';
|
||||
import { esArchiverLoad, esArchiverUnload } from '../../tasks/es_archiver';
|
||||
import { TIMELINE_QUERY, TIMELINE_VIEW_IN_ANALYZER } from '../../screens/timeline';
|
||||
import { selectAlertsHistogram } from '../../tasks/alerts';
|
||||
import { createTimeline } from '../../tasks/timelines';
|
||||
|
||||
describe('Ransomware Prevention Alerts', () => {
|
||||
before(() => {
|
||||
login();
|
||||
esArchiverLoad('ransomware_prevention');
|
||||
});
|
||||
|
||||
after(() => {
|
||||
esArchiverUnload('ransomware_prevention');
|
||||
});
|
||||
|
||||
describe('Ransomware display in Alerts Section', () => {
|
||||
beforeEach(() => {
|
||||
login();
|
||||
visit(ALERTS_URL);
|
||||
waitForAlertsToPopulate();
|
||||
});
|
||||
|
@ -45,7 +49,8 @@ describe('Ransomware Prevention Alerts', () => {
|
|||
});
|
||||
|
||||
describe('Ransomware in Timelines', () => {
|
||||
before(() => {
|
||||
beforeEach(() => {
|
||||
login();
|
||||
visit(TIMELINES_URL);
|
||||
|
||||
createTimeline();
|
||||
|
|
|
@ -26,10 +26,10 @@ describe('All rules - read only', () => {
|
|||
before(() => {
|
||||
cleanKibana();
|
||||
createRule(getNewRule({ rule_id: '1' }));
|
||||
login(ROLES.reader);
|
||||
});
|
||||
|
||||
beforeEach(() => {
|
||||
login(ROLES.reader);
|
||||
visitWithoutDateRange(SECURITY_DETECTIONS_RULES_URL, ROLES.reader);
|
||||
waitForRulesTableToBeLoaded();
|
||||
cy.get(RULE_NAME).should('have.text', getNewRule().name);
|
||||
|
|
|
@ -53,47 +53,48 @@ const NON_EXPIRED_EXCEPTION_ITEM_NAME = 'Sample exception item with future expir
|
|||
describe('Detection rules, bulk duplicate', () => {
|
||||
before(() => {
|
||||
cleanKibana();
|
||||
login();
|
||||
});
|
||||
|
||||
beforeEach(() => {
|
||||
login();
|
||||
// Make sure persisted rules table state is cleared
|
||||
resetRulesTableState();
|
||||
deleteAlertsAndRules();
|
||||
esArchiverResetKibana();
|
||||
createRule(getNewRule({ name: RULE_NAME, ...defaultRuleData, rule_id: '1' })).then(
|
||||
(response) => {
|
||||
createRuleExceptionItem(response.body.id, [
|
||||
{
|
||||
description: 'Exception item for rule default exception list',
|
||||
entries: [
|
||||
{
|
||||
field: 'user.name',
|
||||
operator: 'included',
|
||||
type: 'match',
|
||||
value: 'some value',
|
||||
},
|
||||
],
|
||||
name: EXPIRED_EXCEPTION_ITEM_NAME,
|
||||
type: 'simple',
|
||||
expire_time: expiredDate,
|
||||
},
|
||||
{
|
||||
description: 'Exception item for rule default exception list',
|
||||
entries: [
|
||||
{
|
||||
field: 'user.name',
|
||||
operator: 'included',
|
||||
type: 'match',
|
||||
value: 'some value',
|
||||
},
|
||||
],
|
||||
name: NON_EXPIRED_EXCEPTION_ITEM_NAME,
|
||||
type: 'simple',
|
||||
expire_time: futureDate,
|
||||
},
|
||||
]);
|
||||
}
|
||||
);
|
||||
createRule<{ id: string }>(
|
||||
getNewRule({ name: RULE_NAME, ...defaultRuleData, rule_id: '1' })
|
||||
).then((response) => {
|
||||
createRuleExceptionItem(response.body.id, [
|
||||
{
|
||||
description: 'Exception item for rule default exception list',
|
||||
entries: [
|
||||
{
|
||||
field: 'user.name',
|
||||
operator: 'included',
|
||||
type: 'match',
|
||||
value: 'some value',
|
||||
},
|
||||
],
|
||||
name: EXPIRED_EXCEPTION_ITEM_NAME,
|
||||
type: 'simple',
|
||||
expire_time: expiredDate,
|
||||
},
|
||||
{
|
||||
description: 'Exception item for rule default exception list',
|
||||
entries: [
|
||||
{
|
||||
field: 'user.name',
|
||||
operator: 'included',
|
||||
type: 'match',
|
||||
value: 'some value',
|
||||
},
|
||||
],
|
||||
name: NON_EXPIRED_EXCEPTION_ITEM_NAME,
|
||||
type: 'simple',
|
||||
expire_time: futureDate,
|
||||
},
|
||||
]);
|
||||
});
|
||||
|
||||
visitWithoutDateRange(SECURITY_DETECTIONS_RULES_URL);
|
||||
|
||||
|
|
|
@ -118,9 +118,9 @@ const defaultRuleData = {
|
|||
describe('Detection rules, bulk edit', () => {
|
||||
before(() => {
|
||||
cleanKibana();
|
||||
login();
|
||||
});
|
||||
beforeEach(() => {
|
||||
login();
|
||||
// Make sure persisted rules table state is cleared
|
||||
resetRulesTableState();
|
||||
deleteAlertsAndRules();
|
||||
|
|
|
@ -55,11 +55,12 @@ const expectedNumberOfCustomRulesToBeEdited = 6;
|
|||
describe('Bulk editing index patterns of rules with a data view only', () => {
|
||||
before(() => {
|
||||
cleanKibana();
|
||||
login();
|
||||
});
|
||||
|
||||
beforeEach(() => {
|
||||
deleteAlertsAndRules();
|
||||
esArchiverResetKibana();
|
||||
login();
|
||||
|
||||
postDataView(DATA_VIEW_ID);
|
||||
|
||||
|
@ -179,11 +180,13 @@ describe('Bulk editing index patterns of rules with a data view only', () => {
|
|||
|
||||
describe('Bulk editing index patterns of rules with index patterns and rules with a data view', () => {
|
||||
const customRulesNumber = 2;
|
||||
|
||||
before(() => {
|
||||
cleanKibana();
|
||||
login();
|
||||
});
|
||||
|
||||
beforeEach(() => {
|
||||
login();
|
||||
deleteAlertsAndRules();
|
||||
esArchiverResetKibana();
|
||||
|
||||
|
|
|
@ -111,8 +111,8 @@ import { RULE_CREATION, DETECTIONS_RULE_MANAGEMENT_URL } from '../../urls/naviga
|
|||
describe('Custom query rules', () => {
|
||||
before(() => {
|
||||
cleanKibana();
|
||||
login();
|
||||
});
|
||||
|
||||
describe('Custom detection rules creation', () => {
|
||||
const expectedNumberOfRules = 1;
|
||||
|
||||
|
@ -123,6 +123,7 @@ describe('Custom query rules', () => {
|
|||
return response.body.data.persistTimeline.timeline.savedObjectId;
|
||||
})
|
||||
.as('timelineId');
|
||||
login();
|
||||
});
|
||||
|
||||
it('Creates and enables a new rule', function () {
|
||||
|
@ -240,6 +241,7 @@ describe('Custom query rules', () => {
|
|||
createRule(getNewRule({ rule_id: 'rule1', enabled: true, max_signals: 500 }));
|
||||
createRule(getNewOverrideRule({ rule_id: 'rule2', enabled: true, max_signals: 500 }));
|
||||
createRule(getExistingRule({ rule_id: 'rule3', enabled: true }));
|
||||
login();
|
||||
visit(DETECTIONS_RULE_MANAGEMENT_URL);
|
||||
});
|
||||
|
||||
|
@ -351,7 +353,9 @@ describe('Custom query rules', () => {
|
|||
deleteConnectors();
|
||||
createRule(getExistingRule({ rule_id: 'rule1', enabled: true }));
|
||||
});
|
||||
|
||||
beforeEach(() => {
|
||||
login();
|
||||
visit(DETECTIONS_RULE_MANAGEMENT_URL);
|
||||
});
|
||||
|
||||
|
|
|
@ -69,10 +69,6 @@ import { getDetails } from '../../tasks/rule_details';
|
|||
import { RULE_CREATION } from '../../urls/navigation';
|
||||
|
||||
describe('Custom query rules', () => {
|
||||
before(() => {
|
||||
login();
|
||||
});
|
||||
|
||||
describe('Custom detection rules creation with data views', () => {
|
||||
const rule = getDataViewRule();
|
||||
const expectedUrls = rule.references?.join('');
|
||||
|
@ -83,14 +79,15 @@ describe('Custom query rules', () => {
|
|||
const expectedNumberOfRules = 1;
|
||||
|
||||
beforeEach(() => {
|
||||
/* We don't call cleanKibana method on the before hook, instead we call esArchiverReseKibana on the before each. This is because we
|
||||
/* We don't call cleanKibana method on the before hook, instead we call esArchiverReseKibana on the before each. This is because we
|
||||
are creating a data view we'll use after and cleanKibana does not delete all the data views created, esArchiverReseKibana does.
|
||||
We don't use esArchiverReseKibana in all the tests because is a time-consuming method and we don't need to perform an exhaustive
|
||||
We don't use esArchiverReseKibana in all the tests because is a time-consuming method and we don't need to perform an exhaustive
|
||||
cleaning in all the other tests. */
|
||||
esArchiverResetKibana();
|
||||
if (rule.data_view_id != null) {
|
||||
postDataView(rule.data_view_id);
|
||||
}
|
||||
login();
|
||||
});
|
||||
|
||||
it('Creates and enables a new rule', function () {
|
||||
|
@ -150,11 +147,14 @@ describe('Custom query rules', () => {
|
|||
.should('match', /^[1-9].+$/);
|
||||
cy.get(ALERT_GRID_CELL).contains(rule.name);
|
||||
});
|
||||
|
||||
it('Creates and edits a new rule with a data view', function () {
|
||||
visit(RULE_CREATION);
|
||||
fillDefineCustomRuleAndContinue(rule);
|
||||
cy.get(RULE_NAME_INPUT).clear().type(rule.name);
|
||||
cy.get(RULE_DESCRIPTION_INPUT).clear().type(rule.description);
|
||||
cy.get(RULE_NAME_INPUT).clear();
|
||||
cy.get(RULE_NAME_INPUT).type(rule.name);
|
||||
cy.get(RULE_DESCRIPTION_INPUT).clear();
|
||||
cy.get(RULE_DESCRIPTION_INPUT).type(rule.description);
|
||||
|
||||
cy.get(ABOUT_CONTINUE_BTN).should('exist').click();
|
||||
|
||||
|
|
|
@ -49,10 +49,11 @@ const savedQueryFilterKey = 'testAgent.value';
|
|||
describe('Custom saved_query rules', () => {
|
||||
before(() => {
|
||||
cleanKibana();
|
||||
login();
|
||||
});
|
||||
|
||||
describe('Custom saved_query detection rule creation', () => {
|
||||
beforeEach(() => {
|
||||
login();
|
||||
deleteAlertsAndRules();
|
||||
deleteSavedQueries();
|
||||
});
|
||||
|
@ -102,7 +103,7 @@ describe('Custom saved_query rules', () => {
|
|||
const FAILED_TO_LOAD_ERROR = 'Failed to load the saved query';
|
||||
beforeEach(() => {
|
||||
createRule(getSavedQueryRule({ saved_id: 'non-existent', query: undefined }));
|
||||
cy.visit(SECURITY_DETECTIONS_RULES_URL);
|
||||
visit(SECURITY_DETECTIONS_RULES_URL);
|
||||
});
|
||||
it('Shows error toast on details page when saved query can not be loaded', function () {
|
||||
goToRuleDetails();
|
||||
|
@ -122,7 +123,7 @@ describe('Custom saved_query rules', () => {
|
|||
createSavedQuery(savedQueryName, savedQueryQuery);
|
||||
createRule(getNewRule());
|
||||
|
||||
cy.visit(SECURITY_DETECTIONS_RULES_URL);
|
||||
visit(SECURITY_DETECTIONS_RULES_URL);
|
||||
|
||||
editFirstRule();
|
||||
|
||||
|
@ -150,7 +151,7 @@ describe('Custom saved_query rules', () => {
|
|||
createRule(getSavedQueryRule({ saved_id: response.body.id, query: undefined }));
|
||||
});
|
||||
|
||||
cy.visit(SECURITY_DETECTIONS_RULES_URL);
|
||||
visit(SECURITY_DETECTIONS_RULES_URL);
|
||||
|
||||
editFirstRule();
|
||||
|
||||
|
@ -176,7 +177,7 @@ describe('Custom saved_query rules', () => {
|
|||
const expectedCustomTestQuery = 'random test query';
|
||||
createRule(getSavedQueryRule({ saved_id: 'non-existent', query: undefined }));
|
||||
|
||||
cy.visit(SECURITY_DETECTIONS_RULES_URL);
|
||||
visit(SECURITY_DETECTIONS_RULES_URL);
|
||||
|
||||
editFirstRule();
|
||||
|
||||
|
@ -199,7 +200,7 @@ describe('Custom saved_query rules', () => {
|
|||
createSavedQuery(savedQueryName, savedQueryQuery);
|
||||
createRule(getSavedQueryRule({ saved_id: 'non-existent', query: undefined }));
|
||||
|
||||
cy.visit(SECURITY_DETECTIONS_RULES_URL);
|
||||
visit(SECURITY_DETECTIONS_RULES_URL);
|
||||
|
||||
editFirstRule();
|
||||
|
||||
|
|
|
@ -65,9 +65,13 @@ import { esArchiverLoad, esArchiverUnload } from '../../tasks/es_archiver';
|
|||
describe('EQL rules', () => {
|
||||
before(() => {
|
||||
cleanKibana();
|
||||
});
|
||||
|
||||
beforeEach(() => {
|
||||
login();
|
||||
deleteAlertsAndRules();
|
||||
});
|
||||
|
||||
describe('Detection rules, EQL', () => {
|
||||
const rule = getEqlRule();
|
||||
const expectedUrls = rule.references?.join('');
|
||||
|
@ -155,6 +159,7 @@ describe('EQL rules', () => {
|
|||
});
|
||||
|
||||
it('Creates and enables a new EQL rule with a sequence', function () {
|
||||
login();
|
||||
visit(RULE_CREATION);
|
||||
selectEqlRuleType();
|
||||
fillDefineEqlRuleAndContinue(rule);
|
||||
|
|
|
@ -42,10 +42,10 @@ describe('Export rules', () => {
|
|||
|
||||
before(() => {
|
||||
cleanKibana();
|
||||
login();
|
||||
});
|
||||
|
||||
beforeEach(() => {
|
||||
login();
|
||||
// Make sure persisted rules table state is cleared
|
||||
resetRulesTableState();
|
||||
deleteAlertsAndRules();
|
||||
|
|
|
@ -20,9 +20,10 @@ const RULES_TO_IMPORT_FILENAME = 'cypress/fixtures/7_16_rules.ndjson';
|
|||
describe('Import rules', () => {
|
||||
before(() => {
|
||||
cleanKibana();
|
||||
login();
|
||||
});
|
||||
|
||||
beforeEach(() => {
|
||||
login();
|
||||
deleteAlertsAndRules();
|
||||
cy.intercept('POST', '/api/detection_engine/rules/_import*').as('import');
|
||||
visitWithoutDateRange(DETECTIONS_RULE_MANAGEMENT_URL);
|
||||
|
|
|
@ -123,6 +123,9 @@ describe('indicator match', () => {
|
|||
cleanKibana();
|
||||
esArchiverLoad('threat_indicator');
|
||||
esArchiverLoad('suspicious_source_event');
|
||||
});
|
||||
|
||||
beforeEach(() => {
|
||||
login();
|
||||
});
|
||||
|
||||
|
@ -134,6 +137,7 @@ describe('indicator match', () => {
|
|||
describe('Creating new indicator match rules', () => {
|
||||
describe('Index patterns', () => {
|
||||
beforeEach(() => {
|
||||
login();
|
||||
visitWithoutDateRange(RULE_CREATION);
|
||||
selectIndicatorMatchType();
|
||||
});
|
||||
|
@ -157,6 +161,7 @@ describe('indicator match', () => {
|
|||
|
||||
describe('Indicator index patterns', () => {
|
||||
beforeEach(() => {
|
||||
login();
|
||||
visitWithoutDateRange(RULE_CREATION);
|
||||
selectIndicatorMatchType();
|
||||
});
|
||||
|
@ -178,6 +183,7 @@ describe('indicator match', () => {
|
|||
|
||||
describe('custom query input', () => {
|
||||
beforeEach(() => {
|
||||
login();
|
||||
visitWithoutDateRange(RULE_CREATION);
|
||||
selectIndicatorMatchType();
|
||||
});
|
||||
|
@ -194,6 +200,7 @@ describe('indicator match', () => {
|
|||
|
||||
describe('custom indicator query input', () => {
|
||||
beforeEach(() => {
|
||||
login();
|
||||
visitWithoutDateRange(RULE_CREATION);
|
||||
selectIndicatorMatchType();
|
||||
});
|
||||
|
@ -210,6 +217,7 @@ describe('indicator match', () => {
|
|||
|
||||
describe('Indicator mapping', () => {
|
||||
beforeEach(() => {
|
||||
login();
|
||||
const rule = getNewThreatIndicatorRule();
|
||||
visitWithoutDateRange(RULE_CREATION);
|
||||
selectIndicatorMatchType();
|
||||
|
@ -405,6 +413,7 @@ describe('indicator match', () => {
|
|||
|
||||
describe('Schedule', () => {
|
||||
it('IM rule has 1h time interval and lookback by default', () => {
|
||||
login();
|
||||
visitWithoutDateRange(RULE_CREATION);
|
||||
selectIndicatorMatchType();
|
||||
fillDefineIndicatorMatchRuleAndContinue(getNewThreatIndicatorRule());
|
||||
|
@ -420,6 +429,7 @@ describe('indicator match', () => {
|
|||
|
||||
describe('Generating signals', () => {
|
||||
beforeEach(() => {
|
||||
login();
|
||||
deleteAlertsAndRules();
|
||||
});
|
||||
|
||||
|
@ -530,6 +540,7 @@ describe('indicator match', () => {
|
|||
|
||||
describe('Duplicates the indicator rule', () => {
|
||||
beforeEach(() => {
|
||||
login();
|
||||
deleteAlertsAndRules();
|
||||
createRule(getNewThreatIndicatorRule({ rule_id: 'rule_testing', enabled: true }));
|
||||
visitWithoutDateRange(DETECTIONS_RULE_MANAGEMENT_URL);
|
||||
|
|
|
@ -15,9 +15,10 @@ import { DETECTIONS_RULE_MANAGEMENT_URL } from '../../urls/navigation';
|
|||
describe('Rules talbes links', () => {
|
||||
before(() => {
|
||||
cleanKibana();
|
||||
login();
|
||||
});
|
||||
|
||||
beforeEach(() => {
|
||||
login();
|
||||
deleteAlertsAndRules();
|
||||
createRule(getNewRule({ rule_id: 'rule1' }));
|
||||
visitWithoutDateRange(DETECTIONS_RULE_MANAGEMENT_URL);
|
||||
|
|
|
@ -63,6 +63,9 @@ describe('Detection rules, machine learning', () => {
|
|||
|
||||
before(() => {
|
||||
cleanKibana();
|
||||
});
|
||||
|
||||
beforeEach(() => {
|
||||
login();
|
||||
visitWithoutDateRange(RULE_CREATION);
|
||||
});
|
||||
|
|
|
@ -75,6 +75,7 @@ describe('New Terms rules', () => {
|
|||
|
||||
beforeEach(() => {
|
||||
deleteAlertsAndRules();
|
||||
login();
|
||||
});
|
||||
|
||||
it('Creates and enables a new terms rule', function () {
|
||||
|
|
|
@ -72,6 +72,9 @@ describe('Detection rules, override', () => {
|
|||
|
||||
before(() => {
|
||||
cleanKibana();
|
||||
});
|
||||
|
||||
beforeEach(() => {
|
||||
login();
|
||||
});
|
||||
|
||||
|
|
|
@ -102,10 +102,10 @@ describe('Persistent rules table state', () => {
|
|||
before(() => {
|
||||
cleanKibana();
|
||||
createTestRules();
|
||||
login();
|
||||
});
|
||||
|
||||
beforeEach(() => {
|
||||
login();
|
||||
resetRulesTableState();
|
||||
});
|
||||
|
||||
|
@ -203,6 +203,7 @@ describe('Persistent rules table state', () => {
|
|||
|
||||
describe('and on the rules management tab', () => {
|
||||
beforeEach(() => {
|
||||
login();
|
||||
visit(SECURITY_DETECTIONS_RULES_MANAGEMENT_URL);
|
||||
});
|
||||
|
||||
|
@ -256,6 +257,7 @@ describe('Persistent rules table state', () => {
|
|||
|
||||
describe('and on the rules monitoring tab', () => {
|
||||
beforeEach(() => {
|
||||
login();
|
||||
visit(SECURITY_DETECTIONS_RULES_MONITORING_URL);
|
||||
});
|
||||
|
||||
|
@ -270,6 +272,10 @@ describe('Persistent rules table state', () => {
|
|||
});
|
||||
|
||||
describe('upon state format upgrade', async () => {
|
||||
beforeEach(() => {
|
||||
login();
|
||||
});
|
||||
|
||||
describe('and having state in the url', () => {
|
||||
it('ignores unsupported state key', () => {
|
||||
visitRulesTableWithState({
|
||||
|
@ -313,6 +319,7 @@ describe('Persistent rules table state', () => {
|
|||
describe('when persisted state is partially unavailable', () => {
|
||||
describe('and on the rules management tab', () => {
|
||||
beforeEach(() => {
|
||||
login();
|
||||
visit(SECURITY_DETECTIONS_RULES_MANAGEMENT_URL);
|
||||
});
|
||||
|
||||
|
@ -346,6 +353,7 @@ describe('Persistent rules table state', () => {
|
|||
describe('when corrupted', () => {
|
||||
describe('and on the rules management tab', () => {
|
||||
beforeEach(() => {
|
||||
login();
|
||||
visit(SECURITY_DETECTIONS_RULES_MANAGEMENT_URL);
|
||||
});
|
||||
|
||||
|
|
|
@ -37,10 +37,10 @@ import { DETECTIONS_RULE_MANAGEMENT_URL } from '../../urls/navigation';
|
|||
describe('Prebuilt rules', () => {
|
||||
before(() => {
|
||||
cleanKibana();
|
||||
login();
|
||||
});
|
||||
|
||||
beforeEach(() => {
|
||||
login();
|
||||
deleteAlertsAndRules();
|
||||
visitWithoutDateRange(DETECTIONS_RULE_MANAGEMENT_URL);
|
||||
loadPrebuiltDetectionRules();
|
||||
|
|
|
@ -54,8 +54,8 @@ Note that the rule we are using for testing purposes has the following character
|
|||
|
||||
describe('Related integrations', () => {
|
||||
before(() => {
|
||||
login();
|
||||
cleanKibana();
|
||||
login();
|
||||
importRule('related_integrations.ndjson');
|
||||
});
|
||||
|
||||
|
@ -71,6 +71,7 @@ describe('Related integrations', () => {
|
|||
});
|
||||
|
||||
beforeEach(() => {
|
||||
login();
|
||||
visit(DETECTIONS_RULE_MANAGEMENT_URL);
|
||||
waitForRulesTableToShow();
|
||||
});
|
||||
|
@ -132,6 +133,7 @@ describe('Related integrations', () => {
|
|||
});
|
||||
|
||||
beforeEach(() => {
|
||||
login();
|
||||
visit(DETECTIONS_RULE_MANAGEMENT_URL);
|
||||
waitForRulesTableToShow();
|
||||
});
|
||||
|
@ -216,6 +218,7 @@ describe('Related integrations', () => {
|
|||
});
|
||||
|
||||
beforeEach(() => {
|
||||
login();
|
||||
visit(DETECTIONS_RULE_MANAGEMENT_URL);
|
||||
waitForRulesTableToShow();
|
||||
});
|
||||
|
|
|
@ -32,10 +32,10 @@ describe('Rule actions during detection rule creation', () => {
|
|||
|
||||
before(() => {
|
||||
cleanKibana();
|
||||
login();
|
||||
});
|
||||
|
||||
beforeEach(() => {
|
||||
login();
|
||||
deleteAlertsAndRules();
|
||||
deleteConnectors();
|
||||
deleteIndex(indexConnector.index);
|
||||
|
|
|
@ -51,10 +51,8 @@ describe.skip('Rules selection', () => {
|
|||
cy.get(SELECTED_RULES_NUMBER_LABEL).should('contain.text', availablePrebuiltRulesCount);
|
||||
});
|
||||
|
||||
const bulkSelectButton = cy.get(SELECT_ALL_RULES_BTN);
|
||||
|
||||
// Un-select all rules via the Bulk Selection button from the Utility bar
|
||||
bulkSelectButton.click();
|
||||
cy.get(SELECT_ALL_RULES_BTN).click();
|
||||
|
||||
// Current selection should be 0 rules
|
||||
cy.get(SELECTED_RULES_NUMBER_LABEL).should('contain.text', '0');
|
||||
|
|
|
@ -43,6 +43,10 @@ describe.skip('Alerts detection rules table auto-refresh', () => {
|
|||
}
|
||||
});
|
||||
|
||||
beforeEach(() => {
|
||||
login();
|
||||
});
|
||||
|
||||
it('Auto refreshes rules', () => {
|
||||
visitWithoutDateRange(DETECTIONS_RULE_MANAGEMENT_URL);
|
||||
|
||||
|
|
|
@ -43,6 +43,10 @@ describe('Alerts detection rules', () => {
|
|||
createRule(getNewThresholdRule({ rule_id: '4' }));
|
||||
});
|
||||
|
||||
beforeEach(() => {
|
||||
login();
|
||||
});
|
||||
|
||||
it('Sorts by enabled rules', () => {
|
||||
visit(DETECTIONS_RULE_MANAGEMENT_URL);
|
||||
waitForRulesTableToBeLoaded();
|
||||
|
|
|
@ -69,11 +69,11 @@ describe('Detection rules, threshold', () => {
|
|||
|
||||
before(() => {
|
||||
cleanKibana();
|
||||
login();
|
||||
});
|
||||
|
||||
beforeEach(() => {
|
||||
deleteAlertsAndRules();
|
||||
login();
|
||||
visitWithoutDateRange(RULE_CREATION);
|
||||
});
|
||||
|
||||
|
|
|
@ -67,7 +67,7 @@ import { getExceptionList } from '../../../objects/exception';
|
|||
// to test in enzyme and very small changes can inadvertently add
|
||||
// bugs. As the complexity within the builder grows, these should
|
||||
// ensure the most basic logic holds.
|
||||
describe('Exceptions flyout', { testIsolation: false }, () => {
|
||||
describe('Exceptions flyout', () => {
|
||||
before(() => {
|
||||
esArchiverResetKibana();
|
||||
// this is a made-up index that has just the necessary
|
||||
|
@ -76,7 +76,6 @@ describe('Exceptions flyout', { testIsolation: false }, () => {
|
|||
esArchiverLoad('exceptions');
|
||||
esArchiverLoad('conflicts_1');
|
||||
esArchiverLoad('conflicts_2');
|
||||
login();
|
||||
createExceptionList(getExceptionList(), getExceptionList().list_id).then((response) =>
|
||||
createRule(
|
||||
getNewRule({
|
||||
|
@ -93,19 +92,18 @@ describe('Exceptions flyout', { testIsolation: false }, () => {
|
|||
})
|
||||
)
|
||||
);
|
||||
login();
|
||||
visitWithoutDateRange(DETECTIONS_RULE_MANAGEMENT_URL);
|
||||
});
|
||||
|
||||
beforeEach(() => {
|
||||
login();
|
||||
visitWithoutDateRange(DETECTIONS_RULE_MANAGEMENT_URL);
|
||||
goToRuleDetails();
|
||||
cy.get(RULE_STATUS).should('have.text', '—');
|
||||
goToExceptionsTab();
|
||||
});
|
||||
|
||||
afterEach(() => {
|
||||
closeExceptionBuilderFlyout();
|
||||
});
|
||||
|
||||
after(() => {
|
||||
esArchiverUnload('exceptions');
|
||||
});
|
||||
|
@ -243,7 +241,8 @@ describe('Exceptions flyout', { testIsolation: false }, () => {
|
|||
addExceptionEntryFieldValueOfItemX('name{enter}', 1, 3);
|
||||
// This button will now read `Add non-nested button`
|
||||
cy.get(ADD_NESTED_BTN).scrollIntoView();
|
||||
cy.get(ADD_NESTED_BTN).focus().click();
|
||||
cy.get(ADD_NESTED_BTN).focus();
|
||||
cy.get(ADD_NESTED_BTN).click();
|
||||
addExceptionEntryFieldValueOfItemX('@timestamp', 1, 4);
|
||||
|
||||
// should have only deleted `user.id`
|
||||
|
|
|
@ -44,7 +44,6 @@ const getExceptionList2 = () => ({
|
|||
describe('Exceptions Table', () => {
|
||||
before(() => {
|
||||
esArchiverResetKibana();
|
||||
login();
|
||||
|
||||
// Create exception list associated with a rule
|
||||
createExceptionList(getExceptionList2(), getExceptionList2().list_id).then((response) =>
|
||||
|
@ -67,6 +66,7 @@ describe('Exceptions Table', () => {
|
|||
'exceptionListResponse'
|
||||
);
|
||||
|
||||
login();
|
||||
visitWithoutDateRange(EXCEPTIONS_URL);
|
||||
|
||||
// Using cy.contains because we do not care about the exact text,
|
||||
|
@ -74,6 +74,11 @@ describe('Exceptions Table', () => {
|
|||
cy.contains(EXCEPTIONS_TABLE_SHOWING_LISTS, '3');
|
||||
});
|
||||
|
||||
beforeEach(() => {
|
||||
login();
|
||||
visitWithoutDateRange(EXCEPTIONS_URL);
|
||||
});
|
||||
|
||||
it('Exports exception list', function () {
|
||||
cy.intercept(/(\/api\/exception_lists\/_export)/).as('export');
|
||||
|
||||
|
|
|
@ -57,6 +57,7 @@ describe('Exception list management page', () => {
|
|||
});
|
||||
|
||||
beforeEach(() => {
|
||||
login();
|
||||
visitWithoutDateRange(exceptionsListDetailsUrl(getExceptionList1().list_id));
|
||||
waitForExceptionListDetailToBeLoaded();
|
||||
});
|
||||
|
|
|
@ -58,7 +58,19 @@ describe('Add endpoint exception from rule details', () => {
|
|||
login();
|
||||
deleteAlertsAndRules();
|
||||
// create rule with exception
|
||||
createEndpointExceptionList().then((response) => {
|
||||
createEndpointExceptionList<{
|
||||
id: string;
|
||||
list_id: string;
|
||||
type:
|
||||
| 'detection'
|
||||
| 'rule_default'
|
||||
| 'endpoint'
|
||||
| 'endpoint_trusted_apps'
|
||||
| 'endpoint_events'
|
||||
| 'endpoint_host_isolation_exceptions'
|
||||
| 'endpoint_blocklists';
|
||||
namespace_type: 'agnostic' | 'single';
|
||||
}>().then((response) => {
|
||||
createRule(
|
||||
getNewRule({
|
||||
query: 'event.code:*',
|
||||
|
@ -78,6 +90,7 @@ describe('Add endpoint exception from rule details', () => {
|
|||
});
|
||||
|
||||
beforeEach(() => {
|
||||
login();
|
||||
visitWithoutDateRange(DETECTIONS_RULE_MANAGEMENT_URL);
|
||||
goToRuleDetails();
|
||||
goToEndpointExceptionsTab();
|
||||
|
|
|
@ -120,6 +120,7 @@ describe('Add/edit exception from rule details', () => {
|
|||
});
|
||||
});
|
||||
|
||||
login();
|
||||
visitWithoutDateRange(DETECTIONS_RULE_MANAGEMENT_URL);
|
||||
goToRuleDetails();
|
||||
goToExceptionsTab();
|
||||
|
@ -258,6 +259,7 @@ describe('Add/edit exception from rule details', () => {
|
|||
rule_id: 'rule_testing',
|
||||
})
|
||||
);
|
||||
login();
|
||||
visitWithoutDateRange(DETECTIONS_RULE_MANAGEMENT_URL);
|
||||
goToRuleDetails();
|
||||
goToExceptionsTab();
|
||||
|
|
|
@ -79,6 +79,7 @@ describe('Add exception using data views from rule details', () => {
|
|||
rule_id: 'rule_testing',
|
||||
})
|
||||
);
|
||||
login();
|
||||
visitWithoutDateRange(DETECTIONS_RULE_MANAGEMENT_URL);
|
||||
goToRuleDetails();
|
||||
waitForAlertsToPopulate();
|
||||
|
|
|
@ -51,11 +51,10 @@ describe('Exceptions viewer read only', () => {
|
|||
})
|
||||
);
|
||||
});
|
||||
|
||||
login(ROLES.reader);
|
||||
});
|
||||
|
||||
beforeEach(() => {
|
||||
login(ROLES.reader);
|
||||
visitWithoutDateRange(DETECTIONS_RULE_MANAGEMENT_URL, ROLES.reader);
|
||||
goToRuleDetails();
|
||||
goToExceptionsTab();
|
||||
|
|
|
@ -26,9 +26,12 @@ describe('Add/edit exception from exception management page', () => {
|
|||
before(() => {
|
||||
esArchiverResetKibana();
|
||||
esArchiverLoad('exceptions');
|
||||
createRule(getNewRule());
|
||||
});
|
||||
|
||||
beforeEach(() => {
|
||||
login();
|
||||
visitWithoutDateRange(EXCEPTIONS_URL);
|
||||
createRule(getNewRule());
|
||||
});
|
||||
|
||||
after(() => {
|
||||
|
|
|
@ -62,6 +62,7 @@ describe('Exceptions Table', () => {
|
|||
});
|
||||
|
||||
beforeEach(() => {
|
||||
login();
|
||||
visitWithoutDateRange(EXCEPTIONS_URL);
|
||||
});
|
||||
|
||||
|
|
|
@ -85,6 +85,7 @@ describe('Manage shared exception list', () => {
|
|||
});
|
||||
|
||||
beforeEach(() => {
|
||||
login();
|
||||
visitWithoutDateRange(EXCEPTIONS_URL);
|
||||
waitForExceptionsTableToBeLoaded();
|
||||
});
|
||||
|
|
|
@ -21,10 +21,13 @@ import { postDataView } from '../../tasks/common';
|
|||
|
||||
describe('pinned filters', () => {
|
||||
before(() => {
|
||||
login();
|
||||
postDataView('audit*');
|
||||
});
|
||||
|
||||
beforeEach(() => {
|
||||
login();
|
||||
});
|
||||
|
||||
it('show pinned filters on security', () => {
|
||||
visitWithoutDateRange(DISCOVER_WITH_PINNED_FILTER_URL);
|
||||
|
||||
|
|
|
@ -35,6 +35,7 @@ describe('Guided onboarding tour', () => {
|
|||
createRule(getNewRule({ query: 'user.name:*' }));
|
||||
});
|
||||
beforeEach(() => {
|
||||
login();
|
||||
startAlertsCasesTour();
|
||||
visit(ALERTS_URL);
|
||||
waitForAlertsToPopulate();
|
||||
|
|
|
@ -78,11 +78,8 @@ import {
|
|||
} from '../../screens/kibana_navigation';
|
||||
|
||||
describe('top-level navigation common to all pages in the Security app', () => {
|
||||
before(() => {
|
||||
login();
|
||||
});
|
||||
|
||||
beforeEach(() => {
|
||||
login();
|
||||
visit(TIMELINES_URL);
|
||||
});
|
||||
|
||||
|
@ -204,6 +201,7 @@ describe('top-level navigation common to all pages in the Security app', () => {
|
|||
|
||||
describe('Kibana navigation to all pages in the Security app ', () => {
|
||||
beforeEach(() => {
|
||||
login();
|
||||
visit(KIBANA_HOME);
|
||||
openKibanaNavigation();
|
||||
});
|
||||
|
|
|
@ -23,11 +23,8 @@ import { HOSTS_URL } from '../../urls/navigation';
|
|||
import { waitForAllHostsToBeLoaded } from '../../tasks/hosts/all_hosts';
|
||||
|
||||
describe('SearchBar', () => {
|
||||
before(() => {
|
||||
login();
|
||||
});
|
||||
|
||||
beforeEach(() => {
|
||||
login();
|
||||
visit(HOSTS_URL);
|
||||
waitForAllHostsToBeLoaded();
|
||||
});
|
||||
|
|
|
@ -15,6 +15,9 @@ describe('risk tab', () => {
|
|||
before(() => {
|
||||
cleanKibana();
|
||||
esArchiverLoad('risk_hosts');
|
||||
});
|
||||
|
||||
beforeEach(() => {
|
||||
login();
|
||||
});
|
||||
|
||||
|
|
|
@ -7,7 +7,6 @@
|
|||
|
||||
import {
|
||||
FIELDS_BROWSER_CHECKBOX,
|
||||
FIELDS_BROWSER_CONTAINER,
|
||||
FIELDS_BROWSER_SELECTED_CATEGORIES_BADGES,
|
||||
FIELDS_BROWSER_VIEW_BUTTON,
|
||||
} from '../../screens/fields_browser';
|
||||
|
@ -31,7 +30,7 @@ import {
|
|||
openEventsViewerFieldsBrowser,
|
||||
waitsForEventsToBeLoaded,
|
||||
} from '../../tasks/hosts/events';
|
||||
import { clearSearchBar, kqlSearch } from '../../tasks/security_header';
|
||||
import { kqlSearch } from '../../tasks/security_header';
|
||||
|
||||
import { HOSTS_URL } from '../../urls/navigation';
|
||||
import { resetFields } from '../../tasks/timeline';
|
||||
|
@ -50,7 +49,6 @@ const defaultHeadersInDefaultEcsCategory = [
|
|||
describe('Events Viewer', () => {
|
||||
before(() => {
|
||||
esArchiverLoad('auditbeat_big');
|
||||
login();
|
||||
});
|
||||
|
||||
after(() => {
|
||||
|
@ -59,16 +57,12 @@ describe('Events Viewer', () => {
|
|||
|
||||
context('Fields rendering', () => {
|
||||
beforeEach(() => {
|
||||
login();
|
||||
visit(HOSTS_URL);
|
||||
openEvents();
|
||||
openEventsViewerFieldsBrowser();
|
||||
});
|
||||
|
||||
afterEach(() => {
|
||||
closeFieldsBrowser();
|
||||
cy.get(FIELDS_BROWSER_CONTAINER).should('not.exist');
|
||||
});
|
||||
|
||||
it('displays "view all" option by default', () => {
|
||||
cy.get(FIELDS_BROWSER_VIEW_BUTTON).should('contain.text', 'View: all');
|
||||
});
|
||||
|
@ -86,15 +80,9 @@ describe('Events Viewer', () => {
|
|||
});
|
||||
});
|
||||
|
||||
context('Events viewer query modal', () => {
|
||||
beforeEach(() => {
|
||||
visit(HOSTS_URL);
|
||||
openEvents();
|
||||
});
|
||||
});
|
||||
|
||||
context('Events viewer fields behaviour', () => {
|
||||
beforeEach(() => {
|
||||
login();
|
||||
visit(HOSTS_URL);
|
||||
openEvents();
|
||||
openEventsViewerFieldsBrowser();
|
||||
|
@ -122,15 +110,12 @@ describe('Events Viewer', () => {
|
|||
|
||||
context('Events behavior', () => {
|
||||
beforeEach(() => {
|
||||
login();
|
||||
visit(HOSTS_URL);
|
||||
openEvents();
|
||||
waitsForEventsToBeLoaded();
|
||||
});
|
||||
|
||||
afterEach(() => {
|
||||
clearSearchBar();
|
||||
});
|
||||
|
||||
it('filters the events by applying filter criteria from the search bar at the top of the page', () => {
|
||||
const filterInput = 'aa7ca589f1b8220002f2fc61c64cfbf1'; // this will never match real data
|
||||
cy.get(SERVER_SIDE_EVENT_COUNT)
|
||||
|
|
|
@ -26,10 +26,10 @@ describe('risk tab', () => {
|
|||
before(() => {
|
||||
cleanKibana();
|
||||
esArchiverLoad('risk_hosts');
|
||||
login();
|
||||
});
|
||||
|
||||
beforeEach(() => {
|
||||
login();
|
||||
visit(HOSTS_URL);
|
||||
navigateToHostRiskDetailTab();
|
||||
});
|
||||
|
|
|
@ -17,6 +17,9 @@ describe('All hosts table', () => {
|
|||
before(() => {
|
||||
cleanKibana();
|
||||
esArchiverLoad('risk_hosts');
|
||||
});
|
||||
|
||||
beforeEach(() => {
|
||||
login();
|
||||
});
|
||||
|
||||
|
|
|
@ -46,6 +46,7 @@ describe('Inspect Explore pages', () => {
|
|||
* Group all tests of a page into one "it" call to improve speed
|
||||
*/
|
||||
it(`inspect ${pageName} page`, () => {
|
||||
login();
|
||||
visit(url);
|
||||
waitForPageToBeLoaded();
|
||||
|
||||
|
|
|
@ -7,8 +7,6 @@
|
|||
|
||||
import { OVERLAY_CONTAINER } from '../../../screens/alerts';
|
||||
import {
|
||||
closeAnalyzer,
|
||||
closeSessionViewerFromAlertTable,
|
||||
openAnalyzerForFirstAlertInTimeline,
|
||||
openSessionViewerFromAlertTable,
|
||||
} from '../../../tasks/alerts';
|
||||
|
@ -18,10 +16,13 @@ import { esArchiverLoad, esArchiverUnload } from '../../../tasks/es_archiver';
|
|||
import { login, visit } from '../../../tasks/login';
|
||||
import { ALERTS_URL } from '../../../urls/navigation';
|
||||
|
||||
describe('Alerts Table Action column', { testIsolation: false }, () => {
|
||||
describe('Alerts Table Action column', () => {
|
||||
before(() => {
|
||||
cleanKibana();
|
||||
esArchiverLoad('process_ancestry');
|
||||
});
|
||||
|
||||
beforeEach(() => {
|
||||
login();
|
||||
visit(ALERTS_URL);
|
||||
waitForAlertsToPopulate();
|
||||
|
@ -34,14 +35,10 @@ describe('Alerts Table Action column', { testIsolation: false }, () => {
|
|||
it('should have session viewer button visible & open session viewer on click', () => {
|
||||
openSessionViewerFromAlertTable();
|
||||
cy.get(OVERLAY_CONTAINER).should('be.visible');
|
||||
// cleanup
|
||||
closeSessionViewerFromAlertTable();
|
||||
});
|
||||
|
||||
it('should have analyzer button visible & open analyzer on click', () => {
|
||||
openAnalyzerForFirstAlertInTimeline();
|
||||
cy.get(OVERLAY_CONTAINER).should('be.visible');
|
||||
// cleanup
|
||||
closeAnalyzer();
|
||||
});
|
||||
});
|
||||
|
|
|
@ -8,7 +8,6 @@
|
|||
import { getNewRule } from '../../../objects/rule';
|
||||
import { CELL_COPY_BUTTON, FILTER_BADGE, SHOW_TOP_N_HEADER } from '../../../screens/alerts';
|
||||
import {
|
||||
ALERT_TABLE_ACTIONS_HEADER,
|
||||
ALERT_TABLE_FILE_NAME_HEADER,
|
||||
ALERT_TABLE_FILE_NAME_VALUES,
|
||||
ALERT_TABLE_SEVERITY_HEADER,
|
||||
|
@ -23,7 +22,6 @@ import {
|
|||
showTopNAlertProperty,
|
||||
clickExpandActions,
|
||||
filterOutAlertProperty,
|
||||
closeTopNAlertProperty,
|
||||
} from '../../../tasks/alerts';
|
||||
import { createRule } from '../../../tasks/api_calls/rules';
|
||||
import { cleanKibana } from '../../../tasks/common';
|
||||
|
@ -34,24 +32,22 @@ import {
|
|||
fillAddFilterForm,
|
||||
fillKqlQueryBar,
|
||||
openAddFilterPopover,
|
||||
removeKqlFilter,
|
||||
} from '../../../tasks/search_bar';
|
||||
import { closeTimeline, openActiveTimeline, removeDataProvider } from '../../../tasks/timeline';
|
||||
import { openActiveTimeline } from '../../../tasks/timeline';
|
||||
|
||||
import { ALERTS_URL } from '../../../urls/navigation';
|
||||
describe('Alerts cell actions', { testIsolation: false }, () => {
|
||||
|
||||
describe('Alerts cell actions', () => {
|
||||
before(() => {
|
||||
cleanKibana();
|
||||
login();
|
||||
createRule(getNewRule());
|
||||
visit(ALERTS_URL);
|
||||
waitForAlertsToPopulate();
|
||||
});
|
||||
|
||||
describe('Filter', () => {
|
||||
afterEach(() => {
|
||||
removeKqlFilter();
|
||||
scrollAlertTableColumnIntoView(ALERT_TABLE_ACTIONS_HEADER);
|
||||
beforeEach(() => {
|
||||
login();
|
||||
visit(ALERTS_URL);
|
||||
waitForAlertsToPopulate();
|
||||
});
|
||||
|
||||
it('should filter for a non-empty property', () => {
|
||||
|
@ -104,10 +100,10 @@ describe('Alerts cell actions', { testIsolation: false }, () => {
|
|||
});
|
||||
|
||||
describe('Add to timeline', () => {
|
||||
afterEach(() => {
|
||||
removeDataProvider();
|
||||
closeTimeline();
|
||||
scrollAlertTableColumnIntoView(ALERT_TABLE_ACTIONS_HEADER);
|
||||
beforeEach(() => {
|
||||
login();
|
||||
visit(ALERTS_URL);
|
||||
waitForAlertsToPopulate();
|
||||
});
|
||||
|
||||
it('should add a non-empty property to default timeline', () => {
|
||||
|
@ -137,9 +133,10 @@ describe('Alerts cell actions', { testIsolation: false }, () => {
|
|||
});
|
||||
|
||||
describe('Show Top N', () => {
|
||||
afterEach(() => {
|
||||
closeTopNAlertProperty();
|
||||
scrollAlertTableColumnIntoView(ALERT_TABLE_ACTIONS_HEADER);
|
||||
beforeEach(() => {
|
||||
login();
|
||||
visit(ALERTS_URL);
|
||||
waitForAlertsToPopulate();
|
||||
});
|
||||
|
||||
it('should show top for a property', () => {
|
||||
|
@ -155,8 +152,10 @@ describe('Alerts cell actions', { testIsolation: false }, () => {
|
|||
});
|
||||
|
||||
describe('Copy to clipboard', () => {
|
||||
afterEach(() => {
|
||||
scrollAlertTableColumnIntoView(ALERT_TABLE_ACTIONS_HEADER);
|
||||
beforeEach(() => {
|
||||
login();
|
||||
visit(ALERTS_URL);
|
||||
waitForAlertsToPopulate();
|
||||
});
|
||||
|
||||
it('should copy to clipboard', () => {
|
||||
|
|
|
@ -56,12 +56,15 @@ describe('Alert details flyout', () => {
|
|||
});
|
||||
});
|
||||
|
||||
describe('With unmapped fields', { testIsolation: false }, () => {
|
||||
describe('With unmapped fields', () => {
|
||||
before(() => {
|
||||
cleanKibana();
|
||||
esArchiverLoad('unmapped_fields');
|
||||
login();
|
||||
createRule(getUnmappedRule());
|
||||
});
|
||||
|
||||
beforeEach(() => {
|
||||
login();
|
||||
visitWithoutDateRange(ALERTS_URL);
|
||||
waitForAlertsToPopulate();
|
||||
expandFirstAlert();
|
||||
|
@ -118,16 +121,16 @@ describe('Alert details flyout', () => {
|
|||
});
|
||||
});
|
||||
|
||||
describe('Url state management', { testIsolation: false }, () => {
|
||||
describe('Url state management', () => {
|
||||
before(() => {
|
||||
cleanKibana();
|
||||
esArchiverLoad('query_alert');
|
||||
login();
|
||||
visit(ALERTS_URL);
|
||||
waitForAlertsToPopulate();
|
||||
});
|
||||
|
||||
beforeEach(() => {
|
||||
login();
|
||||
visit(ALERTS_URL);
|
||||
waitForAlertsToPopulate();
|
||||
expandFirstAlert();
|
||||
});
|
||||
|
||||
|
@ -163,16 +166,16 @@ describe('Alert details flyout', () => {
|
|||
});
|
||||
});
|
||||
|
||||
describe('Localstorage management', { testIsolation: false }, () => {
|
||||
describe('Localstorage management', () => {
|
||||
before(() => {
|
||||
cleanKibana();
|
||||
esArchiverLoad('query_alert');
|
||||
login();
|
||||
visit(ALERTS_URL);
|
||||
waitForAlertsToPopulate();
|
||||
});
|
||||
|
||||
beforeEach(() => {
|
||||
login();
|
||||
visit(ALERTS_URL);
|
||||
waitForAlertsToPopulate();
|
||||
expandFirstAlert();
|
||||
});
|
||||
|
||||
|
|
|
@ -43,13 +43,15 @@ describe('Changing alert status', () => {
|
|||
before(() => {
|
||||
esArchiverLoad('auditbeat_big');
|
||||
cleanKibana();
|
||||
login();
|
||||
});
|
||||
|
||||
after(() => {
|
||||
esArchiverUnload('auditbeat_big');
|
||||
});
|
||||
|
||||
context('Opening alerts', () => {
|
||||
beforeEach(() => {
|
||||
login();
|
||||
createRule(getNewRule());
|
||||
visit(ALERTS_URL);
|
||||
waitForAlertsToPopulate();
|
||||
|
@ -156,6 +158,7 @@ describe('Changing alert status', () => {
|
|||
});
|
||||
context('Closing alerts', () => {
|
||||
beforeEach(() => {
|
||||
login();
|
||||
deleteAlertsAndRules();
|
||||
createRule(getNewRule({ rule_id: '1', max_signals: 100 }));
|
||||
visit(ALERTS_URL);
|
||||
|
@ -305,17 +308,17 @@ describe('Changing alert status', () => {
|
|||
});
|
||||
});
|
||||
|
||||
context('Changing alert status with read only role', () => {
|
||||
before(() => {
|
||||
login(ROLES.t2_analyst);
|
||||
});
|
||||
// TODO: Are you sure that read only role should be able to close alerts?
|
||||
context.skip('Changing alert status with read only role', () => {
|
||||
beforeEach(() => {
|
||||
login(ROLES.t2_analyst);
|
||||
deleteAlertsAndRules();
|
||||
createRule(getNewRule());
|
||||
visit(ALERTS_URL);
|
||||
waitForAlertsToPopulate();
|
||||
selectCountTable();
|
||||
});
|
||||
|
||||
it.skip('Mark one alert as acknowledged when more than one open alerts are selected', () => {
|
||||
cy.get(ALERTS_COUNT)
|
||||
.invoke('text')
|
||||
|
|
|
@ -12,7 +12,6 @@ import {
|
|||
CONTROL_FRAME_TITLE,
|
||||
FILTER_GROUP_CHANGED_BANNER,
|
||||
FILTER_GROUP_EDIT_CONTROL_PANEL_ITEMS,
|
||||
FILTER_GROUP_SAVE_CHANGES_POPOVER,
|
||||
OPTION_LIST_LABELS,
|
||||
OPTION_LIST_VALUES,
|
||||
OPTION_SELECTABLE,
|
||||
|
@ -101,17 +100,16 @@ const assertFilterControlsWithFilterObject = (filterObject = DEFAULT_DETECTION_P
|
|||
});
|
||||
};
|
||||
|
||||
describe('Detections : Page Filters', { testIsolation: false }, () => {
|
||||
describe('Detections : Page Filters', () => {
|
||||
before(() => {
|
||||
cleanKibana();
|
||||
login();
|
||||
createRule(getNewRule({ rule_id: 'custom_rule_filters' }));
|
||||
visit(ALERTS_URL);
|
||||
waitForAlerts();
|
||||
waitForPageFilters();
|
||||
});
|
||||
|
||||
afterEach(() => {
|
||||
beforeEach(() => {
|
||||
login();
|
||||
visit(ALERTS_URL);
|
||||
waitForAlerts();
|
||||
resetFilters();
|
||||
});
|
||||
|
||||
|
@ -119,10 +117,14 @@ describe('Detections : Page Filters', { testIsolation: false }, () => {
|
|||
assertFilterControlsWithFilterObject();
|
||||
});
|
||||
|
||||
context('Alert Page Filters Customization ', { testIsolation: false }, () => {
|
||||
context('Alert Page Filters Customization ', () => {
|
||||
beforeEach(() => {
|
||||
login();
|
||||
visit(ALERTS_URL);
|
||||
waitForAlerts();
|
||||
resetFilters();
|
||||
});
|
||||
|
||||
it('should be able to delete Controls', () => {
|
||||
waitForPageFilters();
|
||||
editFilterGroupControls();
|
||||
|
@ -132,6 +134,7 @@ describe('Detections : Page Filters', { testIsolation: false }, () => {
|
|||
});
|
||||
discardFilterGroupControls();
|
||||
});
|
||||
|
||||
it('should be able to add new Controls', () => {
|
||||
const fieldName = 'event.module';
|
||||
const label = 'EventModule';
|
||||
|
@ -142,20 +145,20 @@ describe('Detections : Page Filters', { testIsolation: false }, () => {
|
|||
label,
|
||||
});
|
||||
cy.get(CONTROL_FRAME_TITLE).should('contain.text', label);
|
||||
cy.get(FILTER_GROUP_SAVE_CHANGES_POPOVER).should('be.visible');
|
||||
discardFilterGroupControls();
|
||||
cy.get(CONTROL_FRAME_TITLE).should('not.contain.text', label);
|
||||
});
|
||||
|
||||
it('should be able to edit Controls', () => {
|
||||
const fieldName = 'event.module';
|
||||
const label = 'EventModule';
|
||||
editFilterGroupControls();
|
||||
editFilterGroupControl({ idx: 3, fieldName, label });
|
||||
cy.get(CONTROL_FRAME_TITLE).should('contain.text', label);
|
||||
cy.get(FILTER_GROUP_SAVE_CHANGES_POPOVER).should('be.visible');
|
||||
discardFilterGroupControls();
|
||||
cy.get(CONTROL_FRAME_TITLE).should('not.contain.text', label);
|
||||
});
|
||||
|
||||
it('should not sync to the URL in edit mode but only in view mode', () => {
|
||||
cy.url().then((urlString) => {
|
||||
editFilterGroupControls();
|
||||
|
@ -182,7 +185,7 @@ describe('Detections : Page Filters', { testIsolation: false }, () => {
|
|||
const currURL = new URL(url);
|
||||
|
||||
currURL.searchParams.set('pageFilters', encode(formatPageFilterSearchParam(NEW_FILTERS)));
|
||||
cy.visit(currURL.toString());
|
||||
visit(currURL.toString());
|
||||
waitForAlerts();
|
||||
assertFilterControlsWithFilterObject(NEW_FILTERS);
|
||||
});
|
||||
|
@ -203,7 +206,7 @@ describe('Detections : Page Filters', { testIsolation: false }, () => {
|
|||
const currURL = new URL(url);
|
||||
|
||||
currURL.searchParams.set('pageFilters', encode(pageFilterUrlString));
|
||||
cy.visit(currURL.toString());
|
||||
visit(currURL.toString());
|
||||
|
||||
waitForAlerts();
|
||||
cy.get(OPTION_LIST_LABELS).should((sub) => {
|
||||
|
@ -222,7 +225,6 @@ describe('Detections : Page Filters', { testIsolation: false }, () => {
|
|||
|
||||
it(`Alert list is updated when the alerts are updated`, () => {
|
||||
// mark status of one alert to be acknowledged
|
||||
cy.visit(ALERTS_URL);
|
||||
selectCountTable();
|
||||
cy.get(ALERTS_COUNT)
|
||||
.invoke('text')
|
||||
|
@ -241,8 +243,6 @@ describe('Detections : Page Filters', { testIsolation: false }, () => {
|
|||
});
|
||||
|
||||
it(`URL is updated when filters are updated`, () => {
|
||||
cy.visit(ALERTS_URL);
|
||||
|
||||
cy.on('url:changed', (urlString) => {
|
||||
const NEW_FILTERS = DEFAULT_DETECTION_PAGE_FILTERS.map((filter) => {
|
||||
if (filter.title === 'Severity') {
|
||||
|
@ -261,8 +261,6 @@ describe('Detections : Page Filters', { testIsolation: false }, () => {
|
|||
});
|
||||
|
||||
it(`Filters are restored from localstorage when user navigates back to the page.`, () => {
|
||||
// change severity filter to high
|
||||
cy.visit(ALERTS_URL);
|
||||
cy.get(OPTION_LIST_VALUES(1)).click();
|
||||
cy.get(OPTION_SELECTABLE(1, 'high')).should('be.visible');
|
||||
cy.get(OPTION_SELECTABLE(1, 'high')).click({ force: true });
|
||||
|
@ -297,6 +295,7 @@ describe('Detections : Page Filters', { testIsolation: false }, () => {
|
|||
saveFilterGroupControls();
|
||||
cy.get(FILTER_GROUP_CHANGED_BANNER).should('not.exist');
|
||||
});
|
||||
|
||||
it('Changed banner should hide on discarding changes', () => {
|
||||
visitAlertsPageWithCustomFilters(customFilters);
|
||||
waitForPageFilters();
|
||||
|
@ -316,9 +315,9 @@ describe('Detections : Page Filters', { testIsolation: false }, () => {
|
|||
const idx = 3;
|
||||
const { FILTER_FIELD_TYPE, FIELD_TYPES } = FILTER_GROUP_EDIT_CONTROL_PANEL_ITEMS;
|
||||
editFilterGroupControls();
|
||||
cy.get(CONTROL_FRAME_TITLE).eq(idx).trigger('mouseover');
|
||||
cy.get(FILTER_GROUP_CONTROL_ACTION_EDIT(idx)).trigger('click', { force: true });
|
||||
cy.get(FILTER_FIELD_TYPE).should('be.visible').trigger('click');
|
||||
cy.get(CONTROL_FRAME_TITLE).eq(idx).realHover();
|
||||
cy.get(FILTER_GROUP_CONTROL_ACTION_EDIT(idx)).click();
|
||||
cy.get(FILTER_FIELD_TYPE).click();
|
||||
cy.get(FIELD_TYPES.STRING).should('be.visible');
|
||||
cy.get(FIELD_TYPES.BOOLEAN).should('be.visible');
|
||||
cy.get(FIELD_TYPES.IP).should('be.visible');
|
||||
|
|
|
@ -48,108 +48,115 @@ import { getNewRule } from '../../../../objects/rule';
|
|||
import { ALERTS_URL } from '../../../../urls/navigation';
|
||||
import { waitForAlertsToPopulate } from '../../../../tasks/create_new_rule';
|
||||
|
||||
// Skipping these for now as the feature is protected behind a feature flag set to false by default
|
||||
// To run the tests locally, add 'securityFlyoutEnabled' in the Cypress config.ts here https://github.com/elastic/kibana/blob/main/x-pack/test/security_solution_cypress/config.ts#L50
|
||||
describe.skip('Alert details expandable flyout left panel', { testIsolation: false }, () => {
|
||||
before(() => {
|
||||
cleanKibana();
|
||||
login();
|
||||
createRule(getNewRule());
|
||||
visit(ALERTS_URL);
|
||||
waitForAlertsToPopulate();
|
||||
expandFirstAlertExpandableFlyout();
|
||||
expandDocumentDetailsExpandableFlyoutLeftSection();
|
||||
});
|
||||
describe(
|
||||
'Alert details expandable flyout left panel',
|
||||
{ env: { ftrConfig: { enableExperimental: ['securityFlyoutEnabled'] } } },
|
||||
() => {
|
||||
before(() => {
|
||||
cleanKibana();
|
||||
createRule(getNewRule());
|
||||
});
|
||||
|
||||
it('should display 4 tabs in the header', () => {
|
||||
cy.get(DOCUMENT_DETAILS_FLYOUT_VISUALIZE_TAB)
|
||||
.should('be.visible')
|
||||
.and('have.text', 'Visualize');
|
||||
cy.get(DOCUMENT_DETAILS_FLYOUT_INSIGHTS_TAB).should('be.visible').and('have.text', 'Insights');
|
||||
cy.get(DOCUMENT_DETAILS_FLYOUT_INVESTIGATION_TAB)
|
||||
.should('be.visible')
|
||||
.and('have.text', 'Investigation');
|
||||
cy.get(DOCUMENT_DETAILS_FLYOUT_HISTORY_TAB).should('be.visible').and('have.text', 'History');
|
||||
});
|
||||
beforeEach(() => {
|
||||
login();
|
||||
visit(ALERTS_URL);
|
||||
waitForAlertsToPopulate();
|
||||
expandFirstAlertExpandableFlyout();
|
||||
expandDocumentDetailsExpandableFlyoutLeftSection();
|
||||
});
|
||||
|
||||
it('should display tab content when switching tabs', () => {
|
||||
openVisualizeTab();
|
||||
cy.get(DOCUMENT_DETAILS_FLYOUT_VISUALIZE_TAB_BUTTON_GROUP).should('be.visible');
|
||||
it('should display 4 tabs in the header', () => {
|
||||
cy.get(DOCUMENT_DETAILS_FLYOUT_VISUALIZE_TAB)
|
||||
.should('be.visible')
|
||||
.and('have.text', 'Visualize');
|
||||
cy.get(DOCUMENT_DETAILS_FLYOUT_INSIGHTS_TAB)
|
||||
.should('be.visible')
|
||||
.and('have.text', 'Insights');
|
||||
cy.get(DOCUMENT_DETAILS_FLYOUT_INVESTIGATION_TAB)
|
||||
.should('be.visible')
|
||||
.and('have.text', 'Investigation');
|
||||
cy.get(DOCUMENT_DETAILS_FLYOUT_HISTORY_TAB).should('be.visible').and('have.text', 'History');
|
||||
});
|
||||
|
||||
openInsightsTab();
|
||||
cy.get(DOCUMENT_DETAILS_FLYOUT_INSIGHTS_TAB_BUTTON_GROUP).should('be.visible');
|
||||
|
||||
openInvestigationTab();
|
||||
cy.get(DOCUMENT_DETAILS_FLYOUT_INVESTIGATION_TAB_CONTENT).should('be.visible');
|
||||
|
||||
openHistoryTab();
|
||||
cy.get(DOCUMENT_DETAILS_FLYOUT_HISTORY_TAB_CONTENT).should('be.visible');
|
||||
});
|
||||
|
||||
describe('visualize tab', () => {
|
||||
it('should display a button group with 2 button in the visualize tab', () => {
|
||||
it.skip('should display tab content when switching tabs', () => {
|
||||
openVisualizeTab();
|
||||
cy.get(DOCUMENT_DETAILS_FLYOUT_VISUALIZE_TAB_SESSION_VIEW_BUTTON)
|
||||
.should('be.visible')
|
||||
.and('have.text', 'Session View');
|
||||
cy.get(DOCUMENT_DETAILS_FLYOUT_VISUALIZE_TAB_GRAPH_ANALYZER_BUTTON)
|
||||
.should('be.visible')
|
||||
.and('have.text', 'Analyzer Graph');
|
||||
});
|
||||
cy.get(DOCUMENT_DETAILS_FLYOUT_VISUALIZE_TAB_BUTTON_GROUP).should('be.visible');
|
||||
|
||||
it('should display content when switching buttons', () => {
|
||||
openVisualizeTab();
|
||||
openSessionView();
|
||||
cy.get(DOCUMENT_DETAILS_FLYOUT_VISUALIZE_TAB_SESSION_VIEW_CONTENT).should('be.visible');
|
||||
|
||||
openGraphAnalyzer();
|
||||
cy.get(DOCUMENT_DETAILS_FLYOUT_VISUALIZE_TAB_GRAPH_ANALYZER_CONTENT).should('be.visible');
|
||||
});
|
||||
});
|
||||
|
||||
describe('insights tab', () => {
|
||||
it('should display a button group with 4 button in the insights tab', () => {
|
||||
openInsightsTab();
|
||||
cy.get(DOCUMENT_DETAILS_FLYOUT_INSIGHTS_TAB_ENTITIES_BUTTON)
|
||||
.should('be.visible')
|
||||
.and('have.text', 'Entities');
|
||||
cy.get(DOCUMENT_DETAILS_FLYOUT_INSIGHTS_TAB_THREAT_INTELLIGENCE_BUTTON)
|
||||
.should('be.visible')
|
||||
.and('have.text', 'Threat Intelligence');
|
||||
cy.get(DOCUMENT_DETAILS_FLYOUT_INSIGHTS_TAB_PREVALENCE_BUTTON)
|
||||
.should('be.visible')
|
||||
.and('have.text', 'Prevalence');
|
||||
cy.get(DOCUMENT_DETAILS_FLYOUT_INSIGHTS_TAB_CORRELATIONS_BUTTON)
|
||||
.should('be.visible')
|
||||
.and('have.text', 'Correlations');
|
||||
});
|
||||
cy.get(DOCUMENT_DETAILS_FLYOUT_INSIGHTS_TAB_BUTTON_GROUP).should('be.visible');
|
||||
|
||||
it('should display content when switching buttons', () => {
|
||||
openInsightsTab();
|
||||
openEntities();
|
||||
cy.get(DOCUMENT_DETAILS_FLYOUT_INSIGHTS_TAB_ENTITIES_CONTENT).should('be.visible');
|
||||
|
||||
openThreatIntelligence();
|
||||
cy.get(DOCUMENT_DETAILS_FLYOUT_INSIGHTS_TAB_THREAT_INTELLIGENCE_CONTENT)
|
||||
.should('be.visible')
|
||||
.and('have.text', 'Threat Intelligence');
|
||||
|
||||
openPrevalence();
|
||||
cy.get(DOCUMENT_DETAILS_FLYOUT_INSIGHTS_TAB_PREVALENCE_CONTENT)
|
||||
.should('be.visible')
|
||||
.and('have.text', 'Prevalence');
|
||||
|
||||
openCorrelations();
|
||||
cy.get(DOCUMENT_DETAILS_FLYOUT_INSIGHTS_TAB_CORRELATIONS_CONTENT)
|
||||
.should('be.visible')
|
||||
.and('have.text', 'Correlations');
|
||||
});
|
||||
});
|
||||
|
||||
describe('investigation tab', () => {
|
||||
it('should display investigation guide', () => {
|
||||
openInvestigationTab();
|
||||
cy.get(DOCUMENT_DETAILS_FLYOUT_INVESTIGATION_TAB_CONTENT).should('be.visible');
|
||||
|
||||
openHistoryTab();
|
||||
cy.get(DOCUMENT_DETAILS_FLYOUT_HISTORY_TAB_CONTENT).should('be.visible');
|
||||
});
|
||||
});
|
||||
});
|
||||
|
||||
describe.skip('visualize tab', () => {
|
||||
it('should display a button group with 2 button in the visualize tab', () => {
|
||||
openVisualizeTab();
|
||||
cy.get(DOCUMENT_DETAILS_FLYOUT_VISUALIZE_TAB_SESSION_VIEW_BUTTON)
|
||||
.should('be.visible')
|
||||
.and('have.text', 'Session View');
|
||||
cy.get(DOCUMENT_DETAILS_FLYOUT_VISUALIZE_TAB_GRAPH_ANALYZER_BUTTON)
|
||||
.should('be.visible')
|
||||
.and('have.text', 'Analyzer Graph');
|
||||
});
|
||||
|
||||
it('should display content when switching buttons', () => {
|
||||
openVisualizeTab();
|
||||
openSessionView();
|
||||
cy.get(DOCUMENT_DETAILS_FLYOUT_VISUALIZE_TAB_SESSION_VIEW_CONTENT).should('be.visible');
|
||||
|
||||
openGraphAnalyzer();
|
||||
cy.get(DOCUMENT_DETAILS_FLYOUT_VISUALIZE_TAB_GRAPH_ANALYZER_CONTENT).should('be.visible');
|
||||
});
|
||||
});
|
||||
|
||||
describe.skip('insights tab', () => {
|
||||
it('should display a button group with 4 button in the insights tab', () => {
|
||||
openInsightsTab();
|
||||
cy.get(DOCUMENT_DETAILS_FLYOUT_INSIGHTS_TAB_ENTITIES_BUTTON)
|
||||
.should('be.visible')
|
||||
.and('have.text', 'Entities');
|
||||
cy.get(DOCUMENT_DETAILS_FLYOUT_INSIGHTS_TAB_THREAT_INTELLIGENCE_BUTTON)
|
||||
.should('be.visible')
|
||||
.and('have.text', 'Threat Intelligence');
|
||||
cy.get(DOCUMENT_DETAILS_FLYOUT_INSIGHTS_TAB_PREVALENCE_BUTTON)
|
||||
.should('be.visible')
|
||||
.and('have.text', 'Prevalence');
|
||||
cy.get(DOCUMENT_DETAILS_FLYOUT_INSIGHTS_TAB_CORRELATIONS_BUTTON)
|
||||
.should('be.visible')
|
||||
.and('have.text', 'Correlations');
|
||||
});
|
||||
|
||||
it('should display content when switching buttons', () => {
|
||||
openInsightsTab();
|
||||
openEntities();
|
||||
cy.get(DOCUMENT_DETAILS_FLYOUT_INSIGHTS_TAB_ENTITIES_CONTENT).should('be.visible');
|
||||
|
||||
openThreatIntelligence();
|
||||
cy.get(DOCUMENT_DETAILS_FLYOUT_INSIGHTS_TAB_THREAT_INTELLIGENCE_CONTENT)
|
||||
.should('be.visible')
|
||||
.and('have.text', 'Threat Intelligence');
|
||||
|
||||
openPrevalence();
|
||||
cy.get(DOCUMENT_DETAILS_FLYOUT_INSIGHTS_TAB_PREVALENCE_CONTENT)
|
||||
.should('be.visible')
|
||||
.and('have.text', 'Prevalence');
|
||||
|
||||
openCorrelations();
|
||||
cy.get(DOCUMENT_DETAILS_FLYOUT_INSIGHTS_TAB_CORRELATIONS_CONTENT)
|
||||
.should('be.visible')
|
||||
.and('have.text', 'Correlations');
|
||||
});
|
||||
});
|
||||
|
||||
describe.skip('investigation tab', () => {
|
||||
it('should display investigation guide', () => {
|
||||
openInvestigationTab();
|
||||
cy.get(DOCUMENT_DETAILS_FLYOUT_INVESTIGATION_TAB_CONTENT).should('be.visible');
|
||||
});
|
||||
});
|
||||
}
|
||||
);
|
||||
|
|
|
@ -23,7 +23,7 @@ import { waitForAlertsToPopulate } from '../../../../tasks/create_new_rule';
|
|||
// To run the tests locally, add 'securityFlyoutEnabled' in the Cypress config.ts here https://github.com/elastic/kibana/blob/main/x-pack/test/security_solution_cypress/config.ts#L50
|
||||
describe.skip(
|
||||
'Alert details expandable flyout left panel analyzer graph',
|
||||
{ testIsolation: false },
|
||||
{ env: { ftrConfig: { enableExperimental: ['securityFlyoutEnabled'] } } },
|
||||
() => {
|
||||
before(() => {
|
||||
cleanKibana();
|
||||
|
|
|
@ -26,7 +26,7 @@ import { waitForAlertsToPopulate } from '../../../../tasks/create_new_rule';
|
|||
// To run the tests locally, add 'securityFlyoutEnabled' in the Cypress config.ts here https://github.com/elastic/kibana/blob/main/x-pack/test/security_solution_cypress/config.ts#L50
|
||||
describe.skip(
|
||||
'Alert details expandable flyout left panel entities',
|
||||
{ testIsolation: false },
|
||||
{ env: { ftrConfig: { enableExperimental: ['securityFlyoutEnabled'] } } },
|
||||
() => {
|
||||
before(() => {
|
||||
cleanKibana();
|
||||
|
@ -41,9 +41,11 @@ describe.skip(
|
|||
});
|
||||
|
||||
it('should display analyzer graph and node list', () => {
|
||||
// eslint-disable-next-line cypress/unsafe-to-chain-command
|
||||
cy.get(DOCUMENT_DETAILS_FLYOUT_INSIGHTS_TAB_USER_DETAILS)
|
||||
.scrollIntoView()
|
||||
.should('be.visible');
|
||||
// eslint-disable-next-line cypress/unsafe-to-chain-command
|
||||
cy.get(DOCUMENT_DETAILS_FLYOUT_INSIGHTS_TAB_HOST_DETAILS)
|
||||
.scrollIntoView()
|
||||
.should('be.visible');
|
||||
|
|
|
@ -21,7 +21,7 @@ import { waitForAlertsToPopulate } from '../../../../tasks/create_new_rule';
|
|||
// To run the tests locally, add 'securityFlyoutEnabled' in the Cypress config.ts here https://github.com/elastic/kibana/blob/main/x-pack/test/security_solution_cypress/config.ts#L50
|
||||
describe.skip(
|
||||
'Alert details expandable flyout left panel session view',
|
||||
{ testIsolation: false },
|
||||
{ env: { ftrConfig: { enableExperimental: ['securityFlyoutEnabled'] } } },
|
||||
() => {
|
||||
before(() => {
|
||||
cleanKibana();
|
||||
|
@ -40,6 +40,6 @@ describe.skip(
|
|||
.and('contain.text', 'No process events found for this query');
|
||||
});
|
||||
|
||||
it('should display session view component', () => {});
|
||||
// it('should display session view component', () => {});
|
||||
}
|
||||
);
|
||||
|
|
|
@ -13,16 +13,20 @@ import { ALERTS_URL } from '../../../../urls/navigation';
|
|||
|
||||
// Skipping these for now as the feature is protected behind a feature flag set to false by default
|
||||
// To run the tests locally, add 'securityFlyoutEnabled' in the Cypress config.ts here https://github.com/elastic/kibana/blob/main/x-pack/test/security_solution_cypress/config.ts#L50
|
||||
describe.skip('Expandable flyout left panel threat intelligence', { testIsolation: false }, () => {
|
||||
before(() => {
|
||||
cleanKibana();
|
||||
login();
|
||||
visit(ALERTS_URL);
|
||||
waitForAlertsToPopulate();
|
||||
expandFirstAlertExpandableFlyout();
|
||||
});
|
||||
describe.skip(
|
||||
'Expandable flyout left panel threat intelligence',
|
||||
{ env: { ftrConfig: { enableExperimental: ['securityFlyoutEnabled'] } } },
|
||||
() => {
|
||||
before(() => {
|
||||
cleanKibana();
|
||||
login();
|
||||
visit(ALERTS_URL);
|
||||
waitForAlertsToPopulate();
|
||||
expandFirstAlertExpandableFlyout();
|
||||
});
|
||||
|
||||
it('should serialize its state to url', () => {
|
||||
cy.url().should('include', 'eventFlyout');
|
||||
});
|
||||
});
|
||||
it('should serialize its state to url', () => {
|
||||
cy.url().should('include', 'eventFlyout');
|
||||
});
|
||||
}
|
||||
);
|
||||
|
|
|
@ -34,57 +34,63 @@ import { waitForAlertsToPopulate } from '../../../../tasks/create_new_rule';
|
|||
|
||||
// Skipping these for now as the feature is protected behind a feature flag set to false by default
|
||||
// To run the tests locally, add 'securityFlyoutEnabled' in the Cypress config.ts here https://github.com/elastic/kibana/blob/main/x-pack/test/security_solution_cypress/config.ts#L50
|
||||
describe.skip('Alert details expandable flyout right panel', { testIsolation: false }, () => {
|
||||
const rule = getNewRule();
|
||||
describe.skip(
|
||||
'Alert details expandable flyout right panel',
|
||||
{ env: { ftrConfig: { enableExperimental: ['securityFlyoutEnabled'] } } },
|
||||
() => {
|
||||
const rule = getNewRule();
|
||||
|
||||
before(() => {
|
||||
cleanKibana();
|
||||
login();
|
||||
createRule(rule);
|
||||
visit(ALERTS_URL);
|
||||
waitForAlertsToPopulate();
|
||||
expandFirstAlertExpandableFlyout();
|
||||
});
|
||||
before(() => {
|
||||
cleanKibana();
|
||||
login();
|
||||
createRule(rule);
|
||||
visit(ALERTS_URL);
|
||||
waitForAlertsToPopulate();
|
||||
expandFirstAlertExpandableFlyout();
|
||||
});
|
||||
|
||||
it('should display title in the header', () => {
|
||||
cy.get(DOCUMENT_DETAILS_FLYOUT_HEADER_TITLE).should('be.visible').and('have.text', rule.name);
|
||||
});
|
||||
it('should display title in the header', () => {
|
||||
cy.get(DOCUMENT_DETAILS_FLYOUT_HEADER_TITLE).should('be.visible').and('have.text', rule.name);
|
||||
});
|
||||
|
||||
it('should toggle expand detail button in the header', () => {
|
||||
expandDocumentDetailsExpandableFlyoutLeftSection();
|
||||
cy.get(DOCUMENT_DETAILS_FLYOUT_COLLAPSE_DETAILS_BUTTON)
|
||||
.should('be.visible')
|
||||
.and('have.text', 'Collapse alert details');
|
||||
it('should toggle expand detail button in the header', () => {
|
||||
expandDocumentDetailsExpandableFlyoutLeftSection();
|
||||
cy.get(DOCUMENT_DETAILS_FLYOUT_COLLAPSE_DETAILS_BUTTON)
|
||||
.should('be.visible')
|
||||
.and('have.text', 'Collapse alert details');
|
||||
|
||||
collapseDocumentDetailsExpandableFlyoutLeftSection();
|
||||
cy.get(DOCUMENT_DETAILS_FLYOUT_EXPAND_DETAILS_BUTTON)
|
||||
.should('be.visible')
|
||||
.and('have.text', 'Expand alert details');
|
||||
});
|
||||
collapseDocumentDetailsExpandableFlyoutLeftSection();
|
||||
cy.get(DOCUMENT_DETAILS_FLYOUT_EXPAND_DETAILS_BUTTON)
|
||||
.should('be.visible')
|
||||
.and('have.text', 'Expand alert details');
|
||||
});
|
||||
|
||||
it('should display 3 tabs in the right section', () => {
|
||||
cy.get(DOCUMENT_DETAILS_FLYOUT_OVERVIEW_TAB).should('be.visible').and('have.text', 'Overview');
|
||||
cy.get(DOCUMENT_DETAILS_FLYOUT_TABLE_TAB).should('be.visible').and('have.text', 'Table');
|
||||
cy.get(DOCUMENT_DETAILS_FLYOUT_JSON_TAB).should('be.visible').and('have.text', 'JSON');
|
||||
});
|
||||
it('should display 3 tabs in the right section', () => {
|
||||
cy.get(DOCUMENT_DETAILS_FLYOUT_OVERVIEW_TAB)
|
||||
.should('be.visible')
|
||||
.and('have.text', 'Overview');
|
||||
cy.get(DOCUMENT_DETAILS_FLYOUT_TABLE_TAB).should('be.visible').and('have.text', 'Table');
|
||||
cy.get(DOCUMENT_DETAILS_FLYOUT_JSON_TAB).should('be.visible').and('have.text', 'JSON');
|
||||
});
|
||||
|
||||
it('should display tab content when switching tabs in the right section', () => {
|
||||
openOverviewTab();
|
||||
// we shouldn't need to test anything here as it's covered with the new overview_tab file
|
||||
it('should display tab content when switching tabs in the right section', () => {
|
||||
openOverviewTab();
|
||||
// we shouldn't need to test anything here as it's covered with the new overview_tab file
|
||||
|
||||
openTableTab();
|
||||
// the table component is rendered within a dom element with overflow, so Cypress isn't finding it
|
||||
// this next line is a hack that scrolls to a specific element in the table to ensure Cypress finds it
|
||||
cy.get(DOCUMENT_DETAILS_FLYOUT_TABLE_TAB_EVENT_TYPE_ROW).scrollIntoView();
|
||||
cy.get(DOCUMENT_DETAILS_FLYOUT_TABLE_TAB_CONTENT).should('be.visible');
|
||||
openTableTab();
|
||||
// the table component is rendered within a dom element with overflow, so Cypress isn't finding it
|
||||
// this next line is a hack that scrolls to a specific element in the table to ensure Cypress finds it
|
||||
cy.get(DOCUMENT_DETAILS_FLYOUT_TABLE_TAB_EVENT_TYPE_ROW).scrollIntoView();
|
||||
cy.get(DOCUMENT_DETAILS_FLYOUT_TABLE_TAB_CONTENT).should('be.visible');
|
||||
|
||||
// scroll back up to the top to open the json tab
|
||||
cy.get(DOCUMENT_DETAILS_FLYOUT_JSON_TAB).scrollIntoView();
|
||||
// scroll back up to the top to open the json tab
|
||||
cy.get(DOCUMENT_DETAILS_FLYOUT_JSON_TAB).scrollIntoView();
|
||||
|
||||
openJsonTab();
|
||||
// the json component is rendered within a dom element with overflow, so Cypress isn't finding it
|
||||
// this next line is a hack that vertically scrolls down to ensure Cypress finds it
|
||||
scrollWithinDocumentDetailsExpandableFlyoutRightSection(0, 6500);
|
||||
cy.get(DOCUMENT_DETAILS_FLYOUT_JSON_TAB_CONTENT).should('be.visible');
|
||||
});
|
||||
});
|
||||
openJsonTab();
|
||||
// the json component is rendered within a dom element with overflow, so Cypress isn't finding it
|
||||
// this next line is a hack that vertically scrolls down to ensure Cypress finds it
|
||||
scrollWithinDocumentDetailsExpandableFlyoutRightSection(0, 6500);
|
||||
cy.get(DOCUMENT_DETAILS_FLYOUT_JSON_TAB_CONTENT).should('be.visible');
|
||||
});
|
||||
}
|
||||
);
|
||||
|
|
|
@ -5,6 +5,8 @@
|
|||
* 2.0.
|
||||
*/
|
||||
|
||||
/* eslint-disable cypress/unsafe-to-chain-command */
|
||||
|
||||
import {
|
||||
CASE_ACTION_WRAPPER,
|
||||
CASE_ELLIPSE_BUTTON,
|
||||
|
@ -70,7 +72,7 @@ const deleteCase = () => {
|
|||
// To run the tests locally, add 'securityFlyoutEnabled' in the Cypress config.ts here https://github.com/elastic/kibana/blob/main/x-pack/test/security_solution_cypress/config.ts#L50
|
||||
describe.skip(
|
||||
'Alert details expandable flyout right panel footer',
|
||||
{ testIsolation: false },
|
||||
{ env: { ftrConfig: { enableExperimental: ['securityFlyoutEnabled'] } } },
|
||||
() => {
|
||||
before(() => {
|
||||
cleanKibana();
|
||||
|
@ -171,7 +173,7 @@ describe.skip(
|
|||
|
||||
// TODO figure out why isolate host isn't showing up in the dropdown
|
||||
// https://github.com/elastic/security-team/issues/6302
|
||||
it.skip('should isolate host', () => {});
|
||||
// it.skip('should isolate host', () => {});
|
||||
|
||||
// TODO this will change when respond is improved
|
||||
// https://github.com/elastic/security-team/issues/6303
|
||||
|
|
|
@ -25,7 +25,7 @@ import { waitForAlertsToPopulate } from '../../../../tasks/create_new_rule';
|
|||
// To run the tests locally, add 'securityFlyoutEnabled' in the Cypress config.ts here https://github.com/elastic/kibana/blob/main/x-pack/test/security_solution_cypress/config.ts#L50
|
||||
describe.skip(
|
||||
'Alert details expandable flyout right panel header',
|
||||
{ testIsolation: false },
|
||||
{ env: { ftrConfig: { enableExperimental: ['securityFlyoutEnabled'] } } },
|
||||
() => {
|
||||
const rule = getNewRule();
|
||||
|
||||
|
|
|
@ -5,6 +5,8 @@
|
|||
* 2.0.
|
||||
*/
|
||||
|
||||
/* eslint-disable cypress/unsafe-to-chain-command */
|
||||
|
||||
import {
|
||||
DOCUMENT_DETAILS_FLYOUT_OVERVIEW_TAB_MITRE_ATTACK_DETAILS,
|
||||
DOCUMENT_DETAILS_FLYOUT_OVERVIEW_TAB_MITRE_ATTACK_TITLE,
|
||||
|
@ -62,7 +64,7 @@ import { waitForAlertsToPopulate } from '../../../../tasks/create_new_rule';
|
|||
// To run the tests locally, add 'securityFlyoutEnabled' in the Cypress config.ts here https://github.com/elastic/kibana/blob/main/x-pack/test/security_solution_cypress/config.ts#L50
|
||||
describe.skip(
|
||||
'Alert details expandable flyout right panel overview tab',
|
||||
{ testIsolation: false },
|
||||
{ env: { ftrConfig: { enableExperimental: ['securityFlyoutEnabled'] } } },
|
||||
() => {
|
||||
const rule = getNewRule();
|
||||
|
||||
|
|
|
@ -33,46 +33,50 @@ import { waitForAlertsToPopulate } from '../../../../tasks/create_new_rule';
|
|||
|
||||
// Skipping these for now as the feature is protected behind a feature flag set to false by default
|
||||
// To run the tests locally, add 'securityFlyoutEnabled' in the Cypress config.ts here https://github.com/elastic/kibana/blob/main/x-pack/test/security_solution_cypress/config.ts#L50
|
||||
describe.skip('Alert details expandable flyout right panel', { testIsolation: false }, () => {
|
||||
before(() => {
|
||||
cleanKibana();
|
||||
login();
|
||||
createRule(getNewRule());
|
||||
visit(ALERTS_URL);
|
||||
waitForAlertsToPopulate();
|
||||
expandFirstAlertExpandableFlyout();
|
||||
openTableTab();
|
||||
});
|
||||
describe.skip(
|
||||
'Alert details expandable flyout right panel',
|
||||
{ env: { ftrConfig: { enableExperimental: ['securityFlyoutEnabled'] } } },
|
||||
() => {
|
||||
before(() => {
|
||||
cleanKibana();
|
||||
login();
|
||||
createRule(getNewRule());
|
||||
visit(ALERTS_URL);
|
||||
waitForAlertsToPopulate();
|
||||
expandFirstAlertExpandableFlyout();
|
||||
openTableTab();
|
||||
});
|
||||
|
||||
it('should display and filter the table', () => {
|
||||
cy.get(DOCUMENT_DETAILS_FLYOUT_TABLE_TAB_TIMESTAMP_ROW).should('be.visible');
|
||||
cy.get(DOCUMENT_DETAILS_FLYOUT_TABLE_TAB_ID_ROW).should('be.visible');
|
||||
filterTableTabTable('timestamp');
|
||||
cy.get(DOCUMENT_DETAILS_FLYOUT_TABLE_TAB_TIMESTAMP_ROW).should('be.visible');
|
||||
clearFilterTableTabTable();
|
||||
});
|
||||
it('should display and filter the table', () => {
|
||||
cy.get(DOCUMENT_DETAILS_FLYOUT_TABLE_TAB_TIMESTAMP_ROW).should('be.visible');
|
||||
cy.get(DOCUMENT_DETAILS_FLYOUT_TABLE_TAB_ID_ROW).should('be.visible');
|
||||
filterTableTabTable('timestamp');
|
||||
cy.get(DOCUMENT_DETAILS_FLYOUT_TABLE_TAB_TIMESTAMP_ROW).should('be.visible');
|
||||
clearFilterTableTabTable();
|
||||
});
|
||||
|
||||
it('should test filter in cell actions', () => {
|
||||
filterInTableTabTable();
|
||||
cy.get(FILTER_BADGE).first().should('contain.text', '@timestamp:');
|
||||
removeKqlFilter();
|
||||
});
|
||||
it('should test filter in cell actions', () => {
|
||||
filterInTableTabTable();
|
||||
cy.get(FILTER_BADGE).first().should('contain.text', '@timestamp:');
|
||||
removeKqlFilter();
|
||||
});
|
||||
|
||||
it('should test filter out cell actions', () => {
|
||||
filterOutTableTabTable();
|
||||
cy.get(FILTER_BADGE).first().should('contain.text', 'NOT @timestamp:');
|
||||
removeKqlFilter();
|
||||
});
|
||||
it('should test filter out cell actions', () => {
|
||||
filterOutTableTabTable();
|
||||
cy.get(FILTER_BADGE).first().should('contain.text', 'NOT @timestamp:');
|
||||
removeKqlFilter();
|
||||
});
|
||||
|
||||
it('should test add to timeline cell actions', () => {
|
||||
addToTimelineTableTabTable();
|
||||
openActiveTimeline();
|
||||
cy.get(PROVIDER_BADGE).first().should('contain.text', '@timestamp');
|
||||
closeTimeline();
|
||||
});
|
||||
it('should test add to timeline cell actions', () => {
|
||||
addToTimelineTableTabTable();
|
||||
openActiveTimeline();
|
||||
cy.get(PROVIDER_BADGE).first().should('contain.text', '@timestamp');
|
||||
closeTimeline();
|
||||
});
|
||||
|
||||
it('should test copy to clipboard cell actions', () => {
|
||||
copyToClipboardTableTabTable();
|
||||
cy.get(DOCUMENT_DETAILS_FLYOUT_TABLE_TAB_ROW_CELL_COPY_TO_CLIPBOARD).should('be.visible');
|
||||
});
|
||||
});
|
||||
it('should test copy to clipboard cell actions', () => {
|
||||
copyToClipboardTableTabTable();
|
||||
cy.get(DOCUMENT_DETAILS_FLYOUT_TABLE_TAB_ROW_CELL_COPY_TO_CLIPBOARD).should('be.visible');
|
||||
});
|
||||
}
|
||||
);
|
||||
|
|
|
@ -19,37 +19,41 @@ import {
|
|||
|
||||
// Skipping these for now as the feature is protected behind a feature flag set to false by default
|
||||
// To run the tests locally, add 'securityFlyoutEnabled' in the Cypress config.ts here https://github.com/elastic/kibana/blob/main/x-pack/test/security_solution_cypress/config.ts#L50
|
||||
describe.skip('Expandable flyout state sync', { testIsolation: false }, () => {
|
||||
const rule = getNewRule();
|
||||
describe.skip(
|
||||
'Expandable flyout state sync',
|
||||
{ env: { ftrConfig: { enableExperimental: ['securityFlyoutEnabled'] } } },
|
||||
() => {
|
||||
const rule = getNewRule();
|
||||
|
||||
before(() => {
|
||||
cleanKibana();
|
||||
login();
|
||||
createRule(rule);
|
||||
visit(ALERTS_URL);
|
||||
waitForAlertsToPopulate();
|
||||
expandFirstAlertExpandableFlyout();
|
||||
});
|
||||
before(() => {
|
||||
cleanKibana();
|
||||
login();
|
||||
createRule(rule);
|
||||
visit(ALERTS_URL);
|
||||
waitForAlertsToPopulate();
|
||||
expandFirstAlertExpandableFlyout();
|
||||
});
|
||||
|
||||
it('should serialize its state to url', () => {
|
||||
cy.url().should('include', 'eventFlyout');
|
||||
cy.get(DOCUMENT_DETAILS_FLYOUT_HEADER_TITLE).should('be.visible').and('have.text', rule.name);
|
||||
});
|
||||
it('should serialize its state to url', () => {
|
||||
cy.url().should('include', 'eventFlyout');
|
||||
cy.get(DOCUMENT_DETAILS_FLYOUT_HEADER_TITLE).should('be.visible').and('have.text', rule.name);
|
||||
});
|
||||
|
||||
it('should reopen the flyout after browser refresh', () => {
|
||||
cy.reload();
|
||||
it('should reopen the flyout after browser refresh', () => {
|
||||
cy.reload();
|
||||
|
||||
cy.url().should('include', 'eventFlyout');
|
||||
cy.get(DOCUMENT_DETAILS_FLYOUT_HEADER_TITLE).should('be.visible').and('have.text', rule.name);
|
||||
});
|
||||
cy.url().should('include', 'eventFlyout');
|
||||
cy.get(DOCUMENT_DETAILS_FLYOUT_HEADER_TITLE).should('be.visible').and('have.text', rule.name);
|
||||
});
|
||||
|
||||
it('should clear the url state when flyout is closed', () => {
|
||||
cy.reload();
|
||||
it('should clear the url state when flyout is closed', () => {
|
||||
cy.reload();
|
||||
|
||||
cy.get(DOCUMENT_DETAILS_FLYOUT_HEADER_TITLE).should('be.visible').and('have.text', rule.name);
|
||||
cy.get(DOCUMENT_DETAILS_FLYOUT_HEADER_TITLE).should('be.visible').and('have.text', rule.name);
|
||||
|
||||
cy.get(DOCUMENT_DETAILS_FLYOUT_CLOSE_BUTTON).click();
|
||||
cy.get(DOCUMENT_DETAILS_FLYOUT_CLOSE_BUTTON).click();
|
||||
|
||||
cy.url().should('not.include', 'eventFlyout');
|
||||
});
|
||||
});
|
||||
cy.url().should('not.include', 'eventFlyout');
|
||||
});
|
||||
}
|
||||
);
|
||||
|
|
|
@ -5,7 +5,6 @@
|
|||
* 2.0.
|
||||
*/
|
||||
|
||||
import { closeTimeline } from '../../../tasks/timeline';
|
||||
import { getNewRule } from '../../../objects/rule';
|
||||
import { PROVIDER_BADGE, QUERY_TAB_BUTTON, TIMELINE_TITLE } from '../../../screens/timeline';
|
||||
import { FILTER_BADGE } from '../../../screens/alerts';
|
||||
|
@ -27,18 +26,17 @@ import {
|
|||
} from '../../../screens/alerts_details';
|
||||
import { verifyInsightCount } from '../../../tasks/alerts_details';
|
||||
|
||||
describe('Investigate in timeline', { testIsolation: false }, () => {
|
||||
describe('Investigate in timeline', () => {
|
||||
before(() => {
|
||||
cleanKibana();
|
||||
login();
|
||||
createRule(getNewRule());
|
||||
visit(ALERTS_URL);
|
||||
waitForAlertsToPopulate();
|
||||
});
|
||||
|
||||
describe('From alerts table', () => {
|
||||
after(() => {
|
||||
closeTimeline();
|
||||
beforeEach(() => {
|
||||
login();
|
||||
visit(ALERTS_URL);
|
||||
waitForAlertsToPopulate();
|
||||
});
|
||||
|
||||
it('should open new timeline from alerts table', () => {
|
||||
|
@ -47,33 +45,30 @@ describe('Investigate in timeline', { testIsolation: false }, () => {
|
|||
.first()
|
||||
.invoke('text')
|
||||
.then((eventId) => {
|
||||
investigateFirstAlertInTimeline();
|
||||
cy.get(PROVIDER_BADGE).filter(':visible').should('have.text', eventId);
|
||||
});
|
||||
});
|
||||
});
|
||||
|
||||
describe('From alerts details flyout', () => {
|
||||
before(() => {
|
||||
beforeEach(() => {
|
||||
login();
|
||||
visit(ALERTS_URL);
|
||||
waitForAlertsToPopulate();
|
||||
expandFirstAlert();
|
||||
});
|
||||
|
||||
afterEach(() => {
|
||||
closeTimeline();
|
||||
});
|
||||
|
||||
it('should open a new timeline from a prevalence field', () => {
|
||||
// Only one alert matches the exact process args in this case
|
||||
const alertCount = 1;
|
||||
|
||||
// Click on the last button that lets us investigate in timeline.
|
||||
// We expect this to be the `process.args` row.
|
||||
const investigateButton = cy
|
||||
.get(ALERT_FLYOUT)
|
||||
cy.get(ALERT_FLYOUT)
|
||||
.find(SUMMARY_VIEW_INVESTIGATE_IN_TIMELINE_BUTTON)
|
||||
.last();
|
||||
investigateButton.should('have.text', alertCount);
|
||||
investigateButton.click();
|
||||
.last()
|
||||
.should('have.text', alertCount)
|
||||
.click();
|
||||
|
||||
// Make sure a new timeline is created and opened
|
||||
cy.get(TIMELINE_TITLE).should('have.text', 'Untitled timeline');
|
||||
|
|
|
@ -20,10 +20,11 @@ import { ALERTS_URL } from '../../../urls/navigation';
|
|||
describe('Analyze events view for alerts', () => {
|
||||
before(() => {
|
||||
cleanKibana();
|
||||
login();
|
||||
createRule(getNewRule());
|
||||
});
|
||||
|
||||
beforeEach(() => {
|
||||
login();
|
||||
visit(ALERTS_URL);
|
||||
waitForAlertsToPopulate();
|
||||
});
|
||||
|
@ -33,8 +34,7 @@ describe('Analyze events view for alerts', () => {
|
|||
cy.get(ANALYZER_NODE).first().should('be.visible');
|
||||
});
|
||||
|
||||
it(`should display
|
||||
a toast indicating the date range of found events when a time range has 0 events in it`, () => {
|
||||
it('should display a toast indicating the date range of found events when a time range has 0 events in it', () => {
|
||||
const dateContainingZeroEvents = 'Jul 27, 2022 @ 00:00:00.000';
|
||||
setStartDate(dateContainingZeroEvents);
|
||||
waitForAlertsToPopulate();
|
||||
|
|
|
@ -24,7 +24,6 @@ import {
|
|||
USER_TABLE_ROW_TOTAL_ALERTS,
|
||||
USER_TABLE_USER_NAME_BTN,
|
||||
} from '../../../screens/detection_response';
|
||||
import { DETECTION_RESPONSE } from '../../../screens/security_header';
|
||||
import { QUERY_TAB_BUTTON, TIMELINE_DATA_PROVIDERS_CONTAINER } from '../../../screens/timeline';
|
||||
import { waitForAlerts } from '../../../tasks/alerts';
|
||||
import { createRule } from '../../../tasks/api_calls/rules';
|
||||
|
@ -32,8 +31,8 @@ import { cleanKibana } from '../../../tasks/common';
|
|||
import { investigateDashboardItemInTimeline } from '../../../tasks/dashboards/common';
|
||||
import { waitToNavigateAwayFrom } from '../../../tasks/kibana_navigation';
|
||||
import { login, visit } from '../../../tasks/login';
|
||||
import { clearSearchBar, kqlSearch, navigateFromHeaderTo } from '../../../tasks/security_header';
|
||||
import { closeTimeline } from '../../../tasks/timeline';
|
||||
import { clearSearchBar, kqlSearch } from '../../../tasks/security_header';
|
||||
import { createNewTimeline } from '../../../tasks/timeline';
|
||||
import { ALERTS_URL, DASHBOARDS_URL, DETECTIONS_RESPONSE_URL } from '../../../urls/navigation';
|
||||
|
||||
const TEST_USER_NAME = 'test';
|
||||
|
@ -42,12 +41,15 @@ const SIEM_KIBANA_HOST_NAME = 'siem-kibana';
|
|||
describe('Detection response view', () => {
|
||||
before(() => {
|
||||
cleanKibana();
|
||||
login();
|
||||
createRule(getNewRule());
|
||||
});
|
||||
|
||||
beforeEach(() => {
|
||||
login();
|
||||
visit(DETECTIONS_RESPONSE_URL);
|
||||
});
|
||||
|
||||
context('KQL search bar', { testIsolation: false }, () => {
|
||||
context('KQL search bar', () => {
|
||||
it(`filters out hosts with KQL search bar query`, () => {
|
||||
kqlSearch(`host.name : fakeHostName{enter}`);
|
||||
|
||||
|
@ -89,9 +91,9 @@ describe('Detection response view', () => {
|
|||
});
|
||||
});
|
||||
|
||||
context('Open in timeline', { testIsolation: false }, () => {
|
||||
context('Open in timeline', () => {
|
||||
afterEach(() => {
|
||||
closeTimeline();
|
||||
createNewTimeline();
|
||||
});
|
||||
|
||||
it(`opens timeline with correct query count for hosts by alert severity table`, () => {
|
||||
|
@ -157,11 +159,7 @@ describe('Detection response view', () => {
|
|||
});
|
||||
});
|
||||
|
||||
context('Redirection to AlertPage', { testIsolation: false }, () => {
|
||||
afterEach(() => {
|
||||
navigateFromHeaderTo(DETECTION_RESPONSE);
|
||||
});
|
||||
|
||||
context('Redirection to AlertPage', () => {
|
||||
it('should redirect to alert page with host and status as the filters', () => {
|
||||
cy.get(HOST_TABLE_ROW_TOTAL_ALERTS)
|
||||
.first()
|
||||
|
@ -173,7 +171,7 @@ describe('Detection response view', () => {
|
|||
.should('be.visible')
|
||||
.then((hostNameEl) => {
|
||||
const hostName = hostNameEl.text();
|
||||
sub.trigger('click');
|
||||
sub.click();
|
||||
waitToNavigateAwayFrom(DASHBOARDS_URL);
|
||||
cy.url().should((urlString) => {
|
||||
const url = new URL(urlString);
|
||||
|
@ -201,7 +199,7 @@ describe('Detection response view', () => {
|
|||
.first()
|
||||
.should('be.visible')
|
||||
.then((hostNameEl) => {
|
||||
cy.get(HOST_TABLE_ROW_SEV(severityVal)).first().trigger('click');
|
||||
cy.get(HOST_TABLE_ROW_SEV(severityVal)).first().click();
|
||||
waitToNavigateAwayFrom(DASHBOARDS_URL);
|
||||
const hostName = hostNameEl.text();
|
||||
waitForAlerts();
|
||||
|
@ -227,7 +225,7 @@ describe('Detection response view', () => {
|
|||
.should('be.visible')
|
||||
.then((userNameEl) => {
|
||||
const userName = userNameEl.text();
|
||||
sub.trigger('click');
|
||||
sub.click();
|
||||
waitToNavigateAwayFrom(DASHBOARDS_URL);
|
||||
cy.url().should((urlString) => {
|
||||
const url = new URL(urlString);
|
||||
|
@ -256,7 +254,7 @@ describe('Detection response view', () => {
|
|||
.should('be.visible')
|
||||
.then((userNameEl) => {
|
||||
const userName = userNameEl.text();
|
||||
cy.get(USER_TABLE_ROW_SEV(severityVal)).trigger('click');
|
||||
cy.get(USER_TABLE_ROW_SEV(severityVal)).click();
|
||||
waitToNavigateAwayFrom(DASHBOARDS_URL);
|
||||
waitForAlerts();
|
||||
cy.get(ALERTS_COUNT).should('be.visible').should('have.text', `${alertCount} alerts`);
|
||||
|
@ -280,7 +278,7 @@ describe('Detection response view', () => {
|
|||
.first()
|
||||
.should('be.visible')
|
||||
.then((ruleNameEl) => {
|
||||
sub.trigger('click');
|
||||
sub.click();
|
||||
waitToNavigateAwayFrom(DASHBOARDS_URL);
|
||||
const ruleName = ruleNameEl.text();
|
||||
waitForAlerts();
|
||||
|
@ -294,17 +292,12 @@ describe('Detection response view', () => {
|
|||
});
|
||||
});
|
||||
it('should redirect to "View Open Alerts" correctly', () => {
|
||||
cy.get(RULE_TABLE_VIEW_ALL_OPEN_ALERTS_BTN)
|
||||
.first()
|
||||
.should('be.visible')
|
||||
.then((sub) => {
|
||||
sub.trigger('click');
|
||||
waitToNavigateAwayFrom(DASHBOARDS_URL);
|
||||
waitForAlerts();
|
||||
cy.get(CONTROL_FRAMES).should('have.length', 1);
|
||||
cy.get(OPTION_LIST_LABELS).eq(0).should('have.text', `Status`);
|
||||
cy.get(OPTION_LIST_VALUES(0)).should('have.text', 'open1');
|
||||
});
|
||||
cy.get(RULE_TABLE_VIEW_ALL_OPEN_ALERTS_BTN).first().click();
|
||||
waitToNavigateAwayFrom(DASHBOARDS_URL);
|
||||
waitForAlerts();
|
||||
cy.get(CONTROL_FRAMES).should('have.length', 1);
|
||||
cy.get(OPTION_LIST_LABELS).eq(0).should('have.text', `Status`);
|
||||
cy.get(OPTION_LIST_VALUES(0)).should('have.text', 'open1');
|
||||
});
|
||||
});
|
||||
});
|
||||
|
|
|
@ -51,14 +51,15 @@ import { TIMELINES_URL } from '../../../urls/navigation';
|
|||
describe('Timeline Templates', () => {
|
||||
before(() => {
|
||||
cleanKibana();
|
||||
login();
|
||||
});
|
||||
|
||||
beforeEach(() => {
|
||||
login();
|
||||
deleteTimelines();
|
||||
cy.intercept('PATCH', '/api/timeline').as('timeline');
|
||||
});
|
||||
|
||||
it('Creates a timeline template', async () => {
|
||||
it.skip('Creates a timeline template', () => {
|
||||
visitWithoutDateRange(TIMELINES_URL);
|
||||
openTimelineUsingToggle();
|
||||
createNewTimelineTemplate();
|
||||
|
|
|
@ -20,19 +20,20 @@ import { searchByTitle } from '../../../tasks/table_pagination';
|
|||
describe('Export timelines', () => {
|
||||
before(() => {
|
||||
cleanKibana();
|
||||
cy.intercept({
|
||||
method: 'POST',
|
||||
path: '/api/timeline/_export?file_name=timelines_export.ndjson',
|
||||
}).as('export');
|
||||
|
||||
createTimelineTemplate(getTimelineTemplate()).then((response) => {
|
||||
cy.wrap(response).as('templateResponse');
|
||||
cy.wrap(response.body.data.persistTimeline.timeline.savedObjectId).as('templateId');
|
||||
cy.wrap(response.body.data.persistTimeline.timeline.title).as('templateTitle');
|
||||
});
|
||||
login();
|
||||
});
|
||||
|
||||
it('Exports a custom timeline template', function () {
|
||||
cy.intercept({
|
||||
method: 'POST',
|
||||
path: '/api/timeline/_export?file_name=timelines_export.ndjson',
|
||||
}).as('export');
|
||||
login();
|
||||
visitWithoutDateRange(TIMELINE_TEMPLATES_URL);
|
||||
searchByTitle(this.templateTitle);
|
||||
exportTimeline(this.templateId);
|
||||
|
|
Some files were not shown because too many files have changed in this diff Show more
Loading…
Add table
Add a link
Reference in a new issue