@@ -9,6 +9,7 @@ import fs from 'node:fs/promises';
99import path from 'node:path' ;
1010import { describe , it } from 'node:test' ;
1111
12+ import { McpResponse } from '../../src/McpResponse.js' ;
1213import {
1314 click ,
1415 hover ,
@@ -382,6 +383,79 @@ 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
393+ id ="email "
394+ value ="user@test.com "
395+ />
396+ < input
397+ id ="password "
398+ type ="password "
399+ />
400+ </ form > ` ,
401+ ) ;
402+ await context . createTextSnapshot ( ) ;
403+
404+ // Fill email
405+ const response1 = new McpResponse ( ) ;
406+ await fill . handler (
407+ {
408+ params : {
409+ uid : '1_1' , // email input
410+ value : 'new@test.com' ,
411+ } ,
412+ } ,
413+ response1 ,
414+ context ,
415+ ) ;
416+ assert . strictEqual (
417+ response1 . responseLines [ 0 ] ,
418+ 'Successfully filled out the element' ,
419+ ) ;
420+
421+ // Fill password
422+ const response2 = new McpResponse ( ) ;
423+ await fill . handler (
424+ {
425+ params : {
426+ uid : '1_2' , // password input
427+ value : 'secret' ,
428+ } ,
429+ } ,
430+ response2 ,
431+ context ,
432+ ) ;
433+ assert . strictEqual (
434+ response2 . responseLines [ 0 ] ,
435+ 'Successfully filled out the element' ,
436+ ) ;
437+
438+ // Verify values
439+ const values = await page . evaluate ( ( ) => {
440+ return {
441+ email : ( document . getElementById ( 'email' ) as HTMLInputElement ) . value ,
442+ password : ( document . getElementById ( 'password' ) as HTMLInputElement )
443+ . value ,
444+ } ;
445+ } ) ;
446+
447+ assert . strictEqual (
448+ values . email ,
449+ 'new@test.com' ,
450+ 'Email should be updated correctly' ,
451+ ) ;
452+ assert . strictEqual (
453+ values . password ,
454+ 'secret' ,
455+ 'Password should be updated correctly' ,
456+ ) ;
457+ } ) ;
458+ } ) ;
385459 } ) ;
386460
387461 describe ( 'drags' , ( ) => {
0 commit comments