diff --git a/packages/playwright-core/src/client/playwright.ts b/packages/playwright-core/src/client/playwright.ts index 0df04d6143..9415125be4 100644 --- a/packages/playwright-core/src/client/playwright.ts +++ b/packages/playwright-core/src/client/playwright.ts @@ -26,7 +26,7 @@ import { Selectors, SelectorsOwner } from './selectors'; export class Playwright extends ChannelOwner { readonly _android: Android; readonly _electron: Electron; - readonly _experimentalBidiFirefox: BrowserType; + readonly _experimentalBidi: BrowserType; readonly chromium: BrowserType; readonly firefox: BrowserType; readonly webkit: BrowserType; @@ -46,8 +46,8 @@ export class Playwright extends ChannelOwner { this.webkit._playwright = this; this._android = Android.from(initializer.android); this._electron = Electron.from(initializer.electron); - this._experimentalBidiFirefox = BrowserType.from(initializer.bidi); - this._experimentalBidiFirefox._playwright = this; + this._experimentalBidi = BrowserType.from(initializer.bidi); + this._experimentalBidi._playwright = this; this.devices = this._connection.localUtils()?.devices ?? {}; this.selectors = new Selectors(); this.errors = { TimeoutError }; diff --git a/packages/playwright-core/src/server/bidi/bidiFirefox.ts b/packages/playwright-core/src/server/bidi/bidiFirefox.ts index 1cb82a41b5..499ab7f4c7 100644 --- a/packages/playwright-core/src/server/bidi/bidiFirefox.ts +++ b/packages/playwright-core/src/server/bidi/bidiFirefox.ts @@ -30,7 +30,7 @@ import { kBrowserCloseMessageId } from './bidiConnection'; export class BidiFirefox extends BrowserType { constructor(parent: SdkObject) { - super(parent, 'firefox'); + super(parent, 'bidi'); this._useBidi = true; } diff --git a/packages/playwright-core/src/server/registry/index.ts b/packages/playwright-core/src/server/registry/index.ts index a74f181c83..6069b765f6 100644 --- a/packages/playwright-core/src/server/registry/index.ts +++ b/packages/playwright-core/src/server/registry/index.ts @@ -71,11 +71,6 @@ const EXECUTABLE_PATHS = { 'mac': ['ffmpeg-mac'], 'win': ['ffmpeg-win64.exe'], }, - 'bidi-firefox': { - 'linux': ['firefox', 'firefox'], - 'mac': ['firefox', 'Nightly.app', 'Contents', 'MacOS', 'firefox'], - 'win': ['firefox', 'firefox.exe'], - }, }; type DownloadPaths = Record; @@ -269,34 +264,9 @@ const DOWNLOAD_PATHS: Record = { 'mac14-arm64': 'builds/android/%s/android.zip', 'win64': 'builds/android/%s/android.zip', }, - 'bidi-firefox': { - '': undefined, - 'ubuntu18.04-x64': undefined, - 'ubuntu20.04-x64': 'builds/firefox/%s/firefox-ubuntu-20.04.zip', - 'ubuntu22.04-x64': 'builds/firefox/%s/firefox-ubuntu-22.04.zip', - 'ubuntu24.04-x64': 'builds/firefox/%s/firefox-ubuntu-24.04.zip', - 'ubuntu18.04-arm64': undefined, - 'ubuntu20.04-arm64': 'builds/firefox/%s/firefox-ubuntu-20.04-arm64.zip', - 'ubuntu22.04-arm64': 'builds/firefox/%s/firefox-ubuntu-22.04-arm64.zip', - 'ubuntu24.04-arm64': 'builds/firefox/%s/firefox-ubuntu-24.04-arm64.zip', - 'debian11-x64': 'builds/firefox/%s/firefox-debian-11.zip', - 'debian11-arm64': 'builds/firefox/%s/firefox-debian-11-arm64.zip', - 'debian12-x64': 'builds/firefox/%s/firefox-debian-12.zip', - 'debian12-arm64': 'builds/firefox/%s/firefox-debian-12-arm64.zip', - 'mac10.13': 'builds/firefox/%s/firefox-mac.zip', - 'mac10.14': 'builds/firefox/%s/firefox-mac.zip', - 'mac10.15': 'builds/firefox/%s/firefox-mac.zip', - 'mac11': 'builds/firefox/%s/firefox-mac.zip', - 'mac11-arm64': 'builds/firefox/%s/firefox-mac-arm64.zip', - 'mac12': 'builds/firefox/%s/firefox-mac.zip', - 'mac12-arm64': 'builds/firefox/%s/firefox-mac-arm64.zip', - 'mac13': 'builds/firefox/%s/firefox-mac.zip', - 'mac13-arm64': 'builds/firefox/%s/firefox-mac-arm64.zip', - 'mac14': 'builds/firefox/%s/firefox-mac.zip', - 'mac14-arm64': 'builds/firefox/%s/firefox-mac-arm64.zip', - 'win64': 'builds/firefox/%s/firefox-win64.zip', - }, - + // TODO(bidi): implement downloads. + 'bidi': { + } as DownloadPaths, }; export const registryDirectory = (() => { @@ -382,15 +352,15 @@ function readDescriptors(browsersJSON: BrowsersJSON) { }); } -export type BrowserName = 'chromium' | 'firefox' | 'webkit'; -type InternalTool = 'ffmpeg' | 'firefox-beta' | 'chromium-tip-of-tree' | 'android' | 'bidi-firefox'; -type BidiFirefoxChannel = 'bidi-firefox-stable'; +export type BrowserName = 'chromium' | 'firefox' | 'webkit' | 'bidi'; +type InternalTool = 'ffmpeg' | 'firefox-beta' | 'chromium-tip-of-tree' | 'android'; +type BidiChannel = 'bidi-firefox-stable'; type ChromiumChannel = 'chrome' | 'chrome-beta' | 'chrome-dev' | 'chrome-canary' | 'msedge' | 'msedge-beta' | 'msedge-dev' | 'msedge-canary'; const allDownloadable = ['chromium', 'firefox', 'webkit', 'ffmpeg', 'firefox-beta', 'chromium-tip-of-tree']; export interface Executable { type: 'browser' | 'tool' | 'channel'; - name: BrowserName | InternalTool | ChromiumChannel | BidiFirefoxChannel; + name: BrowserName | InternalTool | ChromiumChannel | BidiChannel; browserName: BrowserName | undefined; installType: 'download-by-default' | 'download-on-demand' | 'install-script' | 'none'; directory: string | undefined; @@ -555,7 +525,7 @@ export class Registry { 'win32': `\\Microsoft\\Edge SxS\\Application\\msedge.exe`, })); - this._executables.push(this._createBidiFirefoxChannel('bidi-firefox-stable', { + this._executables.push(this._createBidiChannel('bidi-firefox-stable', { 'linux': '/usr/bin/firefox', 'darwin': '/Applications/Firefox.app/Contents/MacOS/firefox', 'win32': '\\Mozilla Firefox\\firefox.exe', @@ -657,21 +627,18 @@ export class Registry { _isHermeticInstallation: true, }); - const bidiFirefox = descriptors.find(d => d.name === 'firefox')!; - const bidiFirefoxExecutable = findExecutablePath(bidiFirefox.dir, 'firefox'); this._executables.push({ type: 'browser', - name: 'bidi-firefox', - browserName: 'firefox', - directory: bidiFirefox.dir, - executablePath: () => bidiFirefoxExecutable, - executablePathOrDie: (sdkLanguage: string) => executablePathOrDie('bidi-firefox', bidiFirefoxExecutable, bidiFirefox.installByDefault, sdkLanguage), - installType: bidiFirefox.installByDefault ? 'download-by-default' : 'download-on-demand', - _validateHostRequirements: (sdkLanguage: string) => this._validateHostRequirements(sdkLanguage, 'firefox', bidiFirefox.dir, ['firefox'], [], ['firefox']), - downloadURLs: this._downloadURLs(bidiFirefox), - browserVersion: bidiFirefox.browserVersion, - _install: () => this._downloadExecutable(bidiFirefox, bidiFirefoxExecutable), - _dependencyGroup: 'firefox', + name: 'bidi', + browserName: 'bidi', + directory: undefined, + executablePath: () => undefined, + executablePathOrDie: () => '', + installType: 'none', + _validateHostRequirements: () => Promise.resolve(), + downloadURLs: [], + _install: () => Promise.resolve(), + _dependencyGroup: 'tools', _isHermeticInstallation: true, }); } @@ -714,7 +681,7 @@ export class Registry { }; } - private _createBidiFirefoxChannel(name: BidiFirefoxChannel, lookAt: Record<'linux' | 'darwin' | 'win32', string>, install?: () => Promise): ExecutableImpl { + private _createBidiChannel(name: BidiChannel, lookAt: Record<'linux' | 'darwin' | 'win32', string>, install?: () => Promise): ExecutableImpl { const executablePath = (sdkLanguage: string, shouldThrow: boolean) => { const suffix = lookAt[process.platform as 'linux' | 'darwin' | 'win32']; if (!suffix) { @@ -741,7 +708,7 @@ export class Registry { return { type: 'channel', name, - browserName: 'firefox', + browserName: 'bidi', 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.ts index 206d37c639..8970d336cc 100644 --- a/packages/playwright-core/types/types.d.ts +++ b/packages/playwright-core/types/types.d.ts @@ -15135,7 +15135,7 @@ export type AndroidKey = export const _electron: Electron; export const _android: Android; -export const _experimentalBidiFirefox: BrowserType; +export const _experimentalBidi: BrowserType; // This is required to not export everything by default. See https://github.com/Microsoft/TypeScript/issues/19545#issuecomment-340490459 export {}; diff --git a/packages/playwright/src/index.ts b/packages/playwright/src/index.ts index 922da72bfd..8273c5ef76 100644 --- a/packages/playwright/src/index.ts +++ b/packages/playwright/src/index.ts @@ -83,15 +83,15 @@ const playwrightFixtures: Fixtures = ({ options.channel = channel; options.tracesDir = tracing().tracesDir(); - for (const browserType of [playwright.chromium, playwright.firefox, playwright.webkit, playwright._experimentalBidiFirefox]) + for (const browserType of [playwright.chromium, playwright.firefox, playwright.webkit, playwright._experimentalBidi]) (browserType as any)._defaultLaunchOptions = options; await use(options); - for (const browserType of [playwright.chromium, playwright.firefox, playwright.webkit, playwright._experimentalBidiFirefox]) + for (const browserType of [playwright.chromium, playwright.firefox, playwright.webkit, playwright._experimentalBidi]) (browserType as any)._defaultLaunchOptions = undefined; }, { scope: 'worker', auto: true, box: true }], browser: [async ({ playwright, browserName, _browserOptions, connectOptions, _reuseContext }, use, testInfo) => { - if (!['chromium', 'firefox', 'webkit', '_experimentalBidiFirefox'].includes(browserName)) + if (!['chromium', 'firefox', 'webkit', '_experimentalBidi'].includes(browserName)) throw new Error(`Unexpected browserName "${browserName}", must be one of "chromium", "firefox" or "webkit"`); if (connectOptions) { diff --git a/tests/bidi/playwright.config.ts b/tests/bidi/playwright.config.ts index 40be42b54e..a0c7becf19 100644 --- a/tests/bidi/playwright.config.ts +++ b/tests/bidi/playwright.config.ts @@ -22,7 +22,7 @@ import * as path from 'path'; import type { TestModeWorkerOptions } from '../config/testModeFixtures'; const getExecutablePath = () => { - return process.env.FFPATH; + return process.env.BIDIPATH; }; const headed = process.argv.includes('--headed'); @@ -59,7 +59,7 @@ const config: Config