Skip to content

Commit

Permalink
Fix flaky entity analytics cypress test
Browse files Browse the repository at this point in the history
  • Loading branch information
machadoum committed Aug 4, 2023
1 parent f2d4120 commit b269627
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://github.com/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 b269627

Please sign in to comment.