Add response.addCode() calls to browser_wait_for tool and update tests

Co-authored-by: pavelfeldman <883973+pavelfeldman@users.noreply.github.com>
This commit is contained in:
copilot-swe-agent[bot]
2025-08-10 22:03:03 +00:00
parent 54754d8be1
commit f83a808d39
2 changed files with 27 additions and 3 deletions

View File

@@ -48,6 +48,7 @@ test('browser_wait_for(text)', async ({ client, server }) => {
name: 'browser_wait_for',
arguments: { text: 'Text to appear' },
})).toHaveResponse({
code: `await page.getByText("Text to appear").first().waitFor({ state: 'visible' });`,
pageState: expect.stringContaining(`- generic [ref=e3]: Text to appear`),
});
});
@@ -84,6 +85,23 @@ test('browser_wait_for(textGone)', async ({ client, server }) => {
name: 'browser_wait_for',
arguments: { textGone: 'Text to disappear' },
})).toHaveResponse({
code: `await page.getByText("Text to disappear").first().waitFor({ state: 'hidden' });`,
pageState: expect.stringContaining(`- generic [ref=e3]: Text to appear`),
});
});
test('browser_wait_for(time)', async ({ client, server }) => {
server.setContent('/', `<body><div>Hello World</div></body>`, 'text/html');
await client.callTool({
name: 'browser_navigate',
arguments: { url: server.PREFIX },
});
expect(await client.callTool({
name: 'browser_wait_for',
arguments: { time: 1 },
})).toHaveResponse({
code: `await new Promise(f => setTimeout(f, 1 * 1000));`,
});
});