Add conditional webkit expectations for browser_evaluate error test

Co-authored-by: pavelfeldman <883973+pavelfeldman@users.noreply.github.com>
This commit is contained in:
copilot-swe-agent[bot] 2025-07-18 19:52:18 +00:00
parent 2acdc66c27
commit 269d8d8a4d

View File

@ -50,7 +50,7 @@ test('browser_evaluate (element)', async ({ client, server }) => {
})).toContainTextContent(`- Result: "red"`); })).toContainTextContent(`- Result: "red"`);
}); });
test('browser_evaluate (error)', async ({ client, server }) => { test('browser_evaluate (error)', async ({ client, server, mcpBrowser }) => {
expect(await client.callTool({ expect(await client.callTool({
name: 'browser_navigate', name: 'browser_navigate',
arguments: { url: server.HELLO_WORLD }, arguments: { url: server.HELLO_WORLD },
@ -68,6 +68,12 @@ test('browser_evaluate (error)', async ({ client, server }) => {
expect(result.isError).toBe(true); expect(result.isError).toBe(true);
// Check that JavaScript error details are contained in the response // Check that JavaScript error details are contained in the response
expect(result.content?.[0].text).toContain('page._evaluateFunction'); if (mcpBrowser === 'webkit') {
expect(result.content?.[0].text).toContain('undefinedVariable is not defined'); // Webkit has different error message format
expect(result.content?.[0].text).toContain('undefinedVariable is not defined');
} else {
// Chrome, Firefox, etc. include the Playwright evaluation context
expect(result.content?.[0].text).toContain('page._evaluateFunction');
expect(result.content?.[0].text).toContain('undefinedVariable is not defined');
}
}); });