Skip to content

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

chore(bidi): use bidi- channels with playwright.chromium (#37702)

Yury Semikhatsky83d5165cec21
diff --git a/packages/playwright-client/types/types.d.ts b/packages/playwright-client/types/types.d.ts
index 86af0171bf..ad72bca33d 100644
--- a/packages/playwright-client/types/types.d.ts
+++ b/packages/playwright-client/types/types.d.ts
@@ -16290,7 +16290,6 @@ export type AndroidKey =
export const _electron: Electron;
export const _android: Android;
-export const _bidiChromium: 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-core/src/browserServerImpl.ts b/packages/playwright-core/src/browserServerImpl.ts
index d0e3229d78..1851cdf89a 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' | '_bidiChromium';
+ private _browserName: 'chromium' | 'firefox' | 'webkit';
- constructor(browserName: 'chromium' | 'firefox' | 'webkit' | '_bidiChromium') {
+ constructor(browserName: 'chromium' | 'firefox' | 'webkit') {
this._browserName = browserName;
}
diff --git a/packages/playwright-core/src/client/playwright.ts b/packages/playwright-core/src/client/playwright.ts
index 5b0ed7dcc2..de987c0e5a 100644
--- a/packages/playwright-core/src/client/playwright.ts
+++ b/packages/playwright-core/src/client/playwright.ts
@@ -29,7 +29,6 @@ import type { BrowserContextOptions, LaunchOptions } from 'playwright-core';
export class Playwright extends ChannelOwner<channels.PlaywrightChannel> {
readonly _android: Android;
readonly _electron: Electron;
- readonly _bidiChromium: BrowserType;
readonly chromium: BrowserType;
readonly firefox: BrowserType;
readonly webkit: BrowserType;
@@ -57,8 +56,6 @@ export class Playwright extends ChannelOwner<channels.PlaywrightChannel> {
this._android._playwright = this;
this._electron = Electron.from(initializer.electron);
this._electron._playwright = this;
- this._bidiChromium = BrowserType.from(initializer._bidiChromium);
- this._bidiChromium._playwright = this;
this.devices = this._connection.localUtils()?.devices ?? {};
this.selectors = new Selectors(this._connection._platform);
this.errors = { TimeoutError };
@@ -69,7 +66,7 @@ export class Playwright extends ChannelOwner<channels.PlaywrightChannel> {
}
private _browserTypes(): BrowserType[] {
- return [this.chromium, this.firefox, this.webkit, this._bidiChromium];
+ return [this.chromium, this.firefox, this.webkit];
}
_preLaunchedBrowser(): Browser {
diff --git a/packages/playwright-core/src/inProcessFactory.ts b/packages/playwright-core/src/inProcessFactory.ts
index 3c621133e7..032d20122a 100644
--- a/packages/playwright-core/src/inProcessFactory.ts
+++ b/packages/playwright-core/src/inProcessFactory.ts
@@ -42,7 +42,6 @@ export function createInProcessPlaywright(): PlaywrightAPI {
playwrightAPI.firefox._serverLauncher = new BrowserServerLauncherImpl('firefox');
playwrightAPI.webkit._serverLauncher = new BrowserServerLauncherImpl('webkit');
playwrightAPI._android._serverLauncher = new AndroidServerLauncherImpl();
- playwrightAPI._bidiChromium._serverLauncher = new BrowserServerLauncherImpl('_bidiChromium');
// 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.ts
index d9d3153dcd..b8e7c32993 100644
--- a/packages/playwright-core/src/protocol/validator.ts
+++ b/packages/playwright-core/src/protocol/validator.ts
@@ -377,7 +377,6 @@ scheme.PlaywrightInitializer = tObject({
chromium: tChannel(['BrowserType']),
firefox: tChannel(['BrowserType']),
webkit: tChannel(['BrowserType']),
- _bidiChromium: tChannel(['BrowserType']),
android: tChannel(['Android']),
electron: tChannel(['Electron']),
utils: tOptional(tChannel(['LocalUtils'])),
diff --git a/packages/playwright-core/src/server/bidi/bidiChromium.ts b/packages/playwright-core/src/server/bidi/bidiChromium.ts
index 0af0dfb4d2..e05e023875 100644
--- a/packages/playwright-core/src/server/bidi/bidiChromium.ts
+++ b/packages/playwright-core/src/server/bidi/bidiChromium.ts
@@ -33,7 +33,7 @@ import type * as types from '../types';
export class BidiChromium extends BrowserType {
constructor(parent: SdkObject) {
- super(parent, '_bidiChromium');
+ super(parent, 'chromium');
}
override async connectToTransport(transport: ConnectionTransport, options: BrowserOptions, browserLogsCollector: RecentLogsCollector): Promise<BidiBrowser> {
diff --git a/packages/playwright-core/src/server/chromium/chromium.ts b/packages/playwright-core/src/server/chromium/chromium.ts
index 3db67148c8..4adebfe579 100644
--- a/packages/playwright-core/src/server/chromium/chromium.ts
+++ b/packages/playwright-core/src/server/chromium/chromium.ts
@@ -44,7 +44,9 @@ import type { SdkObject } from '../instrumentation';
import type { Progress } from '../progress';
import type { ProtocolError } from '../protocolError';
import type { ConnectionTransport, ProtocolRequest } from '../transport';
+import type { BrowserContext } from '../browserContext';
import type * as types from '../types';
+import type * as channels from '@protocol/channels';
import type http from 'http';
import type stream from 'stream';
@@ -52,14 +54,28 @@ const ARTIFACTS_FOLDER = path.join(os.tmpdir(), 'playwright-artifacts-');
export class Chromium extends BrowserType {
private _devtools: CRDevTools | undefined;
+ private _bidiChromium: BrowserType;
- constructor(parent: SdkObject) {
+ constructor(parent: SdkObject, bidiChromium: BrowserType) {
super(parent, 'chromium');
+ this._bidiChromium = bidiChromium;
if (debugMode() === 'inspector')
this._devtools = this._createDevTools();
}
+ override launch(progress: Progress, options: types.LaunchOptions, protocolLogger?: types.ProtocolLogger): Promise<Browser> {
+ if (options.channel?.startsWith('bidi-'))
+ return this._bidiChromium.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('bidi-'))
+ return this._bidiChromium.launchPersistentContext(progress, userDataDir, options);
+ return super.launchPersistentContext(progress, userDataDir, options);
+ }
+
override async connectOverCDP(progress: Progress, endpointURL: string, options: { slowMo?: number, headers?: types.HeadersArray }) {
return await this._connectOverCDPInternal(progress, endpointURL, options);
}
diff --git a/packages/playwright-core/src/server/dispatchers/browserContextDispatcher.ts b/packages/playwright-core/src/server/dispatchers/browserContextDispatcher.ts
index 4555d4c101..b2bf606a18 100644
--- a/packages/playwright-core/src/server/dispatchers/browserContextDispatcher.ts
+++ b/packages/playwright-core/src/server/dispatchers/browserContextDispatcher.ts
@@ -25,7 +25,7 @@ import { Dispatcher } from './dispatcher';
import { FrameDispatcher } from './frameDispatcher';
import { APIRequestContextDispatcher, RequestDispatcher, ResponseDispatcher, RouteDispatcher } from './networkDispatchers';
import { BindingCallDispatcher, PageDispatcher, WorkerDispatcher } from './pageDispatcher';
-import { CRBrowserContext } from '../chromium/crBrowser';
+import { CRBrowser, CRBrowserContext } from '../chromium/crBrowser';
import { serializeError } from '../errors';
import { TracingDispatcher } from './tracingDispatcher';
import { WebSocketRouteDispatcher } from './webSocketRouteDispatcher';
@@ -136,7 +136,7 @@ export class BrowserContextDispatcher extends Dispatcher<BrowserContext, channel
};
context.dialogManager.addDialogHandler(this._dialogHandler);
- if (context._browser.options.name === 'chromium') {
+ if (context._browser.options.name === 'chromium' && this._object._browser instanceof CRBrowser) {
for (const serviceWorker of (context as CRBrowserContext).serviceWorkers())
this._dispatchEvent('serviceWorker', { worker: new WorkerDispatcher(this, serviceWorker) });
this.addObjectListener(CRBrowserContext.CREvents.ServiceWorker, serviceWorker => this._dispatchEvent('serviceWorker', { worker: new WorkerDispatcher(this, serviceWorker) }));
diff --git a/packages/playwright-core/src/server/dispatchers/playwrightDispatcher.ts b/packages/playwright-core/src/server/dispatchers/playwrightDispatcher.ts
index 32d3591335..7ca3ebf150 100644
--- a/packages/playwright-core/src/server/dispatchers/playwrightDispatcher.ts
+++ b/packages/playwright-core/src/server/dispatchers/playwrightDispatcher.ts
@@ -53,13 +53,11 @@ export class PlaywrightDispatcher extends Dispatcher<Playwright, channels.Playwr
const chromium = new BrowserTypeDispatcher(scope, playwright.chromium, denyLaunch);
const firefox = new BrowserTypeDispatcher(scope, playwright.firefox, denyLaunch);
const webkit = new BrowserTypeDispatcher(scope, playwright.webkit, denyLaunch);
- const _bidiChromium = new BrowserTypeDispatcher(scope, playwright._bidiChromium, denyLaunch);
const android = new AndroidDispatcher(scope, playwright.android);
const initializer: channels.PlaywrightInitializer = {
chromium,
firefox,
webkit,
- _bidiChromium,
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/playwright.ts b/packages/playwright-core/src/server/playwright.ts
index c8d33d4781..c4bb0ff3ec 100644
--- a/packages/playwright-core/src/server/playwright.ts
+++ b/packages/playwright-core/src/server/playwright.ts
@@ -42,7 +42,6 @@ export class Playwright extends SdkObject {
readonly electron: Electron;
readonly firefox: BrowserType;
readonly webkit: BrowserType;
- readonly _bidiChromium: BrowserType;
readonly options: PlaywrightOptions;
readonly debugController: DebugController;
private _allPages = new Set<Page>();
@@ -58,8 +57,7 @@ export class Playwright extends SdkObject {
onPageOpen: page => this._allPages.add(page),
onPageClose: page => this._allPages.delete(page),
}, null);
- this.chromium = new Chromium(this);
- this._bidiChromium = new BidiChromium(this);
+ this.chromium = new Chromium(this, new BidiChromium(this));
this.firefox = new Firefox(this, new BidiFirefox(this));
this.webkit = new WebKit(this);
this.electron = new Electron(this);
diff --git a/packages/playwright-core/src/server/registry/index.ts b/packages/playwright-core/src/server/registry/index.ts
index 25f3ecffd4..3fb031c01f 100644
--- a/packages/playwright-core/src/server/registry/index.ts
+++ b/packages/playwright-core/src/server/registry/index.ts
@@ -403,9 +403,6 @@ const DOWNLOAD_PATHS: Record<BrowserName | InternalTool, DownloadPaths> = {
'mac15-arm64': 'builds/android/%s/android.zip',
'win64': 'builds/android/%s/android.zip',
},
- // TODO(bidi): implement downloads.
- '_bidiChromium': {
- } as DownloadPaths,
};
export const registryDirectory = (() => {
@@ -500,7 +497,7 @@ function readDescriptors(browsersJSON: BrowsersJSON): BrowsersJSONDescriptor[] {
});
}
-export type BrowserName = 'chromium' | 'firefox' | 'webkit' | '_bidiChromium';
+export type BrowserName = 'chromium' | 'firefox' | 'webkit';
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';
@@ -737,9 +734,9 @@ export class Registry {
'win32': `\\Google\\Chrome SxS\\Application\\chrome.exe`,
}));
this._executables.push({
- type: 'browser',
- name: '_bidiChromium',
- browserName: '_bidiChromium',
+ type: 'channel',
+ name: 'bidi-chromium',
+ browserName: 'chromium',
directory: chromium.dir,
executablePath: () => chromiumExecutable,
executablePathOrDie: (sdkLanguage: string) => executablePathOrDie('chromium', chromiumExecutable, chromium.installByDefault, sdkLanguage),
@@ -1005,7 +1002,7 @@ export class Registry {
return {
type: 'channel',
name,
- browserName: '_bidiChromium',
+ browserName: 'chromium',
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 86af0171bf..ad72bca33d 100644
--- a/packages/playwright-core/types/types.d.ts
+++ b/packages/playwright-core/types/types.d.ts
@@ -16290,7 +16290,6 @@ export type AndroidKey =
export const _electron: Electron;
export const _android: Android;
-export const _bidiChromium: 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 c9ffdd8177..0e66ab3d0f 100644
--- a/packages/playwright/src/index.ts
+++ b/packages/playwright/src/index.ts
@@ -101,7 +101,7 @@ const playwrightFixtures: Fixtures<TestFixtures, WorkerFixtures> = ({
}, { scope: 'worker', auto: true, box: true }],
browser: [async ({ playwright, browserName, _browserOptions, connectOptions }, use) => {
- if (!['chromium', 'firefox', 'webkit', '_bidiChromium'].includes(browserName))
+ if (!['chromium', 'firefox', 'webkit'].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.ts
index f166090f90..66fef77a33 100644
--- a/packages/protocol/src/channels.d.ts
+++ b/packages/protocol/src/channels.d.ts
@@ -626,7 +626,6 @@ export type PlaywrightInitializer = {
chromium: BrowserTypeChannel,
firefox: BrowserTypeChannel,
webkit: BrowserTypeChannel,
- _bidiChromium: BrowserTypeChannel,
android: AndroidChannel,
electron: ElectronChannel,
utils?: LocalUtilsChannel,
diff --git a/packages/protocol/src/protocol.yml b/packages/protocol/src/protocol.yml
index 9ee2ae7f86..73aeba935b 100644
--- a/packages/protocol/src/protocol.yml
+++ b/packages/protocol/src/protocol.yml
@@ -794,7 +794,6 @@ Playwright:
chromium: BrowserType
firefox: BrowserType
webkit: BrowserType
- _bidiChromium: BrowserType
android: Android
electron: Electron
utils: LocalUtils?
diff --git a/tests/bidi/playwright.config.ts b/tests/bidi/playwright.config.ts
index 0f489eeeab..e4f4798702 100644
--- a/tests/bidi/playwright.config.ts
+++ b/tests/bidi/playwright.config.ts
@@ -71,17 +71,17 @@ const config: Config<PlaywrightWorkerOptions & PlaywrightTestOptions & TestModeW
projects: [],
};
-type BrowserName = '_bidiChromium' | 'firefox';
+type BrowserName = 'chromium' | 'firefox';
const getExecutablePath = (browserName: BrowserName) => {
- if (browserName === '_bidiChromium')
+ if (browserName === 'chromium')
return process.env.BIDI_CRPATH;
if (browserName === 'firefox')
return process.env.BIDI_FFPATH;
};
const browserToChannels = {
- '_bidiChromium': ['bidi-chromium', 'bidi-chrome-canary', 'bidi-chrome-stable'],
+ 'chromium': ['bidi-chromium', 'bidi-chrome-canary', 'bidi-chrome-stable'],
'firefox': ['moz-firefox', 'moz-firefox-beta', 'moz-firefox-nightly'],
};
diff --git a/tests/config/browserTest.ts b/tests/config/browserTest.ts
index 0fdc040f09..2fe17120e9 100644
--- a/tests/config/browserTest.ts
+++ b/tests/config/browserTest.ts
@@ -67,14 +67,14 @@ const test = baseTest.extend<BrowserTestTestFixtures, BrowserTestWorkerFixtures>
}, { scope: 'worker' }],
allowsThirdParty: [async ({ browserName, channel }, run) => {
- if (browserName === 'firefox' || channel?.startsWith('moz-firefox'))
+ if (browserName === 'firefox')
await run(true);
else
await run(false);
}, { scope: 'worker' }],
defaultSameSiteCookieValue: [async ({ browserName, platform, channel }, run) => {
- if (browserName === 'chromium' || browserName as any === '_bidiChromium' || channel?.startsWith('moz-firefox'))
+ if (browserName === 'chromium' || channel?.startsWith('moz-firefox'))
await run('Lax');
else if (browserName === 'webkit' && (platform === 'linux' || channel === 'webkit-wsl'))
await run('Lax');
diff --git a/tests/library/browsercontext-network-event.spec.ts b/tests/library/browsercontext-network-event.spec.ts
index 0265d1caa3..fff8476712 100644
--- a/tests/library/browsercontext-network-event.spec.ts
+++ b/tests/library/browsercontext-network-event.spec.ts
@@ -105,7 +105,7 @@ 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, channel }) => {
- it.skip(headless && browserName !== 'firefox' && !channel?.startsWith('moz-firefox'), 'headless browsers, except firefox, do not request favicons');
+ it.skip(headless && browserName !== '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.ts
index 567da9e231..1f6b7c6dce 100644
--- a/tests/library/browsercontext-timezone-id.spec.ts
+++ b/tests/library/browsercontext-timezone-id.spec.ts
@@ -45,11 +45,11 @@ it('should work @smoke', async ({ browser, browserName }) => {
}
});
-it('should throw for invalid timezone IDs when creating pages', async ({ browser, browserName, channel }) => {
+it('should throw for invalid timezone IDs when creating pages', async ({ browser, channel }) => {
for (const timezoneId of ['Foo/Bar', 'Baz/Qux']) {
- if (browserName as any === '_bidiChromium' || channel?.startsWith('moz-firefox')) {
+ if (channel?.startsWith('bidi-chrom') || channel?.startsWith('moz-firefox')) {
const error = await browser.newContext({ timezoneId }).catch(e => e);
- if (browserName as any === '_bidiChromium')
+ if (channel?.startsWith('bidi-chrom'))
expect(error.message).toContain(`Invalid timezone "${timezoneId}"`);
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}`);
diff --git a/tests/library/channels.spec.ts b/tests/library/channels.spec.ts
index 13ec20d3f0..17901000f7 100644
--- a/tests/library/channels.spec.ts
+++ b/tests/library/channels.spec.ts
@@ -45,7 +45,6 @@ it('should scope context handles', async ({ browserType, server, expectScopeStat
{ _guid: 'android', objects: [] },
{ _guid: 'browser-type', objects: [] },
{ _guid: 'browser-type', objects: [] },
- { _guid: 'browser-type', objects: [] },
{ _guid: 'browser-type', objects: [
{ _guid: 'browser', objects: [] }
] },
@@ -67,7 +66,6 @@ it('should scope context handles', async ({ browserType, server, expectScopeStat
{ _guid: 'android', objects: [] },
{ _guid: 'browser-type', objects: [] },
{ _guid: 'browser-type', objects: [] },
- { _guid: 'browser-type', objects: [] },
{ _guid: 'browser-type', objects: [
{ _guid: 'browser', objects: [
{ _guid: 'browser-context', objects: [
@@ -103,7 +101,6 @@ it('should scope CDPSession handles', async ({ browserType, browserName, expectS
{ _guid: 'android', objects: [] },
{ _guid: 'browser-type', objects: [] },
{ _guid: 'browser-type', objects: [] },
- { _guid: 'browser-type', objects: [] },
{ _guid: 'browser-type', objects: [
{ _guid: 'browser', objects: [] }
] },
@@ -121,7 +118,6 @@ it('should scope CDPSession handles', async ({ browserType, browserName, expectS
{ _guid: 'android', objects: [] },
{ _guid: 'browser-type', objects: [] },
{ _guid: 'browser-type', objects: [] },
- { _guid: 'browser-type', objects: [] },
{ _guid: 'browser-type', objects: [
{ _guid: 'browser', objects: [
{ _guid: 'cdp-session', objects: [] },
@@ -147,7 +143,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: [] },
@@ -163,7 +158,6 @@ it('should scope browser handles', async ({ browserType, expectScopeState }) =>
{ _guid: 'android', objects: [] },
{ _guid: 'browser-type', objects: [] },
{ _guid: 'browser-type', objects: [] },
- { _guid: 'browser-type', objects: [] },
{ _guid: 'browser-type', objects: [
{
_guid: 'browser', objects: [
@@ -199,7 +193,6 @@ it('should not generate dispatchers for subresources w/o listeners', async ({ pa
{ _guid: 'android', objects: [] },
{ _guid: 'browser-type', objects: [] },
{ _guid: 'browser-type', objects: [] },
- { _guid: 'browser-type', objects: [] },
{ _guid: 'browser-type', objects: [
{
_guid: 'browser', objects: [
@@ -278,10 +271,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.ts
index 9d8f1aadc7..e12a9897cf 100644
--- a/tests/library/favicon.spec.ts
+++ b/tests/library/favicon.spec.ts
@@ -18,7 +18,7 @@
import { contextTest as it } from '../config/browserTest';
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 !== '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 the
diff --git a/tests/library/har.spec.ts b/tests/library/har.spec.ts
index 227589697f..fd3f47264a 100644
--- a/tests/library/har.spec.ts
+++ b/tests/library/har.spec.ts
@@ -699,7 +699,7 @@ it('should contain http2 for http2 requests', async ({ contextFactory }, testInf
});
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 !== '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.ts
index 4b23924f0b..92d9dda2ea 100644
--- a/tests/library/page-close.spec.ts
+++ b/tests/library/page-close.spec.ts
@@ -153,7 +153,7 @@ test('interrupt request.response() and request.allHeaders() on page.close', asyn
await page.close();
expect((await respPromise).message).toContain(kTargetClosedErrorMessage);
// All headers are the same as "provisional" headers in Firefox.
- if (browserName === 'firefox' || channel?.startsWith('moz-firefox'))
+ if (browserName === 'firefox')
expect((await headersPromise)['user-agent']).toBeTruthy();
else
expect((await headersPromise).message).toContain(kTargetClosedErrorMessage);
diff --git a/tests/page/page-basic.spec.ts b/tests/page/page-basic.spec.ts
index 8cdd65ac1c..c93ee813e5 100644
--- a/tests/page/page-basic.spec.ts
+++ b/tests/page/page-basic.spec.ts
@@ -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' || channel?.startsWith('moz-firefox')) {
+ if (browserName === '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.ts
index 387e4e5709..4c1e7e5a79 100644
--- a/tests/page/page-event-console.spec.ts
+++ b/tests/page/page-event-console.spec.ts
@@ -197,13 +197,13 @@ it('should use object previews for errors', async ({ page, browserName, channel
text = message.text();
});
await page.evaluate(() => console.log(new Error('Exception')));
- if (browserName === 'chromium')
- expect(text).toContain('.evaluate');
- if (browserName as any === '_bidiChromium')
+ if (channel?.startsWith('bidi-chrom'))
expect(text).toEqual('error');
- if (browserName === 'webkit' || channel?.startsWith('moz-firefox'))
+ else if (browserName === 'chromium')
+ expect(text).toContain('.evaluate');
+ else if (browserName === 'webkit' || channel?.startsWith('moz-firefox'))
expect(text).toEqual('Error: Exception');
- if (browserName === 'firefox')
+ else if (browserName === 'firefox')
expect(text).toEqual('Error');
});
diff --git a/tests/page/page-event-network.spec.ts b/tests/page/page-event-network.spec.ts
index c92ef40b5f..5618431c99 100644
--- a/tests/page/page-event-network.spec.ts
+++ b/tests/page/page-event-network.spec.ts
@@ -54,7 +54,7 @@ it('Page.Events.RequestFailed @smoke', async ({ page, server, browserName, platf
expect(failedRequests[0].url()).toContain('one-style.css');
expect(await failedRequests[0].response()).toBe(null);
expect(failedRequests[0].resourceType()).toBe('stylesheet');
- if (browserName === 'chromium' || browserName === '_bidiChromium') {
+ if (browserName === 'chromium') {
expect(failedRequests[0].failure().errorText).toBe('net::ERR_EMPTY_RESPONSE');
} else if (browserName === 'webkit') {
if (platform === 'linux' || channel === 'webkit-wsl')
diff --git a/tests/page/page-event-pageerror.spec.ts b/tests/page/page-event-pageerror.spec.ts
index ea1bf0524f..f2f129f0d3 100644
--- a/tests/page/page-event-pageerror.spec.ts
+++ b/tests/page/page-event-pageerror.spec.ts
@@ -25,7 +25,7 @@ it('should fire', async ({ page, server, browserName, channel }) => {
]);
expect(error.name).toBe('Error');
expect(error.message).toBe('Fancy error!');
- if (browserName === 'chromium' || browserName === '_bidiChromium' || channel?.startsWith('moz-firefox')) {
+ if (browserName === 'chromium' || 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.ts
index 354c970052..c70a3a4e7d 100644
--- a/tests/page/page-goto.spec.ts
+++ b/tests/page/page-goto.spec.ts
@@ -295,10 +295,12 @@ it('should work when page calls history API in beforeunload', async ({ page, ser
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');
+ if (channel?.startsWith('bidi-chrom'))
+ expect(error.message).toContain('Invalid URL');
else if (channel?.startsWith('moz-firefox'))
expect(error.message).toContain('NS_ERROR_MALFORMED_URI');
+ else if (browserName === 'chromium' || browserName === 'webkit')
+ expect(error.message).toContain('Cannot navigate to invalid URL');
else
expect(error.message).toContain('Invalid url');
});
diff --git a/tests/page/page-route.spec.ts b/tests/page/page-route.spec.ts
index 8dc56af5d6..db0b494904 100644
--- a/tests/page/page-route.spec.ts
+++ b/tests/page/page-route.spec.ts
@@ -634,11 +634,11 @@ it('should support cors with GET', async ({ page, server, browserName, channel }
const response = await fetch('https://example.com/cars?reject', { mode: 'cors' });
return response.json();
}).catch(e => e);
- if (browserName === 'chromium' || browserName === '_bidiChromium')
+ if (browserName === 'chromium')
expect(error.message).toContain('Failed');
if (browserName === 'webkit')
expect(error.message).toContain('TypeError');
- if (browserName === 'firefox' || channel?.startsWith('moz-firefox'))
+ if (browserName === 'firefox')
expect(error.message).toContain('NetworkError');
}
});
diff --git a/tests/page/pageTestApi.ts b/tests/page/pageTestApi.ts
index bde24e6235..1b7c8e0b4b 100644
--- a/tests/page/pageTestApi.ts
+++ b/tests/page/pageTestApi.ts
@@ -29,7 +29,7 @@ export type PageWorkerFixtures = {
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' | '_bidiChromium';
+ browserName: 'chromium' | 'firefox' | 'webkit';
browserVersion: string;
browserMajorVersion: number;
electronMajorVersion: number;
diff --git a/utils/generate_types/overrides.d.ts b/utils/generate_types/overrides.d.ts
index 84b556b9ee..2dad53c848 100644
--- a/utils/generate_types/overrides.d.ts
+++ b/utils/generate_types/overrides.d.ts
@@ -397,7 +397,6 @@ export type AndroidKey =
export const _electron: Electron;
export const _android: Android;
-export const _bidiChromium: BrowserType;
// This is required to not export everything by default. See https://github.com/Microsoft/TypeScript/issues/19545#issuecomment-340490459
export {};