import getElementPositionTopWindow from '../clientSideScripts/getElementPositionTopWindow' ; import getElementPositionTopDom from '../clientSideScripts/getElementPositionTopDom' ; import { getElementPositionTopScreenNativeMobile } from '../clientSideScripts/getElementPositionTopScreenNativeMobile' ; import { OFFSETS } from '../helpers/constants' ; import { Executor } from './methods.interface' ; import { ElementPosition } from '../clientSideScripts/elementPosition.interfaces' ; import getAndroidStatusAddressToolBarHeight from '../clientSideScripts/getAndroidStatusAddressToolBarHeight' ; import getIosStatusAddressToolBarHeight from '../clientSideScripts/getIosStatusAddressToolBarHeight' ; import { StatusAddressToolBarHeight } from '../clientSideScripts/statusAddressToolBarHeight.interfaces' ; /**
 * Get the element position on a Android device
 */ export async function getElementPositionAndroid ( executor , isNativeWebScreenshot , element ) { if ( isNativeWebScreenshot ) { const { height } = ( < StatusAddressToolBarHeight > ( await executor ( getAndroidStatusAddressToolBarHeight , OFFSETS . ANDROID , false ) ) ) . statusAddressBar ; return executor ( getElementPositionTopScreenNativeMobile , height , element ) ; } return executor ( getElementPositionTopWindow , element ) ; } param { function } executor param { number } innerHeight param { number } screenshotHeight param { element } element returns { Promise < { height : number , width : number , x : number , y : number * } > } export async function getElementPositionDesktop ( executor , innerHeight , screenshotHeight , element ) { if ( screenshotHeight > innerHeight ) { return executor ( getElementPositionTopDom , element ) ; } return executor ( getElementPositionTopWindow , element ) ; } /**
 * Get the element position on iOS Safari
 */ export async function getElementPositionIos ( executor , element ) { const { height } = ( < StatusAddressToolBarHeight > ( await executor ( getIosStatusAddressToolBarHeight , OFFSETS . IOS ) ) ) . statusAddressBar ; return executor ( getElementPositionTopScreenNativeMobile , height , element ) ; }