@@ -417,16 +417,6 @@ async function waitForVerifiedSession(session, timeoutMs) {
417417
418418async function capture ( session , outputPath ) {
419419 await fs . mkdir ( path . dirname ( outputPath ) , { recursive : true } ) ;
420- await session . send ( "Input.dispatchKeyEvent" , { type : "keyDown" , key : "Escape" , code : "Escape" , windowsVirtualKeyCode : 27 } ) ;
421- await session . send ( "Input.dispatchKeyEvent" , { type : "keyUp" , key : "Escape" , code : "Escape" , windowsVirtualKeyCode : 27 } ) ;
422- const viewport = await session . evaluate ( "({ width: innerWidth, height: innerHeight })" ) ;
423- await session . send ( "Input.dispatchMouseEvent" , {
424- type : "mouseMoved" ,
425- x : Math . round ( viewport . width * 0.64 ) ,
426- y : Math . round ( viewport . height * 0.62 ) ,
427- button : "none" ,
428- } ) ;
429- await new Promise ( ( resolve ) => setTimeout ( resolve , 300 ) ) ;
430420 const result = await session . send ( "Page.captureScreenshot" , {
431421 format : "png" ,
432422 fromSurface : true ,
@@ -620,6 +610,9 @@ if (options.mode === "self-test") {
620610 invalidPageTargets . some ( ( item ) => isValidCdpPageTarget ( item , options . port ) ) ) {
621611 throw new Error ( "CDP URL and target validation self-test failed" ) ;
622612 }
613+ if ( / d i s p a t c h K e y E v e n t | d i s p a t c h M o u s e E v e n t / . test ( capture . toString ( ) ) ) {
614+ throw new Error ( "Screenshot capture must not dispatch renderer input events" ) ;
615+ }
623616 console . log ( JSON . stringify ( { pass : true , version : SKIN_VERSION , test : "loopback-cdp-validation" } ) ) ;
624617} else if ( options . mode === "check-payload" ) {
625618 const payload = await loadPayload ( ) ;
0 commit comments