diff --git a/x-pack/test/security_solution_cypress/cypress/e2e/detection_response/detection_engine/detection_alerts/assignments/assignments.cy.ts b/x-pack/test/security_solution_cypress/cypress/e2e/detection_response/detection_engine/detection_alerts/assignments/assignments.cy.ts index 5dbf14796c583..2d12aed3151b6 100644 --- a/x-pack/test/security_solution_cypress/cypress/e2e/detection_response/detection_engine/detection_alerts/assignments/assignments.cy.ts +++ b/x-pack/test/security_solution_cypress/cypress/e2e/detection_response/detection_engine/detection_alerts/assignments/assignments.cy.ts @@ -17,7 +17,7 @@ import { } from '../../../../../tasks/alerts'; import { createRule } from '../../../../../tasks/api_calls/rules'; import { deleteAlertsAndRules } from '../../../../../tasks/api_calls/common'; -import { login } from '../../../../../tasks/login'; +import { activateUser, login } from '../../../../../tasks/login'; import { ALERTS_URL } from '../../../../../urls/navigation'; import { waitForAlertsToPopulate } from '../../../../../tasks/create_new_rule'; import { @@ -43,17 +43,19 @@ import { import { ALERTS_COUNT } from '../../../../../screens/alerts'; // Failing: See https://github.com/elastic/kibana/issues/173429 -describe.skip('Alert user assignment - ESS & Serverless', { tags: ['@ess', '@serverless'] }, () => { +describe('Alert user assignment - ESS & Serverless', { tags: ['@ess', '@serverless'] }, () => { before(() => { cy.task('esArchiverLoad', { archiveName: 'auditbeat_multiple' }); - // Login into accounts so that they got activated and visible in user profiles list - login(ROLES.t1_analyst); - login(ROLES.t2_analyst); - login(ROLES.t3_analyst); - login(ROLES.soc_manager); - login(ROLES.detections_admin); - login(ROLES.platform_engineer); + login(); + + // Activate accounts so that they got visible in user profiles list + activateUser(ROLES.t1_analyst); + activateUser(ROLES.t2_analyst); + activateUser(ROLES.t3_analyst); + activateUser(ROLES.soc_manager); + activateUser(ROLES.detections_admin); + activateUser(ROLES.platform_engineer); }); after(() => { diff --git a/x-pack/test/security_solution_cypress/cypress/e2e/detection_response/detection_engine/detection_alerts/assignments/assignments_serverless_complete.cy.ts b/x-pack/test/security_solution_cypress/cypress/e2e/detection_response/detection_engine/detection_alerts/assignments/assignments_serverless_complete.cy.ts index 72afcb304f893..e106cfbd7bab8 100644 --- a/x-pack/test/security_solution_cypress/cypress/e2e/detection_response/detection_engine/detection_alerts/assignments/assignments_serverless_complete.cy.ts +++ b/x-pack/test/security_solution_cypress/cypress/e2e/detection_response/detection_engine/detection_alerts/assignments/assignments_serverless_complete.cy.ts @@ -10,7 +10,7 @@ import { getNewRule } from '../../../../../objects/rule'; import { refreshAlertPageFilter, selectFirstPageAlerts } from '../../../../../tasks/alerts'; import { createRule } from '../../../../../tasks/api_calls/rules'; import { deleteAlertsAndRules } from '../../../../../tasks/api_calls/common'; -import { login } from '../../../../../tasks/login'; +import { activateUser, login } from '../../../../../tasks/login'; import { ALERTS_URL } from '../../../../../urls/navigation'; import { waitForAlertsToPopulate } from '../../../../../tasks/create_new_rule'; import { @@ -21,7 +21,7 @@ import { } from '../../../../../tasks/alert_assignments'; // FLAKY: https://github.com/elastic/kibana/issues/172557 -describe.skip( +describe( 'Alert user assignment - Serverless Complete', { tags: ['@serverless'], @@ -38,13 +38,15 @@ describe.skip( before(() => { cy.task('esArchiverLoad', { archiveName: 'auditbeat_multiple' }); - // Login into accounts so that they got activated and visible in user profiles list - login(ROLES.t1_analyst); - login(ROLES.t2_analyst); - login(ROLES.t3_analyst); - login(ROLES.soc_manager); - login(ROLES.detections_admin); - login(ROLES.platform_engineer); + login(); + + // Activate accounts so that they got visible in user profiles list + activateUser(ROLES.t1_analyst); + activateUser(ROLES.t2_analyst); + activateUser(ROLES.t3_analyst); + activateUser(ROLES.soc_manager); + activateUser(ROLES.detections_admin); + activateUser(ROLES.platform_engineer); }); after(() => { diff --git a/x-pack/test/security_solution_cypress/cypress/e2e/detection_response/detection_engine/detection_alerts/assignments/assignments_serverless_essentials.cy.ts b/x-pack/test/security_solution_cypress/cypress/e2e/detection_response/detection_engine/detection_alerts/assignments/assignments_serverless_essentials.cy.ts index 5ae60a01a0e8b..d25919c9ee978 100644 --- a/x-pack/test/security_solution_cypress/cypress/e2e/detection_response/detection_engine/detection_alerts/assignments/assignments_serverless_essentials.cy.ts +++ b/x-pack/test/security_solution_cypress/cypress/e2e/detection_response/detection_engine/detection_alerts/assignments/assignments_serverless_essentials.cy.ts @@ -10,7 +10,7 @@ import { getNewRule } from '../../../../../objects/rule'; import { refreshAlertPageFilter, selectFirstPageAlerts } from '../../../../../tasks/alerts'; import { createRule } from '../../../../../tasks/api_calls/rules'; import { deleteAlertsAndRules } from '../../../../../tasks/api_calls/common'; -import { login } from '../../../../../tasks/login'; +import { activateUser, login } from '../../../../../tasks/login'; import { ALERTS_URL } from '../../../../../urls/navigation'; import { waitForAlertsToPopulate } from '../../../../../tasks/create_new_rule'; import { @@ -21,7 +21,7 @@ import { } from '../../../../../tasks/alert_assignments'; // FLAKY: https://github.com/elastic/kibana/issues/172520 -describe.skip( +describe( 'Alert user assignment - Serverless Essentials', { tags: ['@serverless'], @@ -38,13 +38,15 @@ describe.skip( before(() => { cy.task('esArchiverLoad', { archiveName: 'auditbeat_multiple' }); - // Login into accounts so that they got activated and visible in user profiles list - login(ROLES.t1_analyst); - login(ROLES.t2_analyst); - login(ROLES.t3_analyst); - login(ROLES.soc_manager); - login(ROLES.detections_admin); - login(ROLES.platform_engineer); + login(); + + // Activate accounts so that they got visible in user profiles list + activateUser(ROLES.t1_analyst); + activateUser(ROLES.t2_analyst); + activateUser(ROLES.t3_analyst); + activateUser(ROLES.soc_manager); + activateUser(ROLES.detections_admin); + activateUser(ROLES.platform_engineer); }); after(() => { diff --git a/x-pack/test/security_solution_cypress/cypress/tasks/login.ts b/x-pack/test/security_solution_cypress/cypress/tasks/login.ts index 90c9d245c3bba..22c0efe3f4239 100644 --- a/x-pack/test/security_solution_cypress/cypress/tasks/login.ts +++ b/x-pack/test/security_solution_cypress/cypress/tasks/login.ts @@ -90,3 +90,23 @@ export const loginWithUser = (user: User): void => { export const logout = (): void => { cy.visit(LOGOUT_URL); }; + +export const activateUser = (role?: SecurityRoleName): void => { + const user = role + ? { + username: role, + password: 'changeme', + } + : defaultUser; + + cy.request({ + url: `${Cypress.env('ELASTICSEARCH_URL')}/_security/profile/_activate`, + method: 'POST', + body: { + grant_type: 'password', + username: user.username, + password: user.password, + }, + headers: API_HEADERS, + }); +};