chore: include page errors in console messages (#671)

Fixes https://github.com/microsoft/playwright-mcp/issues/669
This commit is contained in:
Pavel Feldman
2025-07-15 15:46:09 -07:00
committed by GitHub
parent be8adb1866
commit a5a57df105
4 changed files with 68 additions and 15 deletions

View File

@@ -214,7 +214,7 @@ test('browser_type', async ({ client, server }) => {
});
expect(await client.callTool({
name: 'browser_console_messages',
})).toHaveTextContent('[LOG] Key pressed: Enter , Text: Hi!');
})).toHaveTextContent(/\[LOG\] Key pressed: Enter , Text: Hi!/);
});
test('browser_type (slowly)', async ({ client, server }) => {
@@ -238,14 +238,13 @@ test('browser_type (slowly)', async ({ client, server }) => {
slowly: true,
},
});
expect(await client.callTool({
const response = await client.callTool({
name: 'browser_console_messages',
})).toHaveTextContent([
'[LOG] Key pressed: H Text: ',
'[LOG] Key pressed: i Text: H',
'[LOG] Key pressed: ! Text: Hi',
'[LOG] Key pressed: Enter Text: Hi!',
].join('\n'));
});
expect(response).toHaveTextContent(/\[LOG\] Key pressed: H Text: /);
expect(response).toHaveTextContent(/\[LOG\] Key pressed: i Text: H/);
expect(response).toHaveTextContent(/\[LOG\] Key pressed: ! Text: Hi/);
expect(response).toHaveTextContent(/\[LOG\] Key pressed: Enter Text: Hi!/);
});
test('browser_resize', async ({ client, server }) => {