[security_solution] Fix @grep tags in Cypress (#164644)

## Summary

`@cypress/grep` is just reading the file as text, so it's not capable of
evaluating the variables, because of that, today we are running all the
spec files, and that means that we are setting up a new stack just to
stop it a few seconds later after grep skips the spec file

https://github.com/cypress-io/cypress/blob/develop/npm/grep/src/plugin.js#L117

With variable:
<img width="1219" alt="Zrzut ekranu 2023-08-23 o 23 06 30"
src="97b6fdaa-a03a-4a4f-bbdc-97da8e1788ce">

With string:
<img width="2074" alt="Zrzut ekranu 2023-08-23 o 23 06 04"
src="1f48d20a-3a1a-4ded-aa47-493781a4758b">

---------

Co-authored-by: kibanamachine <42973632+kibanamachine@users.noreply.github.com>
This commit is contained in:
Patryk Kopyciński 2023-08-25 14:22:04 +02:00 committed by GitHub
parent b83585b844
commit 4180a1a105
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
169 changed files with 681 additions and 897 deletions

View file

@ -55,7 +55,7 @@ steps:
queue: n2-4-spot
depends_on: build
timeout_in_minutes: 120
parallelism: 6
parallelism: 14
retry:
automatic:
- exit_status: '*'

View file

@ -16,10 +16,10 @@ steps:
- command: .buildkite/scripts/steps/functional/defend_workflows_vagrant.sh
label: 'Defend Workflows Endpoint Cypress Tests'
agents:
queue: n2-16-virt
queue: n2-4-virt
depends_on: build
timeout_in_minutes: 120
parallelism: 6
parallelism: 5
retry:
automatic:
- exit_status: '*'

View file

@ -20,6 +20,8 @@ steps:
depends_on: build
timeout_in_minutes: 50
soft_fail: true
retry:
automatic: false
artifact_paths:
- "target/kibana-osquery/**/*"

View file

@ -19,7 +19,7 @@ steps:
queue: n2-4-spot
depends_on: build
timeout_in_minutes: 60
parallelism: 2
parallelism: 4
retry:
automatic:
- exit_status: '*'
@ -48,6 +48,8 @@ steps:
depends_on: build
timeout_in_minutes: 120
parallelism: 1
retry:
automatic: false
soft_fail: true
artifact_paths:
- "target/kibana-security-solution/**/*"

View file

@ -75,7 +75,7 @@ steps:
- "target/kibana-security-serverless/**/*"
- command: .buildkite/scripts/steps/functional/security_serverless_explore.sh
label: 'Explore - Security Solution Cypress Tests'
label: 'Serverless Explore - Security Solution Cypress Tests'
agents:
queue: n2-4-spot
depends_on: build
@ -89,7 +89,7 @@ steps:
- "target/kibana-security-serverless/**/*"
- command: .buildkite/scripts/steps/functional/security_serverless_investigations.sh
label: 'Investigations - Security Solution Cypress Tests'
label: 'Serverless Investigations - Security Solution Cypress Tests'
agents:
queue: n2-4-spot
depends_on: build

1
typings/index.d.ts vendored
View file

@ -22,3 +22,4 @@ declare module 'monaco-editor/esm/vs/basic-languages/css/css';
declare module 'monaco-editor/esm/vs/basic-languages/yaml/yaml';
declare module 'find-cypress-specs';
declare module '@cypress/grep/src/plugin';

View file

@ -5,7 +5,6 @@
* 2.0.
*/
import { tag } from '../../tags';
import {
cleanupPack,
cleanupAgentPolicy,
@ -31,7 +30,7 @@ import {
} from '../../tasks/integrations';
import { findAndClickButton, findFormFieldByRowsLabelAndType } from '../../tasks/live_query';
describe('ALL - Add Integration', { tags: [tag.ESS, tag.BROKEN_IN_SERVERLESS] }, () => {
describe('ALL - Add Integration', { tags: ['@ess', '@brokenInServerless'] }, () => {
let savedQueryId: string;
before(() => {
@ -62,7 +61,7 @@ describe('ALL - Add Integration', { tags: [tag.ESS, tag.BROKEN_IN_SERVERLESS] },
cy.get(`[url="${NAV_SEARCH_INPUT_OSQUERY_RESULTS.MANAGER}"]`).should('exist').click();
});
describe('Add and upgrade integration', { tags: [tag.ESS] }, () => {
describe('Add and upgrade integration', { tags: ['@ess'] }, () => {
const oldVersion = '0.7.4';
const [integrationName, policyName] = generateRandomStringName(2);
let policyId: string;
@ -77,7 +76,7 @@ describe('ALL - Add Integration', { tags: [tag.ESS, tag.BROKEN_IN_SERVERLESS] },
cleanupAgentPolicy(policyId);
});
it('should add the old integration and be able to upgrade it', { tags: tag.ESS }, () => {
it('should add the old integration and be able to upgrade it', { tags: '@ess' }, () => {
cy.visit(createOldOsqueryPath(oldVersion));
addCustomIntegration(integrationName, policyName);
policyContainsIntegration(integrationName, policyName);

View file

@ -24,9 +24,8 @@ import {
viewRecentCaseAndCheckResults,
} from '../../tasks/live_query';
import { generateRandomStringName, interceptCaseId } from '../../tasks/integrations';
import { tag } from '../../tags';
import { ServerlessRoleName } from '../../support/roles';
describe('Alert Event Details - Cases', { tags: [tag.ESS, tag.SERVERLESS] }, () => {
describe('Alert Event Details - Cases', { tags: ['@ess', '@serverless'] }, () => {
let ruleId: string;
let ruleName: string;
let packId: string;

View file

@ -16,12 +16,11 @@ import {
} from '../../tasks/live_query';
import { closeModalIfVisible, closeToastIfVisible } from '../../tasks/integrations';
import { RESULTS_TABLE, RESULTS_TABLE_BUTTON } from '../../screens/live_query';
import { tag } from '../../tags';
import { ServerlessRoleName } from '../../support/roles';
const UUID_REGEX = '[0-9A-Fa-f]{8}-[0-9A-Fa-f]{4}-[0-9A-Fa-f]{4}-[0-9A-Fa-f]{4}-[0-9A-Fa-f]{12}';
describe('Alert Event Details', { browser: 'electron', tags: [tag.ESS, tag.SERVERLESS] }, () => {
describe('Alert Event Details', { browser: 'electron', tags: ['@ess', '@serverless'] }, () => {
let ruleId: string;
let ruleName: string;
@ -100,7 +99,7 @@ describe('Alert Event Details', { browser: 'electron', tags: [tag.ESS, tag.SERVE
closeModalIfVisible();
});
it('can visit discover from response action results', { tags: [tag.ESS] }, () => {
it('can visit discover from response action results', { tags: ['@ess'] }, () => {
const discoverRegex = new RegExp(`action_id: ${UUID_REGEX}`);
cy.getBySel('expand-event').first().click();
cy.getBySel('securitySolutionDocumentDetailsFlyoutResponseSectionHeader').click();
@ -126,7 +125,7 @@ describe('Alert Event Details', { browser: 'electron', tags: [tag.ESS, tag.SERVE
});
});
it('can visit lens from response action results', { tags: [tag.ESS] }, () => {
it('can visit lens from response action results', { tags: ['@ess'] }, () => {
const lensRegex = new RegExp(`Action ${UUID_REGEX} results`);
cy.getBySel('expand-event').first().click();
cy.getBySel('securitySolutionDocumentDetailsFlyoutResponseSectionHeader').click();
@ -160,7 +159,7 @@ describe('Alert Event Details', { browser: 'electron', tags: [tag.ESS, tag.SERVE
cy.getBySel('breadcrumbs').contains(lensRegex);
});
it('can add to timeline from response action results', { tags: [tag.ESS] }, () => {
it('can add to timeline from response action results', { tags: ['@ess'] }, () => {
const timelineRegex = new RegExp(`Added ${UUID_REGEX} to timeline`);
const filterRegex = new RegExp(`action_id: "${UUID_REGEX}"`);
cy.getBySel('expand-event').first().click();

View file

@ -5,7 +5,6 @@
* 2.0.
*/
import { tag } from '../../tags';
import { cleanupRule, loadRule } from '../../tasks/api_fixtures';
import {
clickRuleName,
@ -16,7 +15,7 @@ import {
} from '../../tasks/live_query';
import { ServerlessRoleName } from '../../support/roles';
describe('Alert Event Details - dynamic params', { tags: [tag.ESS, tag.SERVERLESS] }, () => {
describe('Alert Event Details - dynamic params', { tags: ['@ess', '@serverless'] }, () => {
let ruleId: string;
let ruleName: string;

View file

@ -26,12 +26,11 @@ import {
typeInECSFieldInput,
} from '../../tasks/live_query';
import { closeDateTabIfVisible, closeToastIfVisible } from '../../tasks/integrations';
import { tag } from '../../tags';
import { ServerlessRoleName } from '../../support/roles';
describe(
'Alert Event Details - Response Actions Form',
{ browser: 'electron', tags: [tag.ESS, tag.SERVERLESS] },
{ browser: 'electron', tags: ['@ess', '@serverless'] },
() => {
let multiQueryPackId: string;
let multiQueryPackName: string;

View file

@ -5,7 +5,6 @@
* 2.0.
*/
import { tag } from '../../tags';
import {
addLiveQueryToCase,
checkActionItemsInResults,
@ -29,7 +28,7 @@ describe('Add to Cases', () => {
});
});
describe('observability', { tags: [tag.ESS] }, () => {
describe('observability', { tags: ['@ess'] }, () => {
let caseId: string;
let caseTitle: string;
before(() => {
@ -60,7 +59,7 @@ describe('Add to Cases', () => {
});
});
describe('security', { tags: [tag.ESS, tag.SERVERLESS] }, () => {
describe('security', { tags: ['@ess', '@serverless'] }, () => {
let caseId: string;
let caseTitle: string;

View file

@ -5,7 +5,6 @@
* 2.0.
*/
import { tag } from '../../tags';
import { navigateTo } from '../../tasks/navigation';
import {
checkActionItemsInResults,
@ -18,8 +17,8 @@ import { loadSpace, loadPack, cleanupPack, cleanupSpace } from '../../tasks/api_
import { ServerlessRoleName } from '../../support/roles';
const testSpaces = [
{ name: 'default', tags: [tag.ESS, tag.SERVERLESS] },
{ name: 'custom-spaces', tags: [tag.ESS] },
{ name: 'default', tags: ['@ess', '@serverless'] },
{ name: 'custom-spaces', tags: ['@ess'] },
];
describe('ALL - Custom space', () => {
testSpaces.forEach((testSpace) => {
@ -72,7 +71,7 @@ describe('ALL - Custom space', () => {
}
});
it('Discover should be opened in new tab in results table', { tags: [tag.ESS] }, () => {
it('Discover should be opened in new tab in results table', { tags: ['@ess'] }, () => {
cy.contains('New live query').click();
selectAllAgents();
inputQuery('select * from uptime;');

View file

@ -5,7 +5,6 @@
* 2.0.
*/
import { tag } from '../../tags';
import { getAdvancedButton } from '../../screens/integrations';
import { navigateTo } from '../../tasks/navigation';
import {
@ -19,7 +18,7 @@ import {
} from '../../tasks/live_query';
import { ServerlessRoleName } from '../../support/roles';
describe('EcsMapping', { tags: [tag.ESS, tag.SERVERLESS] }, () => {
describe('EcsMapping', { tags: ['@ess', '@serverless'] }, () => {
beforeEach(() => {
cy.login(ServerlessRoleName.SOC_MANAGER);
});

View file

@ -5,12 +5,11 @@
* 2.0.
*/
import { tag } from '../../tags';
import { navigateTo } from '../../tasks/navigation';
import { loadSavedQuery, cleanupSavedQuery } from '../../tasks/api_fixtures';
import { ServerlessRoleName } from '../../support/roles';
describe('ALL - Edit saved query', { tags: [tag.ESS, tag.SERVERLESS] }, () => {
describe('ALL - Edit saved query', { tags: ['@ess', '@serverless'] }, () => {
let savedQueryName: string;
let savedQueryId: string;

View file

@ -5,7 +5,6 @@
* 2.0.
*/
import { tag } from '../../tags';
import { navigateTo } from '../../tasks/navigation';
import {
checkResults,
@ -19,7 +18,7 @@ import { LIVE_QUERY_EDITOR } from '../../screens/live_query';
import { getAdvancedButton } from '../../screens/integrations';
import { ServerlessRoleName } from '../../support/roles';
describe('ALL - Live Query', { tags: [tag.SERVERLESS, tag.ESS] }, () => {
describe('ALL - Live Query', { tags: ['@serverless', '@ess'] }, () => {
beforeEach(() => {
cy.login(ServerlessRoleName.SOC_MANAGER);
navigateTo('/app/osquery');

View file

@ -5,7 +5,6 @@
* 2.0.
*/
import { tag } from '../../tags';
import { navigateTo } from '../../tasks/navigation';
import {
addToCase,
@ -19,7 +18,7 @@ import { LIVE_QUERY_EDITOR } from '../../screens/live_query';
import { loadPack, cleanupPack, cleanupCase, loadCase } from '../../tasks/api_fixtures';
import { ServerlessRoleName } from '../../support/roles';
describe('ALL - Live Query Packs', { tags: [tag.SERVERLESS, tag.ESS] }, () => {
describe('ALL - Live Query Packs', { tags: ['@serverless', '@ess'] }, () => {
let packName: string;
let packId: string;
let caseId: string;

View file

@ -5,7 +5,6 @@
* 2.0.
*/
import { tag } from '../../tags';
import { navigateTo } from '../../tasks/navigation';
import {
checkActionItemsInResults,
@ -26,7 +25,7 @@ import { getAdvancedButton } from '../../screens/integrations';
import { loadSavedQuery, cleanupSavedQuery } from '../../tasks/api_fixtures';
import { ServerlessRoleName } from '../../support/roles';
describe('ALL - Live Query run custom and saved', { tags: [tag.ESS] }, () => {
describe('ALL - Live Query run custom and saved', { tags: ['@ess'] }, () => {
let savedQueryId: string;
let savedQueryName: string;

View file

@ -5,14 +5,13 @@
* 2.0.
*/
import { tag } from '../../tags';
import { navigateTo } from '../../tasks/navigation';
import { checkResults, inputQuery, submitQuery } from '../../tasks/live_query';
import { loadSavedQuery, cleanupSavedQuery } from '../../tasks/api_fixtures';
import { triggerLoadData } from '../../tasks/inventory';
import { ServerlessRoleName } from '../../support/roles';
describe('ALL - Inventory', { tags: [tag.ESS] }, () => {
describe('ALL - Inventory', { tags: ['@ess'] }, () => {
let savedQueryName: string;
let savedQueryId: string;

View file

@ -7,7 +7,6 @@
import { recurse } from 'cypress-recurse';
import type { PackagePolicy } from '@kbn/fleet-plugin/common';
import { tag } from '../../tags';
import { API_VERSIONS } from '../../../common/constants';
import { navigateTo } from '../../tasks/navigation';
import {
@ -98,7 +97,7 @@ describe('Packs - Create and Edit', () => {
cleanupSavedQuery(multipleMappingsSavedQueryId);
});
describe('Check if result type is correct', { tags: [tag.ESS, tag.SERVERLESS] }, () => {
describe('Check if result type is correct', { tags: ['@ess', '@serverless'] }, () => {
let resultTypePackId: string;
before(() => {
@ -222,7 +221,7 @@ describe('Packs - Create and Edit', () => {
});
});
describe('Check if pack is created', { tags: [tag.ESS, tag.SERVERLESS] }, () => {
describe('Check if pack is created', { tags: ['@ess', '@serverless'] }, () => {
const packName = 'Pack-name' + generateRandomStringName(1)[0];
let packId: string;
@ -262,7 +261,7 @@ describe('Packs - Create and Edit', () => {
});
});
describe('to click the edit button and edit pack', { tags: [tag.ESS, tag.SERVERLESS] }, () => {
describe('to click the edit button and edit pack', { tags: ['@ess', '@serverless'] }, () => {
const newQueryName = 'new-query-name' + generateRandomStringName(1)[0];
let packId: string;
@ -317,7 +316,7 @@ describe('Packs - Create and Edit', () => {
describe(
'should trigger validation when saved query is being chosen',
{ tags: [tag.ESS, tag.SERVERLESS] },
{ tags: ['@ess', '@serverless'] },
() => {
let packId: string;
let packName: string;
@ -365,7 +364,7 @@ describe('Packs - Create and Edit', () => {
}
);
describe('should open lens in new tab', { tags: [tag.ESS] }, () => {
describe('should open lens in new tab', { tags: ['@ess'] }, () => {
let packId: string;
let packName: string;
@ -474,7 +473,7 @@ describe('Packs - Create and Edit', () => {
});
});
describe('deactivate and activate pack', { tags: [tag.ESS, tag.SERVERLESS] }, () => {
describe('deactivate and activate pack', { tags: ['@ess', '@serverless'] }, () => {
let packId: string;
let packName: string;
@ -510,7 +509,7 @@ describe('Packs - Create and Edit', () => {
});
});
describe('should verify that packs are triggered', { tags: [tag.ESS, tag.SERVERLESS] }, () => {
describe('should verify that packs are triggered', { tags: ['@ess', '@serverless'] }, () => {
let packId: string;
let packName: string;
@ -577,7 +576,7 @@ describe('Packs - Create and Edit', () => {
});
});
describe('delete all queries in the pack', { tags: [tag.ESS, tag.SERVERLESS] }, () => {
describe('delete all queries in the pack', { tags: ['@ess', '@serverless'] }, () => {
let packId: string;
let packName: string;
@ -625,7 +624,7 @@ describe('Packs - Create and Edit', () => {
describe(
'enable changing saved queries and ecs_mappings',
{ tags: [tag.ESS, tag.SERVERLESS] },
{ tags: ['@ess', '@serverless'] },
() => {
let packId: string;
let packName: string;
@ -698,7 +697,7 @@ describe('Packs - Create and Edit', () => {
}
);
describe('to click delete button', { tags: [tag.ESS, tag.SERVERLESS] }, () => {
describe('to click delete button', { tags: ['@ess', '@serverless'] }, () => {
let packName: string;
before(() => {
@ -721,7 +720,7 @@ describe('Packs - Create and Edit', () => {
});
});
it('', { tags: [tag.ESS, tag.SERVERLESS] }, () => {
it('', { tags: ['@ess', '@serverless'] }, () => {
preparePack(packName);
findAndClickButton('Edit');
deleteAndConfirm('pack');

View file

@ -7,7 +7,6 @@
import { find } from 'lodash';
import type { PackagePolicy } from '@kbn/fleet-plugin/common';
import { tag } from '../../tags';
import { API_VERSIONS } from '../../../common/constants';
import { FLEET_AGENT_POLICIES, navigateTo } from '../../tasks/navigation';
import {
@ -34,12 +33,12 @@ import { cleanupPack, cleanupAgentPolicy } from '../../tasks/api_fixtures';
import { request } from '../../tasks/common';
import { ServerlessRoleName } from '../../support/roles';
describe('ALL - Packs', { tags: [tag.ESS, tag.SERVERLESS] }, () => {
describe('ALL - Packs', { tags: ['@ess', '@serverless'] }, () => {
const integration = 'Osquery Manager';
describe(
'Validate that agent policy is getting removed from pack if we remove agent policy',
{ tags: [tag.ESS] },
{ tags: ['@ess'] },
() => {
beforeEach(() => {
cy.login('elastic');
@ -93,7 +92,7 @@ describe('ALL - Packs', { tags: [tag.ESS, tag.SERVERLESS] }, () => {
}
);
describe('Load prebuilt packs', { tags: [tag.ESS, tag.SERVERLESS] }, () => {
describe('Load prebuilt packs', { tags: ['@ess', '@serverless'] }, () => {
beforeEach(() => {
cy.login(ServerlessRoleName.SOC_MANAGER);
navigateTo('/app/osquery/packs');
@ -174,7 +173,7 @@ describe('ALL - Packs', { tags: [tag.ESS, tag.SERVERLESS] }, () => {
});
});
describe('Global packs', { tags: [tag.ESS] }, () => {
describe('Global packs', { tags: ['@ess'] }, () => {
beforeEach(() => {
cy.login('elastic');
navigateTo('/app/osquery/packs');

View file

@ -5,7 +5,6 @@
* 2.0.
*/
import { tag } from '../../tags';
import { preparePack } from '../../tasks/packs';
import {
addToCase,
@ -23,7 +22,7 @@ import { getSavedQueriesComplexTest } from '../../tasks/saved_queries';
import { loadCase, cleanupCase, loadPack, cleanupPack } from '../../tasks/api_fixtures';
import { ServerlessRoleName } from '../../support/roles';
describe('ALL - Saved queries', { tags: [tag.ESS, tag.SERVERLESS] }, () => {
describe('ALL - Saved queries', { tags: ['@ess', '@serverless'] }, () => {
let caseId: string;
before(() => {

View file

@ -5,11 +5,10 @@
* 2.0.
*/
import { tag } from '../../tags';
import { takeOsqueryActionWithParams } from '../../tasks/live_query';
import { ServerlessRoleName } from '../../support/roles';
describe('ALL - Timelines', { tags: [tag.ESS] }, () => {
describe('ALL - Timelines', { tags: ['@ess'] }, () => {
beforeEach(() => {
cy.login(ServerlessRoleName.SOC_MANAGER);
});

View file

@ -5,12 +5,11 @@
* 2.0.
*/
import { tag } from '../../tags';
import { checkResults, clickRuleName, submitQuery } from '../../tasks/live_query';
import { loadRule, cleanupRule } from '../../tasks/api_fixtures';
import { ServerlessRoleName } from '../../support/roles';
describe('Alert Test', { tags: [tag.ESS] }, () => {
describe('Alert Test', { tags: ['@ess'] }, () => {
let ruleName: string;
let ruleId: string;

View file

@ -5,7 +5,6 @@
* 2.0.
*/
import { tag } from '../../tags';
import { navigateTo } from '../../tasks/navigation';
import {
cleanupPack,
@ -16,7 +15,7 @@ import {
} from '../../tasks/api_fixtures';
import { ServerlessRoleName } from '../../support/roles';
describe('Reader - only READ', { tags: [tag.ESS] }, () => {
describe('Reader - only READ', { tags: ['@ess'] }, () => {
let savedQueryName: string;
let savedQueryId: string;
let packName: string;

View file

@ -5,7 +5,6 @@
* 2.0.
*/
import { tag } from '../../tags';
import { SAVED_QUERY_ID } from '../../../public/saved_queries/constants';
import { navigateTo } from '../../tasks/navigation';
import {
@ -24,9 +23,9 @@ import {
} from '../../tasks/api_fixtures';
import type { ServerlessRoleName } from '../../support/roles';
describe(`T1 and T2 analysts`, { tags: [tag.ESS, tag.SERVERLESS] }, () => {
describe(`T1 and T2 analysts`, { tags: ['@ess', '@serverless'] }, () => {
['t1_analyst', 't2_analyst'].forEach((role: string) => {
describe(`${role}- READ + runSavedQueries `, { tags: [tag.ESS, tag.SERVERLESS] }, () => {
describe(`${role}- READ + runSavedQueries `, { tags: ['@ess', '@serverless'] }, () => {
let savedQueryName: string;
let savedQueryId: string;
let packName: string;

View file

@ -5,13 +5,12 @@
* 2.0.
*/
import { tag } from '../../tags';
import { checkOsqueryResponseActionsPermissions } from '../../tasks/response_actions';
describe(
'App Features for Enpoint Complete PLI',
{
tags: [tag.SERVERLESS],
tags: ['@serverless'],
env: {
ftrConfig: {
productTypes: [

View file

@ -5,13 +5,12 @@
* 2.0.
*/
import { tag } from '../../tags';
import { checkOsqueryResponseActionsPermissions } from '../../tasks/response_actions';
describe(
'App Features for Endpoint Essentials PLI',
{
tags: [tag.SERVERLESS],
tags: ['@serverless'],
env: {
ftrConfig: {
productTypes: [

View file

@ -5,13 +5,12 @@
* 2.0.
*/
import { tag } from '../../tags';
import { checkOsqueryResponseActionsPermissions } from '../../tasks/response_actions';
describe(
'App Features for Security Complete PLI',
{
tags: [tag.SERVERLESS],
tags: ['@serverless'],
env: {
ftrConfig: {
productTypes: [{ product_line: 'security', product_tier: 'complete' }],

View file

@ -5,13 +5,12 @@
* 2.0.
*/
import { tag } from '../../tags';
import { checkOsqueryResponseActionsPermissions } from '../../tasks/response_actions';
describe(
'App Features for Security Essentials PLI',
{
tags: [tag.SERVERLESS],
tags: ['@serverless'],
env: {
ftrConfig: { productTypes: [{ product_line: 'security', product_tier: 'essentials' }] },
},

View file

@ -1,12 +0,0 @@
/*
* Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one
* or more contributor license agreements. Licensed under the Elastic License
* 2.0; you may not use this file except in compliance with the Elastic License
* 2.0.
*/
export const tag = {
SERVERLESS: '@serverless',
ESS: '@ess',
BROKEN_IN_SERVERLESS: '@brokenInServerless',
};

View file

@ -16,6 +16,7 @@ import cypress from 'cypress';
import { findChangedFiles } from 'find-cypress-specs';
import minimatch from 'minimatch';
import path from 'path';
import grep from '@cypress/grep/src/plugin';
import {
EsVersion,
@ -35,19 +36,17 @@ import { createFailError } from '@kbn/dev-cli-errors';
import pRetry from 'p-retry';
import { renderSummaryTable } from './print_run';
import { getLocalhostRealIp } from '../endpoint/common/localhost_services';
import { parseTestFileConfig } from './utils';
import { isSkipped, parseTestFileConfig } from './utils';
/**
* Retrieve test files using a glob pattern.
* If process.env.RUN_ALL_TESTS is true, returns all matching files, otherwise, return files that should be run by this job based on process.env.BUILDKITE_PARALLEL_JOB_COUNT and process.env.BUILDKITE_PARALLEL_JOB
*/
const retrieveIntegrations = (
/** Pattern passed to globby to find spec files. */ specPattern: string[]
) => {
const integrationsPaths = globby.sync(specPattern);
const retrieveIntegrations = (integrationsPaths: string[]) => {
const nonSkippedSpecs = integrationsPaths.filter((filePath) => !isSkipped(filePath));
if (process.env.RUN_ALL_TESTS === 'true') {
return integrationsPaths;
return nonSkippedSpecs;
} else {
// The number of instances of this job were created
const chunksTotal: number = process.env.BUILDKITE_PARALLEL_JOB_COUNT
@ -58,13 +57,13 @@ const retrieveIntegrations = (
? parseInt(process.env.BUILDKITE_PARALLEL_JOB, 10)
: 0;
const integrationsPathsForChunk: string[] = [];
const nonSkippedSpecsForChunk: string[] = [];
for (let i = chunkIndex; i < integrationsPaths.length; i += chunksTotal) {
integrationsPathsForChunk.push(integrationsPaths[i]);
for (let i = chunkIndex; i < nonSkippedSpecs.length; i += chunksTotal) {
nonSkippedSpecsForChunk.push(nonSkippedSpecs[i]);
}
return integrationsPathsForChunk;
return nonSkippedSpecsForChunk;
}
};
@ -89,7 +88,17 @@ export const cli = () => {
) as string;
const cypressConfigFile = await import(cypressConfigFilePath);
const spec: string | undefined = argv?.spec as string;
let files = retrieveIntegrations(spec ? [spec] : cypressConfigFile?.e2e?.specPattern);
const grepSpecPattern = grep({
...cypressConfigFile,
specPattern: spec ?? cypressConfigFile.e2e.specPattern,
excludeSpecPattern: [],
}).specPattern;
let files = retrieveIntegrations(
_.isArray(grepSpecPattern)
? grepSpecPattern
: globby.sync(spec ? [spec] : cypressConfigFile.e2e.specPattern)
);
if (argv.changedSpecsOnly) {
const basePath = process.cwd().split('kibana/')[1];
@ -112,7 +121,8 @@ export const cli = () => {
}
if (!files?.length) {
throw new Error('No files found');
// eslint-disable-next-line no-process-exit
return process.exit(0);
}
const esPorts: number[] = [9200, 9220];

View file

@ -13,6 +13,24 @@ import type { ExpressionStatement, ObjectExpression, ObjectProperty } from '@bab
import { schema, type TypeOf } from '@kbn/config-schema';
import { getExperimentalAllowedValues } from '../../common/experimental_features';
export const isSkipped = (filePath: string): boolean => {
const testFile = fs.readFileSync(filePath, { encoding: 'utf8' });
const ast = parser.parse(testFile, {
sourceType: 'module',
plugins: ['typescript'],
});
const expressionStatement = _.find(ast.program.body, ['type', 'ExpressionStatement']) as
| ExpressionStatement
| undefined;
const callExpression = expressionStatement?.expression;
// @ts-expect-error
return callExpression?.callee?.property?.name === 'skip';
};
export const parseTestFileConfig = (filePath: string): SecuritySolutionDescribeBlockFtrConfig => {
const testFile = fs.readFileSync(filePath, { encoding: 'utf8' });

View file

@ -17,6 +17,7 @@ export default defineCypressConfig({
defaultCommandTimeout: 150000,
env: {
grepFilterSpecs: true,
grepOmitFiltered: true,
grepTags: '@ess',
},
execTimeout: 150000,

View file

@ -17,6 +17,7 @@ export default defineCypressConfig({
defaultCommandTimeout: 150000,
env: {
grepFilterSpecs: true,
grepOmitFiltered: true,
grepTags: '@serverless --@brokenInServerless',
},
execTimeout: 150000,

View file

@ -5,8 +5,6 @@
* 2.0.
*/
import { tag } from '../../tags';
import { login, visit } from '../../tasks/login';
import { openTimelineUsingToggle } from '../../tasks/security_main';
import { openTimelineFieldsBrowser, populateTimeline } from '../../tasks/timeline';
@ -27,7 +25,7 @@ import { GET_TIMELINE_HEADER } from '../../screens/timeline';
const alertRunTimeField = 'field.name.alert.page';
const timelineRuntimeField = 'field.name.timeline';
describe('Create DataView runtime field', { tags: [tag.ESS, tag.SERVERLESS] }, () => {
describe('Create DataView runtime field', { tags: ['@ess', '@serverless'] }, () => {
before(() => {
deleteRuntimeField('security-solution-default', alertRunTimeField);
deleteRuntimeField('security-solution-default', timelineRuntimeField);

View file

@ -9,7 +9,6 @@ import {
DEFAULT_ALERTS_INDEX,
DEFAULT_INDEX_PATTERN,
} from '@kbn/security-solution-plugin/common/constants';
import { tag } from '../../tags';
import { login, loginWithUser, visit, visitWithUser } from '../../tasks/login';
@ -51,7 +50,7 @@ describe('Sourcerer', () => {
cy.task('esArchiverResetKibana');
dataViews.forEach((dataView: string) => postDataView(dataView));
});
describe('permissions', { tags: tag.ESS }, () => {
describe('permissions', { tags: '@ess' }, () => {
before(() => {
createUsersAndRoles(usersToCreate, rolesToCreate);
});
@ -62,7 +61,7 @@ describe('Sourcerer', () => {
});
});
describe('Default scope', { tags: [tag.ESS, tag.SERVERLESS] }, () => {
describe('Default scope', { tags: ['@ess', '@serverless'] }, () => {
beforeEach(() => {
cy.clearLocalStorage();
login();
@ -124,7 +123,7 @@ describe('Sourcerer', () => {
it(
'adds a pattern to the default index and correctly filters out auditbeat-*',
{ tags: tag.BROKEN_IN_SERVERLESS },
{ tags: '@brokenInServerless' },
() => {
openSourcerer();
isSourcererSelection(`auditbeat-*`);
@ -139,7 +138,7 @@ describe('Sourcerer', () => {
);
});
});
describe('Timeline scope', { tags: tag.BROKEN_IN_SERVERLESS }, () => {
describe('Timeline scope', { tags: '@brokenInServerless' }, () => {
beforeEach(() => {
cy.clearLocalStorage();
login();

View file

@ -5,8 +5,6 @@
* 2.0.
*/
import { tag } from '../../tags';
import { getNewRule } from '../../objects/rule';
import {
clickAlertTag,
@ -26,7 +24,7 @@ import {
UNSELECTED_ALERT_TAG,
} from '../../screens/alerts';
describe('Alert tagging', { tags: [tag.ESS, tag.SERVERLESS] }, () => {
describe('Alert tagging', { tags: ['@ess', '@serverless'] }, () => {
before(() => {
cleanKibana();
cy.task('esArchiverResetKibana');

View file

@ -5,8 +5,6 @@
* 2.0.
*/
import { tag } from '../../tags';
import { getNewRule } from '../../objects/rule';
import { ALERTS_COUNT } from '../../screens/alerts';
import {
@ -26,7 +24,7 @@ import {
} from '../../screens/search_bar';
import { TOASTER } from '../../screens/alerts_detection_rules';
describe('Histogram legend hover actions', { tags: [tag.ESS, tag.SERVERLESS] }, () => {
describe('Histogram legend hover actions', { tags: ['@ess', '@serverless'] }, () => {
const ruleConfigs = getNewRule();
before(() => {

View file

@ -6,7 +6,6 @@
*/
import { ROLES } from '@kbn/security-solution-plugin/common/test';
import { tag } from '../../tags';
import { DETECTIONS_RULE_MANAGEMENT_URL, ALERTS_URL } from '../../urls/navigation';
import { getNewRule } from '../../objects/rule';
@ -33,7 +32,7 @@ const waitForPageTitleToBeShown = () => {
describe(
'Detections > Need Admin Callouts indicating an admin is needed to migrate the alert data set',
{ tags: tag.ESS },
{ tags: '@ess' },
() => {
before(() => {
// First, we have to open the app on behalf of a privileged user in order to initialize it.

View file

@ -5,8 +5,6 @@
* 2.0.
*/
import { tag } from '../../tags';
import { disableExpandableFlyout } from '../../tasks/api_calls/kibana_advanced_settings';
import { getNewThreatIndicatorRule, indicatorRuleMatchingDoc } from '../../objects/rule';
import { cleanKibana } from '../../tasks/common';
@ -30,7 +28,7 @@ import { openJsonView, openThreatIndicatorDetails } from '../../tasks/alerts_det
import { DETECTIONS_RULE_MANAGEMENT_URL } from '../../urls/navigation';
import { addsFieldsToTimeline } from '../../tasks/rule_details';
describe('CTI Enrichment', { tags: [tag.ESS, tag.SERVERLESS] }, () => {
describe('CTI Enrichment', { tags: ['@ess', '@serverless'] }, () => {
before(() => {
cleanKibana();
cy.task('esArchiverLoad', 'threat_indicator');

View file

@ -5,8 +5,6 @@
* 2.0.
*/
import { tag } from '../../tags';
import { getNewRule } from '../../objects/rule';
import {
HOST_RISK_HEADER_COLIMN,
@ -32,7 +30,7 @@ import { login, visit } from '../../tasks/login';
import { ALERTS_URL } from '../../urls/navigation';
describe('Enrichment', { tags: [tag.ESS, tag.SERVERLESS] }, () => {
describe('Enrichment', { tags: ['@ess', '@serverless'] }, () => {
before(() => {
cleanKibana();
cy.task('esArchiverLoad', 'risk_users');

View file

@ -6,7 +6,6 @@
*/
import { ROLES } from '@kbn/security-solution-plugin/common/test';
import { tag } from '../../tags';
import { DETECTIONS_RULE_MANAGEMENT_URL, ALERTS_URL } from '../../urls/navigation';
import { getNewRule } from '../../objects/rule';
@ -43,7 +42,7 @@ const waitForPageTitleToBeShown = () => {
cy.get(PAGE_TITLE).should('be.visible');
};
describe('Detections > Callouts', { tags: tag.ESS }, () => {
describe('Detections > Callouts', { tags: '@ess' }, () => {
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.

View file

@ -5,8 +5,6 @@
* 2.0.
*/
import { tag } from '../../tags';
import { waitForAlertsToPopulate } from '../../tasks/create_new_rule';
import { login, visit } from '../../tasks/login';
@ -16,7 +14,7 @@ import { TIMELINE_QUERY, TIMELINE_VIEW_IN_ANALYZER } from '../../screens/timelin
import { selectAlertsHistogram } from '../../tasks/alerts';
import { createTimeline } from '../../tasks/timelines';
describe('Ransomware Detection Alerts', { tags: [tag.ESS, tag.SERVERLESS] }, () => {
describe('Ransomware Detection Alerts', { tags: ['@ess', '@serverless'] }, () => {
before(() => {
cy.task('esArchiverLoad', 'ransomware_detection');
});

View file

@ -5,8 +5,6 @@
* 2.0.
*/
import { tag } from '../../tags';
import { waitForAlertsToPopulate } from '../../tasks/create_new_rule';
import { login, visit } from '../../tasks/login';
@ -16,7 +14,7 @@ import { TIMELINE_QUERY, TIMELINE_VIEW_IN_ANALYZER } from '../../screens/timelin
import { selectAlertsHistogram } from '../../tasks/alerts';
import { createTimeline } from '../../tasks/timelines';
describe('Ransomware Prevention Alerts', { tags: [tag.ESS, tag.SERVERLESS] }, () => {
describe('Ransomware Prevention Alerts', { tags: ['@ess', '@serverless'] }, () => {
before(() => {
cy.task('esArchiverLoad', 'ransomware_prevention');
});

View file

@ -11,7 +11,6 @@ import {
RULES_UPDATES,
} from '@kbn/security-solution-plugin/common/constants';
import { ROLES } from '@kbn/security-solution-plugin/common/test';
import { tag } from '../../../tags';
import { createRuleAssetSavedObject } from '../../../helpers/rules';
import { createAndInstallMockedPrebuiltRules } from '../../../tasks/api_calls/prebuilt_rules';
@ -58,7 +57,7 @@ const loadPageAsReadOnlyUser = (url: string) => {
describe(
'Detection rules, Prebuilt Rules Installation and Update - Authorization/RBAC',
{ tags: tag.ESS },
{ tags: '@ess' },
() => {
beforeEach(() => {
login();

View file

@ -5,8 +5,6 @@
* 2.0.
*/
import { tag } from '../../../tags';
import { createRuleAssetSavedObject } from '../../../helpers/rules';
import { createAndInstallMockedPrebuiltRules } from '../../../tasks/api_calls/prebuilt_rules';
import { resetRulesTableState, deleteAlertsAndRules, reload } from '../../../tasks/common';
@ -26,7 +24,7 @@ import {
describe(
'Detection rules, Prebuilt Rules Installation and Update - Error handling',
{ tags: tag.ESS },
{ tags: '@ess' },
() => {
beforeEach(() => {
login();

View file

@ -7,7 +7,7 @@
import type { BulkInstallPackageInfo } from '@kbn/fleet-plugin/common';
import type { Rule } from '@kbn/security-solution-plugin/public/detection_engine/rule_management/logic/types';
import { tag } from '../../../tags';
import { createRuleAssetSavedObject } from '../../../helpers/rules';
import {
GO_BACK_TO_RULES_TABLE_BUTTON,
@ -41,7 +41,7 @@ import {
describe(
'Detection rules, Prebuilt Rules Installation and Update workflow',
{ tags: [tag.ESS, tag.BROKEN_IN_SERVERLESS] },
{ tags: ['@ess', '@brokenInServerless'] },
() => {
beforeEach(() => {
login();

View file

@ -5,8 +5,6 @@
* 2.0.
*/
import { tag } from '../../../tags';
import { createRuleAssetSavedObject } from '../../../helpers/rules';
import {
COLLAPSED_ACTION_BTN,
@ -50,7 +48,7 @@ const rules = Array.from(Array(5)).map((_, i) => {
});
});
describe('Prebuilt rules', { tags: [tag.ESS, tag.SERVERLESS] }, () => {
describe('Prebuilt rules', { tags: ['@ess', '@serverless'] }, () => {
before(() => {
cleanKibana();
});

View file

@ -5,8 +5,6 @@
* 2.0.
*/
import { tag } from '../../../tags';
import { createRuleAssetSavedObject } from '../../../helpers/rules';
import {
ADD_ELASTIC_RULES_BTN,
@ -33,7 +31,7 @@ const RULE_1 = createRuleAssetSavedObject({
describe(
'Detection rules, Prebuilt Rules Installation and Update Notifications',
{ tags: [tag.ESS, tag.BROKEN_IN_SERVERLESS] },
{ tags: ['@ess', '@brokenInServerless'] },
() => {
beforeEach(() => {
login();

View file

@ -5,8 +5,6 @@
* 2.0.
*/
import { tag } from '../../../tags';
import { getIndexConnector } from '../../../objects/connector';
import { getSimpleCustomQueryRule } from '../../../objects/rule';
@ -31,7 +29,7 @@ import { RULE_CREATION } from '../../../urls/navigation';
describe(
'Rule actions during detection rule creation',
{ tags: [tag.ESS, tag.BROKEN_IN_SERVERLESS] },
{ tags: ['@ess', '@brokenInServerless'] },
() => {
const indexConnector = getIndexConnector();

View file

@ -5,8 +5,6 @@
* 2.0.
*/
import { tag } from '../../../tags';
import { ruleFields } from '../../../data/detection_engine';
import {
getNewRule,
@ -116,7 +114,7 @@ import { enablesRule, getDetails } from '../../../tasks/rule_details';
import { RULE_CREATION } from '../../../urls/navigation';
describe('Custom query rules', { tags: [tag.ESS, tag.BROKEN_IN_SERVERLESS] }, () => {
describe('Custom query rules', { tags: ['@ess', '@brokenInServerless'] }, () => {
beforeEach(() => {
deleteAlertsAndRules();
});

View file

@ -5,8 +5,6 @@
* 2.0.
*/
import { tag } from '../../../tags';
import { formatMitreAttackDescription, getHumanizedDuration } from '../../../helpers/rules';
import { getDataViewRule } from '../../../objects/rule';
import { ALERTS_COUNT, ALERT_GRID_CELL } from '../../../screens/alerts';
@ -70,7 +68,7 @@ import { getDetails } from '../../../tasks/rule_details';
import { RULE_CREATION } from '../../../urls/navigation';
describe('Custom query rules', { tags: [tag.ESS, tag.BROKEN_IN_SERVERLESS] }, () => {
describe('Custom query rules', { tags: ['@ess', '@brokenInServerless'] }, () => {
describe('Custom detection rules creation with data views', () => {
const rule = getDataViewRule();
const expectedUrls = rule.references?.join('');

View file

@ -5,8 +5,6 @@
* 2.0.
*/
import { tag } from '../../../tags';
import { getNewRule, getSavedQueryRule } from '../../../objects/rule';
import {
@ -47,7 +45,7 @@ const savedQueryName = 'custom saved query';
const savedQueryQuery = 'process.name: test';
const savedQueryFilterKey = 'testAgent.value';
describe('Custom saved_query rules', { tags: [tag.ESS, tag.BROKEN_IN_SERVERLESS] }, () => {
describe('Custom saved_query rules', { tags: ['@ess', '@brokenInServerless'] }, () => {
before(() => {
cleanKibana();
});

View file

@ -5,8 +5,6 @@
* 2.0.
*/
import { tag } from '../../../tags';
import { formatMitreAttackDescription, getHumanizedDuration } from '../../../helpers/rules';
import { getEqlRule, getEqlSequenceRule, getIndexPatterns } from '../../../objects/rule';
@ -63,7 +61,7 @@ import { login, visit } from '../../../tasks/login';
import { RULE_CREATION } from '../../../urls/navigation';
describe('EQL rules', { tags: [tag.ESS, tag.BROKEN_IN_SERVERLESS] }, () => {
describe('EQL rules', { tags: ['@ess', '@brokenInServerless'] }, () => {
before(() => {
cleanKibana();
});

View file

@ -5,8 +5,6 @@
* 2.0.
*/
import { tag } from '../../../tags';
import { formatMitreAttackDescription, getHumanizedDuration } from '../../../helpers/rules';
import {
getIndexPatterns,
@ -110,7 +108,7 @@ import { DETECTIONS_RULE_MANAGEMENT_URL, RULE_CREATION } from '../../../urls/nav
const DEFAULT_THREAT_MATCH_QUERY = '@timestamp >= "now-30d/d"';
describe('indicator match', { tags: [tag.ESS, tag.BROKEN_IN_SERVERLESS] }, () => {
describe('indicator match', { tags: ['@ess', '@brokenInServerless'] }, () => {
describe('Detection rules, Indicator Match', () => {
const expectedUrls = getNewThreatIndicatorRule().references?.join('');
const expectedFalsePositives = getNewThreatIndicatorRule().false_positives?.join('');

View file

@ -5,7 +5,6 @@
* 2.0.
*/
import { isArray } from 'lodash';
import { tag } from '../../../tags';
import { formatMitreAttackDescription, getHumanizedDuration } from '../../../helpers/rules';
import { getMachineLearningRule } from '../../../objects/rule';
@ -54,7 +53,7 @@ import { login, visitWithoutDateRange } from '../../../tasks/login';
import { RULE_CREATION } from '../../../urls/navigation';
describe('Detection rules, machine learning', { tags: [tag.ESS, tag.BROKEN_IN_SERVERLESS] }, () => {
describe('Detection rules, machine learning', { tags: ['@ess', '@brokenInServerless'] }, () => {
const expectedUrls = (getMachineLearningRule().references ?? []).join('');
const expectedFalsePositives = (getMachineLearningRule().false_positives ?? []).join('');
const expectedTags = (getMachineLearningRule().tags ?? []).join('');

View file

@ -5,8 +5,6 @@
* 2.0.
*/
import { tag } from '../../../tags';
import { formatMitreAttackDescription, getHumanizedDuration } from '../../../helpers/rules';
import { getIndexPatterns, getNewTermsRule } from '../../../objects/rule';
@ -61,7 +59,7 @@ import { login, visit } from '../../../tasks/login';
import { RULE_CREATION } from '../../../urls/navigation';
describe('New Terms rules', { tags: [tag.ESS, tag.BROKEN_IN_SERVERLESS] }, () => {
describe('New Terms rules', { tags: ['@ess', '@brokenInServerless'] }, () => {
before(() => {
cleanKibana();
login();

View file

@ -5,8 +5,6 @@
* 2.0.
*/
import { tag } from '../../../tags';
import { formatMitreAttackDescription, getHumanizedDuration } from '../../../helpers/rules';
import { getIndexPatterns, getNewOverrideRule, getSeveritiesOverride } from '../../../objects/rule';
@ -63,7 +61,7 @@ import { getDetails } from '../../../tasks/rule_details';
import { RULE_CREATION } from '../../../urls/navigation';
describe('Detection rules, override', { tags: [tag.ESS, tag.BROKEN_IN_SERVERLESS] }, () => {
describe('Detection rules, override', { tags: ['@ess', '@brokenInServerless'] }, () => {
const rule = getNewOverrideRule();
const expectedUrls = rule.references?.join('');
const expectedFalsePositives = rule.false_positives?.join('');

View file

@ -5,8 +5,6 @@
* 2.0.
*/
import { tag } from '../../../tags';
import { formatMitreAttackDescription, getHumanizedDuration } from '../../../helpers/rules';
import { getIndexPatterns, getNewThresholdRule } from '../../../objects/rule';
@ -61,7 +59,7 @@ import { login, visitWithoutDateRange } from '../../../tasks/login';
import { RULE_CREATION } from '../../../urls/navigation';
describe('Detection rules, threshold', { tags: [tag.ESS, tag.BROKEN_IN_SERVERLESS] }, () => {
describe('Detection rules, threshold', { tags: ['@ess', '@brokenInServerless'] }, () => {
const rule = getNewThresholdRule();
const expectedUrls = rule.references?.join('');
const expectedFalsePositives = rule.false_positives?.join('');

View file

@ -6,7 +6,6 @@
*/
import { ROLES } from '@kbn/security-solution-plugin/common/test';
import { tag } from '../../../../tags';
import { getNewRule } from '../../../../objects/rule';
import {
@ -25,7 +24,7 @@ import {
} from '../../../../tasks/common/callouts';
import { login, visitSecurityDetectionRulesPage } from '../../../../tasks/login';
describe('All rules - read only', { tags: tag.ESS }, () => {
describe('All rules - read only', { tags: '@ess' }, () => {
before(() => {
cleanKibana();
createRule(getNewRule({ rule_id: '1', enabled: false }));

View file

@ -8,12 +8,11 @@
import { INTERNAL_ALERTING_API_MAINTENANCE_WINDOW_PATH } from '@kbn/alerting-plugin/common';
import type { MaintenanceWindowCreateBody } from '@kbn/alerting-plugin/common';
import type { AsApiContract } from '@kbn/alerting-plugin/server/routes/lib';
import { tag } from '../../../../tags';
import { cleanKibana } from '../../../../tasks/common';
import { login, visit } from '../../../../tasks/login';
import { DETECTIONS_RULE_MANAGEMENT_URL } from '../../../../urls/navigation';
describe('Maintenance window callout on Rule Management page', { tags: [tag.ESS] }, () => {
describe('Maintenance window callout on Rule Management page', { tags: ['@ess'] }, () => {
let maintenanceWindowId = '';
before(() => {

View file

@ -5,8 +5,6 @@
* 2.0.
*/
import { tag } from '../../../../tags';
import { DETECTIONS_RULE_MANAGEMENT_URL } from '../../../../urls/navigation';
import { FIELD } from '../../../../screens/alerts_details';
@ -54,7 +52,7 @@ Note that the rule we are using for testing purposes has the following character
- Integration: unknown
*/
describe('Related integrations', { tags: [tag.ESS, tag.BROKEN_IN_SERVERLESS] }, () => {
describe('Related integrations', { tags: ['@ess', '@brokenInServerless'] }, () => {
before(() => {
cleanKibana();
login();

View file

@ -5,8 +5,6 @@
* 2.0.
*/
import { tag } from '../../../../../tags';
import {
goToTheRuleDetailsOf,
expectManagementTableRules,
@ -54,7 +52,7 @@ const EXPIRED_EXCEPTION_ITEM_NAME = 'Sample exception item';
const NON_EXPIRED_EXCEPTION_ITEM_NAME = 'Sample exception item with future expiration';
describe('Detection rules, bulk duplicate', { tags: [tag.ESS, tag.SERVERLESS] }, () => {
describe('Detection rules, bulk duplicate', { tags: ['@ess', '@serverless'] }, () => {
before(() => {
cleanKibana();
});

View file

@ -73,7 +73,6 @@ import {
} from '../../../../../tasks/rules_bulk_actions';
import { createRuleAssetSavedObject } from '../../../../../helpers/rules';
import { tag } from '../../../../../tags';
import { hasIndexPatterns, getDetails } from '../../../../../tasks/rule_details';
import { login, visitSecurityDetectionRulesPage } from '../../../../../tasks/login';
import { createRule } from '../../../../../tasks/api_calls/rules';
@ -114,7 +113,7 @@ const defaultRuleData = {
timeline_id: '495ad7a7-316e-4544-8a0f-9c098daee76e',
};
describe('Detection rules, bulk edit', { tags: [tag.ESS, tag.BROKEN_IN_SERVERLESS] }, () => {
describe('Detection rules, bulk edit', { tags: ['@ess', '@brokenInServerless'] }, () => {
before(() => {
cleanKibana();
});

View file

@ -12,7 +12,6 @@ import {
waitForCallOutToBeShown,
} from '../../../../../tasks/common/callouts';
import { createRuleAssetSavedObject } from '../../../../../helpers/rules';
import { tag } from '../../../../../tags';
import {
RULES_BULK_EDIT_ACTIONS_INFO,
@ -76,7 +75,7 @@ const expectedSlackMessage = 'Slack action test message';
describe(
'Detection rules, bulk edit of rule actions',
{ tags: [tag.ESS, tag.BROKEN_IN_SERVERLESS] },
{ tags: ['@ess', '@brokenInServerless'] },
() => {
beforeEach(() => {
cleanKibana();

View file

@ -5,8 +5,6 @@
* 2.0.
*/
import { tag } from '../../../../../tags';
import {
RULES_BULK_EDIT_DATA_VIEWS_WARNING,
RULES_BULK_EDIT_OVERWRITE_DATA_VIEW_CHECKBOX,
@ -57,7 +55,7 @@ const expectedIndexPatterns = ['index-1-*', 'index-2-*'];
describe(
'Bulk editing index patterns of rules with a data view only',
{ tags: [tag.ESS, tag.BROKEN_IN_SERVERLESS] },
{ tags: ['@ess', '@brokenInServerless'] },
() => {
before(() => {
cleanKibana();
@ -250,7 +248,7 @@ describe(
describe(
'Bulk editing index patterns of rules with index patterns and rules with a data view',
{ tags: [tag.ESS, tag.BROKEN_IN_SERVERLESS] },
{ tags: ['@ess', '@brokenInServerless'] },
() => {
before(() => {
cleanKibana();

View file

@ -6,7 +6,6 @@
*/
import path from 'path';
import { tag } from '../../../../../tags';
import { expectedExportedRule, getNewRule } from '../../../../../objects/rule';
import {
@ -56,7 +55,7 @@ const prebuiltRules = Array.from(Array(7)).map((_, i) => {
});
});
describe('Export rules', { tags: [tag.ESS, tag.BROKEN_IN_SERVERLESS] }, () => {
describe('Export rules', { tags: ['@ess', '@brokenInServerless'] }, () => {
const downloadsFolder = Cypress.config('downloadsFolder');
before(() => {

View file

@ -5,8 +5,6 @@
* 2.0.
*/
import { tag } from '../../../../../tags';
import { TOASTER } from '../../../../../screens/alerts_detection_rules';
import {
expectManagementTableRules,
@ -19,7 +17,7 @@ import { login, visitWithoutDateRange } from '../../../../../tasks/login';
import { DETECTIONS_RULE_MANAGEMENT_URL } from '../../../../../urls/navigation';
const RULES_TO_IMPORT_FILENAME = 'cypress/fixtures/7_16_rules.ndjson';
describe('Import rules', { tags: [tag.ESS, tag.BROKEN_IN_SERVERLESS] }, () => {
describe('Import rules', { tags: ['@ess', '@brokenInServerless'] }, () => {
before(() => {
cleanKibana();
});

View file

@ -7,7 +7,6 @@
import { INTERNAL_ALERTING_API_FIND_RULES_PATH } from '@kbn/alerting-plugin/common';
import type { RuleResponse } from '@kbn/security-solution-plugin/common/api/detection_engine';
import { tag } from '../../../../../tags';
import { createRule, snoozeRule as snoozeRuleViaAPI } from '../../../../../tasks/api_calls/rules';
import { cleanKibana, deleteAlertsAndRules, deleteConnectors } from '../../../../../tasks/common';
@ -48,7 +47,7 @@ import { TOOLTIP } from '../../../../../screens/common';
const RULES_TO_IMPORT_FILENAME = 'cypress/fixtures/7_16_rules.ndjson';
describe('rule snoozing', { tags: [tag.ESS, tag.SERVERLESS] }, () => {
describe('rule snoozing', { tags: ['@ess', '@serverless'] }, () => {
before(() => {
cleanKibana();
});

View file

@ -5,8 +5,6 @@
* 2.0.
*/
import { tag } from '../../../../tags';
import {
REFRESH_RULES_STATUS,
RULES_TABLE_AUTOREFRESH_INDICATOR,
@ -35,7 +33,7 @@ import { getNewRule } from '../../../../objects/rule';
const DEFAULT_RULE_REFRESH_INTERVAL_VALUE = 60000;
const NUM_OF_TEST_RULES = 6;
describe('Rules table: auto-refresh', { tags: [tag.ESS, tag.BROKEN_IN_SERVERLESS] }, () => {
describe('Rules table: auto-refresh', { tags: ['@ess', '@brokenInServerless'] }, () => {
before(() => {
cleanKibana();
login();

View file

@ -5,8 +5,6 @@
* 2.0.
*/
import { tag } from '../../../../tags';
import { cleanKibana, resetRulesTableState, deleteAlertsAndRules } from '../../../../tasks/common';
import { login, visitSecurityDetectionRulesPage } from '../../../../tasks/login';
import {
@ -24,7 +22,7 @@ import {
import { disableAutoRefresh } from '../../../../tasks/alerts_detection_rules';
import { getNewRule } from '../../../../objects/rule';
describe('Rules table: filtering', { tags: [tag.ESS, tag.SERVERLESS] }, () => {
describe('Rules table: filtering', { tags: ['@ess', '@serverless'] }, () => {
before(() => {
cleanKibana();
});

View file

@ -5,8 +5,6 @@
* 2.0.
*/
import { tag } from '../../../../tags';
import { getNewRule } from '../../../../objects/rule';
import { RULES_MONITORING_TAB, RULE_NAME } from '../../../../screens/alerts_detection_rules';
import { createRule } from '../../../../tasks/api_calls/rules';
@ -14,7 +12,7 @@ import { cleanKibana, deleteAlertsAndRules } from '../../../../tasks/common';
import { login, visitWithoutDateRange } from '../../../../tasks/login';
import { DETECTIONS_RULE_MANAGEMENT_URL } from '../../../../urls/navigation';
describe('Rules table: links', { tags: [tag.ESS, tag.SERVERLESS] }, () => {
describe('Rules table: links', { tags: ['@ess', '@serverless'] }, () => {
before(() => {
cleanKibana();
});

View file

@ -6,7 +6,6 @@
*/
import { encode } from '@kbn/rison';
import { tag } from '../../../../tags';
import { cleanKibana, resetRulesTableState } from '../../../../tasks/common';
import { login, visit } from '../../../../tasks/login';
@ -100,7 +99,7 @@ function expectDefaultRulesTableState(): void {
expectTablePage(1);
}
describe('Rules table: persistent state', { tags: [tag.ESS, tag.SERVERLESS] }, () => {
describe('Rules table: persistent state', { tags: ['@ess', '@serverless'] }, () => {
before(() => {
cleanKibana();
createTestRules();

View file

@ -5,8 +5,6 @@
* 2.0.
*/
import { tag } from '../../../../tags';
import { createRuleAssetSavedObject } from '../../../../helpers/rules';
import {
SELECTED_RULES_NUMBER_LABEL,
@ -35,7 +33,7 @@ const RULE_2 = createRuleAssetSavedObject({
rule_id: 'rule_2',
});
describe('Rules table: selection', { tags: [tag.ESS, tag.SERVERLESS] }, () => {
describe('Rules table: selection', { tags: ['@ess', '@serverless'] }, () => {
before(() => {
cleanKibana();
});

View file

@ -5,8 +5,6 @@
* 2.0.
*/
import { tag } from '../../../../tags';
import {
FIRST_RULE,
RULE_NAME,
@ -38,7 +36,7 @@ import {
} from '../../../../tasks/table_pagination';
import { TABLE_FIRST_PAGE, TABLE_SECOND_PAGE } from '../../../../screens/table_pagination';
describe('Rules table: sorting', { tags: [tag.ESS, tag.SERVERLESS] }, () => {
describe('Rules table: sorting', { tags: ['@ess', '@serverless'] }, () => {
before(() => {
cleanKibana();
login();

View file

@ -6,7 +6,6 @@
*/
import { ROLES } from '@kbn/security-solution-plugin/common/test';
import { tag } from '../../../tags';
import { login, visitWithoutDateRange } from '../../../tasks/login';
import { DETECTIONS_RULE_MANAGEMENT_URL } from '../../../urls/navigation';
@ -36,7 +35,7 @@ const IPS_LIST_FILE_NAME = 'ip_list.txt';
const CIDRS_LIST_FILE_NAME = 'cidr_list.txt';
describe('value lists', () => {
describe('management modal', { tags: [tag.ESS, tag.SERVERLESS] }, () => {
describe('management modal', { tags: ['@ess', '@serverless'] }, () => {
beforeEach(() => {
login();
deleteValueLists([TEXT_LIST_FILE_NAME, IPS_LIST_FILE_NAME, CIDRS_LIST_FILE_NAME]);
@ -251,7 +250,7 @@ describe('value lists', () => {
});
});
describe('user with restricted access role', { tags: tag.ESS }, () => {
describe('user with restricted access role', { tags: '@ess' }, () => {
it('Does not allow a t1 analyst user to upload a value list', () => {
login(ROLES.t1_analyst);
visitWithoutDateRange(DETECTIONS_RULE_MANAGEMENT_URL, ROLES.t1_analyst);

View file

@ -5,8 +5,6 @@
* 2.0.
*/
import { tag } from '../../tags';
import {
PAGE_TITLE,
HOST_RISK_PREVIEW_TABLE,
@ -47,7 +45,7 @@ describe(
env: {
ftrConfig: { enableExperimental: ['riskScoringRoutesEnabled', 'riskScoringPersistence'] },
},
tags: [tag.ESS, tag.BROKEN_IN_SERVERLESS],
tags: ['@ess', '@brokenInServerless'],
},
() => {
before(() => {

View file

@ -5,8 +5,6 @@
* 2.0.
*/
import { tag } from '../../../tags';
import { deleteAlertsAndRules } from '../../../tasks/common';
import {
expandFirstAlert,
@ -45,7 +43,7 @@ import { goToEndpointExceptionsTab } from '../../../tasks/rule_details';
// See https://github.com/elastic/kibana/issues/163967
describe.skip(
'Endpoint Exceptions workflows from Alert',
{ tags: [tag.ESS, tag.BROKEN_IN_SERVERLESS] },
{ tags: ['@ess', '@brokenInServerless'] },
() => {
const ITEM_NAME = 'Sample Exception List Item';
const ITEM_NAME_EDIT = 'Sample Exception List Item';

View file

@ -4,7 +4,6 @@
* 2.0; you may not use this file except in compliance with the Elastic License
* 2.0.
*/
import { tag } from '../../../../tags';
import { LOADING_INDICATOR } from '../../../../screens/security_header';
import { getEndpointRule } from '../../../../objects/rule';
import { createRule } from '../../../../tasks/api_calls/rules';
@ -42,7 +41,7 @@ import { waitForAlertsToPopulate } from '../../../../tasks/create_new_rule';
// See https://github.com/elastic/kibana/issues/163967
describe.skip(
'Auto populate exception with Alert data',
{ tags: [tag.ESS, tag.BROKEN_IN_SERVERLESS] },
{ tags: ['@ess', '@brokenInServerless'] },
() => {
const ITEM_NAME = 'Sample Exception Item';
const ITEM_NAME_EDIT = 'Sample Exception Item Edit';

View file

@ -4,7 +4,6 @@
* 2.0; you may not use this file except in compliance with the Elastic License
* 2.0.
*/
import { tag } from '../../../tags';
import { getNewRule } from '../../../objects/rule';
@ -66,7 +65,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.skip('Exceptions flyout', { tags: [tag.ESS, tag.SERVERLESS] }, () => {
describe.skip('Exceptions flyout', { tags: ['@ess', '@serverless'] }, () => {
before(() => {
cy.task('esArchiverResetKibana');
// this is a made-up index that has just the necessary

View file

@ -4,7 +4,6 @@
* 2.0; you may not use this file except in compliance with the Elastic License
* 2.0.
*/
import { tag } from '../../../tags';
import { getNewRule } from '../../../objects/rule';
@ -31,7 +30,7 @@ import { DETECTIONS_RULE_MANAGEMENT_URL } from '../../../urls/navigation';
describe(
'Add multiple conditions and validate the generated exceptions',
{ tags: [tag.ESS, tag.SERVERLESS] },
{ tags: ['@ess', '@serverless'] },
() => {
beforeEach(() => {
cy.task('esArchiverResetKibana');

View file

@ -4,7 +4,6 @@
* 2.0; you may not use this file except in compliance with the Elastic License
* 2.0.
*/
import { tag } from '../../../tags';
import {
addExceptionEntryFieldMatchIncludedValue,
@ -51,7 +50,7 @@ const goToRulesAndOpenValueListModal = () => {
openValueListsModal();
};
describe('Use Value list in exception entry', { tags: [tag.ESS, tag.SERVERLESS] }, () => {
describe('Use Value list in exception entry', { tags: ['@ess', '@serverless'] }, () => {
before(() => {
cleanKibana();
login();

View file

@ -4,7 +4,6 @@
* 2.0; you may not use this file except in compliance with the Elastic License
* 2.0.
*/
import { tag } from '../../../tags';
import { getNewRule } from '../../../objects/rule';
@ -45,7 +44,7 @@ import {
} from '../../../screens/exceptions';
import { createEndpointExceptionList } from '../../../tasks/api_calls/exceptions';
describe('Add endpoint exception from rule details', { tags: [tag.ESS, tag.SERVERLESS] }, () => {
describe('Add endpoint exception from rule details', { tags: ['@ess', '@serverless'] }, () => {
const ITEM_NAME = 'Sample Exception List Item';
before(() => {

View file

@ -4,7 +4,6 @@
* 2.0; you may not use this file except in compliance with the Elastic License
* 2.0.
*/
import { tag } from '../../../tags';
import { getException, getExceptionList } from '../../../objects/exception';
import { getNewRule } from '../../../objects/rule';
@ -60,230 +59,148 @@ import {
} from '../../../tasks/api_calls/exceptions';
import { waitForAlertsToPopulate } from '../../../tasks/create_new_rule';
describe(
'Add/edit exception from rule details',
{ tags: [tag.ESS, tag.BROKEN_IN_SERVERLESS] },
() => {
const NUMBER_OF_AUDITBEAT_EXCEPTIONS_ALERTS = '1 alert';
const FIELD_DIFFERENT_FROM_EXISTING_ITEM_FIELD = 'agent.name';
const ITEM_FIELD = 'unique_value.test';
describe('Add/edit exception from rule details', { tags: ['@ess', '@brokenInServerless'] }, () => {
const NUMBER_OF_AUDITBEAT_EXCEPTIONS_ALERTS = '1 alert';
const FIELD_DIFFERENT_FROM_EXISTING_ITEM_FIELD = 'agent.name';
const ITEM_FIELD = 'unique_value.test';
before(() => {
cy.task('esArchiverResetKibana');
cy.task('esArchiverLoad', 'exceptions');
login();
});
before(() => {
cy.task('esArchiverResetKibana');
cy.task('esArchiverLoad', 'exceptions');
login();
});
after(() => {
cy.task('esArchiverUnload', 'exceptions');
});
after(() => {
cy.task('esArchiverUnload', 'exceptions');
});
describe('existing list and items', () => {
const exceptionList = getExceptionList();
beforeEach(() => {
deleteAlertsAndRules();
deleteExceptionList(exceptionList.list_id, exceptionList.namespace_type);
// create rule with exceptions
createExceptionList(exceptionList, exceptionList.list_id).then((response) => {
createRule(
getNewRule({
query: 'agent.name:*',
index: ['exceptions*'],
exceptions_list: [
{
id: response.body.id,
list_id: exceptionList.list_id,
type: exceptionList.type,
namespace_type: exceptionList.namespace_type,
},
],
rule_id: '2',
})
);
createExceptionListItem(exceptionList.list_id, {
list_id: exceptionList.list_id,
item_id: 'simple_list_item',
tags: [],
type: 'simple',
description: 'Test exception item 2',
name: 'Sample Exception List Item 2',
namespace_type: 'single',
entries: [
{
field: ITEM_FIELD,
operator: 'included',
type: 'match_any',
value: ['foo'],
},
],
});
});
login();
visitWithoutDateRange(DETECTIONS_RULE_MANAGEMENT_URL);
goToRuleDetails();
goToExceptionsTab();
});
it('Edits an exception item', () => {
const NEW_ITEM_NAME = 'Exception item-EDITED';
const ITEM_NAME = 'Sample Exception List Item 2';
// displays existing exception items
cy.get(EXCEPTION_ITEM_VIEWER_CONTAINER).should('have.length', 1);
cy.get(NO_EXCEPTIONS_EXIST_PROMPT).should('not.exist');
cy.get(EXCEPTION_CARD_ITEM_NAME).should('have.text', ITEM_NAME);
cy.get(EXCEPTION_CARD_ITEM_CONDITIONS).should(
'have.text',
' unique_value.testis one of foo'
);
// open edit exception modal
openEditException();
// edit exception item name
editExceptionFlyoutItemName(NEW_ITEM_NAME);
// check that the existing item's field is being populated
cy.get(EXCEPTION_ITEM_CONTAINER)
.eq(0)
.find(FIELD_INPUT_PARENT)
.eq(0)
.should('have.text', ITEM_FIELD);
cy.get(VALUES_MATCH_ANY_INPUT).should('have.text', 'foo');
// edit conditions
editException(FIELD_DIFFERENT_FROM_EXISTING_ITEM_FIELD, 0, 0);
// submit
submitEditedExceptionItem();
// new exception item displays
cy.get(EXCEPTION_ITEM_VIEWER_CONTAINER).should('have.length', 1);
// check that updates stuck
cy.get(EXCEPTION_CARD_ITEM_NAME).should('have.text', NEW_ITEM_NAME);
cy.get(EXCEPTION_CARD_ITEM_CONDITIONS).should('have.text', ' agent.nameIS foo');
});
describe('rule with existing shared exceptions', () => {
it('Creates an exception item to add to shared list', () => {
// displays existing exception items
cy.get(EXCEPTION_ITEM_VIEWER_CONTAINER).should('have.length', 1);
cy.get(NO_EXCEPTIONS_EXIST_PROMPT).should('not.exist');
// open add exception modal
addExceptionFlyoutFromViewerHeader();
// add exception item conditions
addExceptionConditions(getException());
// Name is required so want to check that submit is still disabled
cy.get(CONFIRM_BTN).should('have.attr', 'disabled');
// add exception item name
addExceptionFlyoutItemName('My item name');
// select to add exception item to a shared list
selectSharedListToAddExceptionTo(1);
// not testing close alert functionality here, just ensuring that the options appear as expected
cy.get(CLOSE_ALERTS_CHECKBOX).should('exist');
cy.get(CLOSE_ALERTS_CHECKBOX).should('not.have.attr', 'disabled');
// submit
submitNewExceptionItem();
// new exception item displays
cy.get(EXCEPTION_ITEM_VIEWER_CONTAINER).should('have.length', 2);
});
it('Creates an exception item to add to rule only', () => {
// displays existing exception items
cy.get(EXCEPTION_ITEM_VIEWER_CONTAINER).should('have.length', 1);
cy.get(NO_EXCEPTIONS_EXIST_PROMPT).should('not.exist');
// open add exception modal
addExceptionFlyoutFromViewerHeader();
// add exception item conditions
addExceptionConditions(getException());
// Name is required so want to check that submit is still disabled
cy.get(CONFIRM_BTN).should('have.attr', 'disabled');
// add exception item name
addExceptionFlyoutItemName('My item name');
// select to add exception item to rule only
selectAddToRuleRadio();
// not testing close alert functionality here, just ensuring that the options appear as expected
cy.get(CLOSE_ALERTS_CHECKBOX).should('exist');
cy.get(CLOSE_ALERTS_CHECKBOX).should('not.have.attr', 'disabled');
// submit
submitNewExceptionItem();
// new exception item displays
cy.get(EXCEPTION_ITEM_VIEWER_CONTAINER).should('have.length', 2);
});
// Trying to figure out with EUI why the search won't trigger
it('Can search for items', () => {
// displays existing exception items
cy.get(EXCEPTION_ITEM_VIEWER_CONTAINER).should('have.length', 1);
cy.get(NO_EXCEPTIONS_EXIST_PROMPT).should('not.exist');
// can search for an exception value
searchForExceptionItem('foo');
// new exception item displays
cy.get(EXCEPTION_ITEM_VIEWER_CONTAINER).should('have.length', 1);
// displays empty search result view if no matches found
searchForExceptionItem('abc');
// new exception item displays
cy.get(NO_EXCEPTIONS_SEARCH_RESULTS_PROMPT).should('exist');
});
});
});
describe('rule without existing exceptions', () => {
beforeEach(() => {
deleteAlertsAndRules();
describe('existing list and items', () => {
const exceptionList = getExceptionList();
beforeEach(() => {
deleteAlertsAndRules();
deleteExceptionList(exceptionList.list_id, exceptionList.namespace_type);
// create rule with exceptions
createExceptionList(exceptionList, exceptionList.list_id).then((response) => {
createRule(
getNewRule({
query: 'agent.name:*',
index: ['exceptions*'],
interval: '10s',
rule_id: 'rule_testing',
exceptions_list: [
{
id: response.body.id,
list_id: exceptionList.list_id,
type: exceptionList.type,
namespace_type: exceptionList.namespace_type,
},
],
rule_id: '2',
})
);
login();
visitWithoutDateRange(DETECTIONS_RULE_MANAGEMENT_URL);
goToRuleDetails();
goToExceptionsTab();
createExceptionListItem(exceptionList.list_id, {
list_id: exceptionList.list_id,
item_id: 'simple_list_item',
tags: [],
type: 'simple',
description: 'Test exception item 2',
name: 'Sample Exception List Item 2',
namespace_type: 'single',
entries: [
{
field: ITEM_FIELD,
operator: 'included',
type: 'match_any',
value: ['foo'],
},
],
});
});
afterEach(() => {
cy.task('esArchiverUnload', 'exceptions_2');
});
login();
visitWithoutDateRange(DETECTIONS_RULE_MANAGEMENT_URL);
goToRuleDetails();
goToExceptionsTab();
});
it('Cannot create an item to add to rule but not shared list as rule has no lists attached', () => {
// when no exceptions exist, empty component shows with action to add exception
cy.get(NO_EXCEPTIONS_EXIST_PROMPT).should('exist');
it('Edits an exception item', () => {
const NEW_ITEM_NAME = 'Exception item-EDITED';
const ITEM_NAME = 'Sample Exception List Item 2';
// displays existing exception items
cy.get(EXCEPTION_ITEM_VIEWER_CONTAINER).should('have.length', 1);
cy.get(NO_EXCEPTIONS_EXIST_PROMPT).should('not.exist');
cy.get(EXCEPTION_CARD_ITEM_NAME).should('have.text', ITEM_NAME);
cy.get(EXCEPTION_CARD_ITEM_CONDITIONS).should('have.text', ' unique_value.testis one of foo');
// open edit exception modal
openEditException();
// edit exception item name
editExceptionFlyoutItemName(NEW_ITEM_NAME);
// check that the existing item's field is being populated
cy.get(EXCEPTION_ITEM_CONTAINER)
.eq(0)
.find(FIELD_INPUT_PARENT)
.eq(0)
.should('have.text', ITEM_FIELD);
cy.get(VALUES_MATCH_ANY_INPUT).should('have.text', 'foo');
// edit conditions
editException(FIELD_DIFFERENT_FROM_EXISTING_ITEM_FIELD, 0, 0);
// submit
submitEditedExceptionItem();
// new exception item displays
cy.get(EXCEPTION_ITEM_VIEWER_CONTAINER).should('have.length', 1);
// check that updates stuck
cy.get(EXCEPTION_CARD_ITEM_NAME).should('have.text', NEW_ITEM_NAME);
cy.get(EXCEPTION_CARD_ITEM_CONDITIONS).should('have.text', ' agent.nameIS foo');
});
describe('rule with existing shared exceptions', () => {
it('Creates an exception item to add to shared list', () => {
// displays existing exception items
cy.get(EXCEPTION_ITEM_VIEWER_CONTAINER).should('have.length', 1);
cy.get(NO_EXCEPTIONS_EXIST_PROMPT).should('not.exist');
// open add exception modal
openExceptionFlyoutFromEmptyViewerPrompt();
addExceptionFlyoutFromViewerHeader();
// add exception item conditions
addExceptionConditions({
field: 'agent.name',
operator: 'is',
values: ['foo'],
});
addExceptionConditions(getException());
// Name is required so want to check that submit is still disabled
cy.get(CONFIRM_BTN).should('have.attr', 'disabled');
// add exception item name
addExceptionFlyoutItemName('My item name');
// select to add exception item to a shared list
selectSharedListToAddExceptionTo(1);
// not testing close alert functionality here, just ensuring that the options appear as expected
cy.get(CLOSE_ALERTS_CHECKBOX).should('exist');
cy.get(CLOSE_ALERTS_CHECKBOX).should('not.have.attr', 'disabled');
// submit
submitNewExceptionItem();
// new exception item displays
cy.get(EXCEPTION_ITEM_VIEWER_CONTAINER).should('have.length', 2);
});
it('Creates an exception item to add to rule only', () => {
// displays existing exception items
cy.get(EXCEPTION_ITEM_VIEWER_CONTAINER).should('have.length', 1);
cy.get(NO_EXCEPTIONS_EXIST_PROMPT).should('not.exist');
// open add exception modal
addExceptionFlyoutFromViewerHeader();
// add exception item conditions
addExceptionConditions(getException());
// Name is required so want to check that submit is still disabled
cy.get(CONFIRM_BTN).should('have.attr', 'disabled');
@ -294,50 +211,125 @@ describe(
// select to add exception item to rule only
selectAddToRuleRadio();
// Check that add to shared list is disabled, should be unless
// rule has shared lists attached to it already
cy.get(ADD_TO_SHARED_LIST_RADIO_INPUT).should('have.attr', 'disabled');
// Close matching alerts
selectBulkCloseAlerts();
// not testing close alert functionality here, just ensuring that the options appear as expected
cy.get(CLOSE_ALERTS_CHECKBOX).should('exist');
cy.get(CLOSE_ALERTS_CHECKBOX).should('not.have.attr', 'disabled');
// submit
submitNewExceptionItem();
// new exception item displays
cy.get(EXCEPTION_ITEM_VIEWER_CONTAINER).should('have.length', 2);
});
// Trying to figure out with EUI why the search won't trigger
it('Can search for items', () => {
// displays existing exception items
cy.get(EXCEPTION_ITEM_VIEWER_CONTAINER).should('have.length', 1);
cy.get(NO_EXCEPTIONS_EXIST_PROMPT).should('not.exist');
// can search for an exception value
searchForExceptionItem('foo');
// new exception item displays
cy.get(EXCEPTION_ITEM_VIEWER_CONTAINER).should('have.length', 1);
// Alerts table should now be empty from having added exception and closed
// matching alert
goToAlertsTab();
cy.get(EMPTY_ALERT_TABLE).should('exist');
// displays empty search result view if no matches found
searchForExceptionItem('abc');
// Closed alert should appear in table
goToClosedAlertsOnRuleDetailsPage();
cy.get(ALERTS_COUNT).should('exist');
cy.get(ALERTS_COUNT).should('have.text', `${NUMBER_OF_AUDITBEAT_EXCEPTIONS_ALERTS}`);
// Remove the exception and load an event that would have matched that exception
// to show that said exception now starts to show up again
goToExceptionsTab();
// when removing exception and again, no more exist, empty screen shows again
removeException();
cy.get(NO_EXCEPTIONS_EXIST_PROMPT).should('exist');
// load more docs
cy.task('esArchiverLoad', 'exceptions_2');
// now that there are no more exceptions, the docs should match and populate alerts
goToAlertsTab();
waitForAlertsToPopulate();
goToOpenedAlertsOnRuleDetailsPage();
waitForTheRuleToBeExecuted();
waitForAlertsToPopulate();
cy.get(ALERTS_COUNT).should('exist');
cy.get(ALERTS_COUNT).should('have.text', '2 alerts');
// new exception item displays
cy.get(NO_EXCEPTIONS_SEARCH_RESULTS_PROMPT).should('exist');
});
});
}
);
});
describe('rule without existing exceptions', () => {
beforeEach(() => {
deleteAlertsAndRules();
createRule(
getNewRule({
query: 'agent.name:*',
index: ['exceptions*'],
interval: '10s',
rule_id: 'rule_testing',
})
);
login();
visitWithoutDateRange(DETECTIONS_RULE_MANAGEMENT_URL);
goToRuleDetails();
goToExceptionsTab();
});
afterEach(() => {
cy.task('esArchiverUnload', 'exceptions_2');
});
it('Cannot create an item to add to rule but not shared list as rule has no lists attached', () => {
// when no exceptions exist, empty component shows with action to add exception
cy.get(NO_EXCEPTIONS_EXIST_PROMPT).should('exist');
// open add exception modal
openExceptionFlyoutFromEmptyViewerPrompt();
// add exception item conditions
addExceptionConditions({
field: 'agent.name',
operator: 'is',
values: ['foo'],
});
// Name is required so want to check that submit is still disabled
cy.get(CONFIRM_BTN).should('have.attr', 'disabled');
// add exception item name
addExceptionFlyoutItemName('My item name');
// select to add exception item to rule only
selectAddToRuleRadio();
// Check that add to shared list is disabled, should be unless
// rule has shared lists attached to it already
cy.get(ADD_TO_SHARED_LIST_RADIO_INPUT).should('have.attr', 'disabled');
// Close matching alerts
selectBulkCloseAlerts();
// submit
submitNewExceptionItem();
// new exception item displays
cy.get(EXCEPTION_ITEM_VIEWER_CONTAINER).should('have.length', 1);
// Alerts table should now be empty from having added exception and closed
// matching alert
goToAlertsTab();
cy.get(EMPTY_ALERT_TABLE).should('exist');
// Closed alert should appear in table
goToClosedAlertsOnRuleDetailsPage();
cy.get(ALERTS_COUNT).should('exist');
cy.get(ALERTS_COUNT).should('have.text', `${NUMBER_OF_AUDITBEAT_EXCEPTIONS_ALERTS}`);
// Remove the exception and load an event that would have matched that exception
// to show that said exception now starts to show up again
goToExceptionsTab();
// when removing exception and again, no more exist, empty screen shows again
removeException();
cy.get(NO_EXCEPTIONS_EXIST_PROMPT).should('exist');
// load more docs
cy.task('esArchiverLoad', 'exceptions_2');
// now that there are no more exceptions, the docs should match and populate alerts
goToAlertsTab();
waitForAlertsToPopulate();
goToOpenedAlertsOnRuleDetailsPage();
waitForTheRuleToBeExecuted();
waitForAlertsToPopulate();
cy.get(ALERTS_COUNT).should('exist');
cy.get(ALERTS_COUNT).should('have.text', '2 alerts');
});
});
});

View file

@ -4,7 +4,6 @@
* 2.0; you may not use this file except in compliance with the Elastic License
* 2.0.
*/
import { tag } from '../../../tags';
import { getNewRule } from '../../../objects/rule';
import { ALERTS_COUNT, EMPTY_ALERT_TABLE } from '../../../screens/alerts';
@ -44,7 +43,7 @@ import { waitForAlertsToPopulate } from '../../../tasks/create_new_rule';
describe(
'Add exception using data views from rule details',
{ tags: [tag.ESS, tag.BROKEN_IN_SERVERLESS] },
{ tags: ['@ess', '@brokenInServerless'] },
() => {
const NUMBER_OF_AUDITBEAT_EXCEPTIONS_ALERTS = '1 alert';
const ITEM_NAME = 'Sample Exception List Item';

View file

@ -5,7 +5,6 @@
* 2.0.
*/
import { ROLES } from '@kbn/security-solution-plugin/common/test';
import { tag } from '../../../tags';
import { getExceptionList } from '../../../objects/exception';
import { getNewRule } from '../../../objects/rule';
@ -27,7 +26,7 @@ import {
deleteExceptionList,
} from '../../../tasks/api_calls/exceptions';
describe('Exceptions viewer read only', { tags: tag.ESS }, () => {
describe('Exceptions viewer read only', { tags: '@ess' }, () => {
const exceptionList = getExceptionList();
beforeEach(() => {

View file

@ -4,7 +4,6 @@
* 2.0; you may not use this file except in compliance with the Elastic License
* 2.0.
*/
import { tag } from '../../../../tags';
import { getExceptionList } from '../../../../objects/exception';
import { getNewRule } from '../../../../objects/rule';
@ -41,7 +40,7 @@ const getExceptionList1 = () => ({
const EXCEPTION_LIST_NAME = 'Newly created list';
describe('Exception list detail page', { tags: [tag.ESS, tag.SERVERLESS] }, () => {
describe('Exception list detail page', { tags: ['@ess', '@serverless'] }, () => {
before(() => {
cy.task('esArchiverResetKibana');
login();

View file

@ -4,7 +4,6 @@
* 2.0; you may not use this file except in compliance with the Elastic License
* 2.0.
*/
import { tag } from '../../../tags';
import { getNewRule } from '../../../objects/rule';
import { login, visitWithoutDateRange } from '../../../tasks/login';
@ -39,7 +38,7 @@ import {
waitForExceptionsTableToBeLoaded,
} from '../../../tasks/exceptions_table';
describe('Add, edit and delete exception', { tags: [tag.ESS, tag.SERVERLESS] }, () => {
describe('Add, edit and delete exception', { tags: ['@ess', '@serverless'] }, () => {
before(() => {
cy.task('esArchiverResetKibana');
cy.task('esArchiverLoad', 'exceptions');

View file

@ -4,7 +4,6 @@
* 2.0; you may not use this file except in compliance with the Elastic License
* 2.0.
*/
import { tag } from '../../../../tags';
import { createRule } from '../../../../tasks/api_calls/rules';
import { getExceptionList } from '../../../../objects/exception';
@ -41,7 +40,7 @@ const getExceptionList2 = () => ({
list_id: 'exception_list_2',
});
describe('Duplicate List', { tags: [tag.ESS, tag.SERVERLESS] }, () => {
describe('Duplicate List', { tags: ['@ess', '@serverless'] }, () => {
beforeEach(() => {
cy.task('esArchiverResetKibana');
login();

View file

@ -4,7 +4,6 @@
* 2.0; you may not use this file except in compliance with the Elastic License
* 2.0.
*/
import { tag } from '../../../../tags';
import { getExceptionList } from '../../../../objects/exception';
import { getNewRule } from '../../../../objects/rule';
@ -36,7 +35,7 @@ const getExceptionList2 = () => ({
name: EXCEPTION_LIST_NAME_TWO,
list_id: 'exception_list_2',
});
describe('Filter Lists', { tags: [tag.ESS, tag.SERVERLESS] }, () => {
describe('Filter Lists', { tags: ['@ess', '@serverless'] }, () => {
beforeEach(() => {
cy.task('esArchiverResetKibana');
login();

View file

@ -4,7 +4,6 @@
* 2.0; you may not use this file except in compliance with the Elastic License
* 2.0.
*/
import { tag } from '../../../../tags';
import {
IMPORT_SHARED_EXCEPTION_LISTS_CLOSE_BTN,
@ -21,7 +20,7 @@ import {
import { login, visitWithoutDateRange } from '../../../../tasks/login';
import { EXCEPTIONS_URL } from '../../../../urls/navigation';
describe('Import Lists', { tags: [tag.ESS, tag.SERVERLESS] }, () => {
describe('Import Lists', { tags: ['@ess', '@serverless'] }, () => {
const LIST_TO_IMPORT_FILENAME = 'cypress/fixtures/7_16_exception_list.ndjson';
before(() => {
cy.task('esArchiverResetKibana');

View file

@ -4,7 +4,6 @@
* 2.0; you may not use this file except in compliance with the Elastic License
* 2.0.
*/
import { tag } from '../../../../tags';
import { getExceptionList, expectedExportedExceptionList } from '../../../../objects/exception';
import { getNewRule } from '../../../../objects/rule';
@ -47,7 +46,7 @@ const getExceptionList2 = () => ({
describe(
'Manage lists from "Shared Exception Lists" page',
{ tags: [tag.ESS, tag.SERVERLESS] },
{ tags: ['@ess', '@serverless'] },
() => {
describe('Create/Export/Delete List', () => {
before(() => {

View file

@ -5,7 +5,6 @@
* 2.0.
*/
import { ROLES } from '@kbn/security-solution-plugin/common/test';
import { tag } from '../../../../tags';
import { getExceptionList } from '../../../../objects/exception';
import {
@ -22,7 +21,7 @@ import {
import { login, visitWithoutDateRange } from '../../../../tasks/login';
import { EXCEPTIONS_URL } from '../../../../urls/navigation';
describe('Shared exception lists - read only', { tags: tag.ESS }, () => {
describe('Shared exception lists - read only', { tags: '@ess' }, () => {
before(() => {
cy.task('esArchiverResetKibana');
});

View file

@ -5,7 +5,6 @@
* 2.0.
*/
import { ROLES } from '@kbn/security-solution-plugin/common/test';
import { tag } from '../../../tags';
import { getNewRule } from '../../../objects/rule';
@ -25,7 +24,7 @@ const loadDetectionsPage = (role: ROLES) => {
waitForAlertsToPopulate();
};
describe('Alerts timeline', () => {
describe('Alerts timeline', { tags: '@ess' }, () => {
before(() => {
// First we login as a privileged user to create alerts.
cleanKibana();
@ -35,7 +34,7 @@ describe('Alerts timeline', () => {
waitForAlertsToPopulate();
});
context('Privileges: read only', { tags: tag.ESS }, () => {
context('Privileges: read only', { tags: '@ess' }, () => {
beforeEach(() => {
loadDetectionsPage(ROLES.reader);
});
@ -53,7 +52,7 @@ describe('Alerts timeline', () => {
});
});
context('Privileges: can crud', { tags: tag.ESS }, () => {
context('Privileges: can crud', { tags: '@ess' }, () => {
beforeEach(() => {
loadDetectionsPage(ROLES.platform_engineer);
cy.get(LOADING_INDICATOR).should('not.exist');

View file

@ -4,7 +4,6 @@
* 2.0; you may not use this file except in compliance with the Elastic License
* 2.0.
*/
import { tag } from '../../../tags';
import { login, visitTimeline } from '../../../tasks/login';
import {
@ -20,36 +19,36 @@ import { createTimeline } from '../../../tasks/api_calls/timelines';
import { cleanKibana, deleteTimelines } from '../../../tasks/common';
import { createCase } from '../../../tasks/api_calls/cases';
describe('attach timeline to case', { tags: [tag.ESS, tag.SERVERLESS] }, () => {
context('without cases created', () => {
before(() => {
cleanKibana();
});
beforeEach(() => {
login();
deleteTimelines();
createTimeline(getTimeline()).then((response) => {
cy.wrap(response.body.data.persistTimeline.timeline).as('myTimeline');
describe(
'attach timeline to case',
{ tags: ['@ess', '@serverless', '@brokenInServerless'] },
() => {
context('without cases created', () => {
before(() => {
cleanKibana();
});
});
it('attach timeline to a new case', { tags: tag.BROKEN_IN_SERVERLESS }, function () {
visitTimeline(this.myTimeline.savedObjectId);
attachTimelineToNewCase();
cy.location('origin').then((origin) => {
cy.get(DESCRIPTION_INPUT).should(
'have.text',
`[${this.myTimeline.title}](${origin}/app/security/timelines?timeline=(id:%27${this.myTimeline.savedObjectId}%27,isOpen:!t))`
);
beforeEach(() => {
login();
deleteTimelines();
createTimeline(getTimeline()).then((response) => {
cy.wrap(response.body.data.persistTimeline.timeline).as('myTimeline');
});
});
});
it(
'attach timeline to an existing case with no case',
{ tags: tag.BROKEN_IN_SERVERLESS },
function () {
it('attach timeline to a new case', function () {
visitTimeline(this.myTimeline.savedObjectId);
attachTimelineToNewCase();
cy.location('origin').then((origin) => {
cy.get(DESCRIPTION_INPUT).should(
'have.text',
`[${this.myTimeline.title}](${origin}/app/security/timelines?timeline=(id:%27${this.myTimeline.savedObjectId}%27,isOpen:!t))`
);
});
});
it('attach timeline to an existing case with no case', function () {
visitTimeline(this.myTimeline.savedObjectId);
attachTimelineToExistingCase();
addNewCase();
@ -60,47 +59,47 @@ describe('attach timeline to case', { tags: [tag.ESS, tag.SERVERLESS] }, () => {
`[${this.myTimeline.title}](${origin}/app/security/timelines?timeline=(id:%27${this.myTimeline.savedObjectId}%27,isOpen:!t))`
);
});
}
);
});
context('with cases created', { tags: tag.BROKEN_IN_SERVERLESS }, () => {
before(() => {
login();
deleteTimelines();
createTimeline(getTimeline()).then((response) =>
cy.wrap(response.body.data.persistTimeline.timeline.savedObjectId).as('timelineId')
);
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();
selectCase(this.caseId);
cy.location('origin').then((origin) => {
cy.get(ADD_COMMENT_INPUT).should(
'have.text',
`[${getTimeline().title}](${origin}/app/security/timelines?timeline=(id:%27${
this.timelineId
}%27,isOpen:!t))`
);
});
});
it('modal can be re-opened once closed', function () {
visitTimeline(this.timelineId);
attachTimelineToExistingCase();
cy.get('[data-test-subj="all-cases-modal-cancel-button"]').click({ force: true });
context('with cases created', () => {
before(() => {
login();
deleteTimelines();
createTimeline(getTimeline()).then((response) =>
cy.wrap(response.body.data.persistTimeline.timeline.savedObjectId).as('timelineId')
);
createCase(getCase1()).then((response) => cy.wrap(response.body.id).as('caseId'));
});
cy.get('[data-test-subj="all-cases-modal"]').should('not.exist');
attachTimelineToExistingCase();
cy.get('[data-test-subj="all-cases-modal"]').should('be.visible');
beforeEach(() => {
login();
});
it('attach timeline to an existing case', function () {
visitTimeline(this.timelineId);
attachTimelineToExistingCase();
selectCase(this.caseId);
cy.location('origin').then((origin) => {
cy.get(ADD_COMMENT_INPUT).should(
'have.text',
`[${getTimeline().title}](${origin}/app/security/timelines?timeline=(id:%27${
this.timelineId
}%27,isOpen:!t))`
);
});
});
it('modal can be re-opened once closed', function () {
visitTimeline(this.timelineId);
attachTimelineToExistingCase();
cy.get('[data-test-subj="all-cases-modal-cancel-button"]').click({ force: true });
cy.get('[data-test-subj="all-cases-modal"]').should('not.exist');
attachTimelineToExistingCase();
cy.get('[data-test-subj="all-cases-modal"]').should('be.visible');
});
});
});
});
}
);

View file

@ -4,7 +4,6 @@
* 2.0; you may not use this file except in compliance with the Elastic License
* 2.0.
*/
import { tag } from '../../../tags';
import { login, visitWithoutDateRange } from '../../../tasks/login';
import {
@ -29,7 +28,7 @@ import { CASES_URL } from '../../../urls/navigation';
import { CONNECTOR_CARD_DETAILS, CONNECTOR_TITLE } from '../../../screens/case_details';
import { cleanKibana } from '../../../tasks/common';
describe('Cases connector incident fields', { tags: [tag.ESS, tag.SERVERLESS] }, () => {
describe('Cases connector incident fields', { tags: ['@ess', '@serverless'] }, () => {
before(() => {
cleanKibana();
login();

View file

@ -4,7 +4,6 @@
* 2.0; you may not use this file except in compliance with the Elastic License
* 2.0.
*/
import { tag } from '../../../tags';
import { getServiceNowConnector, getServiceNowITSMHealthResponse } from '../../../objects/case';
@ -21,7 +20,7 @@ import { login, visitWithoutDateRange } from '../../../tasks/login';
import { CASES_URL } from '../../../urls/navigation';
describe('Cases connectors', { tags: [tag.ESS, tag.SERVERLESS] }, () => {
describe('Cases connectors', { tags: ['@ess', '@serverless'] }, () => {
const configureResult = {
connector: {
id: 'e271c3b8-f702-4fbc-98e0-db942b573bbd',

View file

@ -4,7 +4,6 @@
* 2.0; you may not use this file except in compliance with the Elastic License
* 2.0.
*/
import { tag } from '../../../tags';
import type { TestCase } from '../../../objects/case';
import { getCase1 } from '../../../objects/case';
@ -54,7 +53,7 @@ import { loginWithUser, visit, visitWithoutDateRange } from '../../../tasks/logi
import { CASES_URL, OVERVIEW_URL } from '../../../urls/navigation';
describe('Cases', { tags: [tag.ESS, tag.SERVERLESS] }, () => {
describe('Cases', { tags: ['@ess', '@serverless'] }, () => {
before(() => {
cleanKibana();
createTimeline(getCase1().timeline).then((response) =>

View file

@ -4,7 +4,6 @@
* 2.0; you may not use this file except in compliance with the Elastic License
* 2.0.
*/
import { tag } from '../../../tags';
import type { TestCaseWithoutTimeline } from '../../../objects/case';
import { ALL_CASES_CREATE_NEW_CASE_BTN, ALL_CASES_NAME } from '../../../screens/all_cases';
@ -49,7 +48,7 @@ const testCase: TestCaseWithoutTimeline = {
owner: 'securitySolution',
};
describe('Cases privileges', { tags: tag.ESS }, () => {
describe('Cases privileges', { tags: '@ess' }, () => {
before(() => {
cleanKibana();
createUsersAndRoles(usersToCreate, rolesToCreate);

Some files were not shown because too many files have changed in this diff Show more