import { FtrProviderContext } from '../ftr_provider_context' ; import { WebElementWrapper } from '../../../../test/functional/services/lib/web_element_wrapper' ; export function EndpointPageUtils ( { getService } ) { const testSubjects = getService ( 'testSubjects' ) ; const find = getService ( 'find' ) ; return { param euiCheckBoxTestId async clickOnEuiCheckbox ( euiCheckBoxTestId ) { const euiCheckboxLabelElement = await find . byXPath ( `//input[@data-test-subj='${ euiCheckBoxTestId }']/../label` ) ; await euiCheckboxLabelElement . click ( ) ; } , param selector returns async tableHeaderVisibleText ( selector ) { const $ = await ( await testSubjects . find ( selector ) ) . parseDomContent ( ) ; return $ ( 'thead tr th' ) . toArray ( ) . map ( ( th ) => $ ( th ) . text ( ) . replace ( /&nbsp;/g , '' ) . trim ( ) ) ; } , param dataTestSubj returns async tableData ( dataTestSubj ) { await testSubjects . exists ( dataTestSubj ) ; const hostTable = await testSubjects . find ( dataTestSubj ) ; const $ = await hostTable . parseDomContent ( ) ; return $ ( 'tr' ) . toArray ( ) . map ( ( row ) => $ ( row ) . find ( '.euiTableCellContent' ) . toArray ( ) . map ( ( cell ) => $ ( cell ) . text ( ) . replace ( /&nbsp;/g , '' ) . trim ( ) ) ) ; } , } ; }