test: add a test for queryObjects with navigation (#4303)

References #4263
This commit is contained in:
Andrey Lushnikov 2019-04-18 10:03:06 -07:00 committed by GitHub
parent a8ffdad76e
commit 0c4d53b293
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -289,6 +289,15 @@ module.exports.addTests = function({testRunner, expect, headless, Errors, Device
const values = await page.evaluate(objects => Array.from(objects[0].values()), objectsHandle);
expect(values).toEqual(['hello', 'world']);
});
xit('should work for non-blank page', async({page, server}) => {
// Instantiate an object
await page.goto(server.EMPTY_PAGE);
await page.evaluate(() => window.set = new Set(['hello', 'world']));
const prototypeHandle = await page.evaluateHandle(() => Set.prototype);
const objectsHandle = await page.queryObjects(prototypeHandle);
const count = await page.evaluate(objects => objects.length, objectsHandle);
expect(count).toBe(1);
});
it('should fail for disposed handles', async({page, server}) => {
const prototypeHandle = await page.evaluateHandle(() => HTMLBodyElement.prototype);
await prototypeHandle.dispose();