From 6ca01e48b1f7e2ed498301509f1a5fed320a4a81 Mon Sep 17 00:00:00 2001 From: Meni Kadosh Date: Mon, 26 Aug 2024 16:46:43 +0300 Subject: [PATCH] - upgraded Appium to 5.1.0 release and fixed breaking changes with Start/Close App operations - upgraded System.Drawing.Common to 8.0.7 --- Ginger/Ginger/Ginger.csproj | 2 +- Ginger/GingerCore/GingerCore.csproj | 2 +- .../GingerCoreCommon/GingerCoreCommon.csproj | 2 +- .../ActionsLib/UI/Mobile/ActMobileDevice.cs | 13 ++++++++++ .../Mobile/Appium/GenericAppiumDriver.cs | 26 +++++++++++++++++-- Ginger/GingerCoreNET/GingerCoreNET.csproj | 4 +-- .../GingerPluginCore/GingerPluginCore.csproj | 2 +- Ginger/GingerUtils/GingerUtils.csproj | 2 +- 8 files changed, 44 insertions(+), 9 deletions(-) diff --git a/Ginger/Ginger/Ginger.csproj b/Ginger/Ginger/Ginger.csproj index 3e98dc02bf..e02aa55d86 100644 --- a/Ginger/Ginger/Ginger.csproj +++ b/Ginger/Ginger/Ginger.csproj @@ -723,7 +723,7 @@ - + diff --git a/Ginger/GingerCore/GingerCore.csproj b/Ginger/GingerCore/GingerCore.csproj index a1d4b789f8..9712834c02 100644 --- a/Ginger/GingerCore/GingerCore.csproj +++ b/Ginger/GingerCore/GingerCore.csproj @@ -621,7 +621,7 @@ - 8.0.1 + 8.0.7 4.3.0 diff --git a/Ginger/GingerCoreCommon/GingerCoreCommon.csproj b/Ginger/GingerCoreCommon/GingerCoreCommon.csproj index e8ef987988..898c2b9151 100644 --- a/Ginger/GingerCoreCommon/GingerCoreCommon.csproj +++ b/Ginger/GingerCoreCommon/GingerCoreCommon.csproj @@ -42,7 +42,7 @@ - + diff --git a/Ginger/GingerCoreNET/ActionsLib/UI/Mobile/ActMobileDevice.cs b/Ginger/GingerCoreNET/ActionsLib/UI/Mobile/ActMobileDevice.cs index a1a074d04f..1d25e4f084 100644 --- a/Ginger/GingerCoreNET/ActionsLib/UI/Mobile/ActMobileDevice.cs +++ b/Ginger/GingerCoreNET/ActionsLib/UI/Mobile/ActMobileDevice.cs @@ -167,6 +167,19 @@ public ActInputValue Y2 } } + public ActInputValue ActionAppPackage + { + get + { + return GetOrCreateInputParam(nameof(ActionAppPackage), "default"); + } + set + { + AddOrUpdateInputParamValue(nameof(ActionAppPackage), value.ToString()); + OnPropertyChanged(nameof(ActionAppPackage)); + } + } + public string mSimulatedPhotoPath; public ActInputValue SimulatedPhotoPath { diff --git a/Ginger/GingerCoreNET/Drivers/CoreDrivers/Mobile/Appium/GenericAppiumDriver.cs b/Ginger/GingerCoreNET/Drivers/CoreDrivers/Mobile/Appium/GenericAppiumDriver.cs index 515fe80960..a033aa31ef 100644 --- a/Ginger/GingerCoreNET/Drivers/CoreDrivers/Mobile/Appium/GenericAppiumDriver.cs +++ b/Ginger/GingerCoreNET/Drivers/CoreDrivers/Mobile/Appium/GenericAppiumDriver.cs @@ -1079,7 +1079,7 @@ private void MobileDeviceActionHandler(ActMobileDevice act) case ActMobileDevice.eMobileDeviceAction.OpenApp: if (AppType == eAppType.NativeHybride) { - Driver.LaunchApp(); + Driver.ActivateApp((GetAppPackage(act))); } else { @@ -1090,7 +1090,7 @@ private void MobileDeviceActionHandler(ActMobileDevice act) case ActMobileDevice.eMobileDeviceAction.CloseApp: if (AppType == eAppType.NativeHybride) { - Driver.CloseApp(); + Driver.TerminateApp((GetAppPackage(act))); } else { @@ -1196,6 +1196,28 @@ private void MobileDeviceActionHandler(ActMobileDevice act) } } + private string GetAppPackage(ActMobileDevice act) + { + string appPackage = null; + if (string.IsNullOrEmpty(act.ActionAppPackage.ValueForDriver) || act.ActionAppPackage.ValueForDriver.ToLower().Trim() == "default") + { + if (DevicePlatformType == eDevicePlatformType.Android) + { + appPackage = AppiumCapabilities.Where(x => x.Parameter == "appPackage" || x.Parameter == "appium:appPackage").FirstOrDefault().Value; + } + else + { + appPackage = AppiumCapabilities.Where(x => x.Parameter == "bundleId" || x.Parameter == "appium:bundleId").FirstOrDefault().Value; + } + + return appPackage; + } + else + { + return act.ActionAppPackage.Value; + } + } + public string SimulatePhotoOrBarcode(string photoString, string action) { Bitmap picture = null; diff --git a/Ginger/GingerCoreNET/GingerCoreNET.csproj b/Ginger/GingerCoreNET/GingerCoreNET.csproj index 4aec3c56b9..41ecf0044a 100644 --- a/Ginger/GingerCoreNET/GingerCoreNET.csproj +++ b/Ginger/GingerCoreNET/GingerCoreNET.csproj @@ -236,7 +236,7 @@ - + @@ -333,7 +333,7 @@ - + diff --git a/Ginger/GingerPluginCore/GingerPluginCore.csproj b/Ginger/GingerPluginCore/GingerPluginCore.csproj index 977f0982ce..d48acf42db 100644 --- a/Ginger/GingerPluginCore/GingerPluginCore.csproj +++ b/Ginger/GingerPluginCore/GingerPluginCore.csproj @@ -16,7 +16,7 @@ - + diff --git a/Ginger/GingerUtils/GingerUtils.csproj b/Ginger/GingerUtils/GingerUtils.csproj index 3e135d9b03..c980796215 100644 --- a/Ginger/GingerUtils/GingerUtils.csproj +++ b/Ginger/GingerUtils/GingerUtils.csproj @@ -18,7 +18,7 @@ - +