Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

enable skipped timeline sourcerer tests #196827

Merged
merged 2 commits into from
Oct 25, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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);
Copy link
Contributor

@michaelolo24 michaelolo24 Oct 24, 2024

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Sweet, will pull in your changes here: https://github.com/elastic/kibana/pull/195662/files#diff-57ff085e8c0983eb6cbfb4fa9565a8a72a77f6a6a7a230eb96cf64f17feb1166 😄

...but we should update the timeline code to actually properly re-request the new runtime field when the modal closes. I didn't make that change in my PR as I wanted to do it in a separate PR

// 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