Skip to content

Commit 112da99

Browse files
committed
fix: accidental extra typing in the fill tool
1 parent 7e1ec81 commit 112da99

2 files changed

Lines changed: 59 additions & 1 deletion

File tree

src/tools/input.ts

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -220,7 +220,6 @@ export const fill = defineTool({
220220
},
221221
handler: async (request, response, context) => {
222222
await context.waitForEventsAfterAction(async () => {
223-
await context.getSelectedPage().keyboard.type(request.params.value);
224223
await fillFormElement(
225224
request.params.uid,
226225
request.params.value,

tests/tools/input.test.ts

Lines changed: 59 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -22,6 +22,7 @@ import {
2222
import {parseKey} from '../../src/utils/keyboard.js';
2323
import {serverHooks} from '../server.js';
2424
import {html, withMcpContext} from '../utils.js';
25+
import { McpResponse } from '../../src/McpResponse.js';
2526

2627
describe('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

Comments
 (0)