diff --git a/test/TestExpectations.json b/test/TestExpectations.json index 942abf26732..ed74d59d582 100644 --- a/test/TestExpectations.json +++ b/test/TestExpectations.json @@ -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", diff --git a/test/src/jshandle.spec.ts b/test/src/jshandle.spec.ts index 28097811e41..0c5de6cde06 100644 --- a/test/src/jshandle.spec.ts +++ b/test/src/jshandle.spec.ts @@ -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]', () => { diff --git a/test/src/page.spec.ts b/test/src/page.spec.ts index d83920d3ff1..ad88ec6e134 100644 --- a/test/src/page.spec.ts +++ b/test/src/page.spec.ts @@ -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();