Skip to content

Commit

Permalink
enable skipped timeline sourcerer tests (elastic#196827)
Browse files Browse the repository at this point in the history
  • Loading branch information
lgestc authored Oct 25, 2024
1 parent 3b05b6a commit 8f0f0a4
Show file tree
Hide file tree
Showing 4 changed files with 28 additions and 14 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -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';

Expand All @@ -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);
Expand All @@ -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');
});
});
Original file line number Diff line number Diff line change
Expand Up @@ -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`);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -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(
Expand Down
14 changes: 14 additions & 0 deletions x-pack/test/security_solution_cypress/cypress/tasks/timeline.ts
Original file line number Diff line number Diff line change
Expand Up @@ -91,13 +91,15 @@ 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';
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: *';

Expand Down Expand Up @@ -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<JQuery<HTMLElement>> => {
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();
Expand Down

0 comments on commit 8f0f0a4

Please sign in to comment.