Skip to content

Commit

Permalink
[Detection Response][Cypress] Reshuffle bulk action cypress tests (el…
Browse files Browse the repository at this point in the history
…astic#161900)

## Summary

A very small first piece to address
elastic#153645

- Starts adding new folder structure in cypress tests
`detections_response/rules_management`
- Adds `detections_response/rules_management/bulk_actions`
- Reshuffled screens and tasks to now also have a corresponding
`screens/rules_bulk_actions.ts` and `tasks/rules_bulk_actions.ts`
- We chatted and decided to try to organize tests by subdomains rather
than by teams. Anticipated upcoming changes will add something like:
- `detections_response/rules_management`
    - `/bulk_actions.ts`
    - `/rules_table.ts`
- `detections_response/prebuilt_rules`
- `detections_response/rule_creation`
- `detections_response/rule_details`
- `detections_response/rule_edit`
- `detections_response/exceptions`
    -  `/shared_exception_lists` 
    - `/alerts_table`
    - `/alerts_details`
    - `/rule_details`

---------

Co-authored-by: Kibana Machine <42973632+kibanamachine@users.noreply.github.com>
Co-authored-by: Georgii Gorbachev <georgii.gorbachev@elastic.co>
  • Loading branch information
3 people authored and Devon Thomson committed Aug 1, 2023
1 parent 848664d commit 7d75819
Show file tree
Hide file tree
Showing 12 changed files with 334 additions and 308 deletions.
Expand Up @@ -69,11 +69,11 @@ import {
import {
deleteFirstRule,
deleteRuleFromDetailsPage,
deleteSelectedRules,
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';
Expand Down
Expand Up @@ -17,13 +17,13 @@ import {
import {
filterByElasticRules,
selectNumberOfRules,
bulkExportRules,
selectAllRules,
waitForRuleExecution,
exportRule,
importRules,
expectManagementTableRules,
} from '../../tasks/alerts_detection_rules';
import { bulkExportRules } from '../../tasks/rules_bulk_actions';
import { createExceptionList, deleteExceptionList } from '../../tasks/api_calls/exceptions';
import { getExceptionList } from '../../objects/exception';
import { createRule } from '../../tasks/api_calls/rules';
Expand Down
Expand Up @@ -63,8 +63,8 @@ import {
selectNumberOfRules,
checkDuplicatedRule,
expectNumberOfRules,
duplicateSelectedRulesWithExceptions,
} from '../../tasks/alerts_detection_rules';
import { duplicateSelectedRulesWithExceptions } from '../../tasks/rules_bulk_actions';
import { createRule } from '../../tasks/api_calls/rules';
import { loadPrepackagedTimelineTemplates } from '../../tasks/api_calls/timelines';
import { cleanKibana, deleteAlertsAndRules } from '../../tasks/common';
Expand Down
Expand Up @@ -21,14 +21,16 @@ import {
import {
confirmRulesDelete,
deleteFirstRule,
deleteSelectedRules,
disableSelectedRules,
enableSelectedRules,
selectAllRules,
selectNumberOfRules,
waitForPrebuiltDetectionRulesToBeLoaded,
waitForRuleToUpdate,
} from '../../tasks/alerts_detection_rules';
import {
deleteSelectedRules,
disableSelectedRules,
enableSelectedRules,
} from '../../tasks/rules_bulk_actions';
import {
createAndInstallMockedPrebuiltRules,
getAvailablePrebuiltRulesCount,
Expand Down
Expand Up @@ -9,27 +9,28 @@ import {
waitForRulesTableToBeLoaded,
goToTheRuleDetailsOf,
selectNumberOfRules,
duplicateSelectedRulesWithoutExceptions,
expectManagementTableRules,
} from '../../../../tasks/alerts_detection_rules';
import {
duplicateSelectedRulesWithoutExceptions,
duplicateSelectedRulesWithExceptions,
duplicateSelectedRulesWithNonExpiredExceptions,
} from '../../tasks/alerts_detection_rules';

import { goToExceptionsTab, viewExpiredExceptionItems } from '../../tasks/rule_details';
import { login, visitWithoutDateRange } from '../../tasks/login';
} from '../../../../tasks/rules_bulk_actions';
import { goToExceptionsTab, viewExpiredExceptionItems } from '../../../../tasks/rule_details';
import { login, visitWithoutDateRange } from '../../../../tasks/login';

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

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

import { createRuleExceptionItem } from '../../tasks/api_calls/exceptions';
import { EXCEPTION_CARD_ITEM_NAME } from '../../screens/exceptions';
import { createRuleExceptionItem } from '../../../../tasks/api_calls/exceptions';
import { EXCEPTION_CARD_ITEM_NAME } from '../../../../screens/exceptions';
import {
assertExceptionItemsExists,
assertNumberOfExceptionItemsExists,
} from '../../tasks/exceptions';
} from '../../../../tasks/exceptions';

const RULE_NAME = 'Custom rule for bulk actions';

Expand Down
Expand Up @@ -11,7 +11,7 @@ import {
RULE_CHECKBOX,
RULES_TAGS_POPOVER_BTN,
MODAL_ERROR_BODY,
} from '../../screens/alerts_detection_rules';
} from '../../../../screens/alerts_detection_rules';

import {
RULES_BULK_EDIT_INDEX_PATTERNS_WARNING,
Expand All @@ -20,11 +20,11 @@ import {
TAGS_RULE_BULK_MENU_ITEM,
INDEX_PATTERNS_RULE_BULK_MENU_ITEM,
APPLY_TIMELINE_RULE_BULK_MENU_ITEM,
} from '../../screens/rules_bulk_edit';
} from '../../../../screens/rules_bulk_actions';

import { TIMELINE_TEMPLATE_DETAILS } from '../../screens/rule_details';
import { TIMELINE_TEMPLATE_DETAILS } from '../../../../screens/rule_details';

import { EUI_FILTER_SELECT_ITEM } from '../../screens/common/controls';
import { EUI_FILTER_SELECT_ITEM } from '../../../../screens/common/controls';

import {
waitForRulesTableToBeLoaded,
Expand All @@ -38,7 +38,7 @@ import {
clickErrorToastBtn,
unselectRuleByName,
cancelConfirmationModal,
} from '../../tasks/alerts_detection_rules';
} from '../../../../tasks/alerts_detection_rules';

import {
typeIndexPatterns,
Expand Down Expand Up @@ -69,15 +69,15 @@ import {
assertRuleScheduleValues,
assertUpdateScheduleWarningExists,
assertDefaultValuesAreAppliedToScheduleFields,
} from '../../tasks/rules_bulk_edit';
} from '../../../../tasks/rules_bulk_actions';

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

import { SECURITY_DETECTIONS_RULES_URL } from '../../urls/navigation';
import { createRule } from '../../tasks/api_calls/rules';
import { loadPrepackagedTimelineTemplates } from '../../tasks/api_calls/timelines';
import { cleanKibana, resetRulesTableState, deleteAlertsAndRules } from '../../tasks/common';
import { SECURITY_DETECTIONS_RULES_URL } from '../../../../urls/navigation';
import { createRule } from '../../../../tasks/api_calls/rules';
import { loadPrepackagedTimelineTemplates } from '../../../../tasks/api_calls/timelines';
import { cleanKibana, resetRulesTableState, deleteAlertsAndRules } from '../../../../tasks/common';

import {
getEqlRule,
Expand All @@ -86,13 +86,13 @@ import {
getNewThresholdRule,
getMachineLearningRule,
getNewTermsRule,
} from '../../objects/rule';
} from '../../../../objects/rule';

import {
getAvailablePrebuiltRulesCount,
excessivelyInstallAllPrebuiltRules,
} from '../../tasks/api_calls/prebuilt_rules';
import { setRowsPerPageTo } from '../../tasks/table_pagination';
} from '../../../../tasks/api_calls/prebuilt_rules';
import { setRowsPerPageTo } from '../../../../tasks/table_pagination';

const RULE_NAME = 'Custom rule for bulk actions';
const EUI_SELECTABLE_LIST_ITEM_SR_TEXT = '. To check this option, press Enter.';
Expand Down
Expand Up @@ -6,17 +6,17 @@
*/

import type { RuleActionArray } from '@kbn/securitysolution-io-ts-alerting-types';
import { ROLES } from '../../../common/test';
import { ROLES } from '../../../../../common/test';

import {
RULES_BULK_EDIT_ACTIONS_INFO,
RULES_BULK_EDIT_ACTIONS_WARNING,
ADD_RULE_ACTIONS_MENU_ITEM,
} from '../../screens/rules_bulk_edit';
import { actionFormSelector } from '../../screens/common/rule_actions';
} from '../../../../screens/rules_bulk_actions';
import { actionFormSelector } from '../../../../screens/common/rule_actions';

import { cleanKibana, deleteAlertsAndRules, deleteConnectors } from '../../tasks/common';
import type { RuleActionCustomFrequency } from '../../tasks/common/rule_actions';
import { cleanKibana, deleteAlertsAndRules, deleteConnectors } from '../../../../tasks/common';
import type { RuleActionCustomFrequency } from '../../../../tasks/common/rule_actions';
import {
addSlackRuleAction,
assertSlackRuleAction,
Expand All @@ -28,25 +28,25 @@ import {
pickCustomFrequencyOption,
pickPerRuleRunFrequencyOption,
pickSummaryOfAlertsOption,
} from '../../tasks/common/rule_actions';
} from '../../../../tasks/common/rule_actions';
import {
waitForRulesTableToBeLoaded,
selectNumberOfRules,
goToEditRuleActionsSettingsOf,
} from '../../tasks/alerts_detection_rules';
} from '../../../../tasks/alerts_detection_rules';
import {
waitForBulkEditActionToFinish,
submitBulkEditForm,
checkOverwriteRuleActionsCheckbox,
openBulkEditRuleActionsForm,
openBulkActionsMenu,
} from '../../tasks/rules_bulk_edit';
import { login, visitWithoutDateRange } from '../../tasks/login';
} from '../../../../tasks/rules_bulk_actions';
import { login, visitWithoutDateRange } from '../../../../tasks/login';

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

import { createRule } from '../../tasks/api_calls/rules';
import { createSlackConnector } from '../../tasks/api_calls/connectors';
import { createRule } from '../../../../tasks/api_calls/rules';
import { createSlackConnector } from '../../../../tasks/api_calls/connectors';

import {
getEqlRule,
Expand All @@ -55,8 +55,8 @@ import {
getNewThresholdRule,
getMachineLearningRule,
getNewTermsRule,
} from '../../objects/rule';
import { excessivelyInstallAllPrebuiltRules } from '../../tasks/api_calls/prebuilt_rules';
} from '../../../../objects/rule';
import { excessivelyInstallAllPrebuiltRules } from '../../../../tasks/api_calls/prebuilt_rules';

const ruleNameToAssert = 'Custom rule name with actions';
const expectedNumberOfCustomRulesToBeEdited = 7;
Expand Down
Expand Up @@ -8,16 +8,16 @@
import {
RULES_BULK_EDIT_DATA_VIEWS_WARNING,
RULES_BULK_EDIT_OVERWRITE_DATA_VIEW_CHECKBOX,
} from '../../screens/rules_bulk_edit';
} from '../../../../screens/rules_bulk_actions';

import { DATA_VIEW_DETAILS, INDEX_PATTERNS_DETAILS } from '../../screens/rule_details';
import { DATA_VIEW_DETAILS, INDEX_PATTERNS_DETAILS } from '../../../../screens/rule_details';

import {
waitForRulesTableToBeLoaded,
goToRuleDetails,
selectNumberOfRules,
goToTheRuleDetailsOf,
} from '../../tasks/alerts_detection_rules';
} from '../../../../tasks/alerts_detection_rules';

import {
typeIndexPatterns,
Expand All @@ -27,22 +27,26 @@ import {
checkOverwriteIndexPatternsCheckbox,
openBulkEditAddIndexPatternsForm,
openBulkEditDeleteIndexPatternsForm,
} from '../../tasks/rules_bulk_edit';
} from '../../../../tasks/rules_bulk_actions';

import { hasIndexPatterns, getDetails, assertDetailsNotExist } from '../../tasks/rule_details';
import { login, visitWithoutDateRange } from '../../tasks/login';
import {
hasIndexPatterns,
getDetails,
assertDetailsNotExist,
} from '../../../../tasks/rule_details';
import { login, visitWithoutDateRange } from '../../../../tasks/login';

import { SECURITY_DETECTIONS_RULES_URL } from '../../urls/navigation';
import { createRule } from '../../tasks/api_calls/rules';
import { cleanKibana, deleteAlertsAndRules, postDataView } from '../../tasks/common';
import { SECURITY_DETECTIONS_RULES_URL } from '../../../../urls/navigation';
import { createRule } from '../../../../tasks/api_calls/rules';
import { cleanKibana, deleteAlertsAndRules, postDataView } from '../../../../tasks/common';

import {
getEqlRule,
getNewThreatIndicatorRule,
getNewRule,
getNewThresholdRule,
getNewTermsRule,
} from '../../objects/rule';
} from '../../../../objects/rule';

const DATA_VIEW_ID = 'auditbeat';

Expand Down
Expand Up @@ -5,10 +5,6 @@
* 2.0.
*/

export const BULK_ACTIONS_BTN = '[data-test-subj="bulkActions"] span';

export const BULK_ACTIONS_PROGRESS_BTN = '[data-test-subj="bulkActions-progress"]';

export const CREATE_NEW_RULE_BTN = '[data-test-subj="create-new-rule"]';

export const COLLAPSED_ACTION_BTN = '[data-test-subj="euiCollapsedItemActionsButton"]';
Expand All @@ -30,14 +26,6 @@ export const DUPLICATE_RULE_ACTION_BTN = '[data-test-subj="duplicateRuleAction"]
export const DUPLICATE_RULE_MENU_PANEL_BTN = '[data-test-subj="rules-details-duplicate-rule"]';
export const CONFIRM_DUPLICATE_RULE = '[data-test-subj="confirmModalConfirmButton"]';

export const ENABLE_RULE_BULK_BTN = '[data-test-subj="enableRuleBulk"]';

export const DISABLE_RULE_BULK_BTN = '[data-test-subj="disableRuleBulk"]';

export const DELETE_RULE_BULK_BTN = '[data-test-subj="deleteRuleBulk"]';

export const DUPLICATE_RULE_BULK_BTN = '[data-test-subj="duplicateRuleBulk"]';

export const DUPLICATE_WITH_EXCEPTIONS_OPTION = '[data-test-subj="withExceptions"] label';

export const DUPLICATE_WITH_EXCEPTIONS_WITHOUT_EXPIRED_OPTION =
Expand All @@ -49,8 +37,6 @@ export const RULE_SEARCH_FIELD = '[data-test-subj="ruleSearchField"]';

export const EXPORT_ACTION_BTN = '[data-test-subj="exportRuleAction"]';

export const BULK_EXPORT_ACTION_BTN = '[data-test-subj="exportRuleBulk"]';

export const FIRST_RULE = 0;

export const FOURTH_RULE = 3;
Expand Down

0 comments on commit 7d75819

Please sign in to comment.