import { JSON_TEXT } from '../../screens/alerts_details' ; import { expandFirstAlert , waitForAlertsIndexToBeCreated , waitForAlertsPanelToBeLoaded , } from '../../tasks/alerts' ; import { openJsonView } from '../../tasks/alerts_details' ; import { createCustomRuleActivated } from '../../tasks/api_calls/rules' ; import { cleanKibana } from '../../tasks/common' ; import { esArchiverCCSLoad } from '../../tasks/es_archiver' ; import { loginAndWaitForPageWithoutDateRange } from '../../tasks/login' ; import { getUnmappedCCSRule } from '../../objects/rule' ; import { ALERTS_URL } from '../../urls/navigation' ; describe ( 'Alert details with unmapped fields' , ( ) => { beforeEach ( ( ) => { cleanKibana ( ) ; esArchiverCCSLoad ( 'unmapped_fields' ) ; loginAndWaitForPageWithoutDateRange ( ALERTS_URL ) ; waitForAlertsPanelToBeLoaded ( ) ; waitForAlertsIndexToBeCreated ( ) ; createCustomRuleActivated ( getUnmappedCCSRule ( ) ) ; loginAndWaitForPageWithoutDateRange ( ALERTS_URL ) ; waitForAlertsPanelToBeLoaded ( ) ; expandFirstAlert ( ) ; } ) ; it ( 'Displays the unmapped field on the JSON view' , ( ) => { const expectedUnmappedValue = 'This is the unmapped field' ; openJsonView ( ) ; cy . get ( JSON_TEXT ) . then ( ( x ) => { const parsed = JSON . parse ( x . text ( ) ) ; expect ( parsed . _source . unmapped ) . to . equal ( expectedUnmappedValue ) ; } ) ; } ) ; } ) ;