Skip to content

Playwright is a framework for Web Testing and Automation. It allows testing Chromium, Firefox and WebKit with a single API.

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

Dmitry Gozman3f90c09e6def
diff --git a/package.json b/package.json
index 64e44ac5a7..66b19d49cb 100644
--- a/package.json
+++ b/package.json
@@ -9,7 +9,7 @@
"main": "index.js",
"playwright": {
"chromium_revision": "751710",
- "firefox_revision": "1045",
+ "firefox_revision": "1047",
"webkit_revision": "1182"
},
"scripts": {
diff --git a/test/browsercontext.spec.js b/test/browsercontext.spec.js
index de38653b02..45ae9cdff9 100644
--- a/test/browsercontext.spec.js
+++ b/test/browsercontext.spec.js
@@ -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);
diff --git a/test/navigation.spec.js b/test/navigation.spec.js
index e7db690c4d..804518216a 100644
--- a/test/navigation.spec.js
+++ b/test/navigation.spec.js
@@ -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),
diff --git a/test/popup.spec.js b/test/popup.spec.js
index b754391204..30bbfd8698 100644
--- a/test/popup.spec.js
+++ b/test/popup.spec.js
@@ -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();
});