diff --git a/x-pack/test/security_solution_cypress/cypress/e2e/investigations/sourcerer/create_runtime_field.cy.ts b/x-pack/test/security_solution_cypress/cypress/e2e/investigations/sourcerer/create_runtime_field.cy.ts index a96762e530bdb..b8a7bed3c22b9 100644 --- a/x-pack/test/security_solution_cypress/cypress/e2e/investigations/sourcerer/create_runtime_field.cy.ts +++ b/x-pack/test/security_solution_cypress/cypress/e2e/investigations/sourcerer/create_runtime_field.cy.ts @@ -8,7 +8,10 @@ import { login } from '../../../tasks/login'; import { visitWithTimeRange } from '../../../tasks/navigation'; import { openTimelineUsingToggle } from '../../../tasks/security_main'; -import { openTimelineFieldsBrowser, populateTimeline } from '../../../tasks/timeline'; +import { + createRuntimeFieldFromTimelne as createRuntimeFieldFromTimeline, + populateTimeline, +} from '../../../tasks/timeline'; import { hostsUrl, ALERTS_URL } from '../../../urls/navigation'; @@ -20,14 +23,13 @@ import { waitForAlertsToPopulate } from '../../../tasks/create_new_rule'; import { createField } from '../../../tasks/create_runtime_field'; import { openAlertsFieldBrowser } from '../../../tasks/alerts'; import { GET_DATA_GRID_HEADER } from '../../../screens/common/data_grid'; -import { GET_TIMELINE_HEADER } from '../../../screens/timeline'; import { deleteRuntimeField } from '../../../tasks/api_calls/sourcerer'; +import { SAVE_FIELD_BUTTON } from '../../../screens/create_runtime_field'; const alertRunTimeField = 'field.name.alert.page'; const timelineRuntimeField = 'field.name.timeline'; -// FLAKY: https://github.com/elastic/kibana/issues/183104 -describe.skip('Create DataView runtime field', { tags: ['@ess', '@serverless'] }, () => { +describe('Create DataView runtime field', { tags: ['@ess', '@serverless'] }, () => { beforeEach(() => { login(); deleteRuntimeField('security-solution-default', alertRunTimeField); @@ -48,9 +50,9 @@ describe.skip('Create DataView runtime field', { tags: ['@ess', '@serverless'] } visitWithTimeRange(hostsUrl('allHosts')); openTimelineUsingToggle(); populateTimeline(); - openTimelineFieldsBrowser(); - - createField(timelineRuntimeField); - cy.get(GET_TIMELINE_HEADER(timelineRuntimeField)).should('exist'); + createRuntimeFieldFromTimeline(timelineRuntimeField); + // NOTE: the field creation dialog should be closed now + // meaning that the field creation has been successful + cy.get(SAVE_FIELD_BUTTON).should('not.exist'); }); }); diff --git a/x-pack/test/security_solution_cypress/cypress/e2e/investigations/sourcerer/sourcerer_timeline.cy.ts b/x-pack/test/security_solution_cypress/cypress/e2e/investigations/sourcerer/sourcerer_timeline.cy.ts index bb4010a6db4f6..9d2e1ac2e11a5 100644 --- a/x-pack/test/security_solution_cypress/cypress/e2e/investigations/sourcerer/sourcerer_timeline.cy.ts +++ b/x-pack/test/security_solution_cypress/cypress/e2e/investigations/sourcerer/sourcerer_timeline.cy.ts @@ -62,8 +62,7 @@ describe('Timeline scope', { tags: ['@ess', '@serverless', '@skipInServerless'] isNotSourcererOption(`${DEFAULT_ALERTS_INDEX}-default`); }); - // FLAKY: https://github.com/elastic/kibana/issues/173854 - describe.skip('Modified badge', () => { + describe('Modified badge', () => { it('Selecting new data view does not add a modified badge', () => { openTimelineUsingToggle(); cy.get(SOURCERER.badgeModified).should(`not.exist`); diff --git a/x-pack/test/security_solution_cypress/cypress/screens/timeline.ts b/x-pack/test/security_solution_cypress/cypress/screens/timeline.ts index 96bd20dbd29dc..3398345bcd1fd 100644 --- a/x-pack/test/security_solution_cypress/cypress/screens/timeline.ts +++ b/x-pack/test/security_solution_cypress/cypress/screens/timeline.ts @@ -166,6 +166,9 @@ export const TIMELINE_EVENTS_COUNT_PREV_PAGE = export const TIMELINE_FIELDS_BUTTON = '[data-test-subj="timeline"] [data-test-subj="show-field-browser"]'; +export const TIMELINE_DISCOVER_FIELDS_BUTTON = + '[data-test-subj="timeline"] [data-test-subj="dataView-add-field_btn"]'; + export const TIMELINE_FILTER = (filter: TimelineFilter) => `[data-test-subj~="filter"][data-test-subj~="filter-enabled"][data-test-subj~="filter-key-${ filter.field @@ -298,10 +301,6 @@ export const HOVER_ACTIONS = { export const TIMELINE_FILTER_BADGE_ENABLED = '[data-test-subj~="filter-enabled"]'; -export const GET_TIMELINE_HEADER = (fieldName: string) => { - return `[data-test-subj="timeline"] [data-test-subj="header-text-${fieldName}"]`; -}; - export const ESQL_TAB = getDataTestSubjectSelector('timelineTabs-esql'); export const TIMELINE_DATE_PICKER_CONTAINER = getDataTestSubjectSelector( diff --git a/x-pack/test/security_solution_cypress/cypress/tasks/timeline.ts b/x-pack/test/security_solution_cypress/cypress/tasks/timeline.ts index 9f37436d69bf6..7d66243071d9d 100644 --- a/x-pack/test/security_solution_cypress/cypress/tasks/timeline.ts +++ b/x-pack/test/security_solution_cypress/cypress/tasks/timeline.ts @@ -91,6 +91,7 @@ import { TIMELINE_FLYOUT, TIMELINE_FULL_SCREEN_BUTTON, QUERY_EVENT_COUNT, + TIMELINE_DISCOVER_FIELDS_BUTTON, } from '../screens/timeline'; import { REFRESH_BUTTON, TIMELINE, TIMELINES_TAB_TEMPLATE } from '../screens/timelines'; @@ -98,6 +99,7 @@ import { drag, drop, waitForTabToBeLoaded } from './common'; import { closeFieldsBrowser, filterFieldsBrowser } from './fields_browser'; import { TIMELINE_CONTEXT_MENU_BTN } from '../screens/alerts'; +import { RUNTIME_FIELD_INPUT, SAVE_FIELD_BUTTON } from '../screens/create_runtime_field'; const hostExistsQuery = 'host.name: *'; @@ -381,6 +383,18 @@ export const openTimelineFieldsBrowser = () => { cy.get(TIMELINE_FIELDS_BUTTON).first().click(); }; +export const openTimelineDiscoverAddField = () => { + cy.get(TIMELINE_DISCOVER_FIELDS_BUTTON).first().click(); +}; + +export const createRuntimeFieldFromTimelne = ( + fieldName: string +): Cypress.Chainable> => { + openTimelineDiscoverAddField(); + cy.get(RUNTIME_FIELD_INPUT).type(fieldName); + return cy.get(SAVE_FIELD_BUTTON).click(); +}; + export const openTimelineInspectButton = () => { cy.get(TIMELINE_INSPECT_BUTTON).should('not.be.disabled'); cy.get(TIMELINE_INSPECT_BUTTON).click();