Chrome DevTools for coding agents
test: add a console error object test (#910)
Alex Rudenko6d0eb491fd8e
diff --git a/tests/tools/console.test.js.snapshot b/tests/tools/console.test.js.snapshotindex c7c99410..04cee644 100644--- a/tests/tools/console.test.js.snapshot+++ b/tests/tools/console.test.js.snapshot@@ -112,3 +112,10 @@ Learn more:### Affected resourcesreqid=<reqid> data={"corsErrorStatus":{"corsError":"PreflightMissingAllowOriginHeader","failedParameter":""},"isWarning":false,"request":{"url":"http://hostname:port/data.json"},"initiatorOrigin":"","clientSecurityState":{"initiatorIsSecureContext":false,"initiatorIPAddressSpace":"Loopback","privateNetworkRequestPolicy":"BlockFromInsecureToMorePrivate"}}`;++exports[`console > list_console_messages > lists error objects 1`] = `+# test response+## Console messages+Showing 1-1 of 1 (Page 1 of 1).+msgid=1 [error] JSHandle@error (1 args)+`;diff --git a/tests/tools/console.test.ts b/tests/tools/console.test.tsindex 79eae104..bb074377 100644--- a/tests/tools/console.test.ts+++ b/tests/tools/console.test.ts@@ -42,6 +42,19 @@ describe('console', () => {});});+ it('lists error objects', async t => {+ await withMcpContext(async (response, context) => {+ const page = await context.newPage();+ await page.setContent(+ '<script>console.error(new Error("This is an error"))</script>',+ );+ await listConsoleMessages.handler({params: {}}, response, context);+ const formattedResponse = await response.handle('test', context);+ const textContent = getTextContent(formattedResponse.content[0]);+ t.assert.snapshot?.(textContent);+ });+ });+it('work with primitive unhandled errors', async () => {await withMcpContext(async (response, context) => {const page = await context.newPage();