import { ElementTextCondition , ElementTextNotMatchCondition , FrameCondition , TitleCondition , TitleNotMatchCondition , URLCondition , URLNotMatchCondition , } from '../page/conditions' ; import { ElementHandle as TargetElementHandle } from '../page/ElementHandle' ; import { BaseLocator } from '../page/Locator' ; import { Point } from '../page/Point' ; import { Locator , ScrollDirection , ElementHandle } from '../page/types' ; export const isInstanceOf = ( arg , conditions ) : boolean => conditions . some ( ( condition ) => arg instanceof condition ) ; export const isAnElementHandle = ( arg ) : boolean => isInstanceOf ( arg , [ TargetElementHandle ] ) ; export const isURLCondition = ( arg ) : boolean => isInstanceOf ( arg , [ URLCondition , URLNotMatchCondition ] ) ; export const isTitleCondition = ( arg ) : boolean => isInstanceOf ( arg , [ TitleCondition , TitleNotMatchCondition ] ) ; export const isFrameCondition = ( arg ) : boolean => isInstanceOf ( arg , [ FrameCondition ] ) ; export const isElementTextCondition = ( arg ) : boolean => isInstanceOf ( arg , [ ElementTextCondition , ElementTextNotMatchCondition ] ) ; export const isLocator = ( target ) : target is Locator => isInstanceOf ( target , [ BaseLocator ] ) ; export const isPoint = ( target ) : target is Point => { return ( Array . isArray ( target ) && target . length === 2 && typeof target [ 0 ] === 'number' && typeof target [ 1 ] === 'number' ) ; } ;