import * as SUT from '../index' ; import { showMousePosition } from '../../../dom-actions' ; import { sleep } from '../../../../utils' ; import { Browser , firefox } from 'playwright' ; import * as path from 'path' ; describe . skip ( 'handle is moving' , ( ) : void => { let browser = undefined ; beforeEach ( ( ) : void => { } ) ; afterEach ( async ( ) : Promise < void > => { if ( browser ) { await browser . close ( ) ; } } ) ; test ( 'should detect that selector is moving - firefox' , async ( ) : Promise < void > => { browser = await firefox . launch ( { headless : true } ) ; const browserContext = await browser . newContext ( { viewport : null } ) ; const page = await browserContext . newPage ( ) ; await showMousePosition ( page ) ; const url = `file:${ path . join ( __dirname , 'is-handle-moving.test1.html' ) }` ; await page . goto ( url ) ; await sleep ( 100 ) ; const selector = '#moving' ; const handle = await page . $ ( selector ) ; const isMoving = await SUT . isHandleMoving ( handle ) ; expect ( isMoving ) . toBe ( true ) ; } ) ; test ( 'should detect that selector is not moving - firefox' , async ( ) : Promise < void > => { browser = await firefox . launch ( { headless : true } ) ; const browserContext = await browser . newContext ( { viewport : null } ) ; const page = await browserContext . newPage ( ) ; await showMousePosition ( page ) ; const url = `file:${ path . join ( __dirname , 'is-handle-moving.test2.html' ) }` ; await page . goto ( url ) ; await sleep ( 2000 ) ; const selector = '#moving' ; const handle = await page . $ ( selector ) ; const isMoving = await SUT . isHandleMoving ( handle ) ; expect ( isMoving ) . toBe ( false ) ; } ) ; } ) ;