Skip to content

Commit

Permalink
[Security Solutions] Flaky entity analytics cypress (elastic#162963)
Browse files Browse the repository at this point in the history
Original issue: elastic#161874

## Summary

Flaky entity analytics cypress test

Based on my analysis, it seems likely that the issue was caused by some
tests failing to close the filter after opening it. This could have had
an impact on the subsequent tests.
After the change, I could run the test successfully more than 60 times.
Here is a print from some of these runs: 
<img width="587" alt="Screenshot 2023-08-04 at 13 58 55"
src="https:/elastic/kibana/assets/1490444/02367810-3616-4fa2-a82e-48c19e6ac4b6">
  • Loading branch information
machadoum authored and bryce-b committed Aug 9, 2023
1 parent 8d081eb commit d2952db
Show file tree
Hide file tree
Showing 3 changed files with 10 additions and 9 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@ import {
} from '../../../screens/entity_analytics';
import {
openRiskTableFilterAndSelectTheLowOption,
removeLowFilter,
removeLowFilterAndCloseRiskTableFilter,
} from '../../../tasks/host_risk';
import { createRule } from '../../../tasks/api_calls/rules';
import { waitForAlertsToPopulate } from '../../../tasks/create_new_rule';
Expand Down Expand Up @@ -152,14 +152,13 @@ describe('Entity Analytics Dashboard', () => {
cy.get(HOSTS_TABLE_ALERT_CELL).should('have.length', 5);
});

// tracked by https:/elastic/kibana/issues/161874
it.skip('filters by risk classification', () => {
it('filters by risk classification', () => {
openRiskTableFilterAndSelectTheLowOption();

cy.get(HOSTS_DONUT_CHART).should('include.text', '1Total');
cy.get(HOSTS_TABLE_ROWS).should('have.length', 1);

removeLowFilter();
removeLowFilterAndCloseRiskTableFilter();
});

it('filters the host risk table with KQL search bar query', () => {
Expand Down Expand Up @@ -247,7 +246,7 @@ describe('Entity Analytics Dashboard', () => {
cy.get(USERS_DONUT_CHART).should('include.text', '2Total');
cy.get(USERS_TABLE_ROWS).should('have.length', 2);

removeLowFilter();
removeLowFilterAndCloseRiskTableFilter();
});

it('filters the host risk table with KQL search bar query', () => {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ import { cleanKibana } from '../../../tasks/common';
import {
navigateToHostRiskDetailTab,
openRiskTableFilterAndSelectTheCriticalOption,
removeCriticalFilter,
removeCriticalFilterAndCloseRiskTableFilter,
selectFiveItemsPerPageOption,
} from '../../../tasks/host_risk';
import {
Expand Down Expand Up @@ -50,7 +50,7 @@ describe('risk tab', () => {

cy.get(HOST_BY_RISK_TABLE_CELL).eq(3).should('not.have.text', 'siem-kibana');

removeCriticalFilter();
removeCriticalFilterAndCloseRiskTableFilter();
});

it('should be able to change items count per page', () => {
Expand Down
6 changes: 4 additions & 2 deletions x-pack/plugins/security_solution/cypress/tasks/host_risk.ts
Original file line number Diff line number Diff line change
Expand Up @@ -30,12 +30,14 @@ export const openRiskTableFilterAndSelectTheLowOption = () => {
cy.get(HOST_BY_RISK_TABLE_FILTER_LOW).click();
};

export const removeLowFilter = () => {
export const removeLowFilterAndCloseRiskTableFilter = () => {
cy.get(HOST_BY_RISK_TABLE_FILTER_LOW).click();
cy.get(HOST_BY_RISK_TABLE_FILTER).first().click();
};

export const removeCriticalFilter = () => {
export const removeCriticalFilterAndCloseRiskTableFilter = () => {
cy.get(HOST_BY_RISK_TABLE_FILTER_CRITICAL).click();
cy.get(HOST_BY_RISK_TABLE_FILTER).first().click();
};

export const selectFiveItemsPerPageOption = () => {
Expand Down

0 comments on commit d2952db

Please sign in to comment.