-
Notifications
You must be signed in to change notification settings - Fork 8.2k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
[SecuritySolution][Case] Disable cases on detections in read-only mode (
#93010) * Disable cases on detetions on read-only mode * Add cypress tests
- Loading branch information
Showing
6 changed files
with
170 additions
and
18 deletions.
There are no files selected for viewing
60 changes: 60 additions & 0 deletions
60
x-pack/plugins/security_solution/cypress/integration/detection_alerts/attach_to_case.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,60 @@ | ||
/* | ||
* Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one | ||
* or more contributor license agreements. Licensed under the Elastic License | ||
* 2.0; you may not use this file except in compliance with the Elastic License | ||
* 2.0. | ||
*/ | ||
|
||
import { newRule } from '../../objects/rule'; | ||
import { ROLES } from '../../../common/test'; | ||
|
||
import { waitForAlertsIndexToBeCreated, waitForAlertsPanelToBeLoaded } from '../../tasks/alerts'; | ||
import { createCustomRuleActivated } from '../../tasks/api_calls/rules'; | ||
import { cleanKibana } from '../../tasks/common'; | ||
import { waitForAlertsToPopulate } from '../../tasks/create_new_rule'; | ||
import { login, loginAndWaitForPage, waitForPageWithoutDateRange } from '../../tasks/login'; | ||
import { refreshPage } from '../../tasks/security_header'; | ||
|
||
import { DETECTIONS_URL } from '../../urls/navigation'; | ||
import { ATTACH_ALERT_TO_CASE_BUTTON } from '../../screens/alerts_detection_rules'; | ||
|
||
const loadDetectionsPage = (role: ROLES) => { | ||
waitForPageWithoutDateRange(DETECTIONS_URL, role); | ||
waitForAlertsToPopulate(); | ||
}; | ||
|
||
describe('Alerts timeline', () => { | ||
before(() => { | ||
// First we login as a privileged user to create alerts. | ||
cleanKibana(); | ||
loginAndWaitForPage(DETECTIONS_URL, ROLES.platform_engineer); | ||
waitForAlertsPanelToBeLoaded(); | ||
waitForAlertsIndexToBeCreated(); | ||
createCustomRuleActivated(newRule); | ||
refreshPage(); | ||
waitForAlertsToPopulate(); | ||
|
||
// Then we login as read-only user to test. | ||
login(ROLES.reader); | ||
}); | ||
|
||
context('Privileges: read only', () => { | ||
beforeEach(() => { | ||
loadDetectionsPage(ROLES.reader); | ||
}); | ||
|
||
it('should not allow user with read only privileges to attach alerts to cases', () => { | ||
cy.get(ATTACH_ALERT_TO_CASE_BUTTON).first().should('be.disabled'); | ||
}); | ||
}); | ||
|
||
context('Privileges: can crud', () => { | ||
beforeEach(() => { | ||
loadDetectionsPage(ROLES.platform_engineer); | ||
}); | ||
|
||
it('should allow a user with crud privileges to attach alerts to cases', () => { | ||
cy.get(ATTACH_ALERT_TO_CASE_BUTTON).first().should('not.be.disabled'); | ||
}); | ||
}); | ||
}); |
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