From aa8b58dd720c3fd64f96dc95e984faab0b6be040 Mon Sep 17 00:00:00 2001 From: Gloria Hornero Date: Mon, 16 Oct 2023 16:06:02 +0200 Subject: [PATCH] [Security Solution] Unskipping `x-pack/test/security_solution_cypress/cypress/e2e/explore/dashboards/` working tests on serverless (#167916) (cherry picked from commit 3c4a5977a17acbe4303b74339f6a7c16d5ebc2f4) --- .../enable_risk_score_redirect.cy.ts | 44 +++++++++---------- .../explore/dashboards/entity_analytics.cy.ts | 30 ++----------- ...y_analytics_serverless_splash_screen.cy.ts | 2 +- .../dashboards/upgrade_risk_score.cy.ts | 10 ++--- .../cypress/tasks/date_picker.ts | 6 +-- .../es_archives/risk_hosts/mappings.json | 8 ---- .../risk_hosts_no_data/mappings.json | 8 ---- .../es_archives/risk_users/mappings.json | 8 ---- .../risk_users_no_data/mappings.json | 8 ---- 9 files changed, 30 insertions(+), 94 deletions(-) diff --git a/x-pack/test/security_solution_cypress/cypress/e2e/explore/dashboards/enable_risk_score_redirect.cy.ts b/x-pack/test/security_solution_cypress/cypress/e2e/explore/dashboards/enable_risk_score_redirect.cy.ts index a684968bf8b33..43fc7c399593c 100644 --- a/x-pack/test/security_solution_cypress/cypress/e2e/explore/dashboards/enable_risk_score_redirect.cy.ts +++ b/x-pack/test/security_solution_cypress/cypress/e2e/explore/dashboards/enable_risk_score_redirect.cy.ts @@ -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'); + }); +}); diff --git a/x-pack/test/security_solution_cypress/cypress/e2e/explore/dashboards/entity_analytics.cy.ts b/x-pack/test/security_solution_cypress/cypress/e2e/explore/dashboards/entity_analytics.cy.ts index a14aa11bc1cdd..10953feba6182 100644 --- a/x-pack/test/security_solution_cypress/cypress/e2e/explore/dashboards/entity_analytics.cy.ts +++ b/x-pack/test/security_solution_cypress/cypress/e2e/explore/dashboards/entity_analytics.cy.ts @@ -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, @@ -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(); @@ -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', () => { @@ -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', () => { @@ -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', () => { @@ -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', () => { @@ -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', () => { @@ -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', () => { @@ -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', () => { @@ -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', () => { diff --git a/x-pack/test/security_solution_cypress/cypress/e2e/explore/dashboards/entity_analytics_serverless_splash_screen.cy.ts b/x-pack/test/security_solution_cypress/cypress/e2e/explore/dashboards/entity_analytics_serverless_splash_screen.cy.ts index 94d77b45b157b..fcf869f3b0f63 100644 --- a/x-pack/test/security_solution_cypress/cypress/e2e/explore/dashboards/entity_analytics_serverless_splash_screen.cy.ts +++ b/x-pack/test/security_solution_cypress/cypress/e2e/explore/dashboards/entity_analytics_serverless_splash_screen.cy.ts @@ -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: [ diff --git a/x-pack/test/security_solution_cypress/cypress/e2e/explore/dashboards/upgrade_risk_score.cy.ts b/x-pack/test/security_solution_cypress/cypress/e2e/explore/dashboards/upgrade_risk_score.cy.ts index e815e9eaa6cb4..55376429f8edc 100644 --- a/x-pack/test/security_solution_cypress/cypress/e2e/explore/dashboards/upgrade_risk_score.cy.ts +++ b/x-pack/test/security_solution_cypress/cypress/e2e/explore/dashboards/upgrade_risk_score.cy.ts @@ -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(); @@ -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 }); diff --git a/x-pack/test/security_solution_cypress/cypress/tasks/date_picker.ts b/x-pack/test/security_solution_cypress/cypress/tasks/date_picker.ts index 1ea45dcd0b91b..7ae1fa8c30b73 100644 --- a/x-pack/test/security_solution_cypress/cypress/tasks/date_picker.ts +++ b/x-pack/test/security_solution_cypress/cypress/tasks/date_picker.ts @@ -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 }); @@ -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'); }; diff --git a/x-pack/test/security_solution_cypress/es_archives/risk_hosts/mappings.json b/x-pack/test/security_solution_cypress/es_archives/risk_hosts/mappings.json index 3e1b52cb22f5e..e250700644c15 100644 --- a/x-pack/test/security_solution_cypress/es_archives/risk_hosts/mappings.json +++ b/x-pack/test/security_solution_cypress/es_archives/risk_hosts/mappings.json @@ -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" @@ -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" diff --git a/x-pack/test/security_solution_cypress/es_archives/risk_hosts_no_data/mappings.json b/x-pack/test/security_solution_cypress/es_archives/risk_hosts_no_data/mappings.json index 3e1b52cb22f5e..e250700644c15 100644 --- a/x-pack/test/security_solution_cypress/es_archives/risk_hosts_no_data/mappings.json +++ b/x-pack/test/security_solution_cypress/es_archives/risk_hosts_no_data/mappings.json @@ -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" @@ -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" diff --git a/x-pack/test/security_solution_cypress/es_archives/risk_users/mappings.json b/x-pack/test/security_solution_cypress/es_archives/risk_users/mappings.json index 77eade9df7994..2591f2d216575 100644 --- a/x-pack/test/security_solution_cypress/es_archives/risk_users/mappings.json +++ b/x-pack/test/security_solution_cypress/es_archives/risk_users/mappings.json @@ -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" @@ -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" diff --git a/x-pack/test/security_solution_cypress/es_archives/risk_users_no_data/mappings.json b/x-pack/test/security_solution_cypress/es_archives/risk_users_no_data/mappings.json index 77eade9df7994..2591f2d216575 100644 --- a/x-pack/test/security_solution_cypress/es_archives/risk_users_no_data/mappings.json +++ b/x-pack/test/security_solution_cypress/es_archives/risk_users_no_data/mappings.json @@ -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" @@ -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"