From b3027a6e1612c7f6cb28d299a7d5783eb345aa6a Mon Sep 17 00:00:00 2001 From: Andrey Lushnikov Date: Thu, 9 May 2019 18:02:46 -0700 Subject: [PATCH] test(page): make sure exposeFunction works with complex args (#4411) --- test/page.spec.js | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/test/page.spec.js b/test/page.spec.js index e45e7707..cf78ce1c 100644 --- a/test/page.spec.js +++ b/test/page.spec.js @@ -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() {