chore(bidi): fix signals tests (#34209)
This commit is contained in:
parent
8b45ea6f2f
commit
5a22475ea8
|
|
@ -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;
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -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));
|
||||
|
|
|
|||
|
|
@ -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]
|
||||
|
|
|
|||
|
|
@ -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]
|
||||
|
|
|
|||
|
|
@ -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();
|
||||
|
|
|
|||
|
|
@ -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' },
|
||||
|
|
|
|||
Loading…
Reference in a new issue