Skip to content

Commit a04a3d3

Browse files
committed
tests: add page event tests
1 parent e692dd6 commit a04a3d3

File tree

1 file changed

+20
-2
lines changed

1 file changed

+20
-2
lines changed

test/browsercontext.spec.js

+20-2
Original file line numberDiff line numberDiff line change
@@ -479,13 +479,31 @@ module.exports.describe = function({testRunner, expect, playwright, CHROMIUM, FF
479479
});
480480
});
481481

482-
describe('Events.BrowserContext.Page', function() {
482+
fdescribe('Events.BrowserContext.PageEvent', function() {
483+
it.fail(true)('should have url with nowait', async({browser, server}) => {
484+
const context = await browser.newContext();
485+
const page = await context.newPage();
486+
const [otherPage] = await Promise.all([
487+
context.waitForEvent('page').then(event => event.page({ waitUntil: 'nowait' })),
488+
page.evaluate(url => window.open(url), server.EMPTY_PAGE)
489+
]);
490+
expect(otherPage.url()).toBe(server.EMPTY_PAGE);
491+
});
492+
it.fail(CHROMIUM)('should have url with domcontentloaded', async({browser, server}) => {
493+
const context = await browser.newContext();
494+
const page = await context.newPage();
495+
const [otherPage] = await Promise.all([
496+
context.waitForEvent('page').then(event => event.page({ waitUntil: 'domcontentloaded' })),
497+
page.evaluate(url => window.open(url), server.EMPTY_PAGE)
498+
]);
499+
expect(otherPage.url()).toBe(server.EMPTY_PAGE);
500+
});
483501
it('should report when a new page is created and closed', async({browser, server}) => {
484502
const context = await browser.newContext();
485503
const page = await context.newPage();
486504
const [otherPage] = await Promise.all([
487505
context.waitForEvent('page').then(event => event.page()),
488-
page.evaluate(url => window.open(url), server.CROSS_PROCESS_PREFIX + '/empty.html').catch(e => console.log('eee = ' + e)),
506+
page.evaluate(url => window.open(url), server.CROSS_PROCESS_PREFIX + '/empty.html'),
489507
]);
490508
expect(otherPage.url()).toContain(server.CROSS_PROCESS_PREFIX);
491509
expect(await otherPage.evaluate(() => ['Hello', 'world'].join(' '))).toBe('Hello world');

0 commit comments

Comments
 (0)