@@ -22,6 +22,7 @@ import {
2222import { parseKey } from '../../src/utils/keyboard.js' ;
2323import { serverHooks } from '../server.js' ;
2424import { html , withMcpContext } from '../utils.js' ;
25+ import { McpResponse } from '../../src/McpResponse.js' ;
2526
2627describe ( 'input' , ( ) => {
2728 const server = serverHooks ( ) ;
@@ -382,6 +383,64 @@ describe('input', () => {
382383 ) ;
383384 } ) ;
384385 } ) ;
386+
387+ it ( 'reproduction: fill isolation' , async ( ) => {
388+ await withMcpContext ( async ( _response , context ) => {
389+ const page = context . getSelectedPage ( ) ;
390+ await page . setContent (
391+ html `< form >
392+ < input id ="email " value ="user@test.com " />
393+ < input id ="password " type ="password " />
394+ </ form > ` ,
395+ ) ;
396+ await context . createTextSnapshot ( ) ;
397+
398+ // Fill email
399+ const response1 = new McpResponse ( ) ;
400+ await fill . handler (
401+ {
402+ params : {
403+ uid : '1_1' , // email input
404+ value : 'new@test.com' ,
405+ } ,
406+ } ,
407+ response1 ,
408+ context ,
409+ ) ;
410+ assert . strictEqual (
411+ response1 . responseLines [ 0 ] ,
412+ 'Successfully filled out the element' ,
413+ ) ;
414+
415+ // Fill password
416+ const response2 = new McpResponse ( ) ;
417+ await fill . handler (
418+ {
419+ params : {
420+ uid : '1_2' , // password input
421+ value : 'secret' ,
422+ } ,
423+ } ,
424+ response2 ,
425+ context ,
426+ ) ;
427+ assert . strictEqual (
428+ response2 . responseLines [ 0 ] ,
429+ 'Successfully filled out the element' ,
430+ ) ;
431+
432+ // Verify values
433+ const values = await page . evaluate ( ( ) => {
434+ return {
435+ email : ( document . getElementById ( 'email' ) as HTMLInputElement ) . value ,
436+ password : ( document . getElementById ( 'password' ) as HTMLInputElement ) . value ,
437+ } ;
438+ } ) ;
439+
440+ assert . strictEqual ( values . email , 'new@test.com' , 'Email should be updated correctly' ) ;
441+ assert . strictEqual ( values . password , 'secret' , 'Password should be updated correctly' ) ;
442+ } ) ;
443+ } ) ;
385444 } ) ;
386445
387446 describe ( 'drags' , ( ) => {
0 commit comments