File tree Expand file tree Collapse file tree 4 files changed +41
-3
lines changed
Expand file tree Collapse file tree 4 files changed +41
-3
lines changed Original file line number Diff line number Diff line change @@ -53,7 +53,7 @@ const nodeArgs = [
5353 'spec' ,
5454 '--test-force-exit' ,
5555 '--test' ,
56- '--test-timeout=30000 ' ,
56+ '--test-timeout=60000 ' ,
5757 ...flags ,
5858 ...files ,
5959] ;
Original file line number Diff line number Diff line change @@ -159,7 +159,12 @@ async function fillFormElement(
159159 if ( aXNode && aXNode . role === 'combobox' ) {
160160 await selectOption ( handle , aXNode , value ) ;
161161 } else {
162- await handle . asLocator ( ) . fill ( value ) ;
162+ // Increase timeout for longer input values.
163+ const timeoutPerChar = 10 ; // ms
164+ const fillTimeout =
165+ context . getSelectedPage ( ) . getDefaultTimeout ( ) +
166+ value . length * timeoutPerChar ;
167+ await handle . asLocator ( ) . setTimeout ( fillTimeout ) . fill ( value ) ;
163168 }
164169 } finally {
165170 void handle . dispose ( ) ;
@@ -183,6 +188,7 @@ export const fill = defineTool({
183188 } ,
184189 handler : async ( request , response , context ) => {
185190 await context . waitForEventsAfterAction ( async ( ) => {
191+ await context . getSelectedPage ( ) . keyboard . type ( request . params . value ) ;
186192 await fillFormElement (
187193 request . params . uid ,
188194 request . params . value ,
Original file line number Diff line number Diff line change @@ -301,6 +301,38 @@ describe('input', () => {
301301 assert . strictEqual ( selectedValue , 'v2' ) ;
302302 } ) ;
303303 } ) ;
304+
305+ it ( 'fills out a textarea with long text' , async ( ) => {
306+ await withMcpContext ( async ( response , context ) => {
307+ const page = context . getSelectedPage ( ) ;
308+ await page . setContent ( html `< textarea /> ` ) ;
309+ await page . focus ( 'textarea' ) ;
310+ await context . createTextSnapshot ( ) ;
311+ await page . setDefaultTimeout ( 1000 ) ;
312+ await fill . handler (
313+ {
314+ params : {
315+ uid : '1_1' ,
316+ value : '1' . repeat ( 3000 ) ,
317+ } ,
318+ } ,
319+ response ,
320+ context ,
321+ ) ;
322+ assert . strictEqual (
323+ response . responseLines [ 0 ] ,
324+ 'Successfully filled out the element' ,
325+ ) ;
326+ assert . ok ( response . includeSnapshot ) ;
327+ assert . ok (
328+ await page . evaluate ( ( ) => {
329+ return (
330+ document . body . querySelector ( 'textarea' ) ?. value . length === 3_000
331+ ) ;
332+ } ) ,
333+ ) ;
334+ } ) ;
335+ } ) ;
304336 } ) ;
305337
306338 describe ( 'drags' , ( ) => {
Original file line number Diff line number Diff line change @@ -140,7 +140,7 @@ describe('performance', () => {
140140 } ) ;
141141 } ) ;
142142
143- it . only ( 'supports filePath' , async ( ) => {
143+ it ( 'supports filePath' , async ( ) => {
144144 const rawData = loadTraceAsBuffer ( 'basic-trace.json.gz' ) ;
145145 // rawData is the decompressed buffer (based on loadTraceAsBuffer implementation).
146146 // We want to simulate saving it as a .gz file, so the tool should compress it.
You can’t perform that action at this time.
0 commit comments