Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 7 additions & 0 deletions tests/tools/console.test.js.snapshot
Original file line number Diff line number Diff line change
Expand Up @@ -112,3 +112,10 @@ Learn more:
### Affected resources
reqid=<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)
`;
13 changes: 13 additions & 0 deletions tests/tools/console.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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();
Expand Down