mirror of
https://github.com/elastic/kibana.git
synced 2025-04-24 17:59:23 -04:00
fix graph ftr test
This commit is contained in:
parent
9551d840eb
commit
7be44d7d1f
5 changed files with 21 additions and 4 deletions
|
@ -341,7 +341,7 @@ describe.skip('GraphInvestigation Component', () => {
|
|||
// Assert
|
||||
expect(onInvestigateInTimeline).toHaveBeenCalled();
|
||||
expect(onInvestigateInTimeline.mock.calls[0][QUERY_PARAM_IDX]).toEqual({
|
||||
query: 'host1',
|
||||
query: '(host1) OR event.id: "1" OR event.id: "2"',
|
||||
language: 'kuery',
|
||||
});
|
||||
expect(onInvestigateInTimeline.mock.calls[0][FILTERS_PARAM_IDX]).toEqual([]);
|
||||
|
|
|
@ -141,12 +141,18 @@ export const GraphInvestigation = memo<GraphInvestigationProps>(
|
|||
|
||||
let filters = [...searchFilters];
|
||||
|
||||
if (query.query.trim() === '' && searchFilters?.length === 0 && originEventIds.length > 0) {
|
||||
if ((query.query.trim() === '' || searchFilters.length > 0) && originEventIds.length > 0) {
|
||||
filters = originEventIds.reduce<Filter[]>((acc, { id }) => {
|
||||
return addFilter(dataView?.id ?? '', acc, EVENT_ID, id);
|
||||
}, searchFilters);
|
||||
}
|
||||
|
||||
if (query.query.trim() !== '' && searchFilters.length === 0 && originEventIds.length > 0) {
|
||||
query.query = `(${query.query})${originEventIds
|
||||
.map(({ id }) => ` OR ${EVENT_ID}: "${id}"`)
|
||||
.join('')}`;
|
||||
}
|
||||
|
||||
onInvestigateInTimeline?.(query, filters, timeRange);
|
||||
}, [dataView?.id, onInvestigateInTimeline, originEventIds, kquery, searchFilters, timeRange]);
|
||||
|
||||
|
|
|
@ -80,6 +80,17 @@ export class TimelinePageObject extends FtrService {
|
|||
return eventRows.length > 0;
|
||||
}
|
||||
|
||||
/**
|
||||
* Check to see if the timeline is empty
|
||||
*/
|
||||
async isTimelineEmpty(): Promise<boolean> {
|
||||
const eventRows = await this.testSubjects.findService.allByCssSelector(
|
||||
`${testSubjSelector(TIMELINE_MODAL_PAGE_TEST_SUBJ)} [role="row"]`
|
||||
);
|
||||
|
||||
return eventRows.length === 0;
|
||||
}
|
||||
|
||||
/**
|
||||
* Waits for events to be displayed in the timeline. It will click on the "Refresh" button to trigger a data fetch
|
||||
* @param timeoutMs
|
||||
|
|
|
@ -159,7 +159,7 @@ export default function ({ getPageObjects, getService }: SecurityTelemetryFtrPro
|
|||
await expandedFlyoutGraph.setKqlQuery('cannotFindThis');
|
||||
await expandedFlyoutGraph.clickOnInvestigateInTimelineButton();
|
||||
await timelinePage.ensureTimelineIsOpen();
|
||||
await timelinePage.waitForEvents();
|
||||
await timelinePage.isTimelineEmpty();
|
||||
});
|
||||
});
|
||||
}
|
||||
|
|
|
@ -150,7 +150,7 @@ export default function ({ getPageObjects, getService }: SecurityTelemetryFtrPro
|
|||
await expandedFlyoutGraph.setKqlQuery('cannotFindThis');
|
||||
await expandedFlyoutGraph.clickOnInvestigateInTimelineButton();
|
||||
await timelinePage.ensureTimelineIsOpen();
|
||||
await timelinePage.waitForEvents();
|
||||
await timelinePage.isTimelineEmpty();
|
||||
});
|
||||
});
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue