Skip to content

Commit b9e4e6e

Browse files
[SIEM] Adds 'Closes one signal when more than one opened signals are selected' test again (#60380) (#60417)
* Revert "Revert "adds new test (#60064)"" This reverts commit 4a8fd0a. * waits for having 25 signals displayed Co-authored-by: Elastic Machine <elasticmachine@users.noreply.github.com>
1 parent fc2f57e commit b9e4e6e

File tree

3 files changed

+53
-2
lines changed

3 files changed

+53
-2
lines changed

x-pack/legacy/plugins/siem/cypress/integration/detections.spec.ts

Lines changed: 43 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,12 +5,14 @@
55
*/
66
import {
77
NUMBER_OF_SIGNALS,
8+
OPEN_CLOSE_SIGNALS_BTN,
89
SELECTED_SIGNALS,
910
SHOWING_SIGNALS,
1011
SIGNALS,
1112
} from '../screens/detections';
1213

1314
import {
15+
closeFirstSignal,
1416
closeSignals,
1517
goToClosedSignals,
1618
goToOpenedSignals,
@@ -26,7 +28,7 @@ import { loginAndWaitForPage } from '../tasks/login';
2628
import { DETECTIONS } from '../urls/navigation';
2729

2830
describe('Detections', () => {
29-
before(() => {
31+
beforeEach(() => {
3032
esArchiverLoad('signals');
3133
loginAndWaitForPage(DETECTIONS);
3234
});
@@ -53,6 +55,7 @@ describe('Detections', () => {
5355
waitForSignals();
5456
cy.reload();
5557
waitForSignals();
58+
waitForSignalsToBeLoaded();
5659

5760
const expectedNumberOfSignalsAfterClosing = +numberOfSignals - numberOfSignalsToBeClosed;
5861
cy.get(NUMBER_OF_SIGNALS)
@@ -111,4 +114,43 @@ describe('Detections', () => {
111114
.should('eql', expectedNumberOfOpenedSignals.toString());
112115
});
113116
});
117+
118+
it('Closes one signal when more than one opened signals are selected', () => {
119+
waitForSignalsToBeLoaded();
120+
121+
cy.get(NUMBER_OF_SIGNALS)
122+
.invoke('text')
123+
.then(numberOfSignals => {
124+
const numberOfSignalsToBeClosed = 1;
125+
const numberOfSignalsToBeSelected = 3;
126+
127+
cy.get(OPEN_CLOSE_SIGNALS_BTN).should('have.attr', 'disabled');
128+
selectNumberOfSignals(numberOfSignalsToBeSelected);
129+
cy.get(OPEN_CLOSE_SIGNALS_BTN).should('not.have.attr', 'disabled');
130+
131+
closeFirstSignal();
132+
cy.reload();
133+
waitForSignalsToBeLoaded();
134+
waitForSignals();
135+
136+
const expectedNumberOfSignals = +numberOfSignals - numberOfSignalsToBeClosed;
137+
cy.get(NUMBER_OF_SIGNALS)
138+
.invoke('text')
139+
.should('eq', expectedNumberOfSignals.toString());
140+
cy.get(SHOWING_SIGNALS)
141+
.invoke('text')
142+
.should('eql', `Showing ${expectedNumberOfSignals.toString()} signals`);
143+
144+
goToClosedSignals();
145+
waitForSignals();
146+
147+
cy.get(NUMBER_OF_SIGNALS)
148+
.invoke('text')
149+
.should('eql', numberOfSignalsToBeClosed.toString());
150+
cy.get(SHOWING_SIGNALS)
151+
.invoke('text')
152+
.should('eql', `Showing ${numberOfSignalsToBeClosed.toString()} signal`);
153+
cy.get(SIGNALS).should('have.length', numberOfSignalsToBeClosed);
154+
});
155+
});
114156
});

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

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,9 @@ export const MANAGE_SIGNAL_DETECTION_RULES_BTN = '[data-test-subj="manage-signal
1212

1313
export const NUMBER_OF_SIGNALS = '[data-test-subj="server-side-event-count"]';
1414

15-
export const OPEN_CLOSE_SIGNALS_BTN = '[data-test-subj="openCloseSignal"] .siemLinkIcon__label';
15+
export const OPEN_CLOSE_SIGNAL_BTN = '[data-test-subj="update-signal-status-button"]';
16+
17+
export const OPEN_CLOSE_SIGNALS_BTN = '[data-test-subj="openCloseSignal"] button';
1618

1719
export const OPENED_SIGNALS_BTN = '[data-test-subj="openSignals"]';
1820

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

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -8,13 +8,20 @@ import {
88
CLOSED_SIGNALS_BTN,
99
LOADING_SIGNALS_PANEL,
1010
MANAGE_SIGNAL_DETECTION_RULES_BTN,
11+
OPEN_CLOSE_SIGNAL_BTN,
1112
OPEN_CLOSE_SIGNALS_BTN,
1213
OPENED_SIGNALS_BTN,
1314
SIGNALS,
1415
SIGNAL_CHECKBOX,
1516
} from '../screens/detections';
1617
import { REFRESH_BUTTON } from '../screens/siem_header';
1718

19+
export const closeFirstSignal = () => {
20+
cy.get(OPEN_CLOSE_SIGNAL_BTN)
21+
.first()
22+
.click({ force: true });
23+
};
24+
1825
export const closeSignals = () => {
1926
cy.get(OPEN_CLOSE_SIGNALS_BTN).click({ force: true });
2027
};

0 commit comments

Comments
 (0)