Skip to content

Commit

Permalink
Restructure e2e/detection_rules folder
Browse files Browse the repository at this point in the history
  • Loading branch information
banderror committed Jul 25, 2023
1 parent 63c8315 commit d0d1b46
Show file tree
Hide file tree
Showing 32 changed files with 372 additions and 333 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -5,14 +5,14 @@
* 2.0.
*/

import { APP_PATH, RULES_ADD_PATH, RULES_UPDATES } from '../../../common/constants';
import { createRuleAssetSavedObject } from '../../helpers/rules';
import { waitForRulesTableToBeLoaded } from '../../tasks/alerts_detection_rules';
import { createAndInstallMockedPrebuiltRules } from '../../tasks/api_calls/prebuilt_rules';
import { resetRulesTableState, deleteAlertsAndRules } from '../../tasks/common';
import { login, waitForPageWithoutDateRange } from '../../tasks/login';
import { SECURITY_DETECTIONS_RULES_URL } from '../../urls/navigation';
import { ROLES } from '../../../common/test';
import { APP_PATH, RULES_ADD_PATH, RULES_UPDATES } from '../../../../common/constants';
import { createRuleAssetSavedObject } from '../../../helpers/rules';
import { waitForRulesTableToBeLoaded } from '../../../tasks/alerts_detection_rules';
import { createAndInstallMockedPrebuiltRules } from '../../../tasks/api_calls/prebuilt_rules';
import { resetRulesTableState, deleteAlertsAndRules } from '../../../tasks/common';
import { login, waitForPageWithoutDateRange } from '../../../tasks/login';
import { SECURITY_DETECTIONS_RULES_URL } from '../../../urls/navigation';
import { ROLES } from '../../../../common/test';
import {
ADD_ELASTIC_RULES_BTN,
getInstallSingleRuleButtonByRuleId,
Expand All @@ -21,7 +21,7 @@ import {
RULES_UPDATES_TAB,
RULE_CHECKBOX,
UPGRADE_ALL_RULES_BUTTON,
} from '../../screens/alerts_detection_rules';
} from '../../../screens/alerts_detection_rules';

const RULE_1_ID = 'rule_1';
const RULE_2_ID = 'rule_2';
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,12 +5,12 @@
* 2.0.
*/

import { createRuleAssetSavedObject } from '../../helpers/rules';
import { waitForRulesTableToBeLoaded } from '../../tasks/alerts_detection_rules';
import { createAndInstallMockedPrebuiltRules } from '../../tasks/api_calls/prebuilt_rules';
import { resetRulesTableState, deleteAlertsAndRules, reload } from '../../tasks/common';
import { login, visitWithoutDateRange } from '../../tasks/login';
import { SECURITY_DETECTIONS_RULES_URL } from '../../urls/navigation';
import { createRuleAssetSavedObject } from '../../../helpers/rules';
import { waitForRulesTableToBeLoaded } from '../../../tasks/alerts_detection_rules';
import { createAndInstallMockedPrebuiltRules } from '../../../tasks/api_calls/prebuilt_rules';
import { resetRulesTableState, deleteAlertsAndRules, reload } from '../../../tasks/common';
import { login, visitWithoutDateRange } from '../../../tasks/login';
import { SECURITY_DETECTIONS_RULES_URL } from '../../../urls/navigation';
import {
addElasticRulesButtonClick,
assertRuleAvailableForInstallAndInstallOne,
Expand All @@ -22,7 +22,7 @@ import {
assertRuleUpgradeAvailableAndUpgradeAllInPage,
assertRuleUpgradeAvailableAndUpgradeAll,
ruleUpdatesTabClick,
} from '../../tasks/prebuilt_rules';
} from '../../../tasks/prebuilt_rules';

describe('Detection rules, Prebuilt Rules Installation and Update - Error handling', () => {
beforeEach(() => {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,8 +6,8 @@
*/

import type { BulkInstallPackageInfo } from '@kbn/fleet-plugin/common';
import type { Rule } from '../../../public/detection_engine/rule_management/logic/types';
import { createRuleAssetSavedObject } from '../../helpers/rules';
import type { Rule } from '../../../../public/detection_engine/rule_management/logic/types';
import { createRuleAssetSavedObject } from '../../../helpers/rules';
import {
GO_BACK_TO_RULES_TABLE_BUTTON,
INSTALL_ALL_RULES_BUTTON,
Expand All @@ -18,15 +18,15 @@ import {
RULE_CHECKBOX,
SELECT_ALL_RULES_ON_PAGE_CHECKBOX,
TOASTER,
} from '../../screens/alerts_detection_rules';
import { waitForRulesTableToBeLoaded } from '../../tasks/alerts_detection_rules';
} from '../../../screens/alerts_detection_rules';
import { waitForRulesTableToBeLoaded } from '../../../tasks/alerts_detection_rules';
import {
getRuleAssets,
createAndInstallMockedPrebuiltRules,
} from '../../tasks/api_calls/prebuilt_rules';
import { resetRulesTableState, deleteAlertsAndRules, reload } from '../../tasks/common';
import { login, visitWithoutDateRange } from '../../tasks/login';
import { SECURITY_DETECTIONS_RULES_URL } from '../../urls/navigation';
} from '../../../tasks/api_calls/prebuilt_rules';
import { resetRulesTableState, deleteAlertsAndRules, reload } from '../../../tasks/common';
import { login, visitWithoutDateRange } from '../../../tasks/login';
import { SECURITY_DETECTIONS_RULES_URL } from '../../../urls/navigation';
import {
addElasticRulesButtonClick,
assertRuleAvailableForInstallAndInstallOne,
Expand All @@ -38,7 +38,7 @@ import {
assertRuleUpgradeAvailableAndUpgradeAllInPage,
assertRuleUpgradeAvailableAndUpgradeAll,
ruleUpdatesTabClick,
} from '../../tasks/prebuilt_rules';
} from '../../../tasks/prebuilt_rules';

describe('Detection rules, Prebuilt Rules Installation and Update workflow', () => {
beforeEach(() => {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
* 2.0.
*/

import { createRuleAssetSavedObject } from '../../helpers/rules';
import { createRuleAssetSavedObject } from '../../../helpers/rules';
import {
COLLAPSED_ACTION_BTN,
ELASTIC_RULES_BTN,
Expand All @@ -17,27 +17,31 @@ import {
RULE_SWITCH,
SELECT_ALL_RULES_ON_PAGE_CHECKBOX,
INSTALL_ALL_RULES_BUTTON,
} from '../../screens/alerts_detection_rules';
} from '../../../screens/alerts_detection_rules';
import {
confirmRulesDelete,
deleteFirstRule,
selectAllRules,
selectNumberOfRules,
waitForPrebuiltDetectionRulesToBeLoaded,
waitForRuleToUpdate,
} from '../../tasks/alerts_detection_rules';
} from '../../../tasks/alerts_detection_rules';
import {
deleteSelectedRules,
disableSelectedRules,
enableSelectedRules,
} from '../../tasks/rules_bulk_actions';
} from '../../../tasks/rules_bulk_actions';
import {
createAndInstallMockedPrebuiltRules,
getAvailablePrebuiltRulesCount,
} from '../../tasks/api_calls/prebuilt_rules';
import { cleanKibana, deleteAlertsAndRules, deletePrebuiltRulesAssets } from '../../tasks/common';
import { login, visitWithoutDateRange } from '../../tasks/login';
import { DETECTIONS_RULE_MANAGEMENT_URL } from '../../urls/navigation';
} from '../../../tasks/api_calls/prebuilt_rules';
import {
cleanKibana,
deleteAlertsAndRules,
deletePrebuiltRulesAssets,
} from '../../../tasks/common';
import { login, visitWithoutDateRange } from '../../../tasks/login';
import { DETECTIONS_RULE_MANAGEMENT_URL } from '../../../urls/navigation';

const rules = Array.from(Array(5)).map((_, i) => {
return createRuleAssetSavedObject({
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,21 +5,24 @@
* 2.0.
*/

import { createRuleAssetSavedObject } from '../../helpers/rules';
import { ADD_ELASTIC_RULES_BTN, RULES_UPDATES_TAB } from '../../screens/alerts_detection_rules';
import { deleteFirstRule, waitForRulesTableToBeLoaded } from '../../tasks/alerts_detection_rules';
import { createRuleAssetSavedObject } from '../../../helpers/rules';
import { ADD_ELASTIC_RULES_BTN, RULES_UPDATES_TAB } from '../../../screens/alerts_detection_rules';
import {
deleteFirstRule,
waitForRulesTableToBeLoaded,
} from '../../../tasks/alerts_detection_rules';
import {
installAllPrebuiltRulesRequest,
createAndInstallMockedPrebuiltRules,
} from '../../tasks/api_calls/prebuilt_rules';
} from '../../../tasks/api_calls/prebuilt_rules';
import {
resetRulesTableState,
deleteAlertsAndRules,
reload,
deletePrebuiltRulesAssets,
} from '../../tasks/common';
import { login, visitWithoutDateRange } from '../../tasks/login';
import { SECURITY_DETECTIONS_RULES_URL } from '../../urls/navigation';
} from '../../../tasks/common';
import { login, visitWithoutDateRange } from '../../../tasks/login';
import { SECURITY_DETECTIONS_RULES_URL } from '../../../urls/navigation';

const RULE_1 = createRuleAssetSavedObject({
name: 'Test rule 1',
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,27 +5,27 @@
* 2.0.
*/

import { getIndexConnector } from '../../objects/connector';
import { getSimpleCustomQueryRule } from '../../objects/rule';
import { getIndexConnector } from '../../../objects/connector';
import { getSimpleCustomQueryRule } from '../../../objects/rule';

import { goToRuleDetails } from '../../tasks/alerts_detection_rules';
import { deleteIndex, waitForNewDocumentToBeIndexed } from '../../tasks/api_calls/elasticsearch';
import { goToRuleDetails } from '../../../tasks/alerts_detection_rules';
import { deleteIndex, waitForNewDocumentToBeIndexed } from '../../../tasks/api_calls/elasticsearch';
import {
cleanKibana,
deleteAlertsAndRules,
deleteConnectors,
deleteDataView,
} from '../../tasks/common';
} from '../../../tasks/common';
import {
createAndEnableRule,
fillAboutRuleAndContinue,
fillDefineCustomRuleAndContinue,
fillRuleAction,
fillScheduleRuleAndContinue,
} from '../../tasks/create_new_rule';
import { login, visit } from '../../tasks/login';
} from '../../../tasks/create_new_rule';
import { login, visit } from '../../../tasks/login';

import { RULE_CREATION } from '../../urls/navigation';
import { RULE_CREATION } from '../../../urls/navigation';

describe('Rule actions during detection rule creation', () => {
const indexConnector = getIndexConnector();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,10 +5,15 @@
* 2.0.
*/

import { ruleFields } from '../../data/detection_engine';
import { getNewRule, getExistingRule, getEditedRule, getNewOverrideRule } from '../../objects/rule';
import { getTimeline } from '../../objects/timeline';
import { ALERTS_COUNT, ALERT_GRID_CELL } from '../../screens/alerts';
import { ruleFields } from '../../../data/detection_engine';
import {
getNewRule,
getExistingRule,
getEditedRule,
getNewOverrideRule,
} from '../../../objects/rule';
import { getTimeline } from '../../../objects/timeline';
import { ALERTS_COUNT, ALERT_GRID_CELL } from '../../../screens/alerts';

import {
CUSTOM_RULES_BTN,
Expand All @@ -18,11 +23,11 @@ import {
RULES_MANAGEMENT_TABLE,
RULE_SWITCH,
SEVERITY,
} from '../../screens/alerts_detection_rules';
} from '../../../screens/alerts_detection_rules';
import {
ACTIONS_NOTIFY_WHEN_BUTTON,
ACTIONS_SUMMARY_BUTTON,
} from '../../screens/common/rule_actions';
} from '../../../screens/common/rule_actions';
import {
ABOUT_CONTINUE_BTN,
ABOUT_EDIT_BUTTON,
Expand All @@ -39,7 +44,7 @@ import {
SEVERITY_DROPDOWN,
TAGS_CLEAR_BUTTON,
TAGS_FIELD,
} from '../../screens/create_new_rule';
} from '../../../screens/create_new_rule';
import {
ADDITIONAL_LOOK_BACK_DETAILS,
ABOUT_DETAILS,
Expand All @@ -64,20 +69,20 @@ import {
THREAT_TACTIC,
THREAT_TECHNIQUE,
THREAT_SUBTECHNIQUE,
} from '../../screens/rule_details';
} from '../../../screens/rule_details';

import {
deleteFirstRule,
deleteRuleFromDetailsPage,
editFirstRule,
goToRuleDetails,
selectNumberOfRules,
} from '../../tasks/alerts_detection_rules';
import { deleteSelectedRules } from '../../tasks/rules_bulk_actions';
import { createRule } from '../../tasks/api_calls/rules';
import { createTimeline } from '../../tasks/api_calls/timelines';
import { cleanKibana, deleteAlertsAndRules, deleteConnectors } from '../../tasks/common';
import { addEmailConnectorAndRuleAction } from '../../tasks/common/rule_actions';
} from '../../../tasks/alerts_detection_rules';
import { deleteSelectedRules } from '../../../tasks/rules_bulk_actions';
import { createRule } from '../../../tasks/api_calls/rules';
import { createTimeline } from '../../../tasks/api_calls/timelines';
import { cleanKibana, deleteAlertsAndRules, deleteConnectors } from '../../../tasks/common';
import { addEmailConnectorAndRuleAction } from '../../../tasks/common/rule_actions';
import {
createAndEnableRule,
expandAdvancedSettings,
Expand All @@ -100,12 +105,12 @@ import {
importSavedQuery,
waitForAlertsToPopulate,
waitForTheRuleToBeExecuted,
} from '../../tasks/create_new_rule';
import { saveEditedRule } from '../../tasks/edit_rule';
import { login, visit } from '../../tasks/login';
import { enablesRule, getDetails } from '../../tasks/rule_details';
} from '../../../tasks/create_new_rule';
import { saveEditedRule } from '../../../tasks/edit_rule';
import { login, visit } from '../../../tasks/login';
import { enablesRule, getDetails } from '../../../tasks/rule_details';

import { RULE_CREATION, DETECTIONS_RULE_MANAGEMENT_URL } from '../../urls/navigation';
import { RULE_CREATION, DETECTIONS_RULE_MANAGEMENT_URL } from '../../../urls/navigation';

describe('Custom query rules', () => {
before(() => {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,9 +5,9 @@
* 2.0.
*/

import { formatMitreAttackDescription, getHumanizedDuration } from '../../helpers/rules';
import { getDataViewRule } from '../../objects/rule';
import { ALERTS_COUNT, ALERT_GRID_CELL } from '../../screens/alerts';
import { formatMitreAttackDescription, getHumanizedDuration } from '../../../helpers/rules';
import { getDataViewRule } from '../../../objects/rule';
import { ALERTS_COUNT, ALERT_GRID_CELL } from '../../../screens/alerts';

import {
CUSTOM_RULES_BTN,
Expand All @@ -17,12 +17,12 @@ import {
RULES_MANAGEMENT_TABLE,
RULE_SWITCH,
SEVERITY,
} from '../../screens/alerts_detection_rules';
} from '../../../screens/alerts_detection_rules';
import {
ABOUT_CONTINUE_BTN,
RULE_DESCRIPTION_INPUT,
RULE_NAME_INPUT,
} from '../../screens/create_new_rule';
} from '../../../screens/create_new_rule';

import {
ADDITIONAL_LOOK_BACK_DETAILS,
Expand All @@ -48,10 +48,10 @@ import {
TIMELINE_TEMPLATE_DETAILS,
DATA_VIEW_DETAILS,
EDIT_RULE_SETTINGS_LINK,
} from '../../screens/rule_details';
} from '../../../screens/rule_details';

import { goToRuleDetails } from '../../tasks/alerts_detection_rules';
import { postDataView } from '../../tasks/common';
import { goToRuleDetails } from '../../../tasks/alerts_detection_rules';
import { postDataView } from '../../../tasks/common';
import {
createAndEnableRule,
createRuleWithoutEnabling,
Expand All @@ -60,12 +60,12 @@ import {
fillScheduleRuleAndContinue,
waitForAlertsToPopulate,
waitForTheRuleToBeExecuted,
} from '../../tasks/create_new_rule';
} from '../../../tasks/create_new_rule';

import { login, visit } from '../../tasks/login';
import { getDetails } from '../../tasks/rule_details';
import { login, visit } from '../../../tasks/login';
import { getDetails } from '../../../tasks/rule_details';

import { RULE_CREATION } from '../../urls/navigation';
import { RULE_CREATION } from '../../../urls/navigation';

describe('Custom query rules', () => {
describe('Custom detection rules creation with data views', () => {
Expand Down

0 comments on commit d0d1b46

Please sign in to comment.