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
chore(bidi): use firefox browser type with moz-firefox- channel (#37696)
Yury Semikhatskyc85932f0b3f6
diff --git a/packages/playwright-client/types/types.d.ts b/packages/playwright-client/types/types.d.tsindex d4e4f52c74..86af0171bf 100644--- a/packages/playwright-client/types/types.d.ts+++ b/packages/playwright-client/types/types.d.ts@@ -16291,7 +16291,6 @@ export type AndroidKey =export const _electron: Electron;export const _android: Android;export const _bidiChromium: BrowserType;-export const _bidiFirefox: BrowserType;// This is required to not export everything by default. See https://github.com/Microsoft/TypeScript/issues/19545#issuecomment-340490459export {};diff --git a/packages/playwright-core/src/browserServerImpl.ts b/packages/playwright-core/src/browserServerImpl.tsindex 0057d26ac9..d0e3229d78 100644--- a/packages/playwright-core/src/browserServerImpl.ts+++ b/packages/playwright-core/src/browserServerImpl.ts@@ -32,9 +32,9 @@ import type { WebSocketEventEmitter } from './utilsBundle';import type { Browser } from './server/browser';export class BrowserServerLauncherImpl implements BrowserServerLauncher {- private _browserName: 'chromium' | 'firefox' | 'webkit' | '_bidiFirefox' | '_bidiChromium';+ private _browserName: 'chromium' | 'firefox' | 'webkit' | '_bidiChromium';- constructor(browserName: 'chromium' | 'firefox' | 'webkit' | '_bidiFirefox' | '_bidiChromium') {+ constructor(browserName: 'chromium' | 'firefox' | 'webkit' | '_bidiChromium') {this._browserName = browserName;}diff --git a/packages/playwright-core/src/client/playwright.ts b/packages/playwright-core/src/client/playwright.tsindex 48c6349080..5b0ed7dcc2 100644--- a/packages/playwright-core/src/client/playwright.ts+++ b/packages/playwright-core/src/client/playwright.ts@@ -30,7 +30,6 @@ export class Playwright extends ChannelOwner<channels.PlaywrightChannel> {readonly _android: Android;readonly _electron: Electron;readonly _bidiChromium: BrowserType;- readonly _bidiFirefox: BrowserType;readonly chromium: BrowserType;readonly firefox: BrowserType;readonly webkit: BrowserType;@@ -60,8 +59,6 @@ export class Playwright extends ChannelOwner<channels.PlaywrightChannel> {this._electron._playwright = this;this._bidiChromium = BrowserType.from(initializer._bidiChromium);this._bidiChromium._playwright = this;- this._bidiFirefox = BrowserType.from(initializer._bidiFirefox);- this._bidiFirefox._playwright = this;this.devices = this._connection.localUtils()?.devices ?? {};this.selectors = new Selectors(this._connection._platform);this.errors = { TimeoutError };@@ -72,7 +69,7 @@ export class Playwright extends ChannelOwner<channels.PlaywrightChannel> {}private _browserTypes(): BrowserType[] {- return [this.chromium, this.firefox, this.webkit, this._bidiChromium, this._bidiFirefox];+ return [this.chromium, this.firefox, this.webkit, this._bidiChromium];}_preLaunchedBrowser(): Browser {diff --git a/packages/playwright-core/src/inProcessFactory.ts b/packages/playwright-core/src/inProcessFactory.tsindex 8a77643c8e..3c621133e7 100644--- a/packages/playwright-core/src/inProcessFactory.ts+++ b/packages/playwright-core/src/inProcessFactory.ts@@ -43,7 +43,6 @@ export function createInProcessPlaywright(): PlaywrightAPI {playwrightAPI.webkit._serverLauncher = new BrowserServerLauncherImpl('webkit');playwrightAPI._android._serverLauncher = new AndroidServerLauncherImpl();playwrightAPI._bidiChromium._serverLauncher = new BrowserServerLauncherImpl('_bidiChromium');- playwrightAPI._bidiFirefox._serverLauncher = new BrowserServerLauncherImpl('_bidiFirefox');// Switch to async dispatch after we got Playwright object.dispatcherConnection.onmessage = message => setImmediate(() => clientConnection.dispatch(message));diff --git a/packages/playwright-core/src/protocol/validator.ts b/packages/playwright-core/src/protocol/validator.tsindex 3913c0545a..d9d3153dcd 100644--- a/packages/playwright-core/src/protocol/validator.ts+++ b/packages/playwright-core/src/protocol/validator.ts@@ -378,7 +378,6 @@ scheme.PlaywrightInitializer = tObject({firefox: tChannel(['BrowserType']),webkit: tChannel(['BrowserType']),_bidiChromium: tChannel(['BrowserType']),- _bidiFirefox: tChannel(['BrowserType']),android: tChannel(['Android']),electron: tChannel(['Electron']),utils: tOptional(tChannel(['LocalUtils'])),diff --git a/packages/playwright-core/src/server/bidi/bidiFirefox.ts b/packages/playwright-core/src/server/bidi/bidiFirefox.tsindex 9201a5ffc5..09406299cb 100644--- a/packages/playwright-core/src/server/bidi/bidiFirefox.ts+++ b/packages/playwright-core/src/server/bidi/bidiFirefox.ts@@ -34,7 +34,7 @@ import type { RecentLogsCollector } from '../utils/debugLogger';export class BidiFirefox extends BrowserType {constructor(parent: SdkObject) {- super(parent, '_bidiFirefox');+ super(parent, 'firefox');}override executablePath(): string {diff --git a/packages/playwright-core/src/server/browserType.ts b/packages/playwright-core/src/server/browserType.tsindex f8b86e40ca..e370491788 100644--- a/packages/playwright-core/src/server/browserType.ts+++ b/packages/playwright-core/src/server/browserType.ts@@ -92,7 +92,7 @@ export abstract class BrowserType extends SdkObject {}}- async _innerLaunchWithRetries(progress: Progress, options: types.LaunchOptions, persistent: types.BrowserContextOptions | undefined, protocolLogger: types.ProtocolLogger, userDataDir?: string): Promise<Browser> {+ private async _innerLaunchWithRetries(progress: Progress, options: types.LaunchOptions, persistent: types.BrowserContextOptions | undefined, protocolLogger: types.ProtocolLogger, userDataDir?: string): Promise<Browser> {try {return await this._innerLaunch(progress, options, persistent, protocolLogger, userDataDir);} catch (error) {@@ -106,7 +106,7 @@ export abstract class BrowserType extends SdkObject {}}- async _innerLaunch(progress: Progress, options: types.LaunchOptions, persistent: types.BrowserContextOptions | undefined, protocolLogger: types.ProtocolLogger, maybeUserDataDir?: string): Promise<Browser> {+ private async _innerLaunch(progress: Progress, options: types.LaunchOptions, persistent: types.BrowserContextOptions | undefined, protocolLogger: types.ProtocolLogger, maybeUserDataDir?: string): Promise<Browser> {options.proxy = options.proxy ? normalizeProxySettings(options.proxy) : undefined;const browserLogsCollector = new RecentLogsCollector();const { browserProcess, userDataDir, artifactsDir, transport } = await this._launchProcess(progress, options, !!persistent, browserLogsCollector, maybeUserDataDir);@@ -317,7 +317,7 @@ export abstract class BrowserType extends SdkObject {}}- _rewriteStartupLog(error: Error): Error {+ private _rewriteStartupLog(error: Error): Error {if (!isProtocolError(error))return error;return this.doRewriteStartupLog(error);diff --git a/packages/playwright-core/src/server/dispatchers/playwrightDispatcher.ts b/packages/playwright-core/src/server/dispatchers/playwrightDispatcher.tsindex d26042339b..32d3591335 100644--- a/packages/playwright-core/src/server/dispatchers/playwrightDispatcher.ts+++ b/packages/playwright-core/src/server/dispatchers/playwrightDispatcher.ts@@ -54,14 +54,12 @@ export class PlaywrightDispatcher extends Dispatcher<Playwright, channels.Playwrconst firefox = new BrowserTypeDispatcher(scope, playwright.firefox, denyLaunch);const webkit = new BrowserTypeDispatcher(scope, playwright.webkit, denyLaunch);const _bidiChromium = new BrowserTypeDispatcher(scope, playwright._bidiChromium, denyLaunch);- const _bidiFirefox = new BrowserTypeDispatcher(scope, playwright._bidiFirefox, denyLaunch);const android = new AndroidDispatcher(scope, playwright.android);const initializer: channels.PlaywrightInitializer = {chromium,firefox,webkit,_bidiChromium,- _bidiFirefox,android,electron: new ElectronDispatcher(scope, playwright.electron, denyLaunch),utils: playwright.options.isServer ? undefined : new LocalUtilsDispatcher(scope, playwright),diff --git a/packages/playwright-core/src/server/firefox/firefox.ts b/packages/playwright-core/src/server/firefox/firefox.tsindex 254858c5e5..1c0daef0fb 100644--- a/packages/playwright-core/src/server/firefox/firefox.ts+++ b/packages/playwright-core/src/server/firefox/firefox.ts@@ -24,16 +24,34 @@ import { wrapInASCIIBox } from '../utils/ascii';import { BrowserType, kNoXServerRunningError } from '../browserType';import { ManualPromise } from '../../utils/isomorphic/manualPromise';-import type { BrowserOptions } from '../browser';+import type { Browser, BrowserOptions } from '../browser';import type { SdkObject } from '../instrumentation';import type { ProtocolError } from '../protocolError';import type { ConnectionTransport } from '../transport';import type * as types from '../types';import type { RecentLogsCollector } from '../utils/debugLogger';+import type { BrowserContext } from '../browserContext';+import type * as channels from '@protocol/channels';+import type { Progress } from '@protocol/progress';export class Firefox extends BrowserType {- constructor(parent: SdkObject) {+ private _bidiFirefox: BrowserType;++ constructor(parent: SdkObject, bidiFirefox: BrowserType) {super(parent, 'firefox');+ this._bidiFirefox = bidiFirefox;+ }++ override launch(progress: Progress, options: types.LaunchOptions, protocolLogger?: types.ProtocolLogger): Promise<Browser> {+ if (options.channel?.startsWith('moz-'))+ return this._bidiFirefox.launch(progress, options, protocolLogger);+ return super.launch(progress, options, protocolLogger);+ }++ override async launchPersistentContext(progress: Progress, userDataDir: string, options: channels.BrowserTypeLaunchPersistentContextOptions & { cdpPort?: number, internalIgnoreHTTPSErrors?: boolean, socksProxyPort?: number }): Promise<BrowserContext> {+ if (options.channel?.startsWith('moz-'))+ return this._bidiFirefox.launchPersistentContext(progress, userDataDir, options);+ return super.launchPersistentContext(progress, userDataDir, options);}override connectToTransport(transport: ConnectionTransport, options: BrowserOptions): Promise<FFBrowser> {diff --git a/packages/playwright-core/src/server/playwright.ts b/packages/playwright-core/src/server/playwright.tsindex bdd98bd8af..c8d33d4781 100644--- a/packages/playwright-core/src/server/playwright.ts+++ b/packages/playwright-core/src/server/playwright.ts@@ -43,7 +43,6 @@ export class Playwright extends SdkObject {readonly firefox: BrowserType;readonly webkit: BrowserType;readonly _bidiChromium: BrowserType;- readonly _bidiFirefox: BrowserType;readonly options: PlaywrightOptions;readonly debugController: DebugController;private _allPages = new Set<Page>();@@ -61,8 +60,7 @@ export class Playwright extends SdkObject {}, null);this.chromium = new Chromium(this);this._bidiChromium = new BidiChromium(this);- this._bidiFirefox = new BidiFirefox(this);- this.firefox = new Firefox(this);+ this.firefox = new Firefox(this, new BidiFirefox(this));this.webkit = new WebKit(this);this.electron = new Electron(this);this.android = new Android(this, new AdbBackend());diff --git a/packages/playwright-core/src/server/registry/index.ts b/packages/playwright-core/src/server/registry/index.tsindex 700cfdd9b1..25f3ecffd4 100644--- a/packages/playwright-core/src/server/registry/index.ts+++ b/packages/playwright-core/src/server/registry/index.ts@@ -404,8 +404,6 @@ const DOWNLOAD_PATHS: Record<BrowserName | InternalTool, DownloadPaths> = {'win64': 'builds/android/%s/android.zip',},// TODO(bidi): implement downloads.- '_bidiFirefox': {- } as DownloadPaths,'_bidiChromium': {} as DownloadPaths,};@@ -502,7 +500,7 @@ function readDescriptors(browsersJSON: BrowsersJSON): BrowsersJSONDescriptor[] {});}-export type BrowserName = 'chromium' | 'firefox' | 'webkit' | '_bidiFirefox' | '_bidiChromium';+export type BrowserName = 'chromium' | 'firefox' | 'webkit' | '_bidiChromium';type InternalTool = 'ffmpeg' | 'winldd' | 'firefox-beta' | 'chromium-tip-of-tree' | 'chromium-headless-shell' | 'chromium-tip-of-tree-headless-shell' | 'android';type BidiChannel = 'moz-firefox' | 'moz-firefox-beta' | 'moz-firefox-nightly' | 'bidi-chrome-canary' | 'bidi-chrome-stable' | 'bidi-chromium';type ChromiumChannel = 'chrome' | 'chrome-beta' | 'chrome-dev' | 'chrome-canary' | 'msedge' | 'msedge-beta' | 'msedge-dev' | 'msedge-canary';@@ -958,13 +956,13 @@ export class Registry {return executablePath;}if (shouldThrow)- throw new Error(`Cannot find Firefox installation for channel '${name}' at the standard system paths.`);+ throw new Error(`Cannot find Firefox installation for channel '${name}' at the standard system paths. ${`Tried paths:\n ${prefixes.map(p => path.join(p, suffix)).join('\n ')}`}`);return undefined;};return {type: 'channel',name,- browserName: '_bidiFirefox',+ browserName: 'firefox',directory: undefined,executablePath: (sdkLanguage: string) => executablePath(sdkLanguage, false),executablePathOrDie: (sdkLanguage: string) => executablePath(sdkLanguage, true)!,diff --git a/packages/playwright-core/types/types.d.ts b/packages/playwright-core/types/types.d.tsindex d4e4f52c74..86af0171bf 100644--- a/packages/playwright-core/types/types.d.ts+++ b/packages/playwright-core/types/types.d.ts@@ -16291,7 +16291,6 @@ export type AndroidKey =export const _electron: Electron;export const _android: Android;export const _bidiChromium: BrowserType;-export const _bidiFirefox: BrowserType;// This is required to not export everything by default. See https://github.com/Microsoft/TypeScript/issues/19545#issuecomment-340490459export {};diff --git a/packages/playwright/src/index.ts b/packages/playwright/src/index.tsindex 6c412c0d98..c9ffdd8177 100644--- a/packages/playwright/src/index.ts+++ b/packages/playwright/src/index.ts@@ -100,8 +100,8 @@ const playwrightFixtures: Fixtures<TestFixtures, WorkerFixtures> = ({playwright._defaultLaunchOptions = undefined;}, { scope: 'worker', auto: true, box: true }],- browser: [async ({ playwright, browserName, _browserOptions, connectOptions }, use, testInfo) => {- if (!['chromium', 'firefox', 'webkit', '_bidiChromium', '_bidiFirefox'].includes(browserName))+ browser: [async ({ playwright, browserName, _browserOptions, connectOptions }, use) => {+ if (!['chromium', 'firefox', 'webkit', '_bidiChromium'].includes(browserName))throw new Error(`Unexpected browserName "${browserName}", must be one of "chromium", "firefox" or "webkit"`);if (connectOptions) {diff --git a/packages/protocol/src/channels.d.ts b/packages/protocol/src/channels.d.tsindex a3bcb262fa..f166090f90 100644--- a/packages/protocol/src/channels.d.ts+++ b/packages/protocol/src/channels.d.ts@@ -627,7 +627,6 @@ export type PlaywrightInitializer = {firefox: BrowserTypeChannel,webkit: BrowserTypeChannel,_bidiChromium: BrowserTypeChannel,- _bidiFirefox: BrowserTypeChannel,android: AndroidChannel,electron: ElectronChannel,utils?: LocalUtilsChannel,diff --git a/packages/protocol/src/protocol.yml b/packages/protocol/src/protocol.ymlindex d0b79ba72a..9ee2ae7f86 100644--- a/packages/protocol/src/protocol.yml+++ b/packages/protocol/src/protocol.yml@@ -795,7 +795,6 @@ Playwright:firefox: BrowserTypewebkit: BrowserType_bidiChromium: BrowserType- _bidiFirefox: BrowserTypeandroid: Androidelectron: Electronutils: LocalUtils?diff --git a/tests/bidi/playwright.config.ts b/tests/bidi/playwright.config.tsindex e4dc010728..0f489eeeab 100644--- a/tests/bidi/playwright.config.ts+++ b/tests/bidi/playwright.config.ts@@ -71,18 +71,18 @@ const config: Config<PlaywrightWorkerOptions & PlaywrightTestOptions & TestModeWprojects: [],};-type BrowserName = '_bidiChromium' | '_bidiFirefox';+type BrowserName = '_bidiChromium' | 'firefox';const getExecutablePath = (browserName: BrowserName) => {if (browserName === '_bidiChromium')return process.env.BIDI_CRPATH;- if (browserName === '_bidiFirefox')+ if (browserName === 'firefox')return process.env.BIDI_FFPATH;};const browserToChannels = {'_bidiChromium': ['bidi-chromium', 'bidi-chrome-canary', 'bidi-chrome-stable'],- '_bidiFirefox': ['moz-firefox', 'moz-firefox-beta', 'moz-firefox-nightly'],+ 'firefox': ['moz-firefox', 'moz-firefox-beta', 'moz-firefox-nightly'],};for (const [key, channels] of Object.entries(browserToChannels)) {diff --git a/tests/config/browserTest.ts b/tests/config/browserTest.tsindex 2872e37579..0fdc040f09 100644--- a/tests/config/browserTest.ts+++ b/tests/config/browserTest.ts@@ -66,15 +66,15 @@ const test = baseTest.extend<BrowserTestTestFixtures, BrowserTestWorkerFixtures>await run(playwright[browserName]);}, { scope: 'worker' }],- allowsThirdParty: [async ({ browserName }, run) => {- if (browserName === 'firefox' || browserName as any === '_bidiFirefox')+ allowsThirdParty: [async ({ browserName, channel }, run) => {+ if (browserName === 'firefox' || channel?.startsWith('moz-firefox'))await run(true);elseawait run(false);}, { scope: 'worker' }],defaultSameSiteCookieValue: [async ({ browserName, platform, channel }, run) => {- if (browserName === 'chromium' || browserName as any === '_bidiChromium' || browserName as any === '_bidiFirefox')+ if (browserName === 'chromium' || browserName as any === '_bidiChromium' || channel?.startsWith('moz-firefox'))await run('Lax');else if (browserName === 'webkit' && (platform === 'linux' || channel === 'webkit-wsl'))await run('Lax');diff --git a/tests/config/utils.ts b/tests/config/utils.tsindex 6fb3fc6a03..41571186a3 100644--- a/tests/config/utils.ts+++ b/tests/config/utils.ts@@ -53,7 +53,7 @@ export async function verifyViewport(page: Page, width: number, height: number)expect(await page.evaluate('window.innerHeight')).toBe(height);}-export function expectedSSLError(browserName: string, platform: string, channel: string): RegExp {+export function expectedSSLError(browserName: string, platform: string, channel: string | undefined): RegExp {if (browserName === 'chromium')return /net::(ERR_CERT_AUTHORITY_INVALID|ERR_CERT_INVALID)/;if (browserName === 'webkit') {@@ -64,7 +64,7 @@ export function expectedSSLError(browserName: string, platform: string, channel:elsereturn /Unacceptable TLS certificate|Operation was cancelled/;}- if (browserName === '_bidiFirefox')+ if (channel?.startsWith('moz-firefox'))return /MOZILLA_PKIX_ERROR_SELF_SIGNED_CERT/;return /SSL_ERROR_UNKNOWN/;}diff --git a/tests/library/browsercontext-network-event.spec.ts b/tests/library/browsercontext-network-event.spec.tsindex 6eaf9e624b..0265d1caa3 100644--- a/tests/library/browsercontext-network-event.spec.ts+++ b/tests/library/browsercontext-network-event.spec.ts@@ -104,8 +104,8 @@ it('should fire events in proper order', async ({ context, server }) => {]);});-it('should not fire events for favicon or favicon redirects', async ({ context, page, server, browserName, headless }) => {- it.skip(headless && browserName !== 'firefox' && browserName as any !== '_bidiFirefox', 'headless browsers, except firefox, do not request favicons');+it('should not fire events for favicon or favicon redirects', async ({ context, page, server, browserName, headless, channel }) => {+ it.skip(headless && browserName !== 'firefox' && !channel?.startsWith('moz-firefox'), 'headless browsers, except firefox, do not request favicons');it.skip(!headless && browserName === 'webkit', 'headed webkit does not have a favicon feature');const favicon = `/no-cache/favicon.ico`;const hashedFaviconUrl = `/favicon-hashed.ico`;diff --git a/tests/library/browsercontext-timezone-id.spec.ts b/tests/library/browsercontext-timezone-id.spec.tsindex 91b274fc6c..567da9e231 100644--- a/tests/library/browsercontext-timezone-id.spec.ts+++ b/tests/library/browsercontext-timezone-id.spec.ts@@ -45,13 +45,13 @@ it('should work @smoke', async ({ browser, browserName }) => {}});-it('should throw for invalid timezone IDs when creating pages', async ({ browser, browserName }) => {+it('should throw for invalid timezone IDs when creating pages', async ({ browser, browserName, channel }) => {for (const timezoneId of ['Foo/Bar', 'Baz/Qux']) {- if (browserName as any === '_bidiChromium' || browserName as any === '_bidiFirefox') {+ if (browserName as any === '_bidiChromium' || channel?.startsWith('moz-firefox')) {const error = await browser.newContext({ timezoneId }).catch(e => e);if (browserName as any === '_bidiChromium')expect(error.message).toContain(`Invalid timezone "${timezoneId}"`);- else if (browserName as any === '_bidiFirefox')+ else if (channel?.startsWith('moz-firefox'))expect(error.message).toContain(`Expected "timezone" to be a valid timezone ID (e.g., "Europe/Berlin") or a valid timezone offset (e.g., "+01:00"), got ${timezoneId}`);} else {let error = null;diff --git a/tests/library/channels.spec.ts b/tests/library/channels.spec.tsindex 827f9fe0b9..13ec20d3f0 100644--- a/tests/library/channels.spec.ts+++ b/tests/library/channels.spec.ts@@ -46,7 +46,6 @@ it('should scope context handles', async ({ browserType, server, expectScopeStat{ _guid: 'browser-type', objects: [] },{ _guid: 'browser-type', objects: [] },{ _guid: 'browser-type', objects: [] },- { _guid: 'browser-type', objects: [] },{ _guid: 'browser-type', objects: [{ _guid: 'browser', objects: [] }] },@@ -69,7 +68,6 @@ it('should scope context handles', async ({ browserType, server, expectScopeStat{ _guid: 'browser-type', objects: [] },{ _guid: 'browser-type', objects: [] },{ _guid: 'browser-type', objects: [] },- { _guid: 'browser-type', objects: [] },{ _guid: 'browser-type', objects: [{ _guid: 'browser', objects: [{ _guid: 'browser-context', objects: [@@ -106,7 +104,6 @@ it('should scope CDPSession handles', async ({ browserType, browserName, expectS{ _guid: 'browser-type', objects: [] },{ _guid: 'browser-type', objects: [] },{ _guid: 'browser-type', objects: [] },- { _guid: 'browser-type', objects: [] },{ _guid: 'browser-type', objects: [{ _guid: 'browser', objects: [] }] },@@ -125,7 +122,6 @@ it('should scope CDPSession handles', async ({ browserType, browserName, expectS{ _guid: 'browser-type', objects: [] },{ _guid: 'browser-type', objects: [] },{ _guid: 'browser-type', objects: [] },- { _guid: 'browser-type', objects: [] },{ _guid: 'browser-type', objects: [{ _guid: 'browser', objects: [{ _guid: 'cdp-session', objects: [] },@@ -152,7 +148,6 @@ it('should scope browser handles', async ({ browserType, expectScopeState }) =>{ _guid: 'browser-type', objects: [] },{ _guid: 'browser-type', objects: [] },{ _guid: 'browser-type', objects: [] },- { _guid: 'browser-type', objects: [] },{ _guid: 'electron', objects: [] },{ _guid: 'localUtils', objects: [] },{ _guid: 'Playwright', objects: [] },@@ -169,7 +164,6 @@ it('should scope browser handles', async ({ browserType, expectScopeState }) =>{ _guid: 'browser-type', objects: [] },{ _guid: 'browser-type', objects: [] },{ _guid: 'browser-type', objects: [] },- { _guid: 'browser-type', objects: [] },{ _guid: 'browser-type', objects: [{_guid: 'browser', objects: [@@ -206,7 +200,6 @@ it('should not generate dispatchers for subresources w/o listeners', async ({ pa{ _guid: 'browser-type', objects: [] },{ _guid: 'browser-type', objects: [] },{ _guid: 'browser-type', objects: [] },- { _guid: 'browser-type', objects: [] },{ _guid: 'browser-type', objects: [{_guid: 'browser', objects: [@@ -289,10 +282,6 @@ it('exposeFunction should not leak', async ({ page, expectScopeState, server })'_guid': 'browser-type','objects': [],},- {- '_guid': 'browser-type',- 'objects': [],- },{'_guid': 'browser-type','objects': [diff --git a/tests/library/favicon.spec.ts b/tests/library/favicon.spec.tsindex e8c5d56c76..9d8f1aadc7 100644--- a/tests/library/favicon.spec.ts+++ b/tests/library/favicon.spec.ts@@ -17,8 +17,8 @@import { contextTest as it } from '../config/browserTest';-it('should load svg favicon with prefer-color-scheme', async ({ page, server, browserName, headless, asset }) => {- it.skip(headless && browserName !== 'firefox' && browserName as any !== '_bidiFirefox', 'headless browsers, except firefox, do not request favicons');+it('should load svg favicon with prefer-color-scheme', async ({ page, server, browserName, headless, asset, channel }) => {+ it.skip(headless && browserName !== 'firefox' && !channel?.startsWith('moz-firefox'), 'headless browsers, except firefox, do not request favicons');it.skip(!headless && browserName === 'webkit', 'headed webkit does not have a favicon feature');// Browsers aggressively cache favicons, so force bust with thediff --git a/tests/library/har.spec.ts b/tests/library/har.spec.tsindex d85ba463c8..227589697f 100644--- a/tests/library/har.spec.ts+++ b/tests/library/har.spec.ts@@ -698,8 +698,8 @@ it('should contain http2 for http2 requests', async ({ contextFactory }, testInfserver.close();});-it('should filter favicon and favicon redirects', async ({ server, browserName, headless, asset, contextFactory }, testInfo) => {- it.skip(headless && browserName !== 'firefox' && browserName as any !== '_bidiFirefox', 'headless browsers, except firefox, do not request favicons');+it('should filter favicon and favicon redirects', async ({ server, browserName, headless, asset, contextFactory, channel }, testInfo) => {+ it.skip(headless && browserName !== 'firefox' && !channel?.startsWith('moz-firefox'), 'headless browsers, except firefox, do not request favicons');it.skip(!headless && browserName === 'webkit', 'headed webkit does not have a favicon feature');const { page, getLog } = await pageWithHar(contextFactory, testInfo);diff --git a/tests/library/page-close.spec.ts b/tests/library/page-close.spec.tsindex e06dfabe98..4b23924f0b 100644--- a/tests/library/page-close.spec.ts+++ b/tests/library/page-close.spec.ts@@ -140,7 +140,7 @@ test('should not throw UnhandledPromiseRejection when page closes', async ({ pag]).catch(e => {});});-test('interrupt request.response() and request.allHeaders() on page.close', async ({ page, server, browserName }) => {+test('interrupt request.response() and request.allHeaders() on page.close', async ({ page, server, browserName, channel }) => {test.info().annotations.push({ type: 'issue', description: 'https://github.com/microsoft/playwright/issues/27227' });server.setRoute('/one-style.css', (req, res) => {res.setHeader('Content-Type', 'text/css');@@ -153,7 +153,7 @@ test('interrupt request.response() and request.allHeaders() on page.close', asynawait page.close();expect((await respPromise).message).toContain(kTargetClosedErrorMessage);// All headers are the same as "provisional" headers in Firefox.- if (browserName === 'firefox' || browserName as any === '_bidiFirefox')+ if (browserName === 'firefox' || channel?.startsWith('moz-firefox'))expect((await headersPromise)['user-agent']).toBeTruthy();elseexpect((await headersPromise).message).toContain(kTargetClosedErrorMessage);diff --git a/tests/page/page-basic.spec.ts b/tests/page/page-basic.spec.tsindex 715c03b54c..8cdd65ac1c 100644--- a/tests/page/page-basic.spec.ts+++ b/tests/page/page-basic.spec.ts@@ -108,7 +108,7 @@ it('page.frame should respect url', async function({ page, server }) {expect(page.frame({ url: /empty/ }).url()).toBe(server.EMPTY_PAGE);});-it('should have sane user agent', async ({ page, browserName, isElectron, isAndroid }) => {+it('should have sane user agent', async ({ page, browserName, isElectron, isAndroid, channel }) => {it.skip(isAndroid);it.skip(isElectron);@@ -125,7 +125,7 @@ it('should have sane user agent', async ({ page, browserName, isElectron, isAndr// Second part in parenthesis is platform - ignore it.// Third part for Firefox is the last one and encodes engine and browser versions.- if (browserName === 'firefox' || browserName as any === '_bidiFirefox') {+ if (browserName === 'firefox' || channel?.startsWith('moz-firefox')) {const [engine, browser] = part3.split(' ');expect(engine.startsWith('Gecko')).toBe(true);expect(browser.startsWith('Firefox')).toBe(true);diff --git a/tests/page/page-event-console.spec.ts b/tests/page/page-event-console.spec.tsindex 081f743937..387e4e5709 100644--- a/tests/page/page-event-console.spec.ts+++ b/tests/page/page-event-console.spec.ts@@ -191,7 +191,7 @@ it('should use object previews for arrays and objects', async ({ page, browserNaexpect(text).toEqual('Array JSHandle@object JSHandle@object');});-it('should use object previews for errors', async ({ page, browserName }) => {+it('should use object previews for errors', async ({ page, browserName, channel }) => {let text: string;page.on('console', message => {text = message.text();@@ -201,7 +201,7 @@ it('should use object previews for errors', async ({ page, browserName }) => {expect(text).toContain('.evaluate');if (browserName as any === '_bidiChromium')expect(text).toEqual('error');- if (browserName === 'webkit' || browserName as any === '_bidiFirefox')+ if (browserName === 'webkit' || channel?.startsWith('moz-firefox'))expect(text).toEqual('Error: Exception');if (browserName === 'firefox')expect(text).toEqual('Error');diff --git a/tests/page/page-event-pageerror.spec.ts b/tests/page/page-event-pageerror.spec.tsindex 310f4917f0..ea1bf0524f 100644--- a/tests/page/page-event-pageerror.spec.ts+++ b/tests/page/page-event-pageerror.spec.ts@@ -17,7 +17,7 @@import { test as it, expect } from './pageTest';-it('should fire', async ({ page, server, browserName }) => {+it('should fire', async ({ page, server, browserName, channel }) => {const url = server.PREFIX + '/error.html';const [error] = await Promise.all([page.waitForEvent('pageerror'),@@ -25,7 +25,7 @@ it('should fire', async ({ page, server, browserName }) => {]);expect(error.name).toBe('Error');expect(error.message).toBe('Fancy error!');- if (browserName === 'chromium' || browserName === '_bidiChromium' || browserName === '_bidiFirefox') {+ if (browserName === 'chromium' || browserName === '_bidiChromium' || channel?.startsWith('moz-firefox')) {expect(error.stack).toBe(`Error: Fancy error!at c (myscript.js:14:11)at b (myscript.js:10:5)diff --git a/tests/page/page-goto.spec.ts b/tests/page/page-goto.spec.tsindex 954228de06..354c970052 100644--- a/tests/page/page-goto.spec.ts+++ b/tests/page/page-goto.spec.ts@@ -292,12 +292,12 @@ it('should work when page calls history API in beforeunload', async ({ page, serexpect(response.status()).toBe(200);});-it('should fail when navigating to bad url', async ({ mode, page, browserName }) => {+it('should fail when navigating to bad url', async ({ page, browserName, channel }) => {let error = null;await page.goto('asdfasdf').catch(e => error = e);if (browserName === 'chromium' || browserName === 'webkit')expect(error.message).toContain('Cannot navigate to invalid URL');- else if (browserName === '_bidiFirefox')+ else if (channel?.startsWith('moz-firefox'))expect(error.message).toContain('NS_ERROR_MALFORMED_URI');elseexpect(error.message).toContain('Invalid url');diff --git a/tests/page/page-route.spec.ts b/tests/page/page-route.spec.tsindex 00b9754bd9..8dc56af5d6 100644--- a/tests/page/page-route.spec.ts+++ b/tests/page/page-route.spec.ts@@ -344,17 +344,17 @@ it('should send referer', async ({ page, server }) => {expect(request.headers['referer']).toBe('http://google.com/');});-it('should fail navigation when aborting main resource', async ({ page, server, browserName, isMac, macVersion }) => {+it('should fail navigation when aborting main resource', async ({ page, server, browserName, isMac, macVersion, channel }) => {await page.route('**/*', route => route.abort());let error = null;await page.goto(server.EMPTY_PAGE).catch(e => error = e);expect(error).toBeTruthy();if (browserName === 'webkit')expect(error.message).toContain(isMac && macVersion < 11 ? 'Request intercepted' : 'Blocked by Web Inspector');+ else if (channel?.startsWith('moz-firefox'))+ expect(error.message).toContain('NS_ERROR_ABORT');else if (browserName === 'firefox')expect(error.message).toContain('NS_ERROR_FAILURE');- else if (browserName === '_bidiFirefox')- expect(error.message).toContain('NS_ERROR_ABORT');elseexpect(error.message).toContain('net::ERR_FAILED');});@@ -609,7 +609,7 @@ it('should not fulfill with redirect status', async ({ page, server, browserName}});-it('should support cors with GET', async ({ page, server, browserName }) => {+it('should support cors with GET', async ({ page, server, browserName, channel }) => {await page.goto(server.EMPTY_PAGE);await page.route('**/cars*', async (route, request) => {const headers = { 'access-control-allow-origin': request.url().endsWith('allow') ? '*' : 'none' };@@ -638,7 +638,7 @@ it('should support cors with GET', async ({ page, server, browserName }) => {expect(error.message).toContain('Failed');if (browserName === 'webkit')expect(error.message).toContain('TypeError');- if (browserName === 'firefox' || browserName === '_bidiFirefox')+ if (browserName === 'firefox' || channel?.startsWith('moz-firefox'))expect(error.message).toContain('NetworkError');}});diff --git a/tests/page/pageTestApi.ts b/tests/page/pageTestApi.tsindex f29af2c92f..bde24e6235 100644--- a/tests/page/pageTestApi.ts+++ b/tests/page/pageTestApi.ts@@ -25,11 +25,11 @@ export type PageTestFixtures = {export type PageWorkerFixtures = {headless: boolean;- channel: string;+ channel: string | undefined;screenshot: ScreenshotMode | { mode: ScreenshotMode } & Pick<PageScreenshotOptions, 'fullPage' | 'omitBackground'>;trace: 'off' | 'on' | 'retain-on-failure' | 'on-first-retry' | 'retain-on-first-failure' | 'on-all-retries' | /** deprecated */ 'retry-with-trace';video: VideoMode | { mode: VideoMode, size: ViewportSize };- browserName: 'chromium' | 'firefox' | 'webkit' | '_bidiFirefox' | '_bidiChromium';+ browserName: 'chromium' | 'firefox' | 'webkit' | '_bidiChromium';browserVersion: string;browserMajorVersion: number;electronMajorVersion: number;diff --git a/utils/generate_types/overrides.d.ts b/utils/generate_types/overrides.d.tsindex 8c7863a3c8..84b556b9ee 100644--- a/utils/generate_types/overrides.d.ts+++ b/utils/generate_types/overrides.d.ts@@ -398,7 +398,6 @@ export type AndroidKey =export const _electron: Electron;export const _android: Android;export const _bidiChromium: BrowserType;-export const _bidiFirefox: BrowserType;// This is required to not export everything by default. See https://github.com/Microsoft/TypeScript/issues/19545#issuecomment-340490459export {};