-
Notifications
You must be signed in to change notification settings - Fork 60
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
11 changed files
with
769 additions
and
85 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
40 changes: 40 additions & 0 deletions
40
Ginger/Ginger/Actions/ActionEditPages/ActNewSmartSyncEditPage.xaml
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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
171
Ginger/Ginger/Actions/ActionEditPages/ActNewSmartSyncEditPage.xaml.cs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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; } | ||
} | ||
} |
Oops, something went wrong.