Skip to content

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

chore: remove bidi-chromium from default downloads (#39090)

Yury Semikhatsky7f6175fa9e5f
diff --git a/packages/playwright-core/src/server/bidi/bidiChromium.ts b/packages/playwright-core/src/server/bidi/bidiChromium.ts
index 7445f08269..d44a2e2a38 100644
--- a/packages/playwright-core/src/server/bidi/bidiChromium.ts
+++ b/packages/playwright-core/src/server/bidi/bidiChromium.ts
@@ -154,6 +154,22 @@ export class BidiChromium extends BrowserType {
chromeArguments.push(...args);
return chromeArguments;
}
+
+ override getExecutableName(options: types.LaunchOptions): string {
+ switch (options.channel) {
+ case 'bidi-chromium':
+ return 'chromium';
+ case 'bidi-chrome':
+ return 'chrome';
+ case 'bidi-chrome-beta':
+ return 'chrome-beta';
+ case 'bidi-chrome-dev':
+ return 'chrome-dev';
+ case 'bidi-chrome-canary':
+ return 'chrome-canary';
+ }
+ throw new Error(`Unsupported Bidi Chromium channel: ${options.channel}`);
+ }
}
const kBidiOverCdpWrapper = Symbol('kBidiConnectionWrapper');
diff --git a/packages/playwright-core/src/server/registry/index.ts b/packages/playwright-core/src/server/registry/index.ts
index 761f9203eb..51a05463be 100644
--- a/packages/playwright-core/src/server/registry/index.ts
+++ b/packages/playwright-core/src/server/registry/index.ts
@@ -549,7 +549,7 @@ function readDescriptors(browsersJSON: BrowsersJSON): BrowsersJSONDescriptor[] {
export type BrowserName = 'chromium' | 'firefox' | 'webkit';
const allDownloadableDirectoriesThatEverExisted = ['android', 'chromium', 'firefox', 'webkit', 'ffmpeg', 'firefox-beta', 'chromium-tip-of-tree', 'chromium-headless-shell', 'chromium-tip-of-tree-headless-shell', 'winldd'];
-const chromiumAliases = ['bidi-chromium', 'chrome-for-testing'];
+const chromiumAliases = ['chrome-for-testing'];
export interface Executable {
name: string;
@@ -786,17 +786,6 @@ export class Registry {
'win32': '\\Mozilla Firefox\\firefox.exe',
}));
- this._executables.push(this._createBidiChromiumChannel('bidi-chrome-stable', {
- 'linux': '/opt/google/chrome/chrome',
- 'darwin': '/Applications/Google Chrome.app/Contents/MacOS/Google Chrome',
- 'win32': `\\Google\\Chrome\\Application\\chrome.exe`,
- }));
- this._executables.push(this._createBidiChromiumChannel('bidi-chrome-canary', {
- 'linux': '/opt/google/chrome-canary/chrome',
- 'darwin': '/Applications/Google Chrome Canary.app/Contents/MacOS/Google Chrome Canary',
- 'win32': `\\Google\\Chrome SxS\\Application\\chrome.exe`,
- }));
-
const firefox = descriptors.find(d => d.name === 'firefox')!;
const firefoxExecutable = findExecutablePath(firefox.dir, 'firefox');
this._executables.push({
@@ -1021,46 +1010,6 @@ export class Registry {
};
}
- private _createBidiChromiumChannel(name: string, lookAt: Record<'linux' | 'darwin' | 'win32', string>): ExecutableImpl {
- const executablePath = (sdkLanguage: string, shouldThrow: boolean) => {
- const suffix = lookAt[process.platform as 'linux' | 'darwin' | 'win32'];
- if (!suffix) {
- if (shouldThrow)
- throw new Error(`Chromium distribution '${name}' is not supported on ${process.platform}`);
- return undefined;
- }
- const prefixes = (process.platform === 'win32' ? [
- process.env.LOCALAPPDATA,
- process.env.PROGRAMFILES,
- process.env['PROGRAMFILES(X86)'],
- // In some cases there is no PROGRAMFILES/(86) env var set but HOMEDRIVE is set.
- process.env.HOMEDRIVE + '\\Program Files',
- process.env.HOMEDRIVE + '\\Program Files (x86)',
- ].filter(Boolean) : ['']) as string[];
-
- for (const prefix of prefixes) {
- const executablePath = path.join(prefix, suffix);
- if (canAccessFile(executablePath))
- return executablePath;
- }
- if (!shouldThrow)
- return undefined;
-
- const location = prefixes.length ? ` at ${path.join(prefixes[0], suffix)}` : ``;
- throw new Error(`Chromium distribution '${name}' is not found${location}`);
- };
- return {
- name,
- browserName: 'chromium',
- directory: undefined,
- executablePath: (sdkLanguage: string) => executablePath(sdkLanguage, false),
- executablePathOrDie: (sdkLanguage: string) => executablePath(sdkLanguage, true)!,
- installType: 'none',
- _validateHostRequirements: () => Promise.resolve(),
- _isHermeticInstallation: false,
- };
- }
-
executables(): Executable[] {
return this._executables;
}
diff --git a/tests/bidi/playwright.config.ts b/tests/bidi/playwright.config.ts
index d6e8eee5bc..2c8057c4a7 100644
--- a/tests/bidi/playwright.config.ts
+++ b/tests/bidi/playwright.config.ts
@@ -83,7 +83,7 @@ const getExecutablePath = (browserName: BrowserName) => {
};
const browserToChannels = {
- 'chromium': ['bidi-chromium', 'bidi-chrome-canary', 'bidi-chrome-stable'],
+ 'chromium': ['bidi-chromium', 'bidi-chrome-canary', 'bidi-chrome'],
'firefox': ['moz-firefox', 'moz-firefox-beta', 'moz-firefox-nightly'],
};