diff --git a/src/client/channelOwner.ts b/src/client/channelOwner.ts index be7d84a53fc4d..020c8cc80047d 100644 --- a/src/client/channelOwner.ts +++ b/src/client/channelOwner.ts @@ -62,6 +62,8 @@ export abstract class ChannelOwner this._connection.sendMessageToServer(this._type, guid, String(prop), params); }, }); diff --git a/test/channels.spec.ts b/test/channels.spec.ts index 68eec881919d2..9ab7ed2c9ef35 100644 --- a/test/channels.spec.ts +++ b/test/channels.spec.ts @@ -15,9 +15,22 @@ * limitations under the License. */ +import domain from 'domain'; +import { registerWorkerFixture } from '@playwright/test-runner'; import { it, expect, options } from './playwright.fixtures'; import type { ChromiumBrowser } from '..'; +registerWorkerFixture('domain', async ({ }, test) => { + const local = domain.create(); + local.run(() => { }); + let err; + local.on('error', e => err = e); + local.enter(); + await test(null); + if (err) + throw err; +}); + it('should work', async ({browser}) => { expect(!!browser['_connection']).toBeTruthy(); }); @@ -144,6 +157,14 @@ it('should scope browser handles', async ({browserType, defaultBrowserOptions}) await expectScopeState(browserType, GOLDEN_PRECONDITION); }); +it('should work with the domain module', async ({ domain, browserType }) => { + const browser = await browserType.launch(); + const page = await browser.newPage(); + const result = await page.evaluate(() => 1 + 1); + expect(result).toBe(2); + await browser.close(); +}); + async function expectScopeState(object, golden) { golden = trimGuids(golden); const remoteState = trimGuids(await object._channel.debugScopeState()); diff --git a/test/playwright.fixtures.ts b/test/playwright.fixtures.ts index 285bd51a3fa6e..985f515971f3e 100644 --- a/test/playwright.fixtures.ts +++ b/test/playwright.fixtures.ts @@ -48,6 +48,7 @@ declare global { browserType: BrowserType; browser: Browser; httpService: {server: TestServer, httpsServer: TestServer} + domain: void; toImpl: (rpcObject: any) => any; } interface TestState {