Skip to content

Commit

Permalink
[Security Solution] Unskipping `x-pack/test/security_solution_cypress…
Browse files Browse the repository at this point in the history
…/cypress/e2e/explore/dashboards/` working tests on serverless (elastic#167916)

(cherry picked from commit 3c4a597)
  • Loading branch information
MadameSheema committed Oct 16, 2023
1 parent c275374 commit aa8b58d
Show file tree
Hide file tree
Showing 9 changed files with 30 additions and 94 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -20,34 +20,30 @@ import { ENTITY_ANALYTICS_URL } from '../../../urls/navigation';
import { PAGE_TITLE } from '../../../screens/entity_analytics_management';

// FLAKY: https://github.com/elastic/kibana/issues/165644
describe(
'Enable risk scores from dashboard',
{ tags: ['@ess', '@serverless', '@brokenInServerless'] },
() => {
before(() => {
cleanKibana();
login();
});
describe('Enable risk scores from dashboard', { tags: ['@ess', '@serverless'] }, () => {
before(() => {
cleanKibana();
login();
});

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

it('host risk enable button should redirect to entity management page', () => {
cy.get(ENABLE_HOST_RISK_SCORE_BUTTON).should('exist');
it('host risk enable button should redirect to entity management page', () => {
cy.get(ENABLE_HOST_RISK_SCORE_BUTTON).should('exist');

clickEnableRiskScore(RiskScoreEntity.host);
clickEnableRiskScore(RiskScoreEntity.host);

cy.get(PAGE_TITLE).should('have.text', 'Entity Risk Score');
});
cy.get(PAGE_TITLE).should('have.text', 'Entity Risk Score');
});

it('user risk enable button should redirect to entity management page', () => {
cy.get(ENABLE_USER_RISK_SCORE_BUTTON).should('exist');
it('user risk enable button should redirect to entity management page', () => {
cy.get(ENABLE_USER_RISK_SCORE_BUTTON).should('exist');

clickEnableRiskScore(RiskScoreEntity.user);
clickEnableRiskScore(RiskScoreEntity.user);

cy.get(PAGE_TITLE).should('have.text', 'Entity Risk Score');
});
}
);
cy.get(PAGE_TITLE).should('have.text', 'Entity Risk Score');
});
});
Original file line number Diff line number Diff line change
Expand Up @@ -46,8 +46,8 @@ 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';
import { clearSearchBar, kqlSearch } from '../../../tasks/security_header';
import { setEndDate, setEndDateNow, updateDates } from '../../../tasks/date_picker';
import { kqlSearch } from '../../../tasks/security_header';
import { setEndDate, updateDates } from '../../../tasks/date_picker';
import {
enableJob,
navigateToNextPage,
Expand All @@ -62,7 +62,7 @@ const SIEM_KIBANA_HOST_ALERTS = 2;
const SIEM_KIBANA_HOST_NAME = 'siem-kibana';
const END_DATE = 'Jan 19, 2019 @ 20:33:29.186';

describe('Entity Analytics Dashboard', { tags: ['@ess', '@brokenInServerless'] }, () => {
describe('Entity Analytics Dashboard', { tags: ['@ess', '@serverless'] }, () => {
before(() => {
cleanKibana();
login();
Expand Down Expand Up @@ -176,8 +176,6 @@ describe('Entity Analytics Dashboard', { tags: ['@ess', '@brokenInServerless'] }

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

clearSearchBar();
});

describe('With alerts data', () => {
Expand Down Expand Up @@ -205,10 +203,6 @@ describe('Entity Analytics Dashboard', { tags: ['@ess', '@brokenInServerless'] }
updateDates();

cy.get(HOSTS_TABLE_ALERT_CELL).first().should('include.text', 0);

// CLEAR DATES
setEndDateNow();
updateDates();
});

it('opens alerts page when alerts count is clicked', () => {
Expand Down Expand Up @@ -264,8 +258,6 @@ describe('Entity Analytics Dashboard', { tags: ['@ess', '@brokenInServerless'] }

cy.get(USERS_DONUT_CHART).should('include.text', '1Total');
cy.get(USERS_TABLE_ROWS).should('have.length', 1);

clearSearchBar();
});

describe('With alerts data', () => {
Expand Down Expand Up @@ -293,10 +285,6 @@ describe('Entity Analytics Dashboard', { tags: ['@ess', '@brokenInServerless'] }
updateDates();

cy.get(USERS_TABLE_ALERT_CELL).first().should('include.text', 0);

// CLEAR DATES
setEndDateNow();
updateDates();
});

it('opens alerts page when alerts count is clicked', () => {
Expand Down Expand Up @@ -397,8 +385,6 @@ describe('Entity Analytics Dashboard', { tags: ['@ess', '@brokenInServerless'] }

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

clearSearchBar();
});

describe('With alerts data', () => {
Expand Down Expand Up @@ -426,10 +412,6 @@ describe('Entity Analytics Dashboard', { tags: ['@ess', '@brokenInServerless'] }
updateDates();

cy.get(HOSTS_TABLE_ALERT_CELL).first().should('include.text', 0);

// CLEAR DATES
setEndDateNow();
updateDates();
});

it('opens alerts page when alerts count is clicked', () => {
Expand Down Expand Up @@ -490,8 +472,6 @@ describe('Entity Analytics Dashboard', { tags: ['@ess', '@brokenInServerless'] }

cy.get(USERS_DONUT_CHART).should('include.text', '1Total');
cy.get(USERS_TABLE_ROWS).should('have.length', 1);

clearSearchBar();
});

describe('With alerts data', () => {
Expand Down Expand Up @@ -519,10 +499,6 @@ describe('Entity Analytics Dashboard', { tags: ['@ess', '@brokenInServerless'] }
updateDates();

cy.get(USERS_TABLE_ALERT_CELL).first().should('include.text', 0);

// CLEAR DATES
setEndDateNow();
updateDates();
});

it('opens alerts page when alerts count is clicked', () => {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ import { PAYWALL_DESCRIPTION } from '../../../screens/entity_analytics_serverles
describe(
'Entity Analytics Dashboard in Serverless',
{
tags: ['@serverless', '@brokenInServerless'],
tags: ['@serverless'],
env: {
ftrConfig: {
productTypes: [
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -36,8 +36,7 @@ import { deleteRiskEngineConfiguration } from '../../../tasks/api_calls/risk_eng

const spaceId = 'default';

// Flaky on serverless
describe('Upgrade risk scores', { tags: ['@ess', '@serverless', '@brokenInServerless'] }, () => {
describe('Upgrade risk scores', { tags: ['@ess', '@serverless'] }, () => {
before(() => {
cleanKibana();
login();
Expand Down Expand Up @@ -72,18 +71,15 @@ describe('Upgrade risk scores', { tags: ['@ess', '@serverless', '@brokenInServer
});

describe('upgrade risk engine', () => {
before(() => {
beforeEach(() => {
cy.task('esArchiverLoad', { archiveName: 'risk_hosts' });
cy.task('esArchiverLoad', { archiveName: 'risk_users' });
});

beforeEach(() => {
login();
installRiskScoreModule();
visitWithTimeRange(ENTITY_ANALYTICS_URL);
});

after(() => {
afterEach(() => {
cy.task('esArchiverUnload', 'risk_hosts');
cy.task('esArchiverUnload', 'risk_users');
deleteRiskScore({ riskScoreEntity: RiskScoreEntity.host, spaceId });
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -31,9 +31,9 @@ export const setEndDateNow = (container: string = GLOBAL_FILTERS_CONTAINER) => {
export const setEndDate = (date: string, container: string = GLOBAL_FILTERS_CONTAINER) => {
cy.get(GET_LOCAL_DATE_PICKER_END_DATE_POPOVER_BUTTON(container)).first().click();

cy.get(DATE_PICKER_ABSOLUTE_TAB).first().click();
cy.get(DATE_PICKER_ABSOLUTE_TAB).first().click({ force: true });

cy.get(DATE_PICKER_ABSOLUTE_INPUT).click();
cy.get(DATE_PICKER_ABSOLUTE_INPUT).click({ force: true });
cy.get(DATE_PICKER_ABSOLUTE_INPUT).then(($el) => {
if (Cypress.dom.isAttached($el)) {
cy.wrap($el).click({ force: true });
Expand All @@ -57,7 +57,7 @@ export const setStartDate = (date: string, container: string = GLOBAL_FILTERS_CO
};

export const updateDates = (container: string = GLOBAL_FILTERS_CONTAINER) => {
cy.get(GET_DATE_PICKER_APPLY_BUTTON(container)).click();
cy.get(GET_DATE_PICKER_APPLY_BUTTON(container)).click({ force: true });
cy.get(GET_DATE_PICKER_APPLY_BUTTON(container)).should('not.have.text', 'Updating');
};

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -31,10 +31,6 @@
},
"settings": {
"index": {
"lifecycle": {
"name": "ml_host_risk_score_latest_default",
"rollover_alias": "ml_host_risk_score_latest_default"
},
"mapping": {
"total_fields": {
"limit": "10000"
Expand Down Expand Up @@ -83,10 +79,6 @@
},
"settings": {
"index": {
"lifecycle": {
"name": "ml_host_risk_score_default",
"rollover_alias": "ml_host_risk_score_default"
},
"mapping": {
"total_fields": {
"limit": "10000"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -31,10 +31,6 @@
},
"settings": {
"index": {
"lifecycle": {
"name": "ml_host_risk_score_latest_default",
"rollover_alias": "ml_host_risk_score_latest_default"
},
"mapping": {
"total_fields": {
"limit": "10000"
Expand Down Expand Up @@ -83,10 +79,6 @@
},
"settings": {
"index": {
"lifecycle": {
"name": "ml_host_risk_score_default",
"rollover_alias": "ml_host_risk_score_default"
},
"mapping": {
"total_fields": {
"limit": "10000"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -31,10 +31,6 @@
},
"settings": {
"index": {
"lifecycle": {
"name": "ml_user_risk_score_latest_default",
"rollover_alias": "ml_user_risk_score_latest_default"
},
"mapping": {
"total_fields": {
"limit": "10000"
Expand Down Expand Up @@ -83,10 +79,6 @@
},
"settings": {
"index": {
"lifecycle": {
"name": "ml_user_risk_score_default",
"rollover_alias": "ml_user_risk_score_default"
},
"mapping": {
"total_fields": {
"limit": "10000"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -31,10 +31,6 @@
},
"settings": {
"index": {
"lifecycle": {
"name": "ml_user_risk_score_latest_default",
"rollover_alias": "ml_user_risk_score_latest_default"
},
"mapping": {
"total_fields": {
"limit": "10000"
Expand Down Expand Up @@ -83,10 +79,6 @@
},
"settings": {
"index": {
"lifecycle": {
"name": "ml_user_risk_score_default",
"rollover_alias": "ml_user_risk_score_default"
},
"mapping": {
"total_fields": {
"limit": "10000"
Expand Down

0 comments on commit aa8b58d

Please sign in to comment.