Skip to content

Commit

Permalink
Fix operations style and functionality
Browse files Browse the repository at this point in the history
  • Loading branch information
shai1712 committed Feb 4, 2025
1 parent 7dc495d commit 32af1bc
Show file tree
Hide file tree
Showing 8 changed files with 403 additions and 147 deletions.
63 changes: 27 additions & 36 deletions Ginger/Ginger/Actions/ActionEditPages/ActMobileDeviceEditPage.xaml
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
xmlns:UserControlsLib1="clr-namespace:Ginger.UserControlsLib" xmlns:Activities="clr-namespace:Ginger.Activities"
xmlns:UserControlsLib1="clr-namespace:Ginger.UserControlsLib" xmlns:Activities="clr-namespace:Ginger.Activities" xmlns:UserControls="clr-namespace:Ginger.UserControls"
xmlns:Actions="clr-namespace:Ginger.Actions"
mc:Ignorable="d"
d:DesignHeight="300" d:DesignWidth="300"
Expand All @@ -15,9 +15,9 @@
<UserControlsLib1:UCComboBox x:Name="xOperationNameComboBox" VerticalAlignment="Top" Width="250" Margin="10,0,0,0"/>
</StackPanel>

<StackPanel x:Name="xInputPnl" HorizontalAlignment="Left" Orientation="Vertical" DockPanel.Dock="Top" Margin="5,10,0,0" Visibility="Collapsed">
<StackPanel x:Name="xInputPnl" HorizontalAlignment="Left" Orientation="Vertical" DockPanel.Dock="Top" Margin="7,10,0,0" Visibility="Collapsed">
<Label x:Name="xInputLabelVE" Style="{StaticResource $LabelStyle}" Content="Input:"/>
<Actions:UCValueExpression x:Name="xInputVE" VerticalAlignment="Top" Width="320"/>
<Actions:UCValueExpression x:Name="xInputVE" VerticalAlignment="Top" Width="330"/>
</StackPanel>

<StackPanel x:Name="xKeyPressPnl" HorizontalAlignment="Left" Orientation="Horizontal" DockPanel.Dock="Top" Margin="5,10,0,0" Visibility="Collapsed">
Expand Down Expand Up @@ -61,9 +61,9 @@
<UserControlsLib1:UcLabel Content="Note: Andoid device will simulate FingerPrint, iOS devices will simulate FaceID" FontSize="9"></UserControlsLib1:UcLabel>
</StackPanel>

<StackPanel x:Name="xAppPnl" HorizontalAlignment="Left" Orientation="Horizontal" DockPanel.Dock="Top" Margin="5,10,0,0" Visibility="Collapsed">
<StackPanel x:Name="xAppPnl" HorizontalAlignment="Left" Orientation="Vertical" DockPanel.Dock="Top" Margin="6,10,0,0" Visibility="Collapsed">
<Label Style="{StaticResource $LabelStyle}" Content="Application package:"/>
<Actions:UCValueExpression x:Name="xAppPackageVE" VerticalAlignment="Top" Width="205"/>
<Actions:UCValueExpression x:Name="xAppPackageVE" HorizontalAlignment="Left" VerticalAlignment="Center" Width="330" Margin="-1,5,0,0"/>
</StackPanel>

<StackPanel x:Name="xPressPnl" HorizontalAlignment="Left" Orientation="Horizontal" DockPanel.Dock="Top" Margin="0,10,0,0" Visibility="Collapsed">
Expand All @@ -87,37 +87,28 @@
</StackPanel>
</StackPanel>
<StackPanel x:Name="xDeepLinkPnl" HorizontalAlignment="Left" Orientation="Vertical" DockPanel.Dock="Top" Margin="0,10,0,0" Visibility="Collapsed">
<Label Style="{StaticResource $LabelStyle}" Content="URL:" Margin="0 0 0 0"/>
<Activities:UCValueExpression x:Name="xURLNameTxtBox" HorizontalAlignment="Left" VerticalAlignment="Center" Width="250"/>
<Label Style="{StaticResource $LabelStyle}" Content="Application package:"/>
<Actions:UCValueExpression x:Name="xAppPackageDeepLinkVE" HorizontalAlignment="Left" VerticalAlignment="Center" Width="250"/>
</StackPanel>
<StackPanel x:Name="xRecordingScreenPnl" HorizontalAlignment="Left" Orientation="Horizontal" DockPanel.Dock="Top" Margin="0,10,0,0" Visibility="Collapsed">
<StackPanel HorizontalAlignment="Left" Orientation="Horizontal" DockPanel.Dock="Top">
<Label Style="{StaticResource $LabelStyle}" Content="Save File Recording to Folder :"/>
<Actions:UCValueExpression x:Name="xPhotoSumilationVE" HorizontalAlignment="Left" VerticalAlignment="Center" Width="600" />
</StackPanel>
</StackPanel>
<StackPanel x:Name="xRunScriptPnl" HorizontalAlignment="Left" Orientation="Horizontal" DockPanel.Dock="Top" Margin="5,10,0,0" Visibility="Collapsed">
<Label Style="{StaticResource $LabelStyle}" Content="Script:"/>
<Actions:UCValueExpression x:Name="xAppPackageVE2" VerticalAlignment="Top" Width="400"/>
</StackPanel>
<StackPanel x:Name="xPushToDevicePnl" HorizontalAlignment="Left" Orientation="Horizontal" DockPanel.Dock="Top" Margin="5,10,0,0" Visibility="Collapsed">
<StackPanel HorizontalAlignment="Left" Orientation="Horizontal" DockPanel.Dock="Top">
<Label Style="{StaticResource $LabelStyle}" Content="Choose File:"/>
<Actions:UCValueExpression x:Name="xPhotoSumilationEV" HorizontalAlignment="Left" VerticalAlignment="Center" Width="600" />
</StackPanel>
</StackPanel>
<StackPanel x:Name="xPullFromDevicePnl" HorizontalAlignment="Left" Orientation="Horizontal" DockPanel.Dock="Top" Margin="5,10,0,0" Visibility="Collapsed">
<Label Style="{StaticResource $LabelStyle}" Content="Enter File Name From Device:" Margin="0,5,0,0"/>
<Actions:UCValueExpression x:Name="xAppPackageVE3" VerticalAlignment="Top" Margin="5,8,30,8" Width="200"/>
<Label Style="{StaticResource $LabelStyle}" Content="Choose Folder:" Margin="0,5,0,0"/>
<Actions:UCValueExpression x:Name="xPhotoSumilationVE2" Width="600" />
</StackPanel>
<StackPanel x:Name="xSetClipboardTextPnl" HorizontalAlignment="Left" Orientation="Horizontal" DockPanel.Dock="Top" Margin="5,10,0,0" Visibility="Collapsed">
<Label Style="{StaticResource $LabelStyle}" Content="Set value to Clipboard Text:" Margin="0,5,0,0"/>
<Actions:UCValueExpression x:Name="xAppPackageVE4" VerticalAlignment="Top" Margin="5,7,30,8" Width="200"/>

<Label Style="{StaticResource $LabelStyle}" Content="URL:" Margin="2,0,0,0"/>
<Activities:UCValueExpression x:Name="xURLPathTxtBox" HorizontalAlignment="Left" VerticalAlignment="Center" Margin="5,0,0,0" Width="330"/>
</StackPanel>
<StackPanel x:Name="xPushToDevicePnl" HorizontalAlignment="Left" Orientation="Vertical" DockPanel.Dock="Top" Margin="5,10,0,0" Visibility="Collapsed">
<Label Style="{StaticResource $LabelStyle}" Content="Device Target Folder:" Margin="-4,0,0,0"/>
<Actions:UCValueExpression x:Name="xPushFileNameTxtBox" HorizontalAlignment="Left" Margin="0,0,0,0" Width="330"/>
<Label Style="{StaticResource $LabelStyle}" Content="Local File Path:" Margin="-2,2,0,0"/>
<Actions:UCValueExpression x:Name="xPushtoDeviceFolderTxtBox" HorizontalAlignment="Left" VerticalAlignment="Center" Width="340" />
</StackPanel>
<StackPanel x:Name="xPullFromDevicePnl" HorizontalAlignment="Left" Orientation="Vertical" DockPanel.Dock="Top" Margin="5,10,0,0" Visibility="Collapsed">
<Label x:Name="xFileNamebl" Style="{StaticResource $LabelStyle}" Content="Device File Path:" Margin="-4,0,0,0"/>
<Actions:UCValueExpression x:Name="xFileNameTxtBox" HorizontalAlignment="Left" Margin="0,0,0,0" Width="330"/>
<Label x:Name="xFilePathbl" Style="{StaticResource $LabelStyle}" Content="Local Target Folder:" Margin="-3,0,0,0"/>
<Actions:UCValueExpression x:Name="xPulltoFolderTxtBox" Width="340" />
</StackPanel>
<StackPanel x:Name="xSpecificPerformanceDataPnl" HorizontalAlignment="Left" Orientation="Vertical" DockPanel.Dock="Top" Margin="0,2,0,0" Visibility="Collapsed">
<Label Style="{StaticResource $LabelStyle}" Content="Data Type:" Margin="0,0,0,0"/>
<UserControlsLib1:UCComboBox x:Name="xDataTypeComboBox" HorizontalAlignment="Left" VerticalAlignment="Center" Margin="4,-6,0,0" Width="250"/>
</StackPanel>
<StackPanel x:Name="xDeviceRotationPnl" HorizontalAlignment="Left" Orientation="Horizontal" DockPanel.Dock="Top" Margin="5,10,0,0" Visibility="Collapsed">
<Label Style="{StaticResource $LabelStyle}" Content="Choose State: "/>
<UserControlsLib1:UCComboBox x:Name="xDeviceRotateComboBox" VerticalAlignment="Top" Margin="0,-2,0,0" Width="241"/>
</StackPanel>
</DockPanel>
</Page>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -18,16 +18,22 @@ limitations under the License.

using amdocs.ginger.GingerCoreNET;
using Amdocs.Ginger.Common;
using Amdocs.Ginger.CoreNET.Drivers.CoreDrivers.Mobile;
using Amdocs.Ginger.CoreNET.Drivers.DriversWindow;
using Amdocs.Ginger.Repository;
using Ginger.Actions.UserControls;
using Amdocs.Ginger.UserControls;
using Ginger.Drivers.DriversWindows;
using GingerCore;
using GingerCore.Actions;
using GingerCore.Drivers;
using GingerCore.GeneralLib;
using System.IO;
using System.Windows;
using System.Windows.Controls;
using System.Windows.Controls.Primitives;


namespace Ginger.Actions
{
/// <summary>
Expand All @@ -39,24 +45,25 @@ public partial class ActMobileDeviceEditPage : Page
ActMobileDevice mAct;
Context mContext;
bool isValueExpression;



public ActMobileDeviceEditPage(ActMobileDevice Act)
{
InitializeComponent();

mAct = Act;
mContext = Context.GetAsContext(Act.Context);

BindControls();
SetControlsView();
}

private void BindControls()
{
xOperationNameComboBox.Init(mAct, nameof(mAct.MobileDeviceAction), typeof(ActMobileDevice.eMobileDeviceAction), ActionNameComboBox_SelectionChanged);



xInputVE.Init(Context.GetAsContext(mAct.Context), mAct.ActionInput, nameof(ActInputValue.Value));

xAuthResultComboBox.Init(mAct, nameof(mAct.AuthResultSimulation), typeof(ActMobileDevice.eAuthResultSimulation), AuthResultComboBox_SelectionChanged);
Expand All @@ -70,19 +77,24 @@ private void BindControls()

xPhotoSumilationTxtBox.Init(Context.GetAsContext(mAct.Context), mAct.GetOrCreateInputParam(nameof(ActMobileDevice.SimulatedPhotoPath)), true, true, UCValueExpression.eBrowserType.File, "*");

xAppPackageDeepLinkVE.Init(Context.GetAsContext(mAct.Context), mAct.ActionAppPackage, nameof(ActInputValue.Value));

xURLNameTxtBox.Init(Context.GetAsContext(mAct.Context), mAct.URLName, nameof(ActInputValue.Value));
xDeviceRotateComboBox.Init(mAct, nameof(mAct.RotateDeviceState), typeof(ActMobileDevice.eRotateDeviceState), ActionNameComboBox_SelectionChanged);

xDataTypeComboBox.Init(mAct, nameof(mAct.PerformanceTypes), typeof(ActMobileDevice.ePerformanceTypes), ActionNameComboBox_SelectionChanged);

xPulltoFolderTxtBox.Init(Context.GetAsContext(mAct.Context), mAct.LocalFile, nameof(ActInputValue.Value), true, true, UCValueExpression.eBrowserType.Folder, "*");

xPushtoDeviceFolderTxtBox.Init(Context.GetAsContext(mAct.Context), mAct.LocalFile, nameof(ActMobileDevice.Value), true, true, UCValueExpression.eBrowserType.File, "*");

xPhotoSumilationVE2.Init(Context.GetAsContext(mAct.Context), mAct.LocalFile, nameof(ActInputValue.Value), true, true, UCValueExpression.eBrowserType.Folder, "*");
xURLPathTxtBox.Init(Context.GetAsContext(mAct.Context), mAct.ActionInput, nameof(ActInputValue.Value));

xPhotoSumilationEV.Init(Context.GetAsContext(mAct.Context), mAct.LocalFile, nameof(ActMobileDevice.Value), true, true, UCValueExpression.eBrowserType.File, "*");
xFileNameTxtBox.Init(Context.GetAsContext(mAct.Context), mAct.ActionInput, nameof(ActInputValue.Value));
xPushFileNameTxtBox.Init(Context.GetAsContext(mAct.Context), mAct.ActionInput, nameof(ActInputValue.Value));

xAppPackageVE3.Init(Context.GetAsContext(mAct.Context), mAct.ActionInput, nameof(ActInputValue.Value));
xAppPackageVE2.Init(Context.GetAsContext(mAct.Context), mAct.ActionInput, nameof(ActInputValue.Value));
xAppPackageVE4.Init(Context.GetAsContext(mAct.Context), mAct.ActionInput, nameof(ActInputValue.Value));
xAppPackageVE.Init(Context.GetAsContext(mAct.Context), mAct.ActionAppPackage, nameof(ActInputValue.Value));



xPhotoSumilationVE.Init(Context.GetAsContext(mAct.Context), mAct.PathRecording, nameof(ActInputValue.Value), true, true, UCValueExpression.eBrowserType.Folder, "*");

xPressDurationTxtBox.Init(Context.GetAsContext(mAct.Context), mAct.PressDuration, nameof(ActInputValue.Value));
xDragDurationTxtBox.Init(Context.GetAsContext(mAct.Context), mAct.DragDuration, nameof(ActInputValue.Value));
Expand Down Expand Up @@ -141,8 +153,9 @@ private void ValueTextBox_LostFocus(object sender, RoutedEventArgs e)
{
UpdateBaseLineImage();
}




private void BrowseButton_Click(object sender, RoutedEventArgs e)
{
string filePath = UpdateBaseLineImage();
Expand Down Expand Up @@ -225,11 +238,15 @@ private void SetControlsView()
xSwipePnl.Visibility = Visibility.Collapsed;
xInputPnl.Visibility = Visibility.Collapsed;
xDeepLinkPnl.Visibility = Visibility.Collapsed;
xRunScriptPnl.Visibility = Visibility.Collapsed;
xRecordingScreenPnl.Visibility = Visibility.Collapsed;
xPushToDevicePnl.Visibility = Visibility.Collapsed;
xPullFromDevicePnl.Visibility = Visibility.Collapsed;
xSetClipboardTextPnl.Visibility = Visibility.Collapsed;
xSpecificPerformanceDataPnl.Visibility = Visibility.Collapsed;
xDeviceRotationPnl.Visibility = Visibility.Collapsed;






switch (mAct.MobileDeviceAction)
{
Expand Down Expand Up @@ -280,6 +297,7 @@ private void SetControlsView()
xAuthSimulationPnl.Visibility = Visibility.Visible;
break;
case ActMobileDevice.eMobileDeviceAction.OpenDeeplink:
xAppPnl.Visibility = Visibility.Visible;
xDeepLinkPnl.Visibility = Visibility.Visible;

break;
Expand All @@ -290,29 +308,59 @@ private void SetControlsView()
case ActMobileDevice.eMobileDeviceAction.QueryAppState:
xAppPnl.Visibility = Visibility.Visible;
break;

case ActMobileDevice.eMobileDeviceAction.SetContext:
xInputLabelVE.Content = "Context to Set:";
xInputPnl.Visibility = Visibility.Visible;
break;

case ActMobileDevice.eMobileDeviceAction.RunScript:
xRunScriptPnl.Visibility = Visibility.Visible;
xInputLabelVE.Content = "Script:";
xInputPnl.Visibility = Visibility.Visible;
break;

case ActMobileDevice.eMobileDeviceAction.StartRecordingScreen:
xInputLabelVE.Content = "Note: Max duration recording: 30 min.";
xInputVE.Visibility = Visibility.Collapsed;
xInputPnl.Visibility = Visibility.Visible;
break;

case ActMobileDevice.eMobileDeviceAction.StopRecordingScreen:
xRecordingScreenPnl.Visibility = Visibility.Visible;
xFileNamebl.Visibility = Visibility.Collapsed;
xFileNameTxtBox.Visibility = Visibility.Collapsed;
xFilePathbl.Content = "Save to Folder\\File:";
xPullFromDevicePnl.Visibility = Visibility.Visible;
break;

case ActMobileDevice.eMobileDeviceAction.PushFileToDevice:
xPushToDevicePnl.Visibility = Visibility.Visible;
break;

case ActMobileDevice.eMobileDeviceAction.PullFileFromDevice:
xFileNamebl.Visibility = Visibility.Visible;
xFileNameTxtBox.Visibility = Visibility.Visible;
xPullFromDevicePnl.Visibility = Visibility.Visible;
break;

case ActMobileDevice.eMobileDeviceAction.SetClipboardText:
xSetClipboardTextPnl.Visibility = Visibility.Visible;
xInputLabelVE.Content = "Text:";
xInputPnl.Visibility = Visibility.Visible;
break;

case ActMobileDevice.eMobileDeviceAction.GetSpecificPerformanceData:
xAppPnl.Visibility = Visibility.Visible;
xSpecificPerformanceDataPnl.Visibility = Visibility.Visible;
break;

case ActMobileDevice.eMobileDeviceAction.RotateSimulation:
xDeviceRotationPnl.Visibility = Visibility.Visible;
break;

case ActMobileDevice.eMobileDeviceAction.GetDeviceLogs:

Check warning on line 359 in Ginger/Ginger/Actions/ActionEditPages/ActMobileDeviceEditPage.xaml.cs

View check run for this annotation

Codacy Production / Codacy Static Code Analysis

Ginger/Ginger/Actions/ActionEditPages/ActMobileDeviceEditPage.xaml.cs#L359

Either merge this case with the identical one on line 328 or change one of the implementations.
xFileNamebl.Visibility = Visibility.Collapsed;
xFileNameTxtBox.Visibility = Visibility.Collapsed;
xFilePathbl.Content = "Save to Folder\\File:";
xPullFromDevicePnl.Visibility = Visibility.Visible;
break;
}
}
Expand Down
26 changes: 21 additions & 5 deletions Ginger/Ginger/Drivers/DriversWindows/MobileDriverWindow.xaml.cs
Original file line number Diff line number Diff line change
Expand Up @@ -39,6 +39,7 @@ limitations under the License.
using System.Windows.Media;
using System.Windows.Media.Imaging;


namespace Ginger.Drivers.DriversWindows
{
/// <summary>
Expand All @@ -62,12 +63,13 @@ public partial class MobileDriverWindow : Window
bool mWindowIsOpen = true;
bool IsRecording = false;

ObservableList<DeviceInfo> mDeviceDetails = [];

ObservableList <DeviceInfo> mDeviceDetails = [];

public MobileDriverWindow(DriverBase driver, Agent agent)
{
InitializeComponent();

mDriver = (IMobileDriverWindow)driver;
mAgent = agent;

Expand All @@ -78,7 +80,7 @@ public MobileDriverWindow(DriverBase driver, Agent agent)
SetDeviceDetailsGridView();
SetDeviceMetricsGridView();
}

private async void RefreshDetailsTable(object sender, RoutedEventArgs e)
{
await this.Dispatcher.InvokeAsync(async () =>
Expand Down Expand Up @@ -201,7 +203,13 @@ private void RemoveRectangle()
xHighlighterBorder.Height = 0;
xHighlighterBorder.Visibility = Visibility.Collapsed;
}

public void UpdateRotateIcon()
{
Dispatcher.Invoke(() =>
{
SetOrientationButton();
});
}
public void UpdateRecordingImage(bool ShowRecordIcon)
{
Dispatcher.Invoke(() =>
Expand Down Expand Up @@ -267,6 +275,13 @@ await this.Dispatcher.InvokeAsync(async () =>
}
break;

case DriverBase.eDriverMessageType.RotateEvent:


UpdateRotateIcon();

break;

case DriverBase.eDriverMessageType.RecordingEvent:
IsRecording = sender != null && (bool)sender;

Expand Down Expand Up @@ -1301,7 +1316,7 @@ private void AlloworDisableControls(bool toAllow)
}
}

private void SetOrientationButton()
public void SetOrientationButton()
{
try
{
Expand All @@ -1323,6 +1338,7 @@ private void SetOrientationButton()
}
}


private void DoContinualDeviceScreenshotRefresh()
{
Task.Run(() =>
Expand Down
1 change: 1 addition & 0 deletions Ginger/Ginger/Ginger.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -750,6 +750,7 @@
<ProjectReference Include="..\GingerPlugIns\GingerPlugIns.csproj" />
<ProjectReference Include="..\GingerUtils\GingerUtils.csproj" />
<ProjectReference Include="..\GingerWin64OsSupport\GingerWin64OsSupport.csproj" />
<ProjectReference Include="..\GingerWPFDriverWindow\GingerWPFDriverWindow.csproj" />
</ItemGroup>

<ItemGroup>
Expand Down
Loading

0 comments on commit 32af1bc

Please sign in to comment.