import { FtrService } from '../../../functional/ftr_provider_context' ; import { WebElementWrapper } from '../../../../../test/functional/services/lib/web_element_wrapper' ; export class HostsPageObject extends FtrService { private readonly pageObjects = this . ctx . getPageObjects ( [ 'common' , 'header' ] ) ; private readonly testSubjects = this . ctx . getService ( 'testSubjects' ) ; async navigateToHostDetails ( hostName ) { await this . pageObjects . common . navigateToUrl ( 'securitySolution' , `hosts/${ hostName }` , { shouldUseHashForSubUrl : false , } ) ; await this . pageObjects . header . waitUntilLoadingHasFinished ( ) ; } async ensureOnHostDetails ( ) { await this . testSubjects . existOrFail ( 'hostDetailsPage' ) ; } /**
     * Returns an object with the Endpoint overview data, where the keys are the visible labels in the UI.
     * Must be on the Host details in order for this page object to work
     */ async hostDetailsEndpointOverviewData ( ) { await this . ensureOnHostDetails ( ) ; const endpointDescriptionLists = await this . testSubjects . findAll ( 'endpoint-overview' ) ; const data = { } ; for ( const dlElement of endpointDescriptionLists ) { const $ = await dlElement . parseDomContent ( ) ; const title = $ ( 'dt' ) . text ( ) . replace ( /&nbsp;/g , '' ) . trim ( ) ; const $ddElement = $ ( 'dd' ) ; const $valueContainer = $ddElement . find ( '.draggable-keyboard-wrapper .euiToolTipAnchor' ) ; const value = ( $valueContainer . length > 0 ? $valueContainer : $ddElement ) . text ( ) . replace ( /&nbsp;/g , '' ) . trim ( ) ; data [ title ] = value ; } return data ; } }