Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[Security Solution] Removing cleanKibana method from Cypress #170636

Merged
merged 2 commits into from
Nov 7, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,6 @@

import { disableExpandableFlyout } from '../../../tasks/api_calls/kibana_advanced_settings';
import { getNewThreatIndicatorRule, indicatorRuleMatchingDoc } from '../../../objects/rule';
import { cleanKibana } from '../../../tasks/common';
import { login } from '../../../tasks/login';
import {
JSON_TEXT,
Expand All @@ -31,7 +30,6 @@ describe(
{ tags: ['@ess', '@serverless', '@brokenInServerless'] },
() => {
before(() => {
cleanKibana();
// illegal_argument_exception: unknown setting [index.lifecycle.rollover_alias]
cy.task('esArchiverLoad', { archiveName: 'threat_indicator' });
cy.task('esArchiverLoad', { archiveName: 'suspicious_source_event' });
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,6 @@ import {
RULE_CHECKBOX,
UPGRADE_ALL_RULES_BUTTON,
} from '../../../screens/alerts_detection_rules';
import { cleanKibana } from '../../../tasks/common';
import { login } from '../../../tasks/login';

// Rule to test update
Expand Down Expand Up @@ -72,7 +71,6 @@ describe(
() => {
beforeEach(() => {
preventPrebuiltRulesPackageInstallation();
cleanKibana();
});

describe('User with read privileges on Security Solution', () => {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,6 @@ import {
createAndInstallMockedPrebuiltRules,
preventPrebuiltRulesPackageInstallation,
} from '../../../tasks/api_calls/prebuilt_rules';
import { cleanKibana } from '../../../tasks/common';
import { login } from '../../../tasks/login';
import {
clickAddElasticRulesButton,
Expand All @@ -43,7 +42,6 @@ describe(
() => {
beforeEach(() => {
preventPrebuiltRulesPackageInstallation();
cleanKibana();
login();
visitRulesManagementTable();
});
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -35,11 +35,7 @@ import {
getAvailablePrebuiltRulesCount,
preventPrebuiltRulesPackageInstallation,
} from '../../../tasks/api_calls/prebuilt_rules';
import {
cleanKibana,
deleteAlertsAndRules,
deletePrebuiltRulesAssets,
} from '../../../tasks/common';
import { deleteAlertsAndRules, deletePrebuiltRulesAssets } from '../../../tasks/common';
import { login } from '../../../tasks/login';
import { visit } from '../../../tasks/navigation';
import { RULES_MANAGEMENT_URL } from '../../../urls/rules_management';
Expand All @@ -52,10 +48,6 @@ const rules = Array.from(Array(5)).map((_, i) => {
});

describe('Prebuilt rules', { tags: ['@ess', '@serverless', '@brokenInServerlessQA'] }, () => {
before(() => {
cleanKibana();
});

beforeEach(() => {
login();
deleteAlertsAndRules();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -10,12 +10,7 @@ import { getSimpleCustomQueryRule } from '../../../objects/rule';

import { goToRuleDetailsOf } from '../../../tasks/alerts_detection_rules';
import { deleteIndex, waitForNewDocumentToBeIndexed } from '../../../tasks/api_calls/elasticsearch';
import {
cleanKibana,
deleteAlertsAndRules,
deleteConnectors,
deleteDataView,
} from '../../../tasks/common';
import { deleteAlertsAndRules, deleteConnectors, deleteDataView } from '../../../tasks/common';
import {
createAndEnableRule,
fillAboutRuleAndContinue,
Expand All @@ -35,10 +30,6 @@ describe(
() => {
const indexConnector = getIndexConnector();

before(() => {
cleanKibana();
});

beforeEach(() => {
login();
deleteAlertsAndRules();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ import {
import { createRule } from '../../../tasks/api_calls/rules';

import { RULES_MANAGEMENT_URL } from '../../../urls/rules_management';
import { cleanKibana, deleteAlertsAndRules } from '../../../tasks/common';
import { deleteAlertsAndRules } from '../../../tasks/common';
import { goToActionsStepTab } from '../../../tasks/create_new_rule';
import { login } from '../../../tasks/login';

Expand All @@ -43,15 +43,10 @@ describe(
},
},
() => {
before(() => {
cleanKibana();
login();
});

beforeEach(() => {
login();
deleteAlertsAndRules();
createRule(rule);
login();
});

it('more than 3 rule actions should be available', () => {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ import {
import { createRule } from '../../../tasks/api_calls/rules';

import { RULES_MANAGEMENT_URL } from '../../../urls/rules_management';
import { cleanKibana, deleteAlertsAndRules } from '../../../tasks/common';
import { deleteAlertsAndRules } from '../../../tasks/common';
import { goToActionsStepTab } from '../../../tasks/create_new_rule';
import { login } from '../../../tasks/login';

Expand All @@ -43,15 +43,10 @@ describe(
},
},
() => {
before(() => {
cleanKibana();
login();
});

beforeEach(() => {
login();
deleteAlertsAndRules();
createRule(rule);
login();
});

it('only 3 rule actions should be available', () => {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ import {

import { editFirstRule, goToRuleDetailsOf } from '../../../tasks/alerts_detection_rules';
import { createSavedQuery, deleteSavedQueries } from '../../../tasks/api_calls/saved_queries';
import { cleanKibana, deleteAlertsAndRules } from '../../../tasks/common';
import { deleteAlertsAndRules } from '../../../tasks/common';
import {
createAndEnableRule,
fillAboutRuleAndContinue,
Expand Down Expand Up @@ -53,10 +53,6 @@ const savedQueryFilterKey = 'testAgent.value';

// TODO: https://github.com/elastic/kibana/issues/161539
describe('Saved query rules', { tags: ['@ess', '@serverless', '@brokenInServerless'] }, () => {
before(() => {
cleanKibana();
});

describe('Custom saved_query detection rule creation', () => {
beforeEach(() => {
login();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ import { ESQL_TYPE, ESQL_QUERY_BAR } from '../../../screens/create_new_rule';

import { getDetails, goBackToRulesTable } from '../../../tasks/rule_details';
import { expectNumberOfRules } from '../../../tasks/alerts_detection_rules';
import { cleanKibana, deleteAlertsAndRules } from '../../../tasks/common';
import { deleteAlertsAndRules } from '../../../tasks/common';
import {
fillAboutRuleAndContinue,
fillDefineEsqlRuleAndContinue,
Expand All @@ -35,11 +35,6 @@ import { visit } from '../../../tasks/navigation';
import { CREATE_RULE_URL } from '../../../urls/navigation';

describe('Detection ES|QL rules, creation', { tags: ['@ess'] }, () => {
before(() => {
cleanKibana();
login();
});

const rule = getEsqlRule();
const expectedNumberOfRules = 1;

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,18 +9,13 @@ import { getEsqlRule } from '../../../objects/rule';

import { ESQL_TYPE, NEW_TERMS_TYPE, THRESHOLD_TYPE } from '../../../screens/create_new_rule';

import { cleanKibana } from '../../../tasks/common';
import { login } from '../../../tasks/login';
import { visit } from '../../../tasks/navigation';

import { CREATE_RULE_URL } from '../../../urls/navigation';
import { createRule } from '../../../tasks/api_calls/rules';

describe('Detection ES|QL rules, creation', { tags: ['@serverless'] }, () => {
before(() => {
cleanKibana();
});

beforeEach(() => {
login();
});
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -68,7 +68,6 @@ import {
import { duplicateSelectedRulesWithExceptions } from '../../../tasks/rules_bulk_actions';
import { createRule } from '../../../tasks/api_calls/rules';
import { loadPrepackagedTimelineTemplates } from '../../../tasks/api_calls/timelines';
import { cleanKibana } from '../../../tasks/common';
import {
createAndEnableRule,
fillAboutRuleAndContinue,
Expand Down Expand Up @@ -112,6 +111,7 @@ import {
import { CREATE_RULE_URL } from '../../../urls/navigation';
import { RULES_MANAGEMENT_URL } from '../../../urls/rules_management';
import { openRuleManagementPageViaBreadcrumbs } from '../../../tasks/rules_management';
import { deleteAlertsAndRules } from '../../../tasks/common';

const DEFAULT_THREAT_MATCH_QUERY = '@timestamp >= "now-30d/d"';

Expand All @@ -127,9 +127,9 @@ describe('indicator match', { tags: ['@ess', '@serverless', '@brokenInServerless
const expectedNumberOfAlerts = '1 alert';

beforeEach(() => {
cleanKibana();
cy.task('esArchiverLoad', { archiveName: 'threat_indicator' });
cy.task('esArchiverLoad', { archiveName: 'suspicious_source_event' });
deleteAlertsAndRules();
login();
});

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,7 @@ import {

import { getDetails, waitForTheRuleToBeExecuted } from '../../../tasks/rule_details';
import { expectNumberOfRules, goToRuleDetailsOf } from '../../../tasks/alerts_detection_rules';
import { cleanKibana, deleteAlertsAndRules } from '../../../tasks/common';
import { deleteAlertsAndRules } from '../../../tasks/common';
import {
createAndEnableRule,
fillAboutRuleAndContinue,
Expand All @@ -60,10 +60,6 @@ import { CREATE_RULE_URL } from '../../../urls/navigation';
import { openRuleManagementPageViaBreadcrumbs } from '../../../tasks/rules_management';

describe('New Terms rules', { tags: ['@ess', '@serverless'] }, () => {
before(() => {
cleanKibana();
login();
});
describe('Detection rules, New Terms', () => {
const rule = getNewTermsRule();
const expectedUrls = rule.references?.join('');
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,7 @@ import {

import { getDetails, waitForTheRuleToBeExecuted } from '../../../tasks/rule_details';
import { expectNumberOfRules, goToRuleDetailsOf } from '../../../tasks/alerts_detection_rules';
import { cleanKibana, deleteAlertsAndRules } from '../../../tasks/common';
import { deleteAlertsAndRules } from '../../../tasks/common';
import {
createAndEnableRule,
fillAboutRuleAndContinue,
Expand All @@ -67,10 +67,6 @@ describe('Threshold rules', { tags: ['@ess', '@serverless'] }, () => {
const mitreAttack = rule.threat;
const expectedMitre = formatMitreAttackDescription(mitreAttack ?? []);

before(() => {
cleanKibana();
});

beforeEach(() => {
deleteAlertsAndRules();
login();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -17,18 +17,14 @@ import {
import { createRule } from '../../../tasks/api_calls/rules';

import { getDetails } from '../../../tasks/rule_details';
import { cleanKibana, deleteAlertsAndRules } from '../../../tasks/common';
import { deleteAlertsAndRules } from '../../../tasks/common';

import { login } from '../../../tasks/login';
import { visit } from '../../../tasks/navigation';

import { ruleDetailsUrl } from '../../../urls/rule_details';

describe('Detection ES|QL rules, details view', { tags: ['@ess'] }, () => {
before(() => {
cleanKibana();
login();
});
const rule = getEsqlRule();

beforeEach(() => {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ import { createRule } from '../../../tasks/api_calls/rules';

import { RULES_MANAGEMENT_URL } from '../../../urls/rules_management';
import { getDetails } from '../../../tasks/rule_details';
import { cleanKibana, deleteAlertsAndRules } from '../../../tasks/common';
import { deleteAlertsAndRules } from '../../../tasks/common';
import {
clearEsqlQueryBar,
fillEsqlQueryBar,
Expand All @@ -35,15 +35,10 @@ const rule = getEsqlRule();
const expectedValidEsqlQuery = 'from auditbeat* | stats count(event.category) by event.category';

describe('Detection ES|QL rules, edit', { tags: ['@ess'] }, () => {
before(() => {
cleanKibana();
login();
});

beforeEach(() => {
login();
deleteAlertsAndRules();
createRule(rule);
login();
});

it('edits ES|QL rule and checks details page', () => {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,6 @@ import {
} from '../../../../screens/alerts_detection_rules';
import { VALUE_LISTS_MODAL_ACTIVATOR } from '../../../../screens/lists';
import { createRule } from '../../../../tasks/api_calls/rules';
import { cleanKibana } from '../../../../tasks/common';
import {
dismissCallOut,
getCallOut,
Expand All @@ -29,7 +28,6 @@ import { visitRulesManagementTable } from '../../../../tasks/rules_management';
// TODO: https://github.com/elastic/kibana/issues/161540
describe('All rules - read only', { tags: ['@ess', '@serverless', '@skipInServerless'] }, () => {
before(() => {
cleanKibana();
createRule(getNewRule({ rule_id: '1', enabled: false }));
});

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,6 @@
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 { cleanKibana } from '../../../../tasks/common';
import { login } from '../../../../tasks/login';
import { visit } from '../../../../tasks/navigation';
import { RULES_MANAGEMENT_URL } from '../../../../urls/rules_management';
Expand All @@ -19,10 +18,6 @@ describe(
() => {
let maintenanceWindowId = '';

before(() => {
cleanKibana();
});

beforeEach(() => {
login();

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -21,11 +21,7 @@ import { login } from '../../../../../tasks/login';
import { visitRulesManagementTable } from '../../../../../tasks/rules_management';

import { createRule } from '../../../../../tasks/api_calls/rules';
import {
cleanKibana,
resetRulesTableState,
deleteAlertsAndRules,
} from '../../../../../tasks/common';
import { resetRulesTableState, deleteAlertsAndRules } from '../../../../../tasks/common';

import { getNewRule } from '../../../../../objects/rule';

Expand Down Expand Up @@ -54,10 +50,6 @@ 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: ['@ess', '@serverless'] }, () => {
before(() => {
cleanKibana();
});

beforeEach(() => {
login();
// Make sure persisted rules table state is cleared
Expand Down
Loading
Loading