import { getNewRule } from '../../objects/rule' ; import { PROVIDER_BADGE } from '../../screens/timeline' ; import { investigateFirstAlertInTimeline , 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 { loginAndWaitForPage } from '../../tasks/login' ; import { refreshPage } from '../../tasks/security_header' ; import { ALERTS_URL } from '../../urls/navigation' ; describe ( 'Alerts timeline' , ( ) => { beforeEach ( ( ) => { cleanKibana ( ) ; loginAndWaitForPage ( ALERTS_URL ) ; waitForAlertsPanelToBeLoaded ( ) ; waitForAlertsIndexToBeCreated ( ) ; createCustomRuleActivated ( getNewRule ( ) ) ; refreshPage ( ) ; waitForAlertsToPopulate ( 500 ) ; } ) ; it ( 'Investigate alert in default timeline' , ( ) => { investigateFirstAlertInTimeline ( ) ; cy . get ( PROVIDER_BADGE ) . first ( ) . invoke ( 'text' ) . then ( ( eventId ) => { investigateFirstAlertInTimeline ( ) ; cy . get ( PROVIDER_BADGE ) . filter ( ':visible' ) . should ( 'have.text' , eventId ) ; } ) ; } ) ; } ) ;