[SIEM] Adds 'Open one signal' Cypress test (#60484)
* adds data for having closed signals * adds 'Open one signal when more than one closed signals are selected' test' Co-authored-by: Elastic Machine <elasticmachine@users.noreply.github.com>
This commit is contained in:
parent
85481a7017
commit
10afcf4be8
|
@ -16,6 +16,7 @@ import {
|
||||||
closeSignals,
|
closeSignals,
|
||||||
goToClosedSignals,
|
goToClosedSignals,
|
||||||
goToOpenedSignals,
|
goToOpenedSignals,
|
||||||
|
openFirstSignal,
|
||||||
openSignals,
|
openSignals,
|
||||||
selectNumberOfSignals,
|
selectNumberOfSignals,
|
||||||
waitForSignalsPanelToBeLoaded,
|
waitForSignalsPanelToBeLoaded,
|
||||||
|
@ -28,6 +29,7 @@ import { loginAndWaitForPage } from '../tasks/login';
|
||||||
import { DETECTIONS } from '../urls/navigation';
|
import { DETECTIONS } from '../urls/navigation';
|
||||||
|
|
||||||
describe('Detections', () => {
|
describe('Detections', () => {
|
||||||
|
context('Closing signals', () => {
|
||||||
beforeEach(() => {
|
beforeEach(() => {
|
||||||
esArchiverLoad('signals');
|
esArchiverLoad('signals');
|
||||||
loginAndWaitForPage(DETECTIONS);
|
loginAndWaitForPage(DETECTIONS);
|
||||||
|
@ -55,7 +57,6 @@ describe('Detections', () => {
|
||||||
waitForSignals();
|
waitForSignals();
|
||||||
cy.reload();
|
cy.reload();
|
||||||
waitForSignals();
|
waitForSignals();
|
||||||
waitForSignalsToBeLoaded();
|
|
||||||
|
|
||||||
const expectedNumberOfSignalsAfterClosing = +numberOfSignals - numberOfSignalsToBeClosed;
|
const expectedNumberOfSignalsAfterClosing = +numberOfSignals - numberOfSignalsToBeClosed;
|
||||||
cy.get(NUMBER_OF_SIGNALS)
|
cy.get(NUMBER_OF_SIGNALS)
|
||||||
|
@ -97,7 +98,10 @@ describe('Detections', () => {
|
||||||
.should('eql', expectedNumberOfClosedSignalsAfterOpened.toString());
|
.should('eql', expectedNumberOfClosedSignalsAfterOpened.toString());
|
||||||
cy.get(SHOWING_SIGNALS)
|
cy.get(SHOWING_SIGNALS)
|
||||||
.invoke('text')
|
.invoke('text')
|
||||||
.should('eql', `Showing ${expectedNumberOfClosedSignalsAfterOpened.toString()} signals`);
|
.should(
|
||||||
|
'eql',
|
||||||
|
`Showing ${expectedNumberOfClosedSignalsAfterOpened.toString()} signals`
|
||||||
|
);
|
||||||
cy.get(SIGNALS).should('have.length', expectedNumberOfClosedSignalsAfterOpened);
|
cy.get(SIGNALS).should('have.length', expectedNumberOfClosedSignalsAfterOpened);
|
||||||
|
|
||||||
goToOpenedSignals();
|
goToOpenedSignals();
|
||||||
|
@ -153,4 +157,53 @@ describe('Detections', () => {
|
||||||
cy.get(SIGNALS).should('have.length', numberOfSignalsToBeClosed);
|
cy.get(SIGNALS).should('have.length', numberOfSignalsToBeClosed);
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
|
});
|
||||||
|
context('Opening signals', () => {
|
||||||
|
beforeEach(() => {
|
||||||
|
esArchiverLoad('closed_signals');
|
||||||
|
loginAndWaitForPage(DETECTIONS);
|
||||||
|
});
|
||||||
|
|
||||||
|
it('Open one signal when more than one closed signals are selected', () => {
|
||||||
|
waitForSignals();
|
||||||
|
goToClosedSignals();
|
||||||
|
waitForSignalsToBeLoaded();
|
||||||
|
|
||||||
|
cy.get(NUMBER_OF_SIGNALS)
|
||||||
|
.invoke('text')
|
||||||
|
.then(numberOfSignals => {
|
||||||
|
const numberOfSignalsToBeOpened = 1;
|
||||||
|
const numberOfSignalsToBeSelected = 3;
|
||||||
|
|
||||||
|
cy.get(OPEN_CLOSE_SIGNALS_BTN).should('have.attr', 'disabled');
|
||||||
|
selectNumberOfSignals(numberOfSignalsToBeSelected);
|
||||||
|
cy.get(OPEN_CLOSE_SIGNALS_BTN).should('not.have.attr', 'disabled');
|
||||||
|
|
||||||
|
openFirstSignal();
|
||||||
|
cy.reload();
|
||||||
|
goToClosedSignals();
|
||||||
|
waitForSignalsToBeLoaded();
|
||||||
|
waitForSignals();
|
||||||
|
|
||||||
|
const expectedNumberOfSignals = +numberOfSignals - numberOfSignalsToBeOpened;
|
||||||
|
cy.get(NUMBER_OF_SIGNALS)
|
||||||
|
.invoke('text')
|
||||||
|
.should('eq', expectedNumberOfSignals.toString());
|
||||||
|
cy.get(SHOWING_SIGNALS)
|
||||||
|
.invoke('text')
|
||||||
|
.should('eql', `Showing ${expectedNumberOfSignals.toString()} signals`);
|
||||||
|
|
||||||
|
goToOpenedSignals();
|
||||||
|
waitForSignals();
|
||||||
|
|
||||||
|
cy.get(NUMBER_OF_SIGNALS)
|
||||||
|
.invoke('text')
|
||||||
|
.should('eql', numberOfSignalsToBeOpened.toString());
|
||||||
|
cy.get(SHOWING_SIGNALS)
|
||||||
|
.invoke('text')
|
||||||
|
.should('eql', `Showing ${numberOfSignalsToBeOpened.toString()} signal`);
|
||||||
|
cy.get(SIGNALS).should('have.length', numberOfSignalsToBeOpened);
|
||||||
|
});
|
||||||
|
});
|
||||||
|
});
|
||||||
});
|
});
|
||||||
|
|
|
@ -40,6 +40,12 @@ export const goToOpenedSignals = () => {
|
||||||
cy.get(OPENED_SIGNALS_BTN).click({ force: true });
|
cy.get(OPENED_SIGNALS_BTN).click({ force: true });
|
||||||
};
|
};
|
||||||
|
|
||||||
|
export const openFirstSignal = () => {
|
||||||
|
cy.get(OPEN_CLOSE_SIGNAL_BTN)
|
||||||
|
.first()
|
||||||
|
.click({ force: true });
|
||||||
|
};
|
||||||
|
|
||||||
export const openSignals = () => {
|
export const openSignals = () => {
|
||||||
cy.get(OPEN_CLOSE_SIGNALS_BTN).click({ force: true });
|
cy.get(OPEN_CLOSE_SIGNALS_BTN).click({ force: true });
|
||||||
};
|
};
|
||||||
|
|
BIN
x-pack/test/siem_cypress/es_archives/closed_signals/data.json.gz
Normal file
BIN
x-pack/test/siem_cypress/es_archives/closed_signals/data.json.gz
Normal file
Binary file not shown.
7605
x-pack/test/siem_cypress/es_archives/closed_signals/mappings.json
Normal file
7605
x-pack/test/siem_cypress/es_archives/closed_signals/mappings.json
Normal file
File diff suppressed because it is too large
Load diff
Loading…
Reference in a new issue