Skip to content

Commit

Permalink
code review changes
Browse files Browse the repository at this point in the history
  • Loading branch information
MeniKadosh1 committed Sep 18, 2024
1 parent b219dc9 commit f177bd0
Show file tree
Hide file tree
Showing 2 changed files with 22 additions and 22 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -96,30 +96,30 @@ private void BindConfigurationsFields()

private void BindRadioButtons()
{
mDeviceAutoScreenshotRefreshMode = mAgent.GetOrCreateParam(nameof(GenericAppiumDriver.DeviceAutoScreenshotRefreshMode), eAutoScreenshotRefreshMode.Live.ToString());
BindingHandler.ObjFieldBinding(xLiveRdBtn, RadioButton.IsCheckedProperty, mDeviceAutoScreenshotRefreshMode, nameof(DriverConfigParam.Value), bindingConvertor: new RadioBtnEnumConfigConverter(), converterParameter: eAutoScreenshotRefreshMode.Live.ToString());
BindingHandler.ObjFieldBinding(xPostOperationRdBtn, RadioButton.IsCheckedProperty, mDeviceAutoScreenshotRefreshMode, nameof(DriverConfigParam.Value), bindingConvertor: new RadioBtnEnumConfigConverter(), converterParameter: eAutoScreenshotRefreshMode.PostOperation.ToString());
BindingHandler.ObjFieldBinding(xDisabledRdBtn, RadioButton.IsCheckedProperty, mDeviceAutoScreenshotRefreshMode, nameof(DriverConfigParam.Value), bindingConvertor: new RadioBtnEnumConfigConverter(), converterParameter: eAutoScreenshotRefreshMode.Disabled.ToString());
mDeviceAutoScreenshotRefreshMode = mAgent.GetOrCreateParam(nameof(GenericAppiumDriver.DeviceAutoScreenshotRefreshMode), nameof(eAutoScreenshotRefreshMode.Live));
BindingHandler.ObjFieldBinding(xLiveRdBtn, RadioButton.IsCheckedProperty, mDeviceAutoScreenshotRefreshMode, nameof(DriverConfigParam.Value), bindingConvertor: new RadioBtnEnumConfigConverter(), converterParameter: nameof(eAutoScreenshotRefreshMode.Live));
BindingHandler.ObjFieldBinding(xPostOperationRdBtn, RadioButton.IsCheckedProperty, mDeviceAutoScreenshotRefreshMode, nameof(DriverConfigParam.Value), bindingConvertor: new RadioBtnEnumConfigConverter(), converterParameter: nameof(eAutoScreenshotRefreshMode.PostOperation));
BindingHandler.ObjFieldBinding(xDisabledRdBtn, RadioButton.IsCheckedProperty, mDeviceAutoScreenshotRefreshMode, nameof(DriverConfigParam.Value), bindingConvertor: new RadioBtnEnumConfigConverter(), converterParameter: nameof(eAutoScreenshotRefreshMode.Disabled));

mDevicePlatformType = mAgent.GetOrCreateParam(nameof(GenericAppiumDriver.DevicePlatformType));
BindingHandler.ObjFieldBinding(xAndroidRdBtn, RadioButton.IsCheckedProperty, mDevicePlatformType, nameof(DriverConfigParam.Value), bindingConvertor: new RadioBtnEnumConfigConverter(), converterParameter: eDevicePlatformType.Android.ToString());
BindingHandler.ObjFieldBinding(xIOSRdBtn, RadioButton.IsCheckedProperty, mDevicePlatformType, nameof(DriverConfigParam.Value), bindingConvertor: new RadioBtnEnumConfigConverter(), converterParameter: eDevicePlatformType.iOS.ToString());
BindingHandler.ObjFieldBinding(xAndroidRdBtn, RadioButton.IsCheckedProperty, mDevicePlatformType, nameof(DriverConfigParam.Value), bindingConvertor: new RadioBtnEnumConfigConverter(), converterParameter: nameof(eDevicePlatformType.Android));
BindingHandler.ObjFieldBinding(xIOSRdBtn, RadioButton.IsCheckedProperty, mDevicePlatformType, nameof(DriverConfigParam.Value), bindingConvertor: new RadioBtnEnumConfigConverter(), converterParameter: nameof(eDevicePlatformType.iOS));

if (IsUFTCapabilityExist())
{
mDeviceSource = mAgent.GetOrCreateParam(nameof(GenericAppiumDriver.DeviceSource), eDeviceSource.MicroFoucsUFTMLab.ToString());
mDeviceSource = mAgent.GetOrCreateParam(nameof(GenericAppiumDriver.DeviceSource), nameof(eDeviceSource.MicroFoucsUFTMLab));
}
else
{
mDeviceSource = mAgent.GetOrCreateParam(nameof(GenericAppiumDriver.DeviceSource));
}
BindingHandler.ObjFieldBinding(xLocalAppiumRdBtn, RadioButton.IsCheckedProperty, mDeviceSource, nameof(DriverConfigParam.Value), bindingConvertor: new RadioBtnEnumConfigConverter(), converterParameter: eDeviceSource.LocalAppium.ToString());
BindingHandler.ObjFieldBinding(xUFTRdBtn, RadioButton.IsCheckedProperty, mDeviceSource, nameof(DriverConfigParam.Value), bindingConvertor: new RadioBtnEnumConfigConverter(), converterParameter: eDeviceSource.MicroFoucsUFTMLab.ToString());
BindingHandler.ObjFieldBinding(xKobitonRdBtn, RadioButton.IsCheckedProperty, mDeviceSource, nameof(DriverConfigParam.Value), bindingConvertor: new RadioBtnEnumConfigConverter(), converterParameter: eDeviceSource.Kobiton.ToString());
BindingHandler.ObjFieldBinding(xLocalAppiumRdBtn, RadioButton.IsCheckedProperty, mDeviceSource, nameof(DriverConfigParam.Value), bindingConvertor: new RadioBtnEnumConfigConverter(), converterParameter: nameof(eDeviceSource.LocalAppium));
BindingHandler.ObjFieldBinding(xUFTRdBtn, RadioButton.IsCheckedProperty, mDeviceSource, nameof(DriverConfigParam.Value), bindingConvertor: new RadioBtnEnumConfigConverter(), converterParameter: nameof(eDeviceSource.MicroFoucsUFTMLab));
BindingHandler.ObjFieldBinding(xKobitonRdBtn, RadioButton.IsCheckedProperty, mDeviceSource, nameof(DriverConfigParam.Value), bindingConvertor: new RadioBtnEnumConfigConverter(), converterParameter: nameof(eDeviceSource.Kobiton));

mAppType = mAgent.GetOrCreateParam(nameof(GenericAppiumDriver.AppType));
BindingHandler.ObjFieldBinding(xNativeHybRdBtn, RadioButton.IsCheckedProperty, mAppType, nameof(DriverConfigParam.Value), bindingConvertor: new RadioBtnEnumConfigConverter(), converterParameter: eAppType.NativeHybride.ToString());
BindingHandler.ObjFieldBinding(xWebRdBtn, RadioButton.IsCheckedProperty, mAppType, nameof(DriverConfigParam.Value), bindingConvertor: new RadioBtnEnumConfigConverter(), converterParameter: eAppType.Web.ToString());
BindingHandler.ObjFieldBinding(xNativeHybRdBtn, RadioButton.IsCheckedProperty, mAppType, nameof(DriverConfigParam.Value), bindingConvertor: new RadioBtnEnumConfigConverter(), converterParameter: nameof(eAppType.NativeHybride));
BindingHandler.ObjFieldBinding(xWebRdBtn, RadioButton.IsCheckedProperty, mAppType, nameof(DriverConfigParam.Value), bindingConvertor: new RadioBtnEnumConfigConverter(), converterParameter: nameof(eAppType.Web));
}

private void SetCapabilitiesGridView()
Expand Down Expand Up @@ -147,7 +147,7 @@ private void SetPlatformCapabilities()
{
DriverConfigParam platformName = new DriverConfigParam() { Parameter = "platformName", Description = "Which mobile OS platform to use" };
DriverConfigParam automationName = new DriverConfigParam() { Parameter = "appium:automationName", Description = "Which automation engine to use" };
if (mDevicePlatformType.Value == eDevicePlatformType.Android.ToString())
if (mDevicePlatformType.Value == nameof(eDevicePlatformType.Android))
{
platformName.Value = "Android";
automationName.Value = "UiAutomator2";
Expand All @@ -163,14 +163,14 @@ private void SetPlatformCapabilities()

private void SetDeviceSourceCapabilities()
{
if (mDeviceSource.Value == eDeviceSource.LocalAppium.ToString())
if (mDeviceSource.Value == nameof(eDeviceSource.LocalAppium))
{
DeleteUFTMServerCapabilities();
DeleteUFTMSupportSimulationsCapabilities();
DeleteKobitonServerCapabilities();

}
else if (mDeviceSource.Value == eDeviceSource.MicroFoucsUFTMLab.ToString() && !IsUFTCapabilityExist())
else if (mDeviceSource.Value == nameof(eDeviceSource.MicroFoucsUFTMLab) && !IsUFTCapabilityExist())
{
DriverConfigParam uftAppiumVersion = new DriverConfigParam() { Parameter = "uftm:appiumVersion", Value ="v2.x", Description = "Appium server version to use in UFT '1.x' or '2.x'" };
DriverConfigParam uftClientId = new DriverConfigParam() { Parameter = "uftm:oauthClientId", Description= "UFT Execution key Client Id" };
Expand All @@ -189,7 +189,7 @@ private void SetDeviceSourceCapabilities()
SetUFTMSupportSimulationsCapabilities();
}
}
else if (mDeviceSource.Value == eDeviceSource.Kobiton.ToString())
else if (mDeviceSource.Value == nameof(eDeviceSource.Kobiton))
{
DriverConfigParam kobitonUserName = new DriverConfigParam() { Parameter = "username", Description = "Kobiton account User Name" };
DriverConfigParam kobitonAccessKey = new DriverConfigParam() { Parameter = "accessKey", Description = "Kobitn account Access Key" };
Expand Down Expand Up @@ -219,9 +219,9 @@ private void SetApplicationCapabilities(bool init = false)
DriverConfigParam bundleId = new DriverConfigParam() { Parameter = "appium:bundleId", Description = "Bundle ID of the application under test", Value = "com.apple.Preferences" };
DriverConfigParam browserName = new DriverConfigParam() { Parameter = "browserName", Description = "Name of mobile web browser to automate" };
DriverConfigParam defualtURL = new DriverConfigParam() { Parameter = "ginger:defaultURL", Description = "Ginger Capability | Default URL to load on browser connection", Value = "https://ginger.amdocs.com/" };
if (mAppType.Value == eAppType.NativeHybride.ToString())
if (mAppType.Value == nameof(eAppType.NativeHybride))
{
if (mDevicePlatformType.Value == eDevicePlatformType.Android.ToString())
if (mDevicePlatformType.Value == nameof(eDevicePlatformType.Android))
{
if (!init)
{
Expand All @@ -247,7 +247,7 @@ private void SetApplicationCapabilities(bool init = false)
}
else
{
if (mDevicePlatformType.Value == eDevicePlatformType.Android.ToString())
if (mDevicePlatformType.Value == nameof(eDevicePlatformType.Android))
{
browserName.Value = "Chrome";
}
Expand All @@ -267,7 +267,7 @@ private void SetDeviceCapabilities(bool init = false)
{
DriverConfigParam deviceName = new DriverConfigParam() { Parameter = "appium:deviceName", Value = string.Empty };
DriverConfigParam udid = new DriverConfigParam() { Parameter = "appium:udid", Description = "Unique device identifier of the connected physical device", Value = string.Empty };
if (mDevicePlatformType.Value == eDevicePlatformType.Android.ToString())
if (mDevicePlatformType.Value == nameof(eDevicePlatformType.Android))
{
deviceName.Description = "The kind of mobile device to use, for example 'Galaxy S21'";
}
Expand All @@ -294,7 +294,7 @@ private void SetOtherCapabilities(bool init = false)
SetCurrentCapabilityValue(noReset);
}
AddOrUpdateCapability(newCommandTimeout);
if (mAppType.Value == eAppType.NativeHybride.ToString())
if (mAppType.Value == nameof(eAppType.NativeHybride))
{
AddOrUpdateCapability(noReset);
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -1709,7 +1709,7 @@ private string GetCurrentPackage()
}
else if (DevicePlatformType == eDevicePlatformType.iOS)
{
return string.Format("{0}", ((IOSDriver)Driver).GetSessionDetail("CFBundleIdentifier").ToString());
return string.Format("{0}", ((IOSDriver)Driver).GetSessionDetail("CFBundleIdentifier")?.ToString());
}
else
{
Expand Down

0 comments on commit f177bd0

Please sign in to comment.