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): fix signals tests (#34209)

Yury Semikhatsky5a22475ea813
diff --git a/packages/playwright-core/src/browserServerImpl.ts b/packages/playwright-core/src/browserServerImpl.ts
index dfe960c5ea..d59c95bfb1 100644
--- a/packages/playwright-core/src/browserServerImpl.ts
+++ b/packages/playwright-core/src/browserServerImpl.ts
@@ -29,9 +29,9 @@ import { rewriteErrorMessage } from './utils/stackTrace';
import { SocksProxy } from './common/socksProxy';
export class BrowserServerLauncherImpl implements BrowserServerLauncher {
- private _browserName: 'chromium' | 'firefox' | 'webkit';
+ private _browserName: 'chromium' | 'firefox' | 'webkit' | 'bidiFirefox' | 'bidiChromium';
- constructor(browserName: 'chromium' | 'firefox' | 'webkit') {
+ constructor(browserName: 'chromium' | 'firefox' | 'webkit' | 'bidiFirefox' | 'bidiChromium') {
this._browserName = browserName;
}
diff --git a/packages/playwright-core/src/inProcessFactory.ts b/packages/playwright-core/src/inProcessFactory.ts
index 1397c81958..a757294da8 100644
--- a/packages/playwright-core/src/inProcessFactory.ts
+++ b/packages/playwright-core/src/inProcessFactory.ts
@@ -41,6 +41,8 @@ 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');
+ 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/tests/bidi/expectations/bidi-chromium-library.txt b/tests/bidi/expectations/bidi-chromium-library.txt
index ecdb4e425c..e49e4cedb2 100644
--- a/tests/bidi/expectations/bidi-chromium-library.txt
+++ b/tests/bidi/expectations/bidi-chromium-library.txt
@@ -1674,16 +1674,6 @@ library/selectors-register.spec.ts › should work in main and isolated world [p
library/selectors-register.spec.ts › should work when registered on global [pass]
library/selectors-register.spec.ts › should work with path [pass]
library/shared-worker.spec.ts › should survive shared worker restart [timeout]
-library/signals.spec.ts › should close the browser when the node process closes [timeout]
-library/signals.spec.ts › should remove temp dir on process.exit [timeout]
-library/signals.spec.ts › signals › should close the browser on SIGHUP [timeout]
-library/signals.spec.ts › signals › should close the browser on SIGINT [timeout]
-library/signals.spec.ts › signals › should close the browser on SIGTERM [timeout]
-library/signals.spec.ts › signals › should kill the browser on SIGINT + SIGTERM [timeout]
-library/signals.spec.ts › signals › should kill the browser on SIGTERM + SIGINT [timeout]
-library/signals.spec.ts › signals › should kill the browser on double SIGINT and remove temp dir [timeout]
-library/signals.spec.ts › signals › should not prevent default SIGTERM handling after browser close [timeout]
-library/signals.spec.ts › signals › should report browser close signal 2 [timeout]
library/slowmo.spec.ts › slowMo › ElementHandle SlowMo check [pass]
library/slowmo.spec.ts › slowMo › ElementHandle SlowMo click [pass]
library/slowmo.spec.ts › slowMo › ElementHandle SlowMo dblclick [pass]
diff --git a/tests/bidi/expectations/bidi-firefox-nightly-library.txt b/tests/bidi/expectations/bidi-firefox-nightly-library.txt
index f0920dbee4..c4d8b933fa 100644
--- a/tests/bidi/expectations/bidi-firefox-nightly-library.txt
+++ b/tests/bidi/expectations/bidi-firefox-nightly-library.txt
@@ -1726,16 +1726,6 @@ library/selectors-register.spec.ts › should work in main and isolated world [p
library/selectors-register.spec.ts › should work when registered on global [pass]
library/selectors-register.spec.ts › should work with path [pass]
library/shared-worker.spec.ts › should survive shared worker restart [pass]
-library/signals.spec.ts › should close the browser when the node process closes [timeout]
-library/signals.spec.ts › should remove temp dir on process.exit [timeout]
-library/signals.spec.ts › signals › should close the browser on SIGHUP [timeout]
-library/signals.spec.ts › signals › should close the browser on SIGINT [timeout]
-library/signals.spec.ts › signals › should close the browser on SIGTERM [timeout]
-library/signals.spec.ts › signals › should kill the browser on SIGINT + SIGTERM [timeout]
-library/signals.spec.ts › signals › should kill the browser on SIGTERM + SIGINT [timeout]
-library/signals.spec.ts › signals › should kill the browser on double SIGINT and remove temp dir [timeout]
-library/signals.spec.ts › signals › should not prevent default SIGTERM handling after browser close [timeout]
-library/signals.spec.ts › signals › should report browser close signal 2 [timeout]
library/slowmo.spec.ts › slowMo › ElementHandle SlowMo check [pass]
library/slowmo.spec.ts › slowMo › ElementHandle SlowMo click [pass]
library/slowmo.spec.ts › slowMo › ElementHandle SlowMo dblclick [pass]
diff --git a/tests/config/browserTest.ts b/tests/config/browserTest.ts
index 7836b2e38c..9eba4f30d1 100644
--- a/tests/config/browserTest.ts
+++ b/tests/config/browserTest.ts
@@ -137,14 +137,14 @@ const test = baseTest.extend<BrowserTestTestFixtures, BrowserTestWorkerFixtures>
await persistentContext.close();
},
- startRemoteServer: async ({ childProcess, browserType }, run) => {
+ startRemoteServer: async ({ childProcess, browserType, channel }, run) => {
let server: PlaywrightServer | undefined;
const fn = async (kind: 'launchServer' | 'run-server', options?: RemoteServerOptions) => {
if (server)
throw new Error('can only start one remote server');
if (kind === 'launchServer') {
const remoteServer = new RemoteServer();
- await remoteServer._start(childProcess, browserType, options);
+ await remoteServer._start(childProcess, browserType, channel, options);
server = remoteServer;
} else {
const runServer = new RunServer();
diff --git a/tests/config/remoteServer.ts b/tests/config/remoteServer.ts
index 6d9710fd44..94c476ed80 100644
--- a/tests/config/remoteServer.ts
+++ b/tests/config/remoteServer.ts
@@ -80,7 +80,7 @@ export class RemoteServer implements PlaywrightServer {
_browser: Browser | undefined;
_wsEndpoint!: string;
- async _start(childProcess: CommonFixtures['childProcess'], browserType: BrowserType, remoteServerOptions: RemoteServerOptions = {}) {
+ async _start(childProcess: CommonFixtures['childProcess'], browserType: BrowserType, channel: string, remoteServerOptions: RemoteServerOptions = {}) {
this._browserType = browserType;
const browserOptions = (browserType as any)._defaultLaunchOptions;
// Copy options to prevent a large JSON string when launching subprocess.
@@ -97,9 +97,16 @@ export class RemoteServer implements PlaywrightServer {
};
const options = {
browserTypeName: browserType.name(),
+ channel,
launchOptions,
...remoteServerOptions,
};
+ if ('bidi' === browserType.name()) {
+ if (channel.toLocaleLowerCase().includes('firefox'))
+ options.browserTypeName = '_bidiFirefox';
+ else
+ options.browserTypeName = '_bidiChromium';
+ }
this._process = childProcess({
command: ['node', path.join(__dirname, 'remote-server-impl.js'), JSON.stringify(options)],
env: { ...process.env, PWTEST_UNDER_TEST: '1' },