test(page): make sure exposeFunction works with complex args (#4411)

This commit is contained in:
Andrey Lushnikov 2019-05-09 18:02:46 -07:00 committed by GitHub
parent 5f66d82638
commit b3027a6e16
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -656,6 +656,13 @@ module.exports.addTests = function({testRunner, expect, headless, puppeteer, CHR
});
expect(result).toBe(15);
});
it('should work with complex objects', async({page, server}) => {
await page.exposeFunction('complexObject', function(a, b) {
return {x: a.x + b.x};
});
const result = await page.evaluate(async() => complexObject({x: 5}, {x: 2}));
expect(result.x).toBe(7);
});
});
describe('Page.Events.PageError', function() {