tests: mark popup tests as passing on Firefox (#1466)

This commit is contained in:
Dmitry Gozman 2020-03-21 19:56:33 -07:00 committed by GitHub
parent 1b08797c6f
commit 3f90c09e6d
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
4 changed files with 28 additions and 14 deletions

View File

@ -9,7 +9,7 @@
"main": "index.js",
"playwright": {
"chromium_revision": "751710",
"firefox_revision": "1045",
"firefox_revision": "1047",
"webkit_revision": "1182"
},
"scripts": {

View File

@ -480,7 +480,7 @@ module.exports.describe = function({testRunner, expect, playwright, CHROMIUM, FF
});
describe('Events.BrowserContext.Page', function() {
it.fail(FFOX)('should have url', async({browser, server}) => {
it('should have url', async({browser, server}) => {
const context = await browser.newContext();
const page = await context.newPage();
const [otherPage] = await Promise.all([
@ -512,7 +512,7 @@ module.exports.describe = function({testRunner, expect, playwright, CHROMIUM, FF
expect(otherPage.url()).toBe('about:blank');
await context.close();
});
it.fail(FFOX)('should have about:blank for empty url with domcontentloaded', async({browser, server}) => {
it('should have about:blank for empty url with domcontentloaded', async({browser, server}) => {
const context = await browser.newContext();
const page = await context.newPage();
const [otherPage] = await Promise.all([
@ -523,7 +523,7 @@ module.exports.describe = function({testRunner, expect, playwright, CHROMIUM, FF
expect(otherPage.url()).toBe('about:blank');
await context.close();
});
it.fail(FFOX)('should report when a new page is created and closed', async({browser, server}) => {
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([
@ -582,7 +582,7 @@ module.exports.describe = function({testRunner, expect, playwright, CHROMIUM, FF
// Cleanup.
await context.close();
});
it.fail(FFOX)('should have an opener', async({browser, server}) => {
it('should have an opener', async({browser, server}) => {
const context = await browser.newContext();
const page = await context.newPage();
await page.goto(server.EMPTY_PAGE);

View File

@ -843,14 +843,18 @@ module.exports.describe = function({testRunner, expect, playwright, MAC, WIN, FF
await popup.waitForLoadState();
expect(popup.url()).toBe(server.EMPTY_PAGE);
});
it.fail(FFOX)('should wait for load state of empty url popup', async({browser, page}) => {
const [popup] = await Promise.all([
it('should wait for load state of empty url popup', async({browser, page}) => {
const [popup, readyState] = await Promise.all([
page.waitForEvent('popup'),
page.evaluate(() => window.open('') && 1),
page.evaluate(() => {
const popup = window.open('');
return popup.document.readyState;
}),
]);
await popup.waitForLoadState({ waitUntil: 'load' });
expect(await popup.evaluate(() => document.readyState)).toBe('complete');
});
expect(readyState).toBe(FFOX ? 'uninitialized' : 'complete');
expect(await popup.evaluate(() => document.readyState)).toBe(FFOX ? 'uninitialized' : 'complete');
});
it('should wait for load state of about:blank popup ', async({browser, page}) => {
const [popup] = await Promise.all([
page.waitForEvent('popup'),
@ -868,7 +872,7 @@ module.exports.describe = function({testRunner, expect, playwright, MAC, WIN, FF
expect(await popup.evaluate(() => document.readyState)).toBe('complete');
});
it('should wait for load state of popup with network url ', async({browser, page, server}) => {
await page.goto(server.EMPTY_PAGE);
await page.goto(server.EMPTY_PAGE);
const [popup] = await Promise.all([
page.waitForEvent('popup'),
page.evaluate(url => window.open(url) && 1, server.EMPTY_PAGE),
@ -877,7 +881,7 @@ module.exports.describe = function({testRunner, expect, playwright, MAC, WIN, FF
expect(await popup.evaluate(() => document.readyState)).toBe('complete');
});
it('should wait for load state of popup with network url and noopener ', async({browser, page, server}) => {
await page.goto(server.EMPTY_PAGE);
await page.goto(server.EMPTY_PAGE);
const [popup] = await Promise.all([
page.waitForEvent('popup'),
page.evaluate(url => window.open(url, null, 'noopener') && 1, server.EMPTY_PAGE),

View File

@ -245,6 +245,18 @@ module.exports.describe = function({testRunner, expect, playwright, CHROMIUM, WE
expect(await popup.evaluate(() => !!window.opener)).toBe(true);
await context.close();
});
it('should work with noopener and no url', async({browser}) => {
const context = await browser.newContext();
const page = await context.newPage();
const [popup] = await Promise.all([
page.waitForEvent('popup'),
page.evaluate(() => window.__popup = window.open(undefined, null, 'noopener')),
]);
expect(popup.url()).toBe('about:blank');
expect(await page.evaluate(() => !!window.opener)).toBe(false);
expect(await popup.evaluate(() => !!window.opener)).toBe(false);
await context.close();
});
it('should work with noopener and about:blank', async({browser}) => {
const context = await browser.newContext();
const page = await context.newPage();
@ -292,8 +304,6 @@ module.exports.describe = function({testRunner, expect, playwright, CHROMIUM, WE
page.$eval('a', a => a.click()),
]);
expect(await page.evaluate(() => !!window.opener)).toBe(false);
// TODO: At this point popup might still have about:blank as the current document.
// FFOX is slow enough to trigger this. We should do something about popups api.
expect(await popup.evaluate(() => !!window.opener)).toBe(false);
await context.close();
});