Skip to content

Commit 813d6cb

Browse files
authored
[SIEM] View signal in default timeline (#62616)
* adds test data * adds 'View a signal in timeline' test * implements test * fixes implementation * changes view signal for investigate signal
1 parent ab0cc88 commit 813d6cb

File tree

7 files changed

+9138
-0
lines changed

7 files changed

+9138
-0
lines changed
Lines changed: 43 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,43 @@
1+
/*
2+
* Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one
3+
* or more contributor license agreements. Licensed under the Elastic License;
4+
* you may not use this file except in compliance with the Elastic License.
5+
*/
6+
7+
import { SIGNAL_ID } from '../screens/detections';
8+
import { PROVIDER_BADGE } from '../screens/timeline';
9+
10+
import {
11+
expandFirstSignal,
12+
investigateFirstSignalInTimeline,
13+
waitForSignalsPanelToBeLoaded,
14+
} from '../tasks/detections';
15+
import { esArchiverLoad, esArchiverUnload } from '../tasks/es_archiver';
16+
import { loginAndWaitForPage } from '../tasks/login';
17+
18+
import { DETECTIONS } from '../urls/navigation';
19+
20+
describe('Detections timeline', () => {
21+
beforeEach(() => {
22+
esArchiverLoad('timeline_signals');
23+
loginAndWaitForPage(DETECTIONS);
24+
});
25+
26+
afterEach(() => {
27+
esArchiverUnload('timeline_signals');
28+
});
29+
30+
it('Investigate signal in default timeline', () => {
31+
waitForSignalsPanelToBeLoaded();
32+
expandFirstSignal();
33+
cy.get(SIGNAL_ID)
34+
.first()
35+
.invoke('text')
36+
.then(eventId => {
37+
investigateFirstSignalInTimeline();
38+
cy.get(PROVIDER_BADGE)
39+
.invoke('text')
40+
.should('eql', `_id: "${eventId}"`);
41+
});
42+
});
43+
});
Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
/*
2+
* Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one
3+
* or more contributor license agreements. Licensed under the Elastic License;
4+
* you may not use this file except in compliance with the Elastic License.
5+
*/
6+
7+
interface Timeline {
8+
title: string;
9+
query: string;
10+
}

x-pack/legacy/plugins/siem/cypress/screens/detections.ts

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,8 @@
66

77
export const CLOSED_SIGNALS_BTN = '[data-test-subj="closedSignals"]';
88

9+
export const EXPAND_SIGNAL_BTN = '[data-test-subj="expand-event"]';
10+
911
export const LOADING_SIGNALS_PANEL = '[data-test-subj="loading-signals-panel"]';
1012

1113
export const MANAGE_SIGNAL_DETECTION_RULES_BTN = '[data-test-subj="manage-signal-detection-rules"]';
@@ -20,8 +22,12 @@ export const OPENED_SIGNALS_BTN = '[data-test-subj="openSignals"]';
2022

2123
export const SELECTED_SIGNALS = '[data-test-subj="selectedSignals"]';
2224

25+
export const SEND_SIGNAL_TO_TIMELINE_BTN = '[data-test-subj="send-signal-to-timeline-button"]';
26+
2327
export const SHOWING_SIGNALS = '[data-test-subj="showingSignals"]';
2428

2529
export const SIGNALS = '[data-test-subj="event"]';
2630

31+
export const SIGNAL_ID = '[data-test-subj="draggable-content-_id"]';
32+
2733
export const SIGNAL_CHECKBOX = '[data-test-subj="select-event-container"] .euiCheckbox__input';

x-pack/legacy/plugins/siem/cypress/screens/timeline.ts

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,8 @@ export const ID_FIELD = '[data-test-subj="timeline"] [data-test-subj="field-name
1414

1515
export const ID_TOGGLE_FIELD = '[data-test-subj="toggle-field-_id"]';
1616

17+
export const PROVIDER_BADGE = '[data-test-subj="providerBadge"]';
18+
1719
export const SEARCH_OR_FILTER_CONTAINER =
1820
'[data-test-subj="timeline-search-or-filter-search-container"]';
1921

x-pack/legacy/plugins/siem/cypress/tasks/detections.ts

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,11 +6,13 @@
66

77
import {
88
CLOSED_SIGNALS_BTN,
9+
EXPAND_SIGNAL_BTN,
910
LOADING_SIGNALS_PANEL,
1011
MANAGE_SIGNAL_DETECTION_RULES_BTN,
1112
OPEN_CLOSE_SIGNAL_BTN,
1213
OPEN_CLOSE_SIGNALS_BTN,
1314
OPENED_SIGNALS_BTN,
15+
SEND_SIGNAL_TO_TIMELINE_BTN,
1416
SIGNALS,
1517
SIGNAL_CHECKBOX,
1618
} from '../screens/detections';
@@ -26,6 +28,12 @@ export const closeSignals = () => {
2628
cy.get(OPEN_CLOSE_SIGNALS_BTN).click({ force: true });
2729
};
2830

31+
export const expandFirstSignal = () => {
32+
cy.get(EXPAND_SIGNAL_BTN)
33+
.first()
34+
.click({ force: true });
35+
};
36+
2937
export const goToClosedSignals = () => {
3038
cy.get(CLOSED_SIGNALS_BTN).click({ force: true });
3139
};
@@ -58,6 +66,12 @@ export const selectNumberOfSignals = (numberOfSignals: number) => {
5866
}
5967
};
6068

69+
export const investigateFirstSignalInTimeline = () => {
70+
cy.get(SEND_SIGNAL_TO_TIMELINE_BTN)
71+
.first()
72+
.click({ force: true });
73+
};
74+
6175
export const waitForSignals = () => {
6276
cy.get(REFRESH_BUTTON)
6377
.invoke('text')
Binary file not shown.

0 commit comments

Comments
 (0)