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 fc48008af83f7..12173369c896b 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 @@ -5,7 +5,7 @@ * 2.0. */ -import { ROLES } from '@kbn/security-solution-plugin/common/test'; +import { visitWithTimeRange } from '../../../../../tasks/navigation'; import { getNewRule } from '../../../../../objects/rule'; import { closeAlertFlyout, @@ -17,13 +17,11 @@ import { } from '../../../../../tasks/alerts'; import { createRule } from '../../../../../tasks/api_calls/rules'; import { deleteAlertsAndRules } from '../../../../../tasks/api_calls/common'; -import { login } from '../../../../../tasks/login'; +import { getDefaultUserName, login } from '../../../../../tasks/login'; import { ALERTS_URL } from '../../../../../urls/navigation'; import { waitForAlertsToPopulate } from '../../../../../tasks/create_new_rule'; import { alertDetailsFlyoutShowsAssignees, - alertDetailsFlyoutShowsAssigneesBadge, - alertsTableShowsAssigneesBadgeForFirstAlert, alertsTableShowsAssigneesForAlert, updateAssigneesForFirstAlert, checkEmptyAssigneesStateInAlertDetailsFlyout, @@ -38,23 +36,12 @@ import { updateAssigneesViaAddButtonInFlyout, updateAssigneesViaTakeActionButtonInFlyout, removeAllAssigneesViaTakeActionButtonInFlyout, - loadPageAs, } from '../../../../../tasks/alert_assignments'; import { ALERTS_COUNT } from '../../../../../screens/alerts'; -// FLAKY: https://github.com/elastic/kibana/issues/173429 -// FLAKY: https://github.com/elastic/kibana/issues/177334 -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); }); after(() => { @@ -62,59 +49,36 @@ describe.skip('Alert user assignment - ESS & Serverless', { tags: ['@ess', '@ser }); beforeEach(() => { - loadPageAs(ALERTS_URL); + login(); deleteAlertsAndRules(); createRule(getNewRule({ rule_id: 'new custom rule' })); + visitWithTimeRange(ALERTS_URL); waitForAlertsToPopulate(); }); context('Basic rendering', () => { - it('alert with no assignees in alerts table', () => { + it('alert with no assignees in alerts table & details flyout', () => { checkEmptyAssigneesStateInAlertsTable(); - }); - it(`alert with no assignees in alert's details flyout`, () => { expandFirstAlert(); checkEmptyAssigneesStateInAlertDetailsFlyout(); }); - it('alert with some assignees in alerts table', () => { - const users = [ROLES.detections_admin, ROLES.t1_analyst]; + it('alert with some assignees in alerts table & details flyout', () => { + const users = [getDefaultUserName()]; updateAssigneesForFirstAlert(users); + alertsTableShowsAssigneesForAlert(users); - }); - it(`alert with some assignees in alert's details flyout`, () => { - const users = [ROLES.detections_admin, ROLES.t1_analyst]; - updateAssigneesForFirstAlert(users); expandFirstAlert(); alertDetailsFlyoutShowsAssignees(users); }); - - it('alert with many assignees (collapsed into badge) in alerts table', () => { - const users = [ - ROLES.t1_analyst, - ROLES.t2_analyst, - ROLES.t3_analyst, - ROLES.soc_manager, - ROLES.detections_admin, - ]; - updateAssigneesForFirstAlert(users); - alertsTableShowsAssigneesBadgeForFirstAlert(users); - }); - - it(`alert with many assignees (collapsed into badge) in alert's details flyout`, () => { - const users = [ROLES.detections_admin, ROLES.t1_analyst, ROLES.t2_analyst]; - updateAssigneesForFirstAlert(users); - expandFirstAlert(); - alertDetailsFlyoutShowsAssigneesBadge(users); - }); }); context('Updating assignees (single alert)', () => { it('adding new assignees via `More actions` in alerts table', () => { // Assign users - const users = [ROLES.detections_admin, ROLES.t1_analyst]; + const users = [getDefaultUserName()]; updateAssigneesForFirstAlert(users); // Assignees should appear in the alerts table @@ -129,7 +93,7 @@ describe.skip('Alert user assignment - ESS & Serverless', { tags: ['@ess', '@ser expandFirstAlert(); // Assign users - const users = [ROLES.detections_admin, ROLES.t1_analyst]; + const users = [getDefaultUserName()]; updateAssigneesViaAddButtonInFlyout(users); // Assignees should appear in the alert's details flyout @@ -144,7 +108,7 @@ describe.skip('Alert user assignment - ESS & Serverless', { tags: ['@ess', '@ser expandFirstAlert(); // Assign users - const users = [ROLES.detections_admin, ROLES.t1_analyst]; + const users = [getDefaultUserName()]; updateAssigneesViaTakeActionButtonInFlyout(users); // Assignees should appear in the alert's details flyout @@ -155,73 +119,9 @@ describe.skip('Alert user assignment - ESS & Serverless', { tags: ['@ess', '@ser alertsTableShowsAssigneesForAlert(users); }); - it('updating assignees via `More actions` in alerts table', () => { - // Initially assigned users - const initialAssignees = [ROLES.detections_admin, ROLES.t1_analyst]; - updateAssigneesForFirstAlert(initialAssignees); - alertsTableShowsAssigneesForAlert(initialAssignees); - - // Update assignees - const updatedAssignees = [ROLES.t1_analyst, ROLES.t2_analyst]; - updateAssigneesForFirstAlert(updatedAssignees); - - const expectedAssignees = [ROLES.detections_admin, ROLES.t2_analyst]; - - // Expected assignees should appear in the alerts table - alertsTableShowsAssigneesForAlert(expectedAssignees); - - // Expected assignees should appear in the alert's details flyout - expandFirstAlert(); - alertDetailsFlyoutShowsAssignees(expectedAssignees); - }); - - it('updating assignees via add button in flyout', () => { - expandFirstAlert(); - - // Initially assigned users - const initialAssignees = [ROLES.detections_admin, ROLES.t1_analyst]; - updateAssigneesViaAddButtonInFlyout(initialAssignees); - alertDetailsFlyoutShowsAssignees(initialAssignees); - - // Update assignees - const updatedAssignees = [ROLES.t1_analyst, ROLES.t2_analyst]; - updateAssigneesViaAddButtonInFlyout(updatedAssignees); - - const expectedAssignees = [ROLES.detections_admin, ROLES.t2_analyst]; - - // Expected assignees should appear in the alert's details flyout - alertDetailsFlyoutShowsAssignees(expectedAssignees); - - // Expected assignees should appear in the alerts table - closeAlertFlyout(); - alertsTableShowsAssigneesForAlert(expectedAssignees); - }); - - it('updating assignees via `Take action` button in flyout', () => { - expandFirstAlert(); - - // Initially assigned users - const initialAssignees = [ROLES.detections_admin, ROLES.t1_analyst]; - updateAssigneesViaTakeActionButtonInFlyout(initialAssignees); - alertDetailsFlyoutShowsAssignees(initialAssignees); - - // Update assignees - const updatedAssignees = [ROLES.t1_analyst, ROLES.t2_analyst]; - updateAssigneesViaTakeActionButtonInFlyout(updatedAssignees); - - const expectedAssignees = [ROLES.detections_admin, ROLES.t2_analyst]; - - // Expected assignees should appear in the alert's details flyout - alertDetailsFlyoutShowsAssignees(expectedAssignees); - - // Expected assignees should appear in the alerts table - closeAlertFlyout(); - alertsTableShowsAssigneesForAlert(expectedAssignees); - }); - it('removing all assignees via `More actions` in alerts table', () => { // Initially assigned users - const initialAssignees = [ROLES.detections_admin, ROLES.t1_analyst]; + const initialAssignees = [getDefaultUserName()]; updateAssigneesForFirstAlert(initialAssignees); alertsTableShowsAssigneesForAlert(initialAssignees); @@ -237,7 +137,7 @@ describe.skip('Alert user assignment - ESS & Serverless', { tags: ['@ess', '@ser expandFirstAlert(); // Initially assigned users - const initialAssignees = [ROLES.detections_admin, ROLES.t1_analyst]; + const initialAssignees = [getDefaultUserName()]; updateAssigneesViaTakeActionButtonInFlyout(initialAssignees); alertDetailsFlyoutShowsAssignees(initialAssignees); @@ -251,41 +151,22 @@ describe.skip('Alert user assignment - ESS & Serverless', { tags: ['@ess', '@ser }); context('Updating assignees (bulk actions)', () => { - it('adding new assignees should be reflected in UI (alerts table and details flyout)', () => { + it('adding new assignees should be reflected in UI (alerts table)', () => { selectFirstPageAlerts(); // Assign users - const users = [ROLES.detections_admin, ROLES.t1_analyst]; + const users = [getDefaultUserName()]; bulkUpdateAssignees(users); // Assignees should appear in the alerts table alertsTableShowsAssigneesForAllAlerts(users); }); - it('updating assignees should be reflected in UI (alerts table and details flyout)', () => { + it('removing all assignees should be reflected in UI (alerts table)', () => { selectFirstPageAlerts(); // Initially assigned users - const initialAssignees = [ROLES.detections_admin, ROLES.t1_analyst]; - bulkUpdateAssignees(initialAssignees); - alertsTableShowsAssigneesForAllAlerts(initialAssignees); - - // Update assignees - selectFirstPageAlerts(); - const updatedAssignees = [ROLES.t1_analyst, ROLES.t2_analyst]; - bulkUpdateAssignees(updatedAssignees); - - const expectedAssignees = [ROLES.detections_admin, ROLES.t2_analyst]; - - // Expected assignees should appear in the alerts table - alertsTableShowsAssigneesForAllAlerts(expectedAssignees); - }); - - it('removing all assignees should be reflected in UI (alerts table and details flyout)', () => { - selectFirstPageAlerts(); - - // Initially assigned users - const initialAssignees = [ROLES.detections_admin, ROLES.t1_analyst]; + const initialAssignees = [getDefaultUserName()]; bulkUpdateAssignees(initialAssignees); alertsTableShowsAssigneesForAllAlerts(initialAssignees); @@ -303,7 +184,7 @@ describe.skip('Alert user assignment - ESS & Serverless', { tags: ['@ess', '@ser const totalNumberOfAlerts = 5; const numberOfSelectedAlerts = 2; selectNumberOfAlerts(numberOfSelectedAlerts); - bulkUpdateAssignees([ROLES.t1_analyst]); + bulkUpdateAssignees([getDefaultUserName()]); filterByAssignees([NO_ASSIGNEES]); @@ -314,41 +195,20 @@ describe.skip('Alert user assignment - ESS & Serverless', { tags: ['@ess', '@ser it('by one assignee', () => { const numberOfSelectedAlerts = 2; selectNumberOfAlerts(numberOfSelectedAlerts); - bulkUpdateAssignees([ROLES.t1_analyst]); + bulkUpdateAssignees([getDefaultUserName()]); - filterByAssignees([ROLES.t1_analyst]); + filterByAssignees([getDefaultUserName()]); cy.get(ALERTS_COUNT).contains(numberOfSelectedAlerts); }); - it('by multiple assignees', () => { - const numberOfSelectedAlerts1 = 1; - selectNumberOfAlerts(numberOfSelectedAlerts1); - bulkUpdateAssignees([ROLES.t1_analyst]); - - filterByAssignees([NO_ASSIGNEES]); - - const numberOfSelectedAlerts2 = 2; - selectNumberOfAlerts(numberOfSelectedAlerts2); - bulkUpdateAssignees([ROLES.detections_admin]); - - clearAssigneesFilter(); - - cy.get(ALERTS_COUNT).contains(5); - - filterByAssignees([ROLES.t1_analyst, ROLES.detections_admin]); - - const expectedNumberOfAlerts = numberOfSelectedAlerts1 + numberOfSelectedAlerts2; - cy.get(ALERTS_COUNT).contains(expectedNumberOfAlerts); - }); - it('by assignee and alert status', () => { const totalNumberOfAlerts = 5; const numberOfAssignedAlerts = 3; selectNumberOfAlerts(numberOfAssignedAlerts); - bulkUpdateAssignees([ROLES.t1_analyst]); + bulkUpdateAssignees([getDefaultUserName()]); - filterByAssignees([ROLES.t1_analyst]); + filterByAssignees([getDefaultUserName()]); const numberOfClosedAlerts = 1; selectNumberOfAlerts(numberOfClosedAlerts); @@ -362,7 +222,7 @@ describe.skip('Alert user assignment - ESS & Serverless', { tags: ['@ess', '@ser const expectedNumberOfAllerts2 = totalNumberOfAlerts - numberOfClosedAlerts; cy.get(ALERTS_COUNT).contains(expectedNumberOfAllerts2); - filterByAssignees([ROLES.t1_analyst]); + filterByAssignees([getDefaultUserName()]); selectPageFilterValue(0, 'closed'); cy.get(ALERTS_COUNT).contains(numberOfClosedAlerts); }); 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 deleted file mode 100644 index 2d245384ed670..0000000000000 --- a/x-pack/test/security_solution_cypress/cypress/e2e/detection_response/detection_engine/detection_alerts/assignments/assignments_serverless_complete.cy.ts +++ /dev/null @@ -1,89 +0,0 @@ -/* - * Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one - * or more contributor license agreements. Licensed under the Elastic License - * 2.0; you may not use this file except in compliance with the Elastic License - * 2.0. - */ - -import { ROLES } from '@kbn/security-solution-plugin/common/test'; -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 { ALERTS_URL } from '../../../../../urls/navigation'; -import { waitForAlertsToPopulate } from '../../../../../tasks/create_new_rule'; -import { - alertsTableShowsAssigneesForAlert, - updateAssigneesForFirstAlert, - bulkRemoveAllAssignees, - loadPageAs, -} from '../../../../../tasks/alert_assignments'; - -// Failing: See https://github.com/elastic/kibana/issues/177573 -describe.skip( - 'Alert user assignment - Serverless Complete', - { - tags: ['@serverless'], - env: { - ftrConfig: { - productTypes: [ - { product_line: 'security', product_tier: 'complete' }, - { product_line: 'endpoint', product_tier: 'complete' }, - ], - }, - }, - }, - () => { - 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); - }); - - after(() => { - cy.task('esArchiverUnload', 'auditbeat_multiple'); - }); - - beforeEach(() => { - loadPageAs(ALERTS_URL); - deleteAlertsAndRules(); - createRule(getNewRule({ rule_id: 'new custom rule' })); - waitForAlertsToPopulate(); - }); - - context('Authorization / RBAC', () => { - it('users with editing privileges should be able to update assignees', () => { - const editors = [ - ROLES.t1_analyst, - ROLES.t2_analyst, - ROLES.t3_analyst, - ROLES.rule_author, - ROLES.soc_manager, - ROLES.detections_admin, - ROLES.platform_engineer, - ]; - editors.forEach((role) => { - loadPageAs(ALERTS_URL, role); - waitForAlertsToPopulate(); - - // Unassign alert - selectFirstPageAlerts(); - bulkRemoveAllAssignees(); - refreshAlertPageFilter(); - - updateAssigneesForFirstAlert([role]); - - // Assignees should appear in the alerts table - alertsTableShowsAssigneesForAlert([role]); - }); - }); - }); - } -); 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 deleted file mode 100644 index 0405fb7dc5976..0000000000000 --- a/x-pack/test/security_solution_cypress/cypress/e2e/detection_response/detection_engine/detection_alerts/assignments/assignments_serverless_essentials.cy.ts +++ /dev/null @@ -1,89 +0,0 @@ -/* - * Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one - * or more contributor license agreements. Licensed under the Elastic License - * 2.0; you may not use this file except in compliance with the Elastic License - * 2.0. - */ - -import { ROLES } from '@kbn/security-solution-plugin/common/test'; -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 { ALERTS_URL } from '../../../../../urls/navigation'; -import { waitForAlertsToPopulate } from '../../../../../tasks/create_new_rule'; -import { - alertsTableShowsAssigneesForAlert, - updateAssigneesForFirstAlert, - bulkRemoveAllAssignees, - loadPageAs, -} from '../../../../../tasks/alert_assignments'; - -// FLAKY: https://github.com/elastic/kibana/issues/176529 -describe.skip( - 'Alert user assignment - Serverless Essentials', - { - tags: ['@serverless'], - env: { - ftrConfig: { - productTypes: [ - { product_line: 'security', product_tier: 'essentials' }, - { product_line: 'endpoint', product_tier: 'essentials' }, - ], - }, - }, - }, - () => { - 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); - }); - - after(() => { - cy.task('esArchiverUnload', 'auditbeat_multiple'); - }); - - beforeEach(() => { - loadPageAs(ALERTS_URL); - deleteAlertsAndRules(); - createRule(getNewRule({ rule_id: 'new custom rule' })); - waitForAlertsToPopulate(); - }); - - context('Authorization / RBAC', () => { - it('users with editing privileges should be able to update assignees', () => { - const editors = [ - ROLES.t1_analyst, - ROLES.t2_analyst, - ROLES.t3_analyst, - ROLES.rule_author, - ROLES.soc_manager, - ROLES.detections_admin, - ROLES.platform_engineer, - ]; - editors.forEach((role) => { - loadPageAs(ALERTS_URL, role); - waitForAlertsToPopulate(); - - // Unassign alert - selectFirstPageAlerts(); - bulkRemoveAllAssignees(); - refreshAlertPageFilter(); - - updateAssigneesForFirstAlert([role]); - - // Assignees should appear in the alerts table - alertsTableShowsAssigneesForAlert([role]); - }); - }); - }); - } -); diff --git a/x-pack/test/security_solution_cypress/cypress/tasks/alert_assignments.ts b/x-pack/test/security_solution_cypress/cypress/tasks/alert_assignments.ts index ff2d2c8814869..460b9bf14ea33 100644 --- a/x-pack/test/security_solution_cypress/cypress/tasks/alert_assignments.ts +++ b/x-pack/test/security_solution_cypress/cypress/tasks/alert_assignments.ts @@ -111,7 +111,7 @@ export const cannotAddAssigneesViaDetailsFlyout = () => { cy.get(ALERT_DETAILS_ASSIGN_BUTTON).should('be.disabled'); }; -export const alertsTableShowsAssigneesForAlert = (users: SecurityRoleName[], alertIndex = 0) => { +export const alertsTableShowsAssigneesForAlert = (users: string[], alertIndex = 0) => { cy.get(ALERT_ASIGNEES_COLUMN) .eq(alertIndex) .within(() => { @@ -119,7 +119,7 @@ export const alertsTableShowsAssigneesForAlert = (users: SecurityRoleName[], ale }); }; -export const alertsTableShowsAssigneesForAllAlerts = (users: SecurityRoleName[]) => { +export const alertsTableShowsAssigneesForAllAlerts = (users: string[]) => { cy.get(ALERT_ASIGNEES_COLUMN).each(($column) => { cy.wrap($column).within(() => { users.forEach((user) => cy.get(`.euiAvatar${ALERT_USER_AVATAR(user)}`).should('exist')); @@ -127,7 +127,7 @@ export const alertsTableShowsAssigneesForAllAlerts = (users: SecurityRoleName[]) }); }; -export const alertsTableShowsAssigneesBadgeForFirstAlert = (users: SecurityRoleName[]) => { +export const alertsTableShowsAssigneesBadgeForFirstAlert = (users: string[]) => { cy.get(ALERT_ASIGNEES_COLUMN) .first() .within(() => { @@ -136,13 +136,13 @@ export const alertsTableShowsAssigneesBadgeForFirstAlert = (users: SecurityRoleN }); }; -export const alertDetailsFlyoutShowsAssignees = (users: SecurityRoleName[]) => { +export const alertDetailsFlyoutShowsAssignees = (users: string[]) => { cy.get(DOCUMENT_DETAILS_FLYOUT_HEADER_ASSIGNEES).within(() => { users.forEach((user) => cy.get(`.euiAvatar${ALERT_USER_AVATAR(user)}`).should('exist')); }); }; -export const alertDetailsFlyoutShowsAssigneesBadge = (users: SecurityRoleName[]) => { +export const alertDetailsFlyoutShowsAssigneesBadge = (users: string[]) => { cy.get(DOCUMENT_DETAILS_FLYOUT_HEADER_ASSIGNEES).within(() => { cy.get(ALERT_ASSIGNEES_COUNT_BADGE).contains(users.length); users.forEach((user) => cy.get(`.euiAvatar${ALERT_USER_AVATAR(user)}`).should('not.exist')); @@ -165,7 +165,7 @@ export const selectAlertAssignee = (assignee: string) => { * This will update assignees for selected alert * @param users The list of assugnees to update. If assignee is not assigned yet it will be assigned, otherwise it will be unassigned */ -export const updateAssigneesForFirstAlert = (users: SecurityRoleName[]) => { +export const updateAssigneesForFirstAlert = (users: string[]) => { openFirstAlertAssigningActionMenu(); waitForAssigneesToPopulatePopover(); users.forEach((user) => selectAlertAssignee(user)); @@ -173,7 +173,7 @@ export const updateAssigneesForFirstAlert = (users: SecurityRoleName[]) => { cy.get(ALERTS_TABLE_ROW_LOADER).should('not.exist'); }; -export const updateAssigneesViaAddButtonInFlyout = (users: SecurityRoleName[]) => { +export const updateAssigneesViaAddButtonInFlyout = (users: string[]) => { cy.get(ALERT_DETAILS_ASSIGN_BUTTON).click(); waitForAssigneesToPopulatePopover(); users.forEach((user) => selectAlertAssignee(user)); @@ -181,7 +181,7 @@ export const updateAssigneesViaAddButtonInFlyout = (users: SecurityRoleName[]) = cy.get(ALERTS_TABLE_ROW_LOADER).should('not.exist'); }; -export const updateAssigneesViaTakeActionButtonInFlyout = (users: SecurityRoleName[]) => { +export const updateAssigneesViaTakeActionButtonInFlyout = (users: string[]) => { cy.get(ALERT_DETAILS_TAKE_ACTION_BUTTON).click(); cy.get(ALERT_ASSIGN_CONTEXT_MENU_ITEM).click(); waitForAssigneesToPopulatePopover(); @@ -190,7 +190,7 @@ export const updateAssigneesViaTakeActionButtonInFlyout = (users: SecurityRoleNa cy.get(ALERTS_TABLE_ROW_LOADER).should('not.exist'); }; -export const bulkUpdateAssignees = (users: SecurityRoleName[]) => { +export const bulkUpdateAssignees = (users: string[]) => { openAlertAssigningBulkActionMenu(); waitForAssigneesToPopulatePopover(); users.forEach((user) => selectAlertAssignee(user)); @@ -216,9 +216,10 @@ export const bulkRemoveAllAssignees = () => { cy.get(ALERTS_TABLE_ROW_LOADER).should('not.exist'); }; -export const filterByAssignees = (users: Array) => { +export const filterByAssignees = (users: Array) => { cy.get(FILTER_BY_ASSIGNEES_BUTTON).scrollIntoView(); cy.get(FILTER_BY_ASSIGNEES_BUTTON).click(); + cy.get(FILTER_BY_ASSIGNEES_BUTTON).trigger('mouseleave'); users.forEach((user) => selectAlertAssignee(user)); cy.get(FILTER_BY_ASSIGNEES_BUTTON).click(); }; 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..036f9c56d6293 100644 --- a/x-pack/test/security_solution_cypress/cypress/tasks/login.ts +++ b/x-pack/test/security_solution_cypress/cypress/tasks/login.ts @@ -40,6 +40,13 @@ export const getEnvAuth = (role: SecurityRoleName): User => { return user; }; +export const getDefaultUserName = (): string => { + if (Cypress.env(IS_SERVERLESS)) { + return Cypress.env(CLOUD_SERVERLESS) ? 'admin' : 'system_indices_superuser'; + } + return defaultUser.username; +}; + export const login = (role?: SecurityRoleName): void => { let testRole = '';