diff --git a/src/rpc/channels.ts b/src/rpc/channels.ts index 4d09618b5f..f8d62f39df 100644 --- a/src/rpc/channels.ts +++ b/src/rpc/channels.ts @@ -29,7 +29,7 @@ export type PlaywrightInitializer = { firefox: BrowserTypeChannel, webkit: BrowserTypeChannel, electron?: ElectronChannel, - deviceDescriptors: types.Devices, + deviceDescriptors: { name: string, descriptor: types.DeviceDescriptor }[], selectors: SelectorsChannel, }; diff --git a/src/rpc/client/playwright.ts b/src/rpc/client/playwright.ts index 246af0424d..d22de2d1b6 100644 --- a/src/rpc/client/playwright.ts +++ b/src/rpc/client/playwright.ts @@ -35,7 +35,9 @@ export class Playwright extends ChannelOwner implements PlaywrightChannel { constructor(scope: DispatcherScope, playwright: Playwright) { const electron = (playwright as any).electron as (Electron | undefined); + const deviceDescriptors = Object.entries(playwright.devices) + .map(([name, descriptor]) => ({ name, descriptor })); super(scope, playwright, 'playwright', { chromium: new BrowserTypeDispatcher(scope, playwright.chromium!), firefox: new BrowserTypeDispatcher(scope, playwright.firefox!), webkit: new BrowserTypeDispatcher(scope, playwright.webkit!), electron: electron ? new ElectronDispatcher(scope, electron) : undefined, - deviceDescriptors: playwright.devices, + deviceDescriptors, selectors: new SelectorsDispatcher(scope, playwright.selectors), }, false, 'playwright'); }