test: Add test for waitForFunction with cross-process navigation (#3826)

This commit is contained in:
Linus Unnebäck 2019-01-22 18:21:18 +00:00 committed by Andrey Lushnikov
parent 9fd4b67d0c
commit 9fb89e1bbc

View File

@ -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() {