Playwright is a framework for Web Testing and Automation. It allows testing Chromium, Firefox and WebKit with a single API.
TypeScript automationchromechromiume2e-testingelectronend-to-end-testingfirefoxjavascriptplaywrighttesttest-automationtestingtesting-toolswebwebkit
browser(firefox): roll Firefoxes (#22998)
Andrey Lushnikoveea7a8e63874
diff --git a/packages/playwright-core/browsers.json b/packages/playwright-core/browsers.jsonindex affe4a99ef..f13c77b27e 100644--- a/packages/playwright-core/browsers.json+++ b/packages/playwright-core/browsers.json@@ -21,13 +21,13 @@},{"name": "firefox",- "revision": "1406",+ "revision": "1408","installByDefault": true,"browserVersion": "113.0"},{"name": "firefox-beta",- "revision": "1408",+ "revision": "1410","installByDefault": false,"browserVersion": "114.0b3"},diff --git a/packages/playwright-core/src/server/firefox/ffBrowser.ts b/packages/playwright-core/src/server/firefox/ffBrowser.tsindex 7cd57188ef..f805318c4f 100644--- a/packages/playwright-core/src/server/firefox/ffBrowser.ts+++ b/packages/playwright-core/src/server/firefox/ffBrowser.ts@@ -16,7 +16,7 @@*/import { kBrowserClosedError } from '../../common/errors';-import { assert } from '../../utils';+import { assert, getAsBooleanFromENV } from '../../utils';import type { BrowserOptions } from '../browser';import { Browser } from '../browser';import { assertBrowserContextIsNotOwned, BrowserContext, verifyGeolocation } from '../browserContext';@@ -41,8 +41,14 @@ export class FFBrowser extends Browser {const browser = new FFBrowser(connection, options);if ((options as any).__testHookOnConnectToBrowser)await (options as any).__testHookOnConnectToBrowser();+ let firefoxUserPrefs = options.persistent ? {} : options.originalLaunchOptions.firefoxUserPrefs ?? {};+ if (Object.keys(kBandaidFirefoxUserPrefs).length)+ firefoxUserPrefs = { ...kBandaidFirefoxUserPrefs, ...firefoxUserPrefs };const promises: Promise<any>[] = [- connection.send('Browser.enable', { attachToDefaultContext: !!options.persistent }),+ connection.send('Browser.enable', {+ attachToDefaultContext: !!options.persistent,+ userPrefs: Object.entries(firefoxUserPrefs).map(([name, value]) => ({ name, value })),+ }),browser._initVersion(),];if (options.persistent) {@@ -408,3 +414,8 @@ function toJugglerProxyOptions(proxy: types.ProxySettings) {password: proxy.password};}++// Prefs for quick fixes that didn't make it to the build.+// Should all be moved to `playwright.cfg`.+const kBandaidFirefoxUserPrefs = {};+diff --git a/packages/playwright-core/src/server/firefox/firefox.ts b/packages/playwright-core/src/server/firefox/firefox.tsindex 38c6db85d3..7ffbaebbf3 100644--- a/packages/playwright-core/src/server/firefox/firefox.ts+++ b/packages/playwright-core/src/server/firefox/firefox.ts@@ -16,7 +16,6 @@*/import * as os from 'os';-import fs from 'fs';import path from 'path';import { FFBrowser } from './ffBrowser';import { kBrowserCloseMessageId } from './ffConnection';@@ -26,7 +25,7 @@ import type { ConnectionTransport } from '../transport';import type { BrowserOptions, PlaywrightOptions } from '../browser';import type * as types from '../types';import { rewriteErrorMessage } from '../../utils/stackTrace';-import { getAsBooleanFromENV, wrapInASCIIBox } from '../../utils';+import { wrapInASCIIBox } from '../../utils';export class Firefox extends BrowserType {constructor(playwrightOptions: PlaywrightOptions) {@@ -67,17 +66,6 @@ export class Firefox extends BrowserType {throw new Error('Pass userDataDir parameter to `browserType.launchPersistentContext(userDataDir, ...)` instead of specifying --profile argument');if (args.find(arg => arg.startsWith('-juggler')))throw new Error('Use the port parameter instead of -juggler argument');- let firefoxUserPrefs = isPersistent ? undefined : options.firefoxUserPrefs;- if (getAsBooleanFromENV('PLAYWRIGHT_DISABLE_FIREFOX_CROSS_PROCESS'))- firefoxUserPrefs = { ...kDisableFissionFirefoxUserPrefs, ...firefoxUserPrefs };- if (Object.keys(kBandaidFirefoxUserPrefs).length)- firefoxUserPrefs = { ...kBandaidFirefoxUserPrefs, ...firefoxUserPrefs };- if (firefoxUserPrefs) {- const lines: string[] = [];- for (const [name, value] of Object.entries(firefoxUserPrefs))- lines.push(`user_pref(${JSON.stringify(name)}, ${JSON.stringify(value)});`);- fs.writeFileSync(path.join(userDataDir, 'user.js'), lines.join('\n'));- }const firefoxArguments = ['-no-remote'];if (headless) {firefoxArguments.push('-headless');@@ -96,14 +84,3 @@ export class Firefox extends BrowserType {}}-// Prefs for quick fixes that didn't make it to the build.-// Should all be moved to `playwright.cfg`.-const kBandaidFirefoxUserPrefs = {};--const kDisableFissionFirefoxUserPrefs = {- 'browser.tabs.remote.useCrossOriginEmbedderPolicy': false,- 'browser.tabs.remote.useCrossOriginOpenerPolicy': false,- 'browser.tabs.remote.separatePrivilegedMozillaWebContentProcess': false,- 'fission.autostart': false,- 'browser.tabs.remote.systemTriggeredAboutBlankAnywhere': true,-};diff --git a/packages/playwright-core/src/server/firefox/protocol.d.ts b/packages/playwright-core/src/server/firefox/protocol.d.tsindex a84c71896c..417cc489a2 100644--- a/packages/playwright-core/src/server/firefox/protocol.d.ts+++ b/packages/playwright-core/src/server/firefox/protocol.d.ts@@ -8,6 +8,10 @@ export module Protocol {browserContextId?: string;openerId?: string;};+ export type UserPreference = {+ name: string;+ value: any;+ };export type CookieOptions = {name: string;value: string;@@ -71,6 +75,10 @@ export module Protocol {}export type enableParameters = {attachToDefaultContext: boolean;+ userPrefs?: {+ name: string;+ value: any;+ }[];};export type enableReturnValue = void;export type createBrowserContextParameters = {diff --git a/tests/library/video.spec.ts b/tests/library/video.spec.tsindex 0bf9eda45d..03b39b8e84 100644--- a/tests/library/video.spec.ts+++ b/tests/library/video.spec.ts@@ -163,7 +163,6 @@ it.describe('screencast', () => {});it('should work with old options', async ({ browser, browserName, trace, headless, isWindows }, testInfo) => {- it.fixme(browserName === 'firefox' && !headless && isWindows, 'https://github.com/microsoft/playwright/issues/22618');const videosPath = testInfo.outputPath('');// Firefox does not have a mobile variant and has a large minimum size (500 on windows and 450 elsewhere).const size = browserName === 'firefox' ? { width: 500, height: 400 } : { width: 320, height: 240 };@@ -188,7 +187,6 @@ it.describe('screencast', () => {});it('should capture static page', async ({ browser, browserName, trace, headless, isWindows }, testInfo) => {- it.fixme(browserName === 'firefox' && !headless && isWindows, 'https://github.com/microsoft/playwright/issues/22618');// Firefox does not have a mobile variant and has a large minimum size (500 on windows and 450 elsewhere).const size = browserName === 'firefox' ? { width: 500, height: 400 } : { width: 320, height: 240 };const context = await browser.newContext({