Skip to content

Commit

Permalink
remove force: true in detection rules tests
Browse files Browse the repository at this point in the history
  • Loading branch information
maximpn committed May 26, 2023
1 parent bb495c2 commit 24d3798
Showing 1 changed file with 22 additions and 24 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -77,19 +77,19 @@ import { goToRuleEditSettings } from './rule_details';
import { goToActionsStepTab } from './create_new_rule';

export const enableRule = (rulePosition: number) => {
cy.get(RULE_SWITCH).eq(rulePosition).click({ force: true });
cy.get(RULE_SWITCH).eq(rulePosition).click();
};

export const editFirstRule = () => {
cy.get(COLLAPSED_ACTION_BTN).should('be.visible');
cy.get(COLLAPSED_ACTION_BTN).first().click({ force: true });
cy.get(COLLAPSED_ACTION_BTN).first().click();
cy.get(EDIT_RULE_ACTION_BTN).should('be.visible');
cy.get(EDIT_RULE_ACTION_BTN).click();
};

export const duplicateFirstRule = () => {
cy.get(COLLAPSED_ACTION_BTN).should('be.visible');
cy.get(COLLAPSED_ACTION_BTN).first().click({ force: true });
cy.get(COLLAPSED_ACTION_BTN).first().click();
cy.get(DUPLICATE_RULE_ACTION_BTN).should('be.visible');
cy.get(DUPLICATE_RULE_ACTION_BTN).click();
cy.get(CONFIRM_DUPLICATE_RULE).click();
Expand All @@ -102,7 +102,7 @@ export const duplicateFirstRule = () => {
* flake.
*/
export const duplicateRuleFromMenu = () => {
const click = ($el: Cypress.ObjectLike) => cy.wrap($el).click({ force: true });
const click = ($el: Cypress.ObjectLike) => cy.wrap($el).click();
cy.get(LOADING_INDICATOR).should('not.exist');
cy.get(ALL_ACTIONS).pipe(click);
cy.get(DUPLICATE_RULE_MENU_PANEL_BTN).should('be.visible');
Expand All @@ -124,12 +124,12 @@ export const checkDuplicatedRule = () => {
};

export const deleteFirstRule = () => {
cy.get(COLLAPSED_ACTION_BTN).first().click({ force: true });
cy.get(COLLAPSED_ACTION_BTN).first().click();
cy.get(DELETE_RULE_ACTION_BTN).click();
};

export const deleteSelectedRules = () => {
cy.get(BULK_ACTIONS_BTN).click({ force: true });
cy.get(BULK_ACTIONS_BTN).click();
cy.get(DELETE_RULE_BULK_BTN).click();
};

Expand All @@ -150,37 +150,37 @@ export const deleteRuleFromDetailsPage = () => {

export const duplicateSelectedRulesWithoutExceptions = () => {
cy.log('Duplicate selected rules');
cy.get(BULK_ACTIONS_BTN).click({ force: true });
cy.get(BULK_ACTIONS_BTN).click();
cy.get(DUPLICATE_RULE_BULK_BTN).click();
cy.get(DUPLICATE_WITHOUT_EXCEPTIONS_OPTION).click();
cy.get(CONFIRM_DUPLICATE_RULE).click();
};

export const duplicateSelectedRulesWithExceptions = () => {
cy.log('Duplicate selected rules');
cy.get(BULK_ACTIONS_BTN).click({ force: true });
cy.get(BULK_ACTIONS_BTN).click();
cy.get(DUPLICATE_RULE_BULK_BTN).click();
cy.get(DUPLICATE_WITH_EXCEPTIONS_OPTION).click();
cy.get(CONFIRM_DUPLICATE_RULE).click();
};

export const duplicateSelectedRulesWithNonExpiredExceptions = () => {
cy.log('Duplicate selected rules');
cy.get(BULK_ACTIONS_BTN).click({ force: true });
cy.get(BULK_ACTIONS_BTN).click();
cy.get(DUPLICATE_RULE_BULK_BTN).click();
cy.get(DUPLICATE_WITH_EXCEPTIONS_WITHOUT_EXPIRED_OPTION).click();
cy.get(CONFIRM_DUPLICATE_RULE).click();
};

export const enableSelectedRules = () => {
cy.log('Enable selected rules');
cy.get(BULK_ACTIONS_BTN).click({ force: true });
cy.get(BULK_ACTIONS_BTN).click();
cy.get(ENABLE_RULE_BULK_BTN).click();
};

export const disableSelectedRules = () => {
cy.log('Disable selected rules');
cy.get(BULK_ACTIONS_BTN).click({ force: true });
cy.get(BULK_ACTIONS_BTN).click();
cy.get(DISABLE_RULE_BULK_BTN).click();
};

Expand All @@ -194,9 +194,7 @@ export const exportRule = (name: string) => {

export const filterBySearchTerm = (term: string) => {
cy.log(`Filter rules by search term: "${term}"`);
cy.get(RULE_SEARCH_FIELD)
.type(term, { force: true })
.trigger('search', { waitForAnimations: true });
cy.get(RULE_SEARCH_FIELD).type(term).trigger('search');
};

export const filterByTags = (tags: string[]) => {
Expand Down Expand Up @@ -226,23 +224,23 @@ export const filterByElasticRules = () => {
};

export const filterByCustomRules = () => {
cy.get(CUSTOM_RULES_BTN).click({ force: true });
cy.get(CUSTOM_RULES_BTN).click();
};

export const filterByEnabledRules = () => {
cy.get(ENABLED_RULES_BTN).click({ force: true });
cy.get(ENABLED_RULES_BTN).click();
};

export const filterByDisabledRules = () => {
cy.get(DISABLED_RULES_BTN).click({ force: true });
cy.get(DISABLED_RULES_BTN).click();
};

export const goToRuleDetails = () => {
cy.get(RULE_NAME).first().click({ force: true });
cy.get(RULE_NAME).first().click();
};

export const goToTheRuleDetailsOf = (ruleName: string) => {
cy.contains(RULE_NAME, ruleName).click({ force: true });
cy.contains(RULE_NAME, ruleName).click();
};

export const loadPrebuiltDetectionRules = () => {
Expand All @@ -268,7 +266,7 @@ export const openIntegrationsPopover = () => {
};

export const reloadDeletedRules = () => {
cy.get(LOAD_PREBUILT_RULES_ON_PAGE_HEADER_BTN).click({ force: true });
cy.get(LOAD_PREBUILT_RULES_ON_PAGE_HEADER_BTN).click();
};

/**
Expand Down Expand Up @@ -395,8 +393,8 @@ export const checkAutoRefresh = (ms: number, condition: string) => {
export const importRules = (rulesFile: string) => {
cy.get(RULE_IMPORT_MODAL).click();
cy.get(INPUT_FILE).should('exist');
cy.get(INPUT_FILE).trigger('click', { force: true }).selectFile(rulesFile).trigger('change');
cy.get(RULE_IMPORT_MODAL_BUTTON).last().click({ force: true });
cy.get(INPUT_FILE).trigger('click').selectFile(rulesFile).trigger('change');
cy.get(RULE_IMPORT_MODAL_BUTTON).last().click();
cy.get(INPUT_FILE).should('not.exist');
};

Expand Down Expand Up @@ -513,11 +511,11 @@ const selectOverwriteConnectorsRulesImport = () => {
export const importRulesWithOverwriteAll = (rulesFile: string) => {
cy.get(RULE_IMPORT_MODAL).click();
cy.get(INPUT_FILE).should('exist');
cy.get(INPUT_FILE).trigger('click', { force: true }).selectFile(rulesFile).trigger('change');
cy.get(INPUT_FILE).trigger('click').selectFile(rulesFile).trigger('change');
selectOverwriteRulesImport();
selectOverwriteExceptionsRulesImport();
selectOverwriteConnectorsRulesImport();
cy.get(RULE_IMPORT_MODAL_BUTTON).last().click({ force: true });
cy.get(RULE_IMPORT_MODAL_BUTTON).last().click();
cy.get(INPUT_FILE).should('not.exist');
};

Expand Down

0 comments on commit 24d3798

Please sign in to comment.