Skip to content

Commit

Permalink
[Security Solution][Detections]Fixes Rule Management Cypress Tests (#…
Browse files Browse the repository at this point in the history
…96505) (#96521)

## Summary
Fixes two cypress tests:

> Deleting prebuilt rules "before each" hook for "Does not allow to delete one rule when more than one is selected"
#68607

This one is more of a drive around the pot-hole fix as we were waiting for the Alerts Table to load when we really didn't need to. Removed unnecessary check.
<p align="center">
  <img width="500" src="https://user-images.githubusercontent.com/2946766/113932347-b9ab9480-97b0-11eb-8e07-5f3e0c4b6c78.png" />
</p>

> Alerts rules, prebuilt rules Loads prebuilt rules
#71300

This one was fixed with a `.pipe()` and `.should('not.be.visible')` to ensure the click was successful. Also removed unnecessary check on the Alerts Table loading that was present here as well too..
<p align="center">
  <img width="500" src="https://user-images.githubusercontent.com/2946766/113932285-ac8ea580-97b0-11eb-90e1-618c510d33a7.png" />
</p>

Co-authored-by: Garrett Spong <spong@users.noreply.github.com>
  • Loading branch information
kibanamachine and spong authored Apr 8, 2021
1 parent f06be93 commit 6af5828
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 8 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -14,11 +14,7 @@ import {
SHOWING_RULES_TEXT,
} from '../../screens/alerts_detection_rules';

import {
goToManageAlertsDetectionRules,
waitForAlertsIndexToBeCreated,
waitForAlertsPanelToBeLoaded,
} from '../../tasks/alerts';
import { goToManageAlertsDetectionRules, waitForAlertsIndexToBeCreated } from '../../tasks/alerts';
import {
changeRowsPerPageTo300,
deleteFirstRule,
Expand Down Expand Up @@ -47,7 +43,6 @@ describe('Alerts rules, prebuilt rules', () => {
const expectedElasticRulesBtnText = `Elastic rules (${expectedNumberOfRules})`;

loginAndWaitForPageWithoutDateRange(DETECTIONS_URL);
waitForAlertsPanelToBeLoaded();
waitForAlertsIndexToBeCreated();
goToManageAlertsDetectionRules();
waitForRulesTableToBeLoaded();
Expand Down Expand Up @@ -79,7 +74,6 @@ describe('Deleting prebuilt rules', () => {

cleanKibana();
loginAndWaitForPageWithoutDateRange(DETECTIONS_URL);
waitForAlertsPanelToBeLoaded();
waitForAlertsIndexToBeCreated();
goToManageAlertsDetectionRules();
waitForRulesTableToBeLoaded();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -191,7 +191,10 @@ export const resetAllRulesIdleModalTimeout = () => {

export const changeRowsPerPageTo = (rowsCount: number) => {
cy.get(PAGINATION_POPOVER_BTN).click({ force: true });
cy.get(rowsPerPageSelector(rowsCount)).click();
cy.get(rowsPerPageSelector(rowsCount))
.pipe(($el) => $el.trigger('click'))
.should('not.be.visible');

waitForRulesTableToBeRefreshed();
};

Expand Down

0 comments on commit 6af5828

Please sign in to comment.