Skip to content

Commit 3f90c09

Browse files
authored
tests: mark popup tests as passing on Firefox (#1466)
1 parent 1b08797 commit 3f90c09

File tree

4 files changed

+28
-14
lines changed

4 files changed

+28
-14
lines changed

package.json

+1-1
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@
99
"main": "index.js",
1010
"playwright": {
1111
"chromium_revision": "751710",
12-
"firefox_revision": "1045",
12+
"firefox_revision": "1047",
1313
"webkit_revision": "1182"
1414
},
1515
"scripts": {

test/browsercontext.spec.js

+4-4
Original file line numberDiff line numberDiff line change
@@ -480,7 +480,7 @@ module.exports.describe = function({testRunner, expect, playwright, CHROMIUM, FF
480480
});
481481

482482
describe('Events.BrowserContext.Page', function() {
483-
it.fail(FFOX)('should have url', async({browser, server}) => {
483+
it('should have url', async({browser, server}) => {
484484
const context = await browser.newContext();
485485
const page = await context.newPage();
486486
const [otherPage] = await Promise.all([
@@ -512,7 +512,7 @@ module.exports.describe = function({testRunner, expect, playwright, CHROMIUM, FF
512512
expect(otherPage.url()).toBe('about:blank');
513513
await context.close();
514514
});
515-
it.fail(FFOX)('should have about:blank for empty url with domcontentloaded', async({browser, server}) => {
515+
it('should have about:blank for empty url with domcontentloaded', async({browser, server}) => {
516516
const context = await browser.newContext();
517517
const page = await context.newPage();
518518
const [otherPage] = await Promise.all([
@@ -523,7 +523,7 @@ module.exports.describe = function({testRunner, expect, playwright, CHROMIUM, FF
523523
expect(otherPage.url()).toBe('about:blank');
524524
await context.close();
525525
});
526-
it.fail(FFOX)('should report when a new page is created and closed', async({browser, server}) => {
526+
it('should report when a new page is created and closed', async({browser, server}) => {
527527
const context = await browser.newContext();
528528
const page = await context.newPage();
529529
const [otherPage] = await Promise.all([
@@ -582,7 +582,7 @@ module.exports.describe = function({testRunner, expect, playwright, CHROMIUM, FF
582582
// Cleanup.
583583
await context.close();
584584
});
585-
it.fail(FFOX)('should have an opener', async({browser, server}) => {
585+
it('should have an opener', async({browser, server}) => {
586586
const context = await browser.newContext();
587587
const page = await context.newPage();
588588
await page.goto(server.EMPTY_PAGE);

test/navigation.spec.js

+11-7
Original file line numberDiff line numberDiff line change
@@ -843,14 +843,18 @@ module.exports.describe = function({testRunner, expect, playwright, MAC, WIN, FF
843843
await popup.waitForLoadState();
844844
expect(popup.url()).toBe(server.EMPTY_PAGE);
845845
});
846-
it.fail(FFOX)('should wait for load state of empty url popup', async({browser, page}) => {
847-
const [popup] = await Promise.all([
846+
it('should wait for load state of empty url popup', async({browser, page}) => {
847+
const [popup, readyState] = await Promise.all([
848848
page.waitForEvent('popup'),
849-
page.evaluate(() => window.open('') && 1),
849+
page.evaluate(() => {
850+
const popup = window.open('');
851+
return popup.document.readyState;
852+
}),
850853
]);
851854
await popup.waitForLoadState({ waitUntil: 'load' });
852-
expect(await popup.evaluate(() => document.readyState)).toBe('complete');
853-
});
855+
expect(readyState).toBe(FFOX ? 'uninitialized' : 'complete');
856+
expect(await popup.evaluate(() => document.readyState)).toBe(FFOX ? 'uninitialized' : 'complete');
857+
});
854858
it('should wait for load state of about:blank popup ', async({browser, page}) => {
855859
const [popup] = await Promise.all([
856860
page.waitForEvent('popup'),
@@ -868,7 +872,7 @@ module.exports.describe = function({testRunner, expect, playwright, MAC, WIN, FF
868872
expect(await popup.evaluate(() => document.readyState)).toBe('complete');
869873
});
870874
it('should wait for load state of popup with network url ', async({browser, page, server}) => {
871-
await page.goto(server.EMPTY_PAGE);
875+
await page.goto(server.EMPTY_PAGE);
872876
const [popup] = await Promise.all([
873877
page.waitForEvent('popup'),
874878
page.evaluate(url => window.open(url) && 1, server.EMPTY_PAGE),
@@ -877,7 +881,7 @@ module.exports.describe = function({testRunner, expect, playwright, MAC, WIN, FF
877881
expect(await popup.evaluate(() => document.readyState)).toBe('complete');
878882
});
879883
it('should wait for load state of popup with network url and noopener ', async({browser, page, server}) => {
880-
await page.goto(server.EMPTY_PAGE);
884+
await page.goto(server.EMPTY_PAGE);
881885
const [popup] = await Promise.all([
882886
page.waitForEvent('popup'),
883887
page.evaluate(url => window.open(url, null, 'noopener') && 1, server.EMPTY_PAGE),

test/popup.spec.js

+12-2
Original file line numberDiff line numberDiff line change
@@ -245,6 +245,18 @@ module.exports.describe = function({testRunner, expect, playwright, CHROMIUM, WE
245245
expect(await popup.evaluate(() => !!window.opener)).toBe(true);
246246
await context.close();
247247
});
248+
it('should work with noopener and no url', async({browser}) => {
249+
const context = await browser.newContext();
250+
const page = await context.newPage();
251+
const [popup] = await Promise.all([
252+
page.waitForEvent('popup'),
253+
page.evaluate(() => window.__popup = window.open(undefined, null, 'noopener')),
254+
]);
255+
expect(popup.url()).toBe('about:blank');
256+
expect(await page.evaluate(() => !!window.opener)).toBe(false);
257+
expect(await popup.evaluate(() => !!window.opener)).toBe(false);
258+
await context.close();
259+
});
248260
it('should work with noopener and about:blank', async({browser}) => {
249261
const context = await browser.newContext();
250262
const page = await context.newPage();
@@ -292,8 +304,6 @@ module.exports.describe = function({testRunner, expect, playwright, CHROMIUM, WE
292304
page.$eval('a', a => a.click()),
293305
]);
294306
expect(await page.evaluate(() => !!window.opener)).toBe(false);
295-
// TODO: At this point popup might still have about:blank as the current document.
296-
// FFOX is slow enough to trigger this. We should do something about popups api.
297307
expect(await popup.evaluate(() => !!window.opener)).toBe(false);
298308
await context.close();
299309
});

0 commit comments

Comments
 (0)