Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[Security Solutions] Display additional anomaly jobs in Entity Analytics Dashboard #155520

Merged
merged 4 commits into from
Apr 25, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -28,13 +28,18 @@ import {
USERS_TABLE_ALERT_CELL,
HOSTS_TABLE_ALERT_CELL,
HOSTS_TABLE,
ANOMALIES_TABLE_NEXT_PAGE_BUTTON,
ANOMALIES_TABLE_ENABLE_JOB_BUTTON,
ANOMALIES_TABLE_ENABLE_JOB_LOADER,
ANOMALIES_TABLE_COUNT_COLUMN,
} from '../../screens/entity_analytics';
import { openRiskTableFilterAndSelectTheLowOption } from '../../tasks/host_risk';
import { createRule } from '../../tasks/api_calls/rules';
import { waitForAlertsToPopulate } from '../../tasks/create_new_rule';
import { getNewRule } from '../../objects/rule';
import { clickOnFirstHostsAlerts, clickOnFirstUsersAlerts } from '../../tasks/risk_scores';
import { OPTION_LIST_LABELS, OPTION_LIST_VALUES } from '../../screens/common/filter_group';
import { setRowsPerPageTo } from '../../tasks/table_pagination';

const TEST_USER_ALERTS = 2;
const TEST_USER_NAME = 'test';
Expand Down Expand Up @@ -239,13 +244,39 @@ describe('Entity Analytics Dashboard', () => {
});

describe('With anomalies data', () => {
before(() => {
esArchiverLoad('network');
});

after(() => {
esArchiverUnload('network');
});

beforeEach(() => {
visit(ENTITY_ANALYTICS_URL);
});

it('renders table', () => {
it('renders table with pagination', () => {
cy.get(ANOMALIES_TABLE).should('be.visible');
cy.get(ANOMALIES_TABLE_ROWS).should('have.length', 6);
cy.get(ANOMALIES_TABLE_ROWS).should('have.length', 10);

// navigates to next page
cy.get(ANOMALIES_TABLE_NEXT_PAGE_BUTTON).click();
cy.get(ANOMALIES_TABLE_ROWS).should('have.length', 10);

// updates rows per page to 25 items
setRowsPerPageTo(25);
cy.get(ANOMALIES_TABLE_ROWS).should('have.length', 25);
});

it('enables a job', () => {
cy.get(ANOMALIES_TABLE_ROWS)
.eq(5)
.within(() => {
cy.get(ANOMALIES_TABLE_ENABLE_JOB_BUTTON).click();
cy.get(ANOMALIES_TABLE_ENABLE_JOB_LOADER).should('be.visible');
cy.get(ANOMALIES_TABLE_COUNT_COLUMN).should('include.text', '0');
});
});
});
});
Original file line number Diff line number Diff line change
Expand Up @@ -47,6 +47,15 @@ export const ANOMALIES_TABLE =

export const ANOMALIES_TABLE_ROWS = '[data-test-subj="entity_analytics_anomalies"] .euiTableRow';

export const ANOMALIES_TABLE_ENABLE_JOB_BUTTON = '[data-test-subj="enable-job"]';

export const ANOMALIES_TABLE_ENABLE_JOB_LOADER = '[data-test-subj="job-switch-loader"]';

export const ANOMALIES_TABLE_COUNT_COLUMN = '[data-test-subj="anomalies-table-column-count"]';

export const ANOMALIES_TABLE_NEXT_PAGE_BUTTON =
'[data-test-subj="entity_analytics_anomalies"] [data-test-subj="pagination-button-next"]';

export const UPGRADE_CONFIRMATION_MODAL = (riskScoreEntity: RiskScoreEntity) =>
`[data-test-subj="${riskScoreEntity}-risk-score-upgrade-confirmation-modal"]`;

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -162,14 +162,9 @@ describe('useNotableAnomaliesSearch', () => {
await waitForNextUpdate();

const names = result.current.data.map(({ name }) => name);
expect(names).toEqual([
firstJobSecurityName,
secondJobSecurityName,
'packetbeat_dns_tunneling',
'packetbeat_rare_dns_question',
'packetbeat_rare_server_domain',
'suspicious_login_activity',
]);

expect(names[0]).toEqual(firstJobSecurityName);
expect(names[1]).toEqual(secondJobSecurityName);
});
});

Expand Down
Loading