browser://console should be single resource (#34)

Returning one resource per log line is flooding the Claude UI:

<img width="1061" alt="Screenshot 2025-03-19 at 16 01 45"
src="https://github.com/user-attachments/assets/1779374e-6b9d-44d7-b916-c521933e1085"
/>

Returning one big resource with all lines feels better.

original PR: https://github.com/microsoft/playwright/pull/35276
This commit is contained in:
Simon Knott
2025-03-26 16:27:55 +01:00
committed by GitHub
parent cd214cb58d
commit bd9c8729ff
2 changed files with 40 additions and 10 deletions

View File

@@ -331,3 +331,35 @@ test.describe('test browser_select_option', () => {
}));
});
});
test('browser://console', async ({ server }) => {
await server.send({
jsonrpc: '2.0',
id: 2,
method: 'tools/call',
params: {
name: 'browser_navigate',
arguments: {
url: 'data:text/html,<html><script>console.log("Hello, world!");console.error("Error"); </script></html>',
},
},
});
const response = await server.send({
jsonrpc: '2.0',
id: 3,
method: 'resources/read',
params: {
uri: 'browser://console',
},
});
expect(response).toEqual(expect.objectContaining({
result: expect.objectContaining({
contents: [{
uri: 'browser://console',
mimeType: 'text/plain',
text: '[LOG] Hello, world!\n[ERROR] Error',
}],
}),
}));
});