chore: add eval object test (#952)

This commit is contained in:
Pavel Feldman
2025-08-26 08:58:33 -07:00
committed by GitHub
parent 78298c3448
commit 11480fa8ce

View File

@@ -57,6 +57,25 @@ test('browser_evaluate (element)', async ({ client, server }) => {
});
});
test('browser_evaluate object', async ({ client, server }) => {
expect(await client.callTool({
name: 'browser_navigate',
arguments: { url: server.HELLO_WORLD },
})).toHaveResponse({
pageState: expect.stringContaining(`- Page Title: Title`),
});
expect(await client.callTool({
name: 'browser_evaluate',
arguments: {
function: '() => ({ title: document.title, url: document.URL })',
},
})).toHaveResponse({
result: JSON.stringify({ title: 'Title', url: server.HELLO_WORLD }, null, 2),
code: `await page.evaluate('() => ({ title: document.title, url: document.URL })');`,
});
});
test('browser_evaluate (error)', async ({ client, server }) => {
expect(await client.callTool({
name: 'browser_navigate',