From 9fb89e1bbc143f5e34f5ff25dae92077bc198fce Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Linus=20Unneb=C3=A4ck?= Date: Tue, 22 Jan 2019 18:21:18 +0000 Subject: [PATCH] test: Add test for waitForFunction with cross-process navigation (#3826) --- test/waittask.spec.js | 13 +++++++++++++ 1 file changed, 13 insertions(+) diff --git a/test/waittask.spec.js b/test/waittask.spec.js index b7757b3536aaa..c23dd4fc6d176 100644 --- a/test/waittask.spec.js +++ b/test/waittask.spec.js @@ -172,6 +172,19 @@ module.exports.addTests = function({testRunner, expect, product}) { await page.evaluate(() => window.__injected = true); await watchdog; }); + it('should survive cross-process navigation', async({page, server}) => { + let fooFound = false; + const waitForFunction = page.waitForFunction('window.__FOO === 1').then(() => fooFound = true); + await page.goto(server.EMPTY_PAGE); + expect(fooFound).toBe(false); + await page.reload(); + expect(fooFound).toBe(false); + await page.goto(server.CROSS_PROCESS_PREFIX + '/grid.html'); + expect(fooFound).toBe(false); + await page.evaluate(() => window.__FOO = 1); + await waitForFunction; + expect(fooFound).toBe(true); + }); }); describe('Frame.waitForSelector', function() {