Skip to content

Commit 7d8d3d0

Browse files
authored
fix: fix type error for RemoteDebugger (#2726)
* fix: fix type error for RemoteDebugger * use a ternary operator style * fix bad removal
1 parent 0f208a9 commit 7d8d3d0

File tree

1 file changed

+25
-23
lines changed

1 file changed

+25
-23
lines changed

lib/commands/context.ts

Lines changed: 25 additions & 23 deletions
Original file line numberDiff line numberDiff line change
@@ -434,31 +434,33 @@ export function isWebview(this: XCUITestDriver): boolean {
434434
* @returns A configured RemoteDebugger instance
435435
*/
436436
export async function getNewRemoteDebugger(this: XCUITestDriver): Promise<RemoteDebugger> {
437-
const socketPath = this.isRealDevice()
437+
const isRealDevice = this.isRealDevice();
438+
const socketPath = isRealDevice
438439
? undefined
439440
: (await (this.device as Simulator).getWebInspectorSocket() ?? undefined);
440-
return createRemoteDebugger(
441-
{
442-
bundleId: this.opts.bundleId,
443-
additionalBundleIds: this.opts.additionalWebviewBundleIds as string[] | undefined,
444-
isSafari: this.isSafari(),
445-
includeSafari: this.opts.includeSafariInWebviews,
446-
pageLoadMs: this.pageLoadMs,
447-
platformVersion: this.opts.platformVersion,
448-
socketPath,
449-
remoteDebugProxy: this.opts.remoteDebugProxy,
450-
garbageCollectOnExecute: util.hasValue(this.opts.safariGarbageCollect)
451-
? !!this.opts.safariGarbageCollect
452-
: false,
453-
udid: this.opts.udid as string,
454-
logAllCommunication: this.opts.safariLogAllCommunication,
455-
logAllCommunicationHexDump: this.opts.safariLogAllCommunicationHexDump,
456-
socketChunkSize: this.opts.safariSocketChunkSize,
457-
webInspectorMaxFrameLength: this.opts.safariWebInspectorMaxFrameLength,
458-
pageLoadStrategy: this.caps.pageLoadStrategy,
459-
},
460-
this.isRealDevice(),
461-
);
441+
442+
const baseOpts = {
443+
bundleId: this.opts.bundleId,
444+
additionalBundleIds: this.opts.additionalWebviewBundleIds as string[] | undefined,
445+
isSafari: this.isSafari(),
446+
includeSafari: this.opts.includeSafariInWebviews,
447+
pageLoadMs: this.pageLoadMs,
448+
platformVersion: this.opts.platformVersion,
449+
socketPath,
450+
remoteDebugProxy: this.opts.remoteDebugProxy,
451+
garbageCollectOnExecute: util.hasValue(this.opts.safariGarbageCollect)
452+
? !!this.opts.safariGarbageCollect
453+
: false,
454+
logAllCommunication: this.opts.safariLogAllCommunication,
455+
logAllCommunicationHexDump: this.opts.safariLogAllCommunicationHexDump,
456+
socketChunkSize: this.opts.safariSocketChunkSize,
457+
webInspectorMaxFrameLength: this.opts.safariWebInspectorMaxFrameLength,
458+
pageLoadStrategy: this.caps.pageLoadStrategy,
459+
};
460+
461+
return isRealDevice
462+
? createRemoteDebugger({...baseOpts, udid: this.opts.udid as string}, true)
463+
: createRemoteDebugger(baseOpts, false);
462464
}
463465

464466
/**

0 commit comments

Comments
 (0)