import { getBuildingBlockRule } from '../../objects/rule' ; import { OVERVIEW_ALERTS_HISTOGRAM } from '../../screens/overview' ; import { OVERVIEW } from '../../screens/security_header' ; import { waitForAlertsIndexToBeCreated , waitForAlertsPanelToBeLoaded } from '../../tasks/alerts' ; import { goToRuleDetails } from '../../tasks/alerts_detection_rules' ; import { createCustomRuleActivated } from '../../tasks/api_calls/rules' ; import { cleanKibana } from '../../tasks/common' ; import { waitForAlertsToPopulate , waitForTheRuleToBeExecuted } from '../../tasks/create_new_rule' ; import { loginAndWaitForPage , loginAndWaitForPageWithoutDateRange } from '../../tasks/login' ; import { navigateFromHeaderTo } from '../../tasks/security_header' ; import { ALERTS_URL , DETECTIONS_RULE_MANAGEMENT_URL } from '../../urls/navigation' ; const EXPECTED_NUMBER_OF_ALERTS = 16 ; describe ( 'Alerts generated by building block rules' , ( ) => { beforeEach ( ( ) => { cleanKibana ( ) ; loginAndWaitForPageWithoutDateRange ( ALERTS_URL ) ; waitForAlertsPanelToBeLoaded ( ) ; waitForAlertsIndexToBeCreated ( ) ; } ) ; it ( 'Alerts should be visible on the Rule Detail page and not visible on the Overview page' , ( ) => { createCustomRuleActivated ( getBuildingBlockRule ( ) ) ; loginAndWaitForPage ( DETECTIONS_RULE_MANAGEMENT_URL ) ; goToRuleDetails ( ) ; waitForTheRuleToBeExecuted ( ) ; waitForAlertsToPopulate ( EXPECTED_NUMBER_OF_ALERTS ) ; navigateFromHeaderTo ( OVERVIEW ) ; cy . get ( OVERVIEW_ALERTS_HISTOGRAM ) . should ( 'contain.text' , 'No data to display' ) ; } ) ; } ) ;