diff --git a/src/platform/packages/shared/response-ops/alerts-table/components/alerts_data_grid.tsx b/src/platform/packages/shared/response-ops/alerts-table/components/alerts_data_grid.tsx index fce5457d926c8..d0668c680da0a 100644 --- a/src/platform/packages/shared/response-ops/alerts-table/components/alerts_data_grid.tsx +++ b/src/platform/packages/shared/response-ops/alerts-table/components/alerts_data_grid.tsx @@ -358,7 +358,7 @@ export const AlertsDataGrid = typedMemo( ref={dataGridRef} css={rowStyles} aria-label="Alerts table" - data-test-subj="alertsTable" + data-test-subj={isLoading ? `alertsTableIsLoading` : `alertsTableIsLoaded`} height={height} columns={columnsWithCellActions} columnVisibility={columnVisibility} diff --git a/x-pack/solutions/security/packages/kbn-scout-security/src/playwright/fixtures/test/page_objects/alerts_table.ts b/x-pack/solutions/security/packages/kbn-scout-security/src/playwright/fixtures/test/page_objects/alerts_table.ts index c8aa96f5d9ca6..cb23acc7cf9fd 100644 --- a/x-pack/solutions/security/packages/kbn-scout-security/src/playwright/fixtures/test/page_objects/alerts_table.ts +++ b/x-pack/solutions/security/packages/kbn-scout-security/src/playwright/fixtures/test/page_objects/alerts_table.ts @@ -10,16 +10,14 @@ import { ScoutPage, Locator, expect } from '@kbn/scout'; const PAGE_URL = 'security/alerts'; export class AlertsTablePage { - public detectionsAlertsContainer: Locator; + public detectionsAlertsWrapper: Locator; public alertRow: Locator; - public alertsTableBody: Locator; + public alertsTable: Locator; constructor(private readonly page: ScoutPage) { - this.detectionsAlertsContainer = this.page.testSubj.locator('detectionsAlertsPage'); + this.detectionsAlertsWrapper = this.page.testSubj.locator('detectionsAlertsPage'); this.alertRow = this.page.locator('div.euiDataGridRow'); - this.alertsTableBody = this.page.testSubj - .locator('alertsTable') - .locator(`[data-test-subj='euiDataGridBody']`); + this.alertsTable = this.page.testSubj.locator('alertsTableIsLoaded'); // Search for loaded Alerts table } async navigate() { @@ -27,7 +25,7 @@ export class AlertsTablePage { } async expandAlertDetailsFlyout(ruleName: string) { - await this.alertsTableBody.waitFor({ state: 'visible' }); + await this.alertsTable.waitFor({ state: 'visible' }); // Filter alert by unique rule name const row = this.alertRow.filter({ hasText: ruleName }); await expect( @@ -37,4 +35,9 @@ export class AlertsTablePage { return row.locator(`[data-test-subj='expand-event']`).click(); } + + async waitForDetectionsAlertsWrapper() { + // Increased timeout to 20 seconds because this page sometimes takes longer to load + return this.detectionsAlertsWrapper.waitFor({ state: 'visible', timeout: 20_000 }); + } } diff --git a/x-pack/solutions/security/plugins/security_solution/public/management/cypress/e2e/response_actions/isolate_mocked_data.cy.ts b/x-pack/solutions/security/plugins/security_solution/public/management/cypress/e2e/response_actions/isolate_mocked_data.cy.ts index c5d88ad5420b1..e9057a8f04903 100644 --- a/x-pack/solutions/security/plugins/security_solution/public/management/cypress/e2e/response_actions/isolate_mocked_data.cy.ts +++ b/x-pack/solutions/security/plugins/security_solution/public/management/cypress/e2e/response_actions/isolate_mocked_data.cy.ts @@ -139,7 +139,7 @@ describe('Isolate command', { tags: ['@ess', '@serverless', '@brokenInServerless loadPage(APP_ALERTS_PATH); closeAllToasts(); - cy.getByTestSubj('alertsTable').within(() => { + cy.getByTestSubj('alertsTableIsLoaded').within(() => { cy.getByTestSubj('expand-event') .first() .within(() => { diff --git a/x-pack/solutions/security/plugins/security_solution/public/management/cypress/screens/alerts.ts b/x-pack/solutions/security/plugins/security_solution/public/management/cypress/screens/alerts.ts index 3ce5846a5b152..339b5a72c35e6 100644 --- a/x-pack/solutions/security/plugins/security_solution/public/management/cypress/screens/alerts.ts +++ b/x-pack/solutions/security/plugins/security_solution/public/management/cypress/screens/alerts.ts @@ -30,7 +30,7 @@ export const getAlertsTableRows = (timeout?: number): Cypress.Chainable('.euiDataGridRow') .then(($rowsFound) => { $rows = $rowsFound; diff --git a/x-pack/solutions/security/plugins/security_solution/ui_tests/parallel_tests/flyout/alert_details_url_sync.spec.ts b/x-pack/solutions/security/plugins/security_solution/ui_tests/parallel_tests/flyout/alert_details_url_sync.spec.ts index 7a819bd1b6b06..596717efe9688 100644 --- a/x-pack/solutions/security/plugins/security_solution/ui_tests/parallel_tests/flyout/alert_details_url_sync.spec.ts +++ b/x-pack/solutions/security/plugins/security_solution/ui_tests/parallel_tests/flyout/alert_details_url_sync.spec.ts @@ -28,7 +28,7 @@ spaceTest.describe('Expandable flyout state sync', { tag: ['@ess', '@svlSecurity const urlBeforeAlertDetails = page.url(); expect(urlBeforeAlertDetails).not.toContain(RIGHT); - await pageObjects.alertsTablePage.detectionsAlertsContainer.waitFor({ state: 'visible' }); + await pageObjects.alertsTablePage.waitForDetectionsAlertsWrapper(); await pageObjects.alertsTablePage.expandAlertDetailsFlyout(ruleName); const urlAfterAlertDetails = page.url(); @@ -38,7 +38,7 @@ spaceTest.describe('Expandable flyout state sync', { tag: ['@ess', '@svlSecurity await expect(headerTitle).toHaveText(ruleName); await page.reload(); - await pageObjects.alertsTablePage.detectionsAlertsContainer.waitFor({ state: 'visible' }); + await pageObjects.alertsTablePage.waitForDetectionsAlertsWrapper(); const urlAfterReload = page.url(); expect(urlAfterReload).toContain(RIGHT); diff --git a/x-pack/test/cloud_security_posture_functional/constants/test_subject_ids.ts b/x-pack/test/cloud_security_posture_functional/constants/test_subject_ids.ts index 59760c7966b6b..b29ec3b2fce7b 100644 --- a/x-pack/test/cloud_security_posture_functional/constants/test_subject_ids.ts +++ b/x-pack/test/cloud_security_posture_functional/constants/test_subject_ids.ts @@ -64,7 +64,7 @@ export const testSubjectIds = { GRAPH_ACTIONS_TOGGLE_SEARCH_ID: 'cloudSecurityGraphGraphInvestigationToggleSearch', GRAPH_ACTIONS_INVESTIGATE_IN_TIMELINE_ID: 'cloudSecurityGraphGraphInvestigationInvestigateInTimeline', - ALERT_TABLE_ROW_CSS_SELECTOR: '[data-test-subj="alertsTable"] .euiDataGridRow', + ALERT_TABLE_ROW_CSS_SELECTOR: '[data-test-subj="alertsTableIsLoaded"] .euiDataGridRow', SETUP_TECHNOLOGY_SELECTOR: 'setup-technology-selector', DIRECT_ACCESS_KEYS: 'direct_access_keys', SETUP_TECHNOLOGY_SELECTOR_AGENTLESS_RADIO: 'setup-technology-agentless-radio', diff --git a/x-pack/test/functional/services/observability/alerts/common.ts b/x-pack/test/functional/services/observability/alerts/common.ts index 23bb4f7ee596d..797a1d143198c 100644 --- a/x-pack/test/functional/services/observability/alerts/common.ts +++ b/x-pack/test/functional/services/observability/alerts/common.ts @@ -21,7 +21,7 @@ const DATE_WITH_DATA = { const ALERTS_FLYOUT_SELECTOR = 'alertsFlyout'; const FILTER_FOR_VALUE_BUTTON_SELECTOR = 'filterForValue'; -const ALERTS_TABLE_WITH_DATA_SELECTOR = 'alertsTable'; +const ALERTS_TABLE_WITH_DATA_SELECTOR = 'alertsTableIsLoaded'; const ALERTS_TABLE_NO_DATA_SELECTOR = 'alertsTableEmptyState'; const ALERTS_TABLE_ERROR_PROMPT_SELECTOR = 'alertsTableErrorPrompt'; const ALERTS_TABLE_ACTIONS_MENU_SELECTOR = 'alertsTableActionsMenu'; diff --git a/x-pack/test/functional/services/observability/overview/common.ts b/x-pack/test/functional/services/observability/overview/common.ts index 37f917bf8eaa1..0d4585e18af82 100644 --- a/x-pack/test/functional/services/observability/overview/common.ts +++ b/x-pack/test/functional/services/observability/overview/common.ts @@ -22,7 +22,7 @@ const ALERTS_TITLE = 'Alerts'; const ALERTS_ACCORDION_SELECTOR = `accordion-${ALERTS_TITLE}`; const ALERTS_SECTION_BUTTON_CSS_SELECTOR = `[data-test-subj=${ALERTS_ACCORDION_SELECTOR}] button.euiAccordion__button`; const ALERTS_TABLE_NO_DATA_SELECTOR = 'alertsTableEmptyState'; -const ALERTS_TABLE_WITH_DATA_SELECTOR = 'alertsTable'; +const ALERTS_TABLE_WITH_DATA_SELECTOR = 'alertsTableIsLoaded'; const ALERTS_TABLE_LOADING_SELECTOR = 'internalAlertsPageLoading'; export function ObservabilityOverviewCommonProvider({ diff --git a/x-pack/test/security_solution_cypress/cypress/e2e/investigations/alerts/alerts_table_api_calls.cy.ts b/x-pack/test/security_solution_cypress/cypress/e2e/investigations/alerts/alerts_table_api_calls.cy.ts index 3ef2c0dd21b64..adc24de020087 100644 --- a/x-pack/test/security_solution_cypress/cypress/e2e/investigations/alerts/alerts_table_api_calls.cy.ts +++ b/x-pack/test/security_solution_cypress/cypress/e2e/investigations/alerts/alerts_table_api_calls.cy.ts @@ -41,7 +41,7 @@ describe('Alert Table API calls', { tags: ['@ess', '@serverless'] }, () => { }); it('should call `api/lists/index` only once', () => { - cy.get('[data-test-subj="alertsTable"]').then(() => { + cy.get('[data-test-subj="alertsTableIsLoaded"]').then(() => { expect(callCount, 'number of times lists index api is called').to.equal(1); }); }); diff --git a/x-pack/test/security_solution_cypress/cypress/screens/common/data_grid.ts b/x-pack/test/security_solution_cypress/cypress/screens/common/data_grid.ts index 5c4fb9b0ffc96..6861fdf24fdf3 100644 --- a/x-pack/test/security_solution_cypress/cypress/screens/common/data_grid.ts +++ b/x-pack/test/security_solution_cypress/cypress/screens/common/data_grid.ts @@ -38,7 +38,7 @@ export const GET_DATA_GRID_HEADER_CELL_ACTION_GROUP = (fieldName: string) => { }; export const DATA_GRID_FULL_SCREEN = - '[data-test-subj="alertsTable"] [data-test-subj="dataGridFullScreenButton"]'; + '[data-test-subj="alertsTableIsLoaded"] [data-test-subj="dataGridFullScreenButton"]'; export const DATA_GRID_FIELD_SORT_BTN = '[data-test-subj="dataGridColumnSortingButton"]'; diff --git a/x-pack/test/security_solution_cypress/cypress/screens/rule_details.ts b/x-pack/test/security_solution_cypress/cypress/screens/rule_details.ts index 29bd6f25504f3..33508e6d3d48d 100644 --- a/x-pack/test/security_solution_cypress/cypress/screens/rule_details.ts +++ b/x-pack/test/security_solution_cypress/cypress/screens/rule_details.ts @@ -87,7 +87,7 @@ export const NEW_TERMS_FIELDS_DETAILS = 'Fields'; export const NEW_TERMS_HISTORY_WINDOW_DETAILS = 'History Window Size'; export const FIELDS_BROWSER_BTN = - '[data-test-subj="alertsTable"] [data-test-subj="show-field-browser"]'; + '[data-test-subj="alertsTableIsLoaded"] [data-test-subj="show-field-browser"]'; export const LAST_EXECUTION_STATUS_REFRESH_BUTTON = '[data-test-subj="ruleLastExecutionStatusRefreshButton"]'; diff --git a/x-pack/test/security_solution_cypress/cypress/tasks/alerts.ts b/x-pack/test/security_solution_cypress/cypress/tasks/alerts.ts index 8602064af92a6..e11ce6bc9c977 100644 --- a/x-pack/test/security_solution_cypress/cypress/tasks/alerts.ts +++ b/x-pack/test/security_solution_cypress/cypress/tasks/alerts.ts @@ -489,7 +489,7 @@ export const sumAlertCountFromAlertCountTable = (callback?: (sumOfEachRow: numbe }; export const selectFirstPageAlerts = () => { - const ALERTS_DATA_GRID = '[data-test-subj="alertsTable"]'; + const ALERTS_DATA_GRID = '[data-test-subj="alertsTableIsLoaded"]'; cy.get(ALERTS_DATA_GRID).find(SELECT_ALL_VISIBLE_ALERTS).scrollIntoView(); cy.get(ALERTS_DATA_GRID).find(SELECT_ALL_VISIBLE_ALERTS).click({ force: true }); }; diff --git a/x-pack/test/security_solution_ftr/page_objects/detections/index.ts b/x-pack/test/security_solution_ftr/page_objects/detections/index.ts index a8eb7cbcfbce1..e4b1e8e0c4169 100644 --- a/x-pack/test/security_solution_ftr/page_objects/detections/index.ts +++ b/x-pack/test/security_solution_ftr/page_objects/detections/index.ts @@ -8,7 +8,7 @@ import { WebElementWrapper } from '@kbn/ftr-common-functional-ui-services'; import { FtrService } from '../../../functional/ftr_provider_context'; -const ALERT_TABLE_ROW_CSS_SELECTOR = '[data-test-subj="alertsTable"] .euiDataGridRow'; +const ALERT_TABLE_ROW_CSS_SELECTOR = '[data-test-subj="alertsTableIsLoaded"] .euiDataGridRow'; export class DetectionsPageObject extends FtrService { private readonly find = this.ctx.getService('find');