Skip to content

Commit

Permalink
Please code review
Browse files Browse the repository at this point in the history
  • Loading branch information
machadoum committed Mar 7, 2022
1 parent 2927134 commit e98197e
Show file tree
Hide file tree
Showing 2 changed files with 30 additions and 12 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -7,14 +7,15 @@

import { cleanKibana } from '../../tasks/common';
import { esArchiverLoad, esArchiverUnload } from '../../tasks/es_archiver';
import { navigateToHostRiskDetailTab } from '../../tasks/host_risk';
import {
navigateToHostRiskDetailTab,
openRiskTableFilterAndSelectTheCriticalOption,
removeCritialFilter,
selectFiveItemsPerPageOption,
} from '../../tasks/host_risk';
import {
HOST_BY_RISK_TABLE_CELL,
HOST_BY_RISK_TABLE_FILTER,
HOST_BY_RISK_TABLE_FILTER_CRITICAL,
HOST_BY_RISK_TABLE_HOSTNAME_CELL,
HOST_BY_RISK_TABLE_PERPAGE_BUTTON,
HOST_BY_RISK_TABLE_PERPAGE_OPTIONS,
HOST_BY_RISK_TABLE_NEXT_PAGE_BUTTON,
} from '../../screens/hosts/host_risk';
import { loginAndWaitForPage } from '../../tasks/login';
Expand Down Expand Up @@ -42,18 +43,15 @@ describe('risk tab', () => {
});

it('filters the table', () => {
cy.get(HOST_BY_RISK_TABLE_FILTER).click();
cy.get(HOST_BY_RISK_TABLE_FILTER_CRITICAL).click();
openRiskTableFilterAndSelectTheCriticalOption();

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

// remove filter
cy.get(HOST_BY_RISK_TABLE_FILTER_CRITICAL).click();
removeCritialFilter();
});

it('should be able to change items count per page', () => {
cy.get(HOST_BY_RISK_TABLE_PERPAGE_BUTTON).click();
cy.get(HOST_BY_RISK_TABLE_PERPAGE_OPTIONS).first().click();
selectFiveItemsPerPageOption();

cy.get(HOST_BY_RISK_TABLE_HOSTNAME_CELL).should('have.length', 5);
});
Expand Down
22 changes: 21 additions & 1 deletion x-pack/plugins/security_solution/cypress/tasks/host_risk.ts
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,15 @@
* 2.0.
*/

import { LOADING_TABLE, RISK_DETAILS_NAV, RISK_FLYOUT_TRIGGER } from '../screens/hosts/host_risk';
import {
HOST_BY_RISK_TABLE_FILTER,
HOST_BY_RISK_TABLE_FILTER_CRITICAL,
HOST_BY_RISK_TABLE_PERPAGE_BUTTON,
HOST_BY_RISK_TABLE_PERPAGE_OPTIONS,
LOADING_TABLE,
RISK_DETAILS_NAV,
RISK_FLYOUT_TRIGGER,
} from '../screens/hosts/host_risk';

export const navigateToHostRiskDetailTab = () => cy.get(RISK_DETAILS_NAV).click();

Expand All @@ -15,3 +23,15 @@ export const waitForTableToLoad = () => {
cy.get(LOADING_TABLE).should('exist');
cy.get(LOADING_TABLE).should('not.exist');
};

export const openRiskTableFilterAndSelectTheCriticalOption = () => {
cy.get(HOST_BY_RISK_TABLE_FILTER).click();
cy.get(HOST_BY_RISK_TABLE_FILTER_CRITICAL).click();
};
export const removeCritialFilter = () => {
cy.get(HOST_BY_RISK_TABLE_FILTER_CRITICAL).click();
};
export const selectFiveItemsPerPageOption = () => {
cy.get(HOST_BY_RISK_TABLE_PERPAGE_BUTTON).click();
cy.get(HOST_BY_RISK_TABLE_PERPAGE_OPTIONS).first().click();
};

0 comments on commit e98197e

Please sign in to comment.