From e4991a148901146f48bfdf3b22dbefba3702a188 Mon Sep 17 00:00:00 2001 From: Pavel Feldman Date: Sat, 14 Mar 2020 19:14:46 -0700 Subject: [PATCH] tests: add some failing page event tests (#1394) --- test/browsercontext.spec.js | 22 ++++++++++++++++++++-- 1 file changed, 20 insertions(+), 2 deletions(-) diff --git a/test/browsercontext.spec.js b/test/browsercontext.spec.js index 27ecc3f7a7..c52f0f7205 100644 --- a/test/browsercontext.spec.js +++ b/test/browsercontext.spec.js @@ -479,13 +479,31 @@ module.exports.describe = function({testRunner, expect, playwright, CHROMIUM, FF }); }); - describe('Events.BrowserContext.Page', function() { + describe('Events.BrowserContext.PageEvent', function() { + it.fail(true)('should have url with nowait', async({browser, server}) => { + const context = await browser.newContext(); + const page = await context.newPage(); + const [otherPage] = await Promise.all([ + context.waitForEvent('page').then(event => event.page({ waitUntil: 'nowait' })), + page.evaluate(url => window.open(url), server.EMPTY_PAGE) + ]); + expect(otherPage.url()).toBe(server.EMPTY_PAGE); + }); + it.fail(CHROMIUM)('should have url with domcontentloaded', async({browser, server}) => { + const context = await browser.newContext(); + const page = await context.newPage(); + const [otherPage] = await Promise.all([ + context.waitForEvent('page').then(event => event.page({ waitUntil: 'domcontentloaded' })), + page.evaluate(url => window.open(url), server.EMPTY_PAGE) + ]); + expect(otherPage.url()).toBe(server.EMPTY_PAGE); + }); it('should report when a new page is created and closed', async({browser, server}) => { const context = await browser.newContext(); const page = await context.newPage(); const [otherPage] = await Promise.all([ context.waitForEvent('page').then(event => event.page()), - page.evaluate(url => window.open(url), server.CROSS_PROCESS_PREFIX + '/empty.html').catch(e => console.log('eee = ' + e)), + page.evaluate(url => window.open(url), server.CROSS_PROCESS_PREFIX + '/empty.html'), ]); expect(otherPage.url()).toContain(server.CROSS_PROCESS_PREFIX); expect(await otherPage.evaluate(() => ['Hello', 'world'].join(' '))).toBe('Hello world');