chore: add test for remote value console logs (#11910)

This commit is contained in:
jrandolf 2024-02-13 17:04:59 +01:00 committed by GitHub
parent d14c47097d
commit 9193832a2b
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
2 changed files with 27 additions and 0 deletions

View File

@ -993,6 +993,18 @@
"parameters": ["webDriverBiDi"],
"expectations": ["SKIP"]
},
{
"testIdPattern": "[page.spec] Page Page.Events.Console should return remote objects",
"platforms": ["darwin", "linux", "win32"],
"parameters": ["webDriverBiDi"],
"expectations": ["FAIL"]
},
{
"testIdPattern": "[page.spec] Page Page.Events.Console should return remote objects",
"platforms": ["darwin", "linux", "win32"],
"parameters": ["firefox"],
"expectations": ["SKIP"]
},
{
"testIdPattern": "[page.spec] Page Page.Events.Console should trigger correct Log",
"platforms": ["darwin", "linux", "win32"],

View File

@ -496,6 +496,21 @@ describe('Page', function () {
'JSHandle@window',
]);
});
it('should return remote objects', async () => {
const {page} = await getTestState();
const logPromise = waitEvent<ConsoleMessage>(page, 'console');
await page.evaluate(() => {
(globalThis as any).test = 1;
console.log(1, 2, 3, globalThis);
});
const log = await logPromise;
expect(log.text()).toBe('1 2 3 JSHandle@object');
expect(log.args()).toHaveLength(4);
expect(await (await log.args()[3]!.getProperty('test')).jsonValue()).toBe(
1
);
});
it('should trigger correct Log', async () => {
const {page, server, isChrome} = await getTestState();