chore: update tests (#12081)

This commit is contained in:
Nikolay Vitkov 2024-03-13 16:55:34 +01:00 committed by GitHub
parent 26376224d5
commit 02b9678f85
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
3 changed files with 25 additions and 5 deletions

View File

@ -467,6 +467,13 @@
"expectations": ["FAIL"],
"comment": "TODO: add a comment explaining why this expectation is required (include links to issues)"
},
{
"testIdPattern": "[jshandle.spec] JSHandle JSHandle.toString should work with window subtypes",
"platforms": ["darwin", "linux", "win32"],
"parameters": ["cdp"],
"expectations": ["FAIL"],
"comment": "CDP does not have special type for window"
},
{
"testIdPattern": "[jshandle.spec] JSHandle Page.evaluateHandle should return the RemoteObject",
"platforms": ["darwin", "linux", "win32"],
@ -685,7 +692,7 @@
"platforms": ["darwin", "linux", "win32"],
"parameters": ["webDriverBiDi"],
"expectations": ["FAIL"],
"comment": "TODO: add a comment explaining why this expectation is required (include links to issues)"
"comment": "BiDi does not support getting a Handle for log args"
},
{
"testIdPattern": "[page.spec] Page Page.Events.Console should return remote objects",

View File

@ -326,6 +326,16 @@ describe('JSHandle', function () {
'JSHandle@proxy'
);
});
it('should work with window subtypes', async () => {
const {page} = await getTestState();
expect((await page.evaluateHandle('window')).toString()).toBe(
'JSHandle@window'
);
expect((await page.evaluateHandle('globalThis')).toString()).toBe(
'JSHandle@window'
);
});
});
describe('JSHandle[Symbol.dispose]', () => {

View File

@ -506,11 +506,14 @@ describe('Page', function () {
console.log(1, 2, 3, globalThis);
});
const log = await logPromise;
expect(log.text()).toBe('1 2 3 JSHandle@object');
expect(log.text()).atLeastOneToContain([
'1 2 3 JSHandle@object',
'1 2 3 JSHandle@window',
]);
expect(log.args()).toHaveLength(4);
expect(await (await log.args()[3]!.getProperty('test')).jsonValue()).toBe(
1
);
using property = await log.args()[3]!.getProperty('test');
expect(await property.jsonValue()).toBe(1);
});
it('should trigger correct Log', async () => {
const {page, server, isChrome} = await getTestState();