Skip to content

Commit

Permalink
Merge pull request #3876 from Ginger-Automation/Upgrade-Appium-Solution
Browse files Browse the repository at this point in the history
Upgrade appium solution
  • Loading branch information
Maheshkale447 authored Sep 4, 2024
2 parents eb57951 + 4c30b8a commit 51f727f
Show file tree
Hide file tree
Showing 8 changed files with 557 additions and 305 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@
<DockPanel>
<StackPanel HorizontalAlignment="Left" Orientation="Horizontal" DockPanel.Dock="Top">
<Label Style="{StaticResource $LabelStyle}" Content="Operation:"/>
<UserControlsLib1:UCComboBox x:Name="xOperationNameComboBox" VerticalAlignment="Top" Width="200" Margin="10,0,0,0"/>
<UserControlsLib1:UCComboBox x:Name="xOperationNameComboBox" VerticalAlignment="Top" Width="250" Margin="10,0,0,0"/>
</StackPanel>

<StackPanel x:Name="xKeyPressPnl" HorizontalAlignment="Left" Orientation="Horizontal" DockPanel.Dock="Top" Margin="0,10,0,0" Visibility="Collapsed">
Expand Down Expand Up @@ -55,5 +55,32 @@
<UserControlsLib1:UcLabel Content="*Action will work only with a UFTM mobile device"></UserControlsLib1:UcLabel>
<UserControlsLib1:UcLabel Content="*Andoid device will simulate FingerPrint, iOS devices will simulate FaceID"></UserControlsLib1:UcLabel>
</StackPanel>

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

<StackPanel x:Name="xPressPnl" HorizontalAlignment="Left" Orientation="Horizontal" DockPanel.Dock="Top" Margin="0,10,0,0" Visibility="Collapsed">
<Label Style="{StaticResource $LabelStyle}" Content="Press duration (milliseconds):" Margin="0 0 0 0"/>
<Activities:UCValueExpression x:Name="xPressDurationTxtBox" HorizontalAlignment="Left" VerticalAlignment="Center" Width="100" />
</StackPanel>

<StackPanel x:Name="xDragPnl" HorizontalAlignment="Left" Orientation="Horizontal" DockPanel.Dock="Top" Margin="0,10,0,0" Visibility="Collapsed">
<Label Style="{StaticResource $LabelStyle}" Content="Drag duration (milliseconds):" Margin="0 0 0 0"/>
<Activities:UCValueExpression x:Name="xDragDurationTxtBox" HorizontalAlignment="Left" VerticalAlignment="Center" Width="100"/>
</StackPanel>

<StackPanel x:Name="xSwipePnl" HorizontalAlignment="Left" Orientation="Vertical" DockPanel.Dock="Top" Margin="0,10,0,0" Visibility="Collapsed">
<StackPanel x:Name="xSwipeScalePnl" Orientation="Horizontal">
<Label Style="{StaticResource $LabelStyle}" Content="Swipe scale (0.1-1):" Margin="0 0 0 0"/>
<Activities:UCValueExpression x:Name="xSwipeScaleTxtBox" HorizontalAlignment="Left" VerticalAlignment="Center" Width="100" />
</StackPanel>
<StackPanel Orientation="Horizontal" Margin="0 10 0 0">
<Label Style="{StaticResource $LabelStyle}" Content="Swipe duration (milliseconds):" Margin="0 0 0 0"/>
<Activities:UCValueExpression x:Name="xSwipeDurationTxtBox" HorizontalAlignment="Left" VerticalAlignment="Center" Width="100"/>
</StackPanel>
</StackPanel>

</DockPanel>
</Page>
Original file line number Diff line number Diff line change
Expand Up @@ -66,6 +66,13 @@ private void BindControls()

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

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

xPressDurationTxtBox.Init(Context.GetAsContext(mAct.Context), mAct.PressDuration, nameof(ActInputValue.Value));
xDragDurationTxtBox.Init(Context.GetAsContext(mAct.Context), mAct.DragDuration, nameof(ActInputValue.Value));
xSwipeScaleTxtBox.Init(Context.GetAsContext(mAct.Context), mAct.SwipeScale, nameof(ActInputValue.Value));
xSwipeDurationTxtBox.Init(Context.GetAsContext(mAct.Context), mAct.SwipeDuration, nameof(ActInputValue.Value));

UpdateBaseLineImage(true);


Expand Down Expand Up @@ -196,6 +203,10 @@ private void SetControlsView()
xXY2Pnl.Visibility = Visibility.Collapsed;
xPhotoSimulationPnl.Visibility = Visibility.Collapsed;
xAuthSimulationPnl.Visibility = Visibility.Collapsed;
xAppPnl.Visibility = Visibility.Collapsed;
xPressPnl.Visibility = Visibility.Collapsed;
xDragPnl.Visibility = Visibility.Collapsed;
xSwipePnl.Visibility = Visibility.Collapsed;

switch (mAct.MobileDeviceAction)
{
Expand All @@ -204,24 +215,52 @@ private void SetControlsView()
xKeyPressPnl.Visibility = Visibility.Visible;
break;

case ActMobileDevice.eMobileDeviceAction.PressXY:
case ActMobileDevice.eMobileDeviceAction.LongPressXY:
case ActMobileDevice.eMobileDeviceAction.TapXY:
case ActMobileDevice.eMobileDeviceAction.DoubleTapXY:
case ActMobileDevice.eMobileDeviceAction.LongPressXY:
xXY1Pnl.Visibility = Visibility.Visible;
break;

case ActMobileDevice.eMobileDeviceAction.PressXY:
xXY1Pnl.Visibility = Visibility.Visible;
xPressPnl.Visibility = Visibility.Visible;
break;

case ActMobileDevice.eMobileDeviceAction.DragXYXY:
xXY1Pnl.Visibility = Visibility.Visible;
xXY2Pnl.Visibility = Visibility.Visible;
xPressPnl.Visibility = Visibility.Visible;
xDragPnl.Visibility = Visibility.Visible;
break;

case ActMobileDevice.eMobileDeviceAction.SwipeByCoordinates:
xXY1Pnl.Visibility = Visibility.Visible;
xXY2Pnl.Visibility = Visibility.Visible;
xSwipePnl.Visibility = Visibility.Visible;
xSwipeScalePnl.Visibility = Visibility.Collapsed;
break;

case ActMobileDevice.eMobileDeviceAction.SwipeDown:
case ActMobileDevice.eMobileDeviceAction.SwipeUp:
case ActMobileDevice.eMobileDeviceAction.SwipeLeft:
case ActMobileDevice.eMobileDeviceAction.SwipeRight:
xSwipePnl.Visibility = Visibility.Visible;
xSwipeScalePnl.Visibility = Visibility.Visible;
break;

case ActMobileDevice.eMobileDeviceAction.SimulatePhoto:
case ActMobileDevice.eMobileDeviceAction.SimulateBarcode:
xPhotoSimulationPnl.Visibility = Visibility.Visible;
break;

case ActMobileDevice.eMobileDeviceAction.SimulateBiometrics:
xAuthSimulationPnl.Visibility = Visibility.Visible;
break;

case ActMobileDevice.eMobileDeviceAction.CloseApp:
case ActMobileDevice.eMobileDeviceAction.OpenApp:
xAppPnl.Visibility = Visibility.Visible;
break;
}
}

Expand Down
64 changes: 33 additions & 31 deletions Ginger/Ginger/Drivers/DriversWindows/MobileDriverWindow.xaml
Original file line number Diff line number Diff line change
Expand Up @@ -4,11 +4,11 @@
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006" xmlns:UserControls="clr-namespace:Amdocs.Ginger.UserControls" xmlns:Ginger="clr-namespace:Ginger" xmlns:GingerCore="clr-namespace:GingerCore;assembly=GingerCore"
mc:Ignorable="d"
Title="Loading Device..." Height="685" Width="323"
MinHeight="600" MinWidth="300" WindowStyle="SingleBorderWindow"
Title="Loading Device..." Height="685" Width="323"
MinHeight="600" MinWidth="300" WindowStyle="ToolWindow" ResizeMode="CanMinimize"
WindowStartupLocation="CenterScreen" Closing="Window_Closing" SizeChanged="Window_SizeChanged" Loaded="Window_Loaded"
Topmost="False" KeyDown="Window_KeyDown">
<Grid x:Name="xWindowGrid" Background="{StaticResource $BackgroundColor_LightGray}">
<Grid x:Name="xWindowGrid" Background="Transparent">
<Grid.ColumnDefinitions>
<ColumnDefinition x:Name="xMeticsCol" Width="350"/>
<ColumnDefinition Width="35*"/>
Expand All @@ -24,16 +24,16 @@

<StackPanel Orientation="Horizontal" VerticalAlignment="Stretch" HorizontalAlignment="Stretch" Background="{StaticResource $BackgroundColor_White}">
<TabControl x:Name="xItemsTabs" HorizontalAlignment="Stretch" BorderThickness="1" BorderBrush="{StaticResource $BackgroundColor_White}">
<TabItem x:Name="xDetailsTab" Style="{StaticResource $CoolTab}" TabIndex="1" >
<TabItem.Header>
<Border Style="{StaticResource $CoolTabBorderStyle}">
<DockPanel >
<UserControls:ImageMakerControl SetAsFontImageWithSize="16" ImageType="Config" Width="20" Height="16" FontWeight="Bold" Foreground="{StaticResource $BackgroundColor_DarkGray}" />
<TextBlock Text="Details" Style="{StaticResource $CoolTabTextBlockStyle}" />
</DockPanel>
</Border>
</TabItem.Header>
<TabItem x:Name="xDetailsTab" Style="{StaticResource $CoolTab}" TabIndex="1" >
<TabItem.Header>
<Border Style="{StaticResource $CoolTabBorderStyle}">
<DockPanel >
<UserControls:ImageMakerControl SetAsFontImageWithSize="16" ImageType="Config" Width="20" Height="16" FontWeight="Bold" Foreground="{StaticResource $BackgroundColor_DarkGray}" />
<TextBlock Text="Details" Style="{StaticResource $CoolTabTextBlockStyle}" />
</DockPanel>
</Border>
</TabItem.Header>

<StackPanel HorizontalAlignment="Stretch" VerticalAlignment="Stretch" Background="{StaticResource $BackgroundColor_White}" >

<Ginger:ucGrid x:Name="xDeviceDetailsGrid" Width="346" HorizontalAlignment="Left" IsReadOnly="False" Title="Device Details" ShowAdd="Collapsed" ShowDelete="Collapsed" ShowClearAll="Collapsed" ShowCut="Collapsed" ShowRefresh="Visible" ShowUndo="Collapsed" ShowUpDown="Collapsed" ShowEdit="Collapsed" ShowSearch="Collapsed"/>
Expand All @@ -46,20 +46,18 @@
</Label.Content>
</Label>
</StackPanel>

</StackPanel>

</TabItem>

<TabItem x:Name="xDeviceMetricsTab" Style="{StaticResource $CoolTab}" TabIndex="2" >
<TabItem.Header>
<Border Style="{StaticResource $CoolTabBorderStyle}">
<DockPanel >
<UserControls:ImageMakerControl SetAsFontImageWithSize="16" ImageType="Config" Width="20" Height="16" FontWeight="Bold" Foreground="{StaticResource $BackgroundColor_DarkGray}" />
<TextBlock Text="Metrics" Style="{StaticResource $CoolTabTextBlockStyle}" />
</DockPanel>
</Border>
</TabItem.Header>
<TabItem x:Name="xDeviceMetricsTab" Style="{StaticResource $CoolTab}" TabIndex="2" >
<TabItem.Header>
<Border Style="{StaticResource $CoolTabBorderStyle}">
<DockPanel >
<UserControls:ImageMakerControl SetAsFontImageWithSize="16" ImageType="Config" Width="20" Height="16" FontWeight="Bold" Foreground="{StaticResource $BackgroundColor_DarkGray}" />
<TextBlock Text="Metrics" Style="{StaticResource $CoolTabTextBlockStyle}" />
</DockPanel>
</Border>
</TabItem.Header>

<StackPanel HorizontalAlignment="Stretch" VerticalAlignment="Stretch" Background="{StaticResource $BackgroundColor_White}">
<Ginger:ucGrid x:Name="xDeviceMetricsGrid" Width="346" HorizontalAlignment="Left" Title="Metrics Details" IsReadOnly="false" ShowAdd="Collapsed" ShowDelete="Collapsed" ShowClearAll="Collapsed" ShowCut="Collapsed" ShowRefresh="Visible" ShowUndo="Collapsed" ShowUpDown="Collapsed" ShowEdit="Collapsed" ShowSearch="Collapsed"/>
Expand All @@ -74,12 +72,11 @@
</StackPanel>
</StackPanel>
</TabItem>
</TabControl>
</StackPanel>
</TabControl>
</StackPanel>

<Grid x:Name="xDeviceViewGrid" Margin="5" Grid.Column="1" Grid.ColumnSpan="2">
<Grid.ColumnDefinitions>

<ColumnDefinition Width="12"/>
<ColumnDefinition Width="100*"/>
<ColumnDefinition Width="12"/>
Expand All @@ -97,10 +94,10 @@
<UserControls:ImageMakerControl x:Name="xRecordingImage" Grid.Row="0" Grid.Column="1" Height="16" Width="16" ImageType="Recording" Foreground="Red" ImageForeground="Red" HorizontalAlignment="Right" VerticalAlignment="Center" SetBorder="False" ToolTip="Recording..." Margin="0,0,80,0" Visibility="Collapsed" />
<UserControls:ucButton x:Name="xConfigurationsBtn" Grid.Row="0" Grid.Column="1" ButtonType="ImageButton" HorizontalAlignment="Right" VerticalAlignment="Bottom" ButtonFontImageSize="15" ButtonImageType="Config" Click="xConfigurationsBtn_Click" ToolTip="Show Configurations" Margin="0,0,25,0" />
<UserControls:ucButton x:Name="xPinBtn" Grid.Row="0" Grid.Column="1" ButtonType="ImageButton" HorizontalAlignment="Right" VerticalAlignment="Bottom" ButtonFontImageSize="14" ButtonImageType="Pin" Click="xPinBtn_Click" ToolTip="Dock Window" Margin="0,1,5,0" />
<UserControls:ucButton x:Name="xCordBtn" Grid.Row="0" Grid.Column="1" ButtonType="ImageButton" HorizontalAlignment="Left" VerticalAlignment="Bottom" ButtonFontImageSize="13" ButtonImageType="Target" Click="xCordBtn_Click" ToolTip="Show Mouse Coordinates" Margin="45,0,0,0" Visibility="Collapsed" />
<UserControls:ucButton x:Name="xSwipeBtn" Grid.Row="0" Grid.Column="1" ButtonType="ImageButton" HorizontalAlignment="Left" VerticalAlignment="Bottom" ButtonFontImageSize="13" ButtonImageType="Pointer" Click="xSwipeBtn_Click" ToolTip="Perform Swipe" Margin="25,0,0,0" Visibility="Collapsed" />
<UserControls:ucButton x:Name="xPortraiteBtn" Grid.Row="0" Grid.Column="1" ButtonType="ImageButton" HorizontalAlignment="Left" VerticalAlignment="Bottom" ButtonFontImageSize="16" ButtonImageType="Mobile" Click="xOrientationBtn_Click" ToolTip="Switch to Portrait" Margin="5,0,0,0" Visibility="Collapsed"/>
<UserControls:ucButton x:Name="xLandscapeBtn" Grid.Row="0" Grid.Column="1" ButtonType="ImageButton" HorizontalAlignment="Left" VerticalAlignment="Bottom" ButtonFontImageSize="16" ButtonImageType="Mobile" Click="xOrientationBtn_Click" ToolTip="Switch to Landscape" Margin="5,0,0,0" RenderTransformOrigin="0.5,0.5" Visibility="Collapsed">
<UserControls:ucButton x:Name="xCordBtn" Grid.Row="0" Grid.Column="1" ButtonType="ImageButton" HorizontalAlignment="Left" VerticalAlignment="Bottom" ButtonFontImageSize="13" ButtonImageType="Target" Click="xCordBtn_Click" ToolTip="Show Mouse Coordinates" Margin="65,0,0,0" Visibility="Collapsed" />
<UserControls:ucButton x:Name="xSwipeBtn" Grid.Row="0" Grid.Column="1" ButtonType="ImageButton" HorizontalAlignment="Left" VerticalAlignment="Bottom" ButtonFontImageSize="13" ButtonImageType="Pointer" Click="xSwipeBtn_Click" ToolTip="Perform Swipe" Margin="45,0,0,0" Visibility="Collapsed" />
<UserControls:ucButton x:Name="xPortraiteBtn" Grid.Row="0" Grid.Column="1" ButtonType="ImageButton" HorizontalAlignment="Left" VerticalAlignment="Bottom" ButtonFontImageSize="16" ButtonImageType="Mobile" Click="xOrientationBtn_Click" ToolTip="Switch to Portrait" Margin="26,0,0,0" Visibility="Collapsed"/>
<UserControls:ucButton x:Name="xLandscapeBtn" Grid.Row="0" Grid.Column="1" ButtonType="ImageButton" HorizontalAlignment="Left" VerticalAlignment="Bottom" ButtonFontImageSize="16" ButtonImageType="Mobile" Click="xOrientationBtn_Click" ToolTip="Switch to Landscape" Margin="26,0,0,0" RenderTransformOrigin="0.5,0.5" Visibility="Collapsed">
<UserControls:ucButton.RenderTransform>
<TransformGroup>
<ScaleTransform/>
Expand All @@ -110,6 +107,7 @@
</TransformGroup>
</UserControls:ucButton.RenderTransform>
</UserControls:ucButton>
<UserControls:ucButton x:Name="xExternalViewBtn" Grid.Row="0" Grid.Column="1" ButtonType="ImageButton" HorizontalAlignment="Left" VerticalAlignment="Bottom" ButtonFontImageSize="13" ButtonImageType="ShareExternal" Click="xExternalViewBtn_Click" ToolTip="Open Device External View" Margin="5,0,0,0" Visibility="Collapsed" />
<UserControls:ucButton x:Name="xMetricsBtn" Grid.Row="0" Grid.Column="1" ButtonType="ImageButton" HorizontalAlignment="Right" VerticalAlignment="Bottom" ButtonFontImageSize="15" ButtonImageType="Parameter" Click="xMetricsBtn_Click" ToolTip="Show Device Metrics" Margin="0,0,50,0" />

<!--Sides-->
Expand Down Expand Up @@ -211,6 +209,10 @@
</ComboBox>
</StackPanel>
<UserControls:ucButton x:Name="xClearHighlightBtn" ButtonType="ImageButton" HorizontalAlignment="Left" VerticalAlignment="Center" ButtonFontImageSize="16" ButtonImageHeight="16" ButtonImageWidth="16" ButtonImageType="Invisible" Click="xClearHighlightsBtn_Click" ToolTip="Clear Highlights" Margin="0,5,0,0"/>
<StackPanel Orientation="Horizontal" Margin="0,5,0,0">
<UserControls:ucButton x:Name="xZoomInBtn" ButtonType="ImageButton" HorizontalAlignment="Left" VerticalAlignment="Center" ButtonFontImageSize="16" ButtonImageHeight="16" ButtonImageWidth="16" ButtonImageType="PlusSquare" Click="xZoomInBtn_Click" ToolTip="Zoom In" Margin="10,0,0,0"/>
<UserControls:ucButton x:Name="xZoomOutBtn" ButtonType="ImageButton" HorizontalAlignment="Left" VerticalAlignment="Center" ButtonFontImageSize="16" ButtonImageHeight="16" ButtonImageWidth="16" ButtonImageType="MinusSquare" Click="xZoomOutBtn_Click" ToolTip="Zoom Out" Margin="10,0,0,0"/>
</StackPanel>
<UserControls:ucButton x:Name="xDeviceSettingsBtn" ButtonType="RoundTextAndImageButton" HorizontalAlignment="Left" Visibility="Collapsed" VerticalAlignment="Center" ButtonFontImageSize="16" ButtonImageHeight="16" ButtonImageWidth="16" ButtonImageType="Config" Click="xDeviceSettingsBtn_Click" ButtonText="Device Settings" Margin="0,10,0,0"/>
</StackPanel>
</ScrollViewer>
Expand Down
Loading

0 comments on commit 51f727f

Please sign in to comment.