Skip to content

Commit

Permalink
[Security Solution] Unskip related integrations tests (#164933)
Browse files Browse the repository at this point in the history
**Fixes: #154663
**Fixes: #153684

## Summary

This PR unskips Cypress rule related integration tests ([related_integrations.cy.ts](https://github.com/elastic/kibana/blob/main/x-pack/test/security_solution_cypress/cypress/e2e/detection_response/rule_management/related_integrations/related_integrations.cy.ts)).

## Details

Testing approach has changed. Instead of importing a rule and installing agent and package policies via Fleet UI the rule is created by mocking a prebuilt rule asset and Fleet API is used to install required integrations. Along the way it required to add and update some testing selectors as UI had changed while the tests were skipped.

## Flaky test runner

[related_integrations.cy.ts (150 runs)](https://buildkite.com/elastic/kibana-flaky-test-suite-runner/builds/2995) 🟢
  • Loading branch information
maximpn authored Aug 31, 2023
1 parent 672f38f commit 2c3464c
Show file tree
Hide file tree
Showing 27 changed files with 549 additions and 246 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,7 @@ export const search = {
incremental: true,
placeholder: i18n.PLACEHOLDER,
schema: true,
'data-test-subj': 'search-input',
},
};

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -410,7 +410,7 @@ const RuleDetailsPageComponent: React.FC<DetectionEngineComponentProps> = ({
) : (
<RuleStatus status={lastExecutionStatus} date={lastExecutionDate}>
<EuiButtonIcon
data-test-subj="refreshButton"
data-test-subj="ruleLastExecutionStatusRefreshButton"
color="primary"
onClick={refreshRule}
iconType="refresh"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -106,11 +106,10 @@ import {
goToScheduleStepTab,
importSavedQuery,
waitForAlertsToPopulate,
waitForTheRuleToBeExecuted,
} from '../../../tasks/create_new_rule';
import { saveEditedRule } from '../../../tasks/edit_rule';
import { login, visit, visitSecurityDetectionRulesPage } from '../../../tasks/login';
import { enablesRule, getDetails } from '../../../tasks/rule_details';
import { enablesRule, getDetails, waitForTheRuleToBeExecuted } from '../../../tasks/rule_details';

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

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -60,11 +60,10 @@ import {
fillDefineCustomRuleAndContinue,
fillScheduleRuleAndContinue,
waitForAlertsToPopulate,
waitForTheRuleToBeExecuted,
} from '../../../tasks/create_new_rule';

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

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

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,7 @@ import {
TIMELINE_TEMPLATE_DETAILS,
} from '../../../screens/rule_details';

import { getDetails } from '../../../tasks/rule_details';
import { getDetails, waitForTheRuleToBeExecuted } from '../../../tasks/rule_details';
import {
expectNumberOfRules,
goToRuleDetails,
Expand All @@ -55,7 +55,6 @@ import {
fillScheduleRuleAndContinue,
selectEqlRuleType,
waitForAlertsToPopulate,
waitForTheRuleToBeExecuted,
} from '../../../tasks/create_new_rule';
import { login, visit } from '../../../tasks/login';

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -92,7 +92,6 @@ import {
getIndicatorOrButton,
selectIndicatorMatchType,
waitForAlertsToPopulate,
waitForTheRuleToBeExecuted,
} from '../../../tasks/create_new_rule';
import {
SCHEDULE_INTERVAL_AMOUNT_INPUT,
Expand All @@ -102,7 +101,11 @@ import {
} from '../../../screens/create_new_rule';
import { goBackToRuleDetails } from '../../../tasks/edit_rule';
import { login, visit, visitWithoutDateRange } from '../../../tasks/login';
import { goBackToRulesTable, getDetails } from '../../../tasks/rule_details';
import {
goBackToRulesTable,
getDetails,
waitForTheRuleToBeExecuted,
} from '../../../tasks/rule_details';

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

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,7 @@ import {
NEW_TERMS_FIELDS_DETAILS,
} from '../../../screens/rule_details';

import { getDetails } from '../../../tasks/rule_details';
import { getDetails, waitForTheRuleToBeExecuted } from '../../../tasks/rule_details';
import { expectNumberOfRules, goToRuleDetails } from '../../../tasks/alerts_detection_rules';
import { cleanKibana, deleteAlertsAndRules } from '../../../tasks/common';
import {
Expand All @@ -53,7 +53,6 @@ import {
fillScheduleRuleAndContinue,
selectNewTermsRuleType,
waitForAlertsToPopulate,
waitForTheRuleToBeExecuted,
} from '../../../tasks/create_new_rule';
import { login, visit } from '../../../tasks/login';

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -48,16 +48,16 @@ import {
} from '../../../screens/rule_details';

import { expectNumberOfRules, goToRuleDetails } from '../../../tasks/alerts_detection_rules';
import { deleteAlertsAndRules } from '../../../tasks/common';
import {
createAndEnableRule,
fillAboutRuleWithOverrideAndContinue,
fillDefineCustomRuleAndContinue,
fillScheduleRuleAndContinue,
waitForAlertsToPopulate,
waitForTheRuleToBeExecuted,
} from '../../../tasks/create_new_rule';
import { login, visitWithoutDateRange } from '../../../tasks/login';
import { getDetails } from '../../../tasks/rule_details';
import { getDetails, waitForTheRuleToBeExecuted } from '../../../tasks/rule_details';

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

Expand All @@ -71,6 +71,7 @@ describe('Detection rules, override', { tags: ['@ess', '@brokenInServerless'] },

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

it('Creates and enables a new custom rule with override option', function () {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,7 @@ import {
TIMELINE_TEMPLATE_DETAILS,
} from '../../../screens/rule_details';

import { getDetails } from '../../../tasks/rule_details';
import { getDetails, waitForTheRuleToBeExecuted } from '../../../tasks/rule_details';
import { expectNumberOfRules, goToRuleDetails } from '../../../tasks/alerts_detection_rules';
import { cleanKibana, deleteAlertsAndRules } from '../../../tasks/common';
import {
Expand All @@ -53,7 +53,6 @@ import {
fillScheduleRuleAndContinue,
selectThresholdRuleType,
waitForAlertsToPopulate,
waitForTheRuleToBeExecuted,
} from '../../../tasks/create_new_rule';
import { login, visitWithoutDateRange } from '../../../tasks/login';

Expand Down
Loading

0 comments on commit 2c3464c

Please sign in to comment.