forked from elastic/kibana
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
[SIEM] Adds 'Closes and opens signals' Cypress test (elastic#59950) (e…
…lastic#60241) * adds signals data * adds 'closes and opens signals' * refactors test * adds extra check to see that the selected number of signals is correct Co-authored-by: Elastic Machine <elasticmachine@users.noreply.github.com> Co-authored-by: Elastic Machine <elasticmachine@users.noreply.github.com>
- Loading branch information
1 parent
66d5b22
commit 2ddbb89
Showing
10 changed files
with
7,809 additions
and
7 deletions.
There are no files selected for viewing
114 changes: 114 additions & 0 deletions
114
x-pack/legacy/plugins/siem/cypress/integration/detections.spec.ts
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,114 @@ | ||
/* | ||
* Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one | ||
* or more contributor license agreements. Licensed under the Elastic License; | ||
* you may not use this file except in compliance with the Elastic License. | ||
*/ | ||
import { | ||
NUMBER_OF_SIGNALS, | ||
SELECTED_SIGNALS, | ||
SHOWING_SIGNALS, | ||
SIGNALS, | ||
} from '../screens/detections'; | ||
|
||
import { | ||
closeSignals, | ||
goToClosedSignals, | ||
goToOpenedSignals, | ||
openSignals, | ||
selectNumberOfSignals, | ||
waitForSignalsPanelToBeLoaded, | ||
waitForSignals, | ||
waitForSignalsToBeLoaded, | ||
} from '../tasks/detections'; | ||
import { esArchiverLoad } from '../tasks/es_archiver'; | ||
import { loginAndWaitForPage } from '../tasks/login'; | ||
|
||
import { DETECTIONS } from '../urls/navigation'; | ||
|
||
describe('Detections', () => { | ||
before(() => { | ||
esArchiverLoad('signals'); | ||
loginAndWaitForPage(DETECTIONS); | ||
}); | ||
|
||
it('Closes and opens signals', () => { | ||
waitForSignalsPanelToBeLoaded(); | ||
waitForSignalsToBeLoaded(); | ||
|
||
cy.get(NUMBER_OF_SIGNALS) | ||
.invoke('text') | ||
.then(numberOfSignals => { | ||
cy.get(SHOWING_SIGNALS) | ||
.invoke('text') | ||
.should('eql', `Showing ${numberOfSignals} signals`); | ||
|
||
const numberOfSignalsToBeClosed = 3; | ||
selectNumberOfSignals(numberOfSignalsToBeClosed); | ||
|
||
cy.get(SELECTED_SIGNALS) | ||
.invoke('text') | ||
.should('eql', `Selected ${numberOfSignalsToBeClosed} signals`); | ||
|
||
closeSignals(); | ||
waitForSignals(); | ||
cy.reload(); | ||
waitForSignals(); | ||
|
||
const expectedNumberOfSignalsAfterClosing = +numberOfSignals - numberOfSignalsToBeClosed; | ||
cy.get(NUMBER_OF_SIGNALS) | ||
.invoke('text') | ||
.should('eq', expectedNumberOfSignalsAfterClosing.toString()); | ||
cy.get(SHOWING_SIGNALS) | ||
.invoke('text') | ||
.should('eql', `Showing ${expectedNumberOfSignalsAfterClosing.toString()} signals`); | ||
|
||
goToClosedSignals(); | ||
waitForSignals(); | ||
|
||
cy.get(NUMBER_OF_SIGNALS) | ||
.invoke('text') | ||
.should('eql', numberOfSignalsToBeClosed.toString()); | ||
cy.get(SHOWING_SIGNALS) | ||
.invoke('text') | ||
.should('eql', `Showing ${numberOfSignalsToBeClosed.toString()} signals`); | ||
cy.get(SIGNALS).should('have.length', numberOfSignalsToBeClosed); | ||
|
||
const numberOfSignalsToBeOpened = 1; | ||
selectNumberOfSignals(numberOfSignalsToBeOpened); | ||
|
||
cy.get(SELECTED_SIGNALS) | ||
.invoke('text') | ||
.should('eql', `Selected ${numberOfSignalsToBeOpened} signal`); | ||
|
||
openSignals(); | ||
waitForSignals(); | ||
cy.reload(); | ||
waitForSignalsToBeLoaded(); | ||
waitForSignals(); | ||
goToClosedSignals(); | ||
waitForSignals(); | ||
|
||
const expectedNumberOfClosedSignalsAfterOpened = 2; | ||
cy.get(NUMBER_OF_SIGNALS) | ||
.invoke('text') | ||
.should('eql', expectedNumberOfClosedSignalsAfterOpened.toString()); | ||
cy.get(SHOWING_SIGNALS) | ||
.invoke('text') | ||
.should('eql', `Showing ${expectedNumberOfClosedSignalsAfterOpened.toString()} signals`); | ||
cy.get(SIGNALS).should('have.length', expectedNumberOfClosedSignalsAfterOpened); | ||
|
||
goToOpenedSignals(); | ||
waitForSignals(); | ||
|
||
const expectedNumberOfOpenedSignals = | ||
+numberOfSignals - expectedNumberOfClosedSignalsAfterOpened; | ||
cy.get(SHOWING_SIGNALS) | ||
.invoke('text') | ||
.should('eql', `Showing ${expectedNumberOfOpenedSignals.toString()} signals`); | ||
|
||
cy.get('[data-test-subj="server-side-event-count"]') | ||
.invoke('text') | ||
.should('eql', expectedNumberOfOpenedSignals.toString()); | ||
}); | ||
}); | ||
}); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Binary file not shown.
Oops, something went wrong.