From aa9ac949bbce0e683a14c2b2fc52a0da2bc6e06f Mon Sep 17 00:00:00 2001 From: saikrishna321 Date: Thu, 25 Apr 2024 15:27:56 +0530 Subject: [PATCH] fix app path for remote rexecution --- src/CapabilityManager.ts | 5 ++++- src/modules | 2 +- src/plugin.ts | 4 +++- 3 files changed, 8 insertions(+), 3 deletions(-) diff --git a/src/CapabilityManager.ts b/src/CapabilityManager.ts index 3161aa73d..3285f3113 100644 --- a/src/CapabilityManager.ts +++ b/src/CapabilityManager.ts @@ -3,6 +3,7 @@ import { ISessionCapability } from './interfaces/ISessionCapability'; import _ from 'lodash'; import { IDevice } from './interfaces/IDevice'; import { prisma } from './prisma'; +import { DevicePlugin } from './plugin'; export enum DEVICE_FARM_CAPABILITIES { BUILD_NAME = 'build', @@ -36,7 +37,7 @@ async function findAppPath(fileName: string) { const appInfo: any = await prisma.appInformation.findFirst({ where: { uploadedFileName: fileName as string }, }); - return appInfo?.path; + return `${DevicePlugin.serverUrl}${appInfo?.path}`; } else { return fileName; } @@ -74,6 +75,7 @@ export async function iOSCapabilities( wdaBundleId?: string; }, ) { + caps.firstMatch[0]['appium:app'] = await findAppPath(caps.alwaysMatch['appium:app']); caps.firstMatch[0]['appium:udid'] = freeDevice.udid; caps.firstMatch[0]['appium:deviceName'] = freeDevice.name; caps.firstMatch[0]['appium:platformVersion'] = freeDevice.sdk; @@ -91,6 +93,7 @@ export async function iOSCapabilities( 'appium:mjpegServerPort', 'appium:udid', 'appium:deviceName', + 'appium:app', ]; deleteMatch.forEach((value) => deleteAlwaysMatch(caps, value)); } diff --git a/src/modules b/src/modules index e54db7ffd..c1a08ff82 160000 --- a/src/modules +++ b/src/modules @@ -1 +1 @@ -Subproject commit e54db7ffd81cf033862aab5d33ff1aad4b389c5e +Subproject commit c1a08ff823b5469818cc8cf49985a05c35e8cb37 diff --git a/src/plugin.ts b/src/plugin.ts index 0df9bb141..f66b56e72 100644 --- a/src/plugin.ts +++ b/src/plugin.ts @@ -92,13 +92,14 @@ class DevicePlugin extends BasePlugin { public static IS_HUB = false; private static httpServer: any; private static adbInstance: any; + public static serverUrl: string; constructor(pluginName: string, cliArgs: any) { super(pluginName, cliArgs); // here, CLI Args are already pluginArgs. Different case for updateServer log.debug(`📱 Plugin Args: ${JSON.stringify(cliArgs)}`); // plugin args will assign undefined value as well for bindHostOrIp - this.pluginArgs = Object.assign({}, DefaultPluginArgs, this.cliArgs as unknown as IPluginArgs); + this.pluginArgs = Object.assign({}, DefaultPluginArgs, cliArgs as unknown as IPluginArgs); // not pretty but will do for now if (this.pluginArgs.bindHostOrIp === undefined) { this.pluginArgs.bindHostOrIp = ip.address(); @@ -231,6 +232,7 @@ class DevicePlugin extends BasePlugin { ); } else { DevicePlugin.IS_HUB = true; + DevicePlugin.serverUrl = `http://${pluginArgs.bindHostOrIp}:${cliArgs.port}`; log.info(`📣📣📣 I'm a hub and I'm listening on ${pluginArgs.bindHostOrIp}:${cliArgs.port}`); }