Skip to content

Commit

Permalink
Handled Conflict
Browse files Browse the repository at this point in the history
  • Loading branch information
Maheshkale447 committed Jun 8, 2024
2 parents 0768ec8 + d36878f commit 75064b8
Show file tree
Hide file tree
Showing 11 changed files with 769 additions and 85 deletions.
27 changes: 13 additions & 14 deletions Ginger/Ginger/Actions/ActionEditPage.xaml
Original file line number Diff line number Diff line change
Expand Up @@ -104,21 +104,20 @@
<DockPanel x:Name="xOperationSettingsPnl" Margin="5">
<Grid x:Name="xActionLocatorPnl" DockPanel.Dock="Top">
<Grid.ColumnDefinitions>
<ColumnDefinition Width="65" />
<ColumnDefinition Width="200" />
<ColumnDefinition Width="85" />
<ColumnDefinition Width="200*" />
<ColumnDefinition Width="30" />
<ColumnDefinition Width="30" />
<ColumnDefinition Width="30" />
<ColumnDefinition Width="100" />
<ColumnDefinition Width="330" />
</Grid.ColumnDefinitions>
<Label Grid.Column="0" Content="Locate By:" Style="{StaticResource $LabelStyle}" VerticalAlignment="Center"/>
<ComboBox Grid.Column="1" x:Name="xLocateByCombo" SelectionChanged="cboLocateBy_SelectionChanged" Style="{StaticResource $FlatInputComboBoxStyle}" ToolTip="How to Locate the Element on the screen" VerticalAlignment="Center" />
<Label Grid.Column="2" Content="Locate Value:" Style="{StaticResource $LabelStyle}" VerticalAlignment="Center" HorizontalAlignment="Right"/>
<Actions:UCValueExpression x:Name="xLocateValueVE" Grid.Column="3" HorizontalAlignment="Stretch" VerticalAlignment="Center" />
<usercontrols:ucButton x:Name="xEditLocatorBtn" Grid.Column="4" ButtonType="ImageButton" Click="btnEditLocator_Click" ToolTip="Edit" ButtonFontImageSize="15" ButtonImageType="Edit" VerticalAlignment="Center" />
<usercontrols:ucButton x:Name="xControlSelectorButton" Grid.Column="5" ButtonType="ImageButton" Click="ControlSelectorButton_Click" ToolTip="Open Window Explorer to select Element" ButtonFontImageSize="15" ButtonImageType="Search" VerticalAlignment="Center" />
<usercontrols:ucButton x:Name="xHighLightElementButton" Grid.Column="6" ButtonType="ImageButton" Click="HighLightElementButton_Click" ToolTip="Highlight Element on Application" ButtonFontImageSize="15" ButtonImageType="Pointer" VerticalAlignment="Center" />
<Grid.RowDefinitions>
<RowDefinition Height="50"></RowDefinition>
<RowDefinition Height="50"></RowDefinition>
</Grid.RowDefinitions>
<Label Grid.Row="0" Grid.Column="0" Content="Locate By:" Style="{StaticResource $LabelStyle}" VerticalAlignment="Center"/>
<ComboBox Grid.Row="0" Grid.Column="1" x:Name="xLocateByCombo" SelectionChanged="cboLocateBy_SelectionChanged" Style="{StaticResource $FlatInputComboBoxStyle}" ToolTip="How to Locate the Element on the screen" HorizontalAlignment="Left" VerticalAlignment="Center" Width="300" />
<Label Grid.Row="1" Grid.Column="0" Content="Locate Value:" Style="{StaticResource $LabelStyle}" VerticalAlignment="Center" />
<Actions:UCValueExpression x:Name="xLocateValueVE" Grid.Row="1" Grid.Column="1" HorizontalAlignment="Stretch" VerticalAlignment="Center" />
<usercontrols:ucButton x:Name="xEditLocatorBtn" Visibility="Collapsed" Grid.Column="4" ButtonType="ImageButton" Click="btnEditLocator_Click" ToolTip="Edit" ButtonFontImageSize="15" ButtonImageType="Edit" VerticalAlignment="Center" />
<usercontrols:ucButton x:Name="xControlSelectorButton" Visibility="Collapsed" Grid.Column="5" ButtonType="ImageButton" Click="ControlSelectorButton_Click" ToolTip="Open Window Explorer to select Element" ButtonFontImageSize="15" ButtonImageType="Search" VerticalAlignment="Center" />
<usercontrols:ucButton x:Name="xHighLightElementButton" Visibility="Collapsed" Grid.Column="6" ButtonType="ImageButton" Click="HighLightElementButton_Click" ToolTip="Highlight Element on Application" ButtonFontImageSize="15" ButtonImageType="Pointer" VerticalAlignment="Center" />
</Grid>

<Frame x:Name="xActionPrivateConfigsFrame" DockPanel.Dock="Top" Margin="0,0,0,0" Content="Action private configurations Frame" NavigationUIVisibility="Hidden" ScrollViewer.VerticalScrollBarVisibility="Auto" ScrollViewer.HorizontalScrollBarVisibility="Auto" ScrollViewer.CanContentScroll="True"/>
Expand Down
20 changes: 20 additions & 0 deletions Ginger/Ginger/Actions/ActionEditPage.xaml.cs
Original file line number Diff line number Diff line change
Expand Up @@ -1116,6 +1116,14 @@ private void LoadOperationSettingsEditPage(Act a)
if (a.ActionEditPage != null)
{
Page actEditPage = ActionsFactory.GetActionEditPage(a, mContext);
if (actEditPage is IActEditPage)
{
xActionLocatorPnl.Visibility = ((IActEditPage)actEditPage).LocatorVisibility;

string allProperties = string.Empty;
PropertyChangedEventManager.RemoveHandler(source: (IActEditPage)actEditPage, ActionEditPage_PropertyChanged, propertyName: allProperties);
PropertyChangedEventManager.AddHandler(source: (IActEditPage)actEditPage, ActionEditPage_PropertyChanged, propertyName: allProperties);
}
if (actEditPage != null)
{
// Load the page
Expand All @@ -1129,6 +1137,18 @@ private void LoadOperationSettingsEditPage(Act a)
}
}

private void ActionEditPage_PropertyChanged(object? sender, PropertyChangedEventArgs e)
{
if (string.Equals(e.PropertyName, nameof(IActEditPage.LocatorVisibility)) && sender != null)
{
Visibility locatorVisibility = ((IActEditPage)sender).LocatorVisibility;
if (xActionLocatorPnl.Visibility != locatorVisibility)
{
xActionLocatorPnl.Visibility = locatorVisibility;
}
}
}

//private void NextActionButton_Click(object sender, RoutedEventArgs e)
//{
// Mouse.OverrideCursor = System.Windows.Input.Cursors.Wait;
Expand Down
40 changes: 40 additions & 0 deletions Ginger/Ginger/Actions/ActionEditPages/ActNewSmartSyncEditPage.xaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,40 @@
<Page x:Class="Ginger.Actions.ActNewSmartSyncEditPage"
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
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:Actions="clr-namespace:Ginger.BusinessFlowWindows"
mc:Ignorable="d"
d:DesignHeight="300" d:DesignWidth="500"
Title="ActNewSmartSyncEditPage">

<Grid >
<StackPanel Background="{StaticResource $BackgroundColor_White}">
<StackPanel Orientation="Horizontal" Margin="0,10,0,0" HorizontalAlignment="Left" VerticalAlignment="Center">
<Label Content="Operation Type:" Style="{StaticResource $LabelStyle}"/>
<ComboBox x:Name="ActionNameComboBox" Margin="5,0,0,0" Style="{StaticResource $FlatInputComboBoxStyle}" Width="300" HorizontalAlignment="Left" ToolTip="Select the action type to perform" SelectionChanged="ActionNameComboBox_SelectionChanged"/>
</StackPanel>
<StackPanel x:Name="TxtMatch_Pnl" Margin="0,25,0,0" Orientation="Horizontal" HorizontalAlignment="Left" >
<Label Content="Text to Match:" Style="{StaticResource $LabelStyle}"/>
<Actions:UCValueExpression x:Name="xTxtMatchVE" Margin="16,0,0,0" ToolTip="Please provide the input to match the text for the specified element." Width="330" Height="25"/>
</StackPanel>
<StackPanel x:Name="AttributeMatches_Pnl" Orientation="Vertical" HorizontalAlignment="Left" >
<StackPanel Orientation="Horizontal" Margin="0,25,0,0">
<Label Content="Attribute Name:" Style="{StaticResource $LabelStyle}"/>
<Actions:UCValueExpression x:Name="xAttributeNameVE" Margin="6,0,0,0" ToolTip="Please provide the Attribute Name for the specified element." Width="330" Height="25"/>
</StackPanel>
<StackPanel Orientation="Horizontal" Margin="0,25,0,0">
<Label Content="Attribute Value:" Style="{StaticResource $LabelStyle}"/>
<Actions:UCValueExpression x:Name="xAttributeValueVE" Margin="9,0,0,0" ToolTip="Please provide the Attribute Value for the specified Attribute Name." Width="330" Height="25"/>
</StackPanel>
</StackPanel>
<StackPanel x:Name="UrlMatches_Pnl" Margin="0,25,0,0" Orientation="Horizontal" HorizontalAlignment="Left" VerticalAlignment="Center" >
<Label Content="URL to Match:" Style="{StaticResource $LabelStyle}"/>
<Actions:UCValueExpression x:Name="xUrlMatchesVE" Margin="29,0,0,0" ToolTip="Please provide the input value based on the operation." Width="330" Height="25"/>
</StackPanel>
<StackPanel Margin="0,25,0,0">
<Label Content="Operation Description:" FontWeight="Bold" Style="{StaticResource $LabelStyle}"></Label>
<TextBlock x:Name="xOperationDescription" TextWrapping="Wrap" Style="{StaticResource @TextBlockStyle}" DockPanel.Dock="Top" TextAlignment="Left" FontSize="12" Margin="0,0,0,0"></TextBlock>
</StackPanel>
</StackPanel>
</Grid>
</Page>
171 changes: 171 additions & 0 deletions Ginger/Ginger/Actions/ActionEditPages/ActNewSmartSyncEditPage.xaml.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,171 @@
#region License
/*
Copyright © 2014-2024 European Support Limited
Licensed under the Apache License, Version 2.0 (the "License")
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
*/
#endregion


using Amdocs.Ginger.Common;
using GingerCore.Actions;
using GingerCore.GeneralLib;
using Ginger;
using System.ComponentModel;
using System.Globalization;
using System.Windows;
using System.Windows.Controls;
using System.Windows.Controls.Primitives;
using System.Windows.Data;
using Ginger.UserControls;
namespace Ginger.Actions
{
public partial class ActNewSmartSyncEditPage : Page, IActEditPage
{
ActNewSmartSync mAct;
public Visibility LocatorVisibility
{
get => GetLocatorVisibility();
}
public event PropertyChangedEventHandler? PropertyChanged;

public ActNewSmartSyncEditPage(GingerCore.Actions.ActNewSmartSync Act)
{
InitializeComponent();
GingerCore.General.FillComboFromEnumObj(ActionNameComboBox, Act.SyncOperations, sortValues: false);
GingerCore.GeneralLib.BindingHandler.ObjFieldBinding(ActionNameComboBox, ComboBox.SelectedValueProperty, Act, nameof(ActNewSmartSync.SyncOperations));
xTxtMatchVE.Init(Context.GetAsContext(Act.Context), Act, nameof(ActNewSmartSync.TxtMatchInput));
xAttributeValueVE.Init(Context.GetAsContext(Act.Context), Act, nameof(ActNewSmartSync.AttributeValue));
xAttributeNameVE.Init(Context.GetAsContext(Act.Context), Act, nameof(ActNewSmartSync.AttributeName));
xUrlMatchesVE.Init(Context.GetAsContext(Act.Context), Act, nameof(ActNewSmartSync.UrlMatches));


}



private Visibility GetLocatorVisibility()
{
if (ActionNameComboBox.SelectedValue is not ActNewSmartSync.eSyncOperation selectedSyncAction)
{
return Visibility.Visible;
}

if (selectedSyncAction == ActNewSmartSync.eSyncOperation.PageHasBeenLoaded || selectedSyncAction == ActNewSmartSync.eSyncOperation.AlertIsPresent || selectedSyncAction == ActNewSmartSync.eSyncOperation.UrlMatches)
{
return Visibility.Collapsed;
}
else
{
return Visibility.Visible;
}
}

private void SetPanelVisibility(Panel panel, ActNewSmartSync.eSyncOperation action)
{
if (ActionNameComboBox.SelectedValue is not ActNewSmartSync.eSyncOperation selectedSyncAction)
{
panel.Visibility = Visibility.Collapsed;
return;
}

panel.Visibility = selectedSyncAction == action ? Visibility.Visible : Visibility.Collapsed;
}

private void NotifyLocatorVisibilityChanged()
{
PropertyChanged?.Invoke(sender: this, new PropertyChangedEventArgs(propertyName: nameof(LocatorVisibility)));
}

private void ActionNameComboBox_SelectionChanged(object sender, SelectionChangedEventArgs e)
{
if (ActionNameComboBox.SelectedValue is not ActNewSmartSync.eSyncOperation)
{
return;
}

NotifyLocatorVisibilityChanged();
SetPanelVisibility(TxtMatch_Pnl, ActNewSmartSync.eSyncOperation.TextMatches);
SetPanelVisibility(UrlMatches_Pnl, ActNewSmartSync.eSyncOperation.UrlMatches);
SetPanelVisibility(AttributeMatches_Pnl, ActNewSmartSync.eSyncOperation.AttributeMatches);
setOperationDescription();
}

void setOperationDescription()
{
switch (ActionNameComboBox.SelectedValue)
{
case ActNewSmartSync.eSyncOperation.ElementIsVisible:
xOperationDescription.Text = "Verifies if an element is present on both the webpage's structure (DOM) and visible to the user.";
break;
case ActNewSmartSync.eSyncOperation.ElementExists:
xOperationDescription.Text = "Checks if an element exists on the webpage, regardless of whether it is visible.";
break;
case ActNewSmartSync.eSyncOperation.AlertIsPresent:
xOperationDescription.Text = "Waits until an alert message pops up on the webpage. ";
break;
case ActNewSmartSync.eSyncOperation.ElementIsSelected:
xOperationDescription.Text = "Confirms if a form element like a checkbox or radio button is currently selected. ";
break;
case ActNewSmartSync.eSyncOperation.PageHasBeenLoaded:
xOperationDescription.Text = "Ensures that the entire webpage has been loaded and is ready for interaction. ";
break;
case ActNewSmartSync.eSyncOperation.ElementToBeClickable:
xOperationDescription.Text = "Waits until an element is both visible and enabled, indicating that it can be clicked. ";
break;
case ActNewSmartSync.eSyncOperation.TextMatches:
xOperationDescription.Text = "Waits until the text of an element matches a specified pattern. ";
break;
case ActNewSmartSync.eSyncOperation.AttributeMatches:
xOperationDescription.Text = "Waits until a specific attribute of an element matches a specified pattern. ";
break;
case ActNewSmartSync.eSyncOperation.EnabilityOfAllElementsLocatedBy:
xOperationDescription.Text = "Checks if all the elements found by a given method are enabled and can be interacted. ";
break;
case ActNewSmartSync.eSyncOperation.FrameToBeAvailableAndSwitchToIt:
xOperationDescription.Text = "Waits until a frame is available to switch to and then switches to it. ";
break;
case ActNewSmartSync.eSyncOperation.InvisibilityOfAllElementsLocatedBy:
xOperationDescription.Text = "Waits until all the elements found by a given method are invisible or not present. ";
break;
case ActNewSmartSync.eSyncOperation.InvisibilityOfElementLocated:
xOperationDescription.Text = "Waits until a specific element is no longer visible or not present. ";
break;
case ActNewSmartSync.eSyncOperation.PresenceOfAllElementsLocatedBy:
xOperationDescription.Text = "Ensures that all the elements found by a given method are present in the webpage's structure (DOM). ";
break;
case ActNewSmartSync.eSyncOperation.SelectedOfAllElementsLocatedBy:
xOperationDescription.Text = "Ensures that all the elements found by a given method are visible on the webpage. ";
break;
case ActNewSmartSync.eSyncOperation.UrlMatches:
xOperationDescription.Text = "Waits until the URL of the current page matches a specified pattern. ";
break;
case ActNewSmartSync.eSyncOperation.VisibilityOfAllElementsLocatedBy:
xOperationDescription.Text = "Ensures that all the elements found by a given method are selected. ";
break;
default:
xOperationDescription.Text = "No operation selected.";
break;


}

}

}

public interface IActEditPage : INotifyPropertyChanged
{
public Visibility LocatorVisibility { get; }
}
}
Loading

0 comments on commit 75064b8

Please sign in to comment.