Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Accessibility configuration Added for Exclude Rule from analysis #3851

Merged
merged 9 commits into from
Aug 8, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -106,16 +106,16 @@ public ActAccessibilityTestingEditPage(ActAccessibilityTesting act)
xSeverityCB.Init(mAct, nameof(mAct.SeverityList));

xLocateValueVE.BindControl(Context.GetAsContext(mAct.Context), mAct, Act.Fields.LocateValue);
xTargetRadioButton.Init(typeof(ActAccessibilityTesting.eTarget), xTargetRadioButtonPnl, mAct.GetOrCreateInputParam(ActAccessibilityTesting.Fields.Target, ActAccessibilityTesting.eTarget.Page.ToString()), TargetRadioButton_Clicked);
xAnalyzerRadioButton.Init(typeof(ActAccessibilityTesting.eAnalyzer), xAnalyzerRadioButtonPnl, mAct.GetOrCreateInputParam(ActAccessibilityTesting.Fields.Analyzer, ActAccessibilityTesting.eAnalyzer.ByStandard.ToString()), AnalyzerRadioButton_Clicked);
xTargetRadioButton.Init(typeof(ActAccessibilityTesting.eTarget), xTargetRadioButtonPnl, mAct.GetOrCreateInputParam(ActAccessibilityTesting.Fields.Target, nameof(ActAccessibilityTesting.eTarget.Page)), TargetRadioButton_Clicked);
xAnalyzerRadioButton.Init(typeof(ActAccessibilityTesting.eAnalyzer), xAnalyzerRadioButtonPnl, mAct.GetOrCreateInputParam(ActAccessibilityTesting.Fields.Analyzer, nameof(ActAccessibilityTesting.eAnalyzer.ByStandard)), AnalyzerRadioButton_Clicked);
BindControlForTarget();
BindControlForAnalyzer();
SetLocateValueFrame();
}

private void BindControlForTarget()
{
if ((mAct.GetInputParamValue(ActAccessibilityTesting.Fields.Target) == ActAccessibilityTesting.eTarget.Element.ToString()))
if ((mAct.GetInputParamValue(ActAccessibilityTesting.Fields.Target) == nameof(ActAccessibilityTesting.eTarget.Element)))
{
xLocateByAndValuePanel.Visibility = System.Windows.Visibility.Visible;
}
Expand All @@ -126,12 +126,12 @@ private void BindControlForTarget()
}
private void BindControlForAnalyzer()
{
if ((mAct.GetInputParamValue(ActAccessibilityTesting.Fields.Analyzer) == ActAccessibilityTesting.eAnalyzer.ByStandard.ToString()))
if ((mAct.GetInputParamValue(ActAccessibilityTesting.Fields.Analyzer) == nameof(ActAccessibilityTesting.eAnalyzer.ByStandard)))
{
xStdStack.Visibility = System.Windows.Visibility.Visible;
xSeveritylbl.Content = "Acceptable Severities :";
}
else if ((mAct.GetInputParamValue(ActAccessibilityTesting.Fields.Analyzer) == ActAccessibilityTesting.eAnalyzer.BySeverity.ToString()))
else if ((mAct.GetInputParamValue(ActAccessibilityTesting.Fields.Analyzer) == nameof(ActAccessibilityTesting.eAnalyzer.BySeverity)))
{
xStdStack.Visibility = System.Windows.Visibility.Collapsed;
xSeveritylbl.Content = "Severities :";
Expand Down Expand Up @@ -232,24 +232,24 @@ private void SetLocateValueControls()
public ObservableList<OperationValues> GetStandardTagslist()
{
ObservableList<OperationValues> StandardTagList = new ObservableList<OperationValues>();
StandardTagList.Add(new OperationValues() { Value = ActAccessibilityTesting.eTags.wcag2a.ToString(), DisplayName = GingerCore.General.GetEnumValueDescription(typeof(ActAccessibilityTesting.eTags), ActAccessibilityTesting.eTags.wcag2a.ToString()) });
StandardTagList.Add(new OperationValues() { Value = ActAccessibilityTesting.eTags.wcag2aa.ToString(), DisplayName = GingerCore.General.GetEnumValueDescription(typeof(ActAccessibilityTesting.eTags), ActAccessibilityTesting.eTags.wcag2aa.ToString()) });
StandardTagList.Add(new OperationValues() { Value = ActAccessibilityTesting.eTags.wcag21a.ToString(), DisplayName = GingerCore.General.GetEnumValueDescription(typeof(ActAccessibilityTesting.eTags), ActAccessibilityTesting.eTags.wcag21a.ToString()) });
StandardTagList.Add(new OperationValues() { Value = ActAccessibilityTesting.eTags.wcag21aa.ToString(), DisplayName = GingerCore.General.GetEnumValueDescription(typeof(ActAccessibilityTesting.eTags), ActAccessibilityTesting.eTags.wcag21aa.ToString()) });
StandardTagList.Add(new OperationValues() { Value = ActAccessibilityTesting.eTags.wcag22a.ToString(), DisplayName = GingerCore.General.GetEnumValueDescription(typeof(ActAccessibilityTesting.eTags), ActAccessibilityTesting.eTags.wcag22a.ToString()) });
StandardTagList.Add(new OperationValues() { Value = ActAccessibilityTesting.eTags.wcag22aa.ToString(), DisplayName = GingerCore.General.GetEnumValueDescription(typeof(ActAccessibilityTesting.eTags), ActAccessibilityTesting.eTags.wcag22aa.ToString()) });
StandardTagList.Add(new OperationValues() { Value = ActAccessibilityTesting.eTags.bestpractice.ToString(), DisplayName = GingerCore.General.GetEnumValueDescription(typeof(ActAccessibilityTesting.eTags), ActAccessibilityTesting.eTags.bestpractice.ToString()) });
StandardTagList.Add(new OperationValues() { Value = nameof(ActAccessibilityTesting.eTags.wcag2a), DisplayName = GingerCore.General.GetEnumValueDescription(typeof(ActAccessibilityTesting.eTags), nameof(ActAccessibilityTesting.eTags.wcag2a)) });
StandardTagList.Add(new OperationValues() { Value = nameof(ActAccessibilityTesting.eTags.wcag2aa), DisplayName = GingerCore.General.GetEnumValueDescription(typeof(ActAccessibilityTesting.eTags), nameof(ActAccessibilityTesting.eTags.wcag2aa)) });
StandardTagList.Add(new OperationValues() { Value = nameof(ActAccessibilityTesting.eTags.wcag21a), DisplayName = GingerCore.General.GetEnumValueDescription(typeof(ActAccessibilityTesting.eTags), nameof(ActAccessibilityTesting.eTags.wcag21a)) });
StandardTagList.Add(new OperationValues() { Value = nameof(ActAccessibilityTesting.eTags.wcag21aa), DisplayName = GingerCore.General.GetEnumValueDescription(typeof(ActAccessibilityTesting.eTags), nameof(ActAccessibilityTesting.eTags.wcag21aa)) });
StandardTagList.Add(new OperationValues() { Value = nameof(ActAccessibilityTesting.eTags.wcag22a), DisplayName = GingerCore.General.GetEnumValueDescription(typeof(ActAccessibilityTesting.eTags), nameof(ActAccessibilityTesting.eTags.wcag22a)) });
StandardTagList.Add(new OperationValues() { Value = nameof(ActAccessibilityTesting.eTags.wcag22aa), DisplayName = GingerCore.General.GetEnumValueDescription(typeof(ActAccessibilityTesting.eTags), nameof(ActAccessibilityTesting.eTags.wcag22aa)) });
StandardTagList.Add(new OperationValues() { Value = nameof(ActAccessibilityTesting.eTags.bestpractice), DisplayName = GingerCore.General.GetEnumValueDescription(typeof(ActAccessibilityTesting.eTags), nameof(ActAccessibilityTesting.eTags.bestpractice)) });
return StandardTagList;
}

public ObservableList<OperationValues> GetSeverityList()
{
ObservableList<OperationValues> SeverityList = new ObservableList<OperationValues>();

SeverityList.Add(new OperationValues() { Value = ActAccessibilityTesting.eSeverity.Critical.ToString() });
SeverityList.Add(new OperationValues() { Value = ActAccessibilityTesting.eSeverity.Serious.ToString() });
SeverityList.Add(new OperationValues() { Value = ActAccessibilityTesting.eSeverity.Moderate.ToString() });
SeverityList.Add(new OperationValues() { Value = ActAccessibilityTesting.eSeverity.Minor.ToString() });
SeverityList.Add(new OperationValues() { Value = nameof(ActAccessibilityTesting.eSeverity.Critical) });
SeverityList.Add(new OperationValues() { Value = nameof(ActAccessibilityTesting.eSeverity.Serious) });
SeverityList.Add(new OperationValues() { Value = nameof(ActAccessibilityTesting.eSeverity.Moderate) });
SeverityList.Add(new OperationValues() { Value = nameof(ActAccessibilityTesting.eSeverity.Minor) });
return SeverityList;
}

Expand Down
9 changes: 9 additions & 0 deletions Ginger/Ginger/MenusLib/ConfigurationsMenu.cs
Original file line number Diff line number Diff line change
Expand Up @@ -92,6 +92,10 @@ private static TwoLevelMenu GetMenu()
externalConfigMenu.Add(eImageType.Exchange, "Ask Lisa Configuration", GetAskLisaConfigsPage, ConsoleKey.X, "Ask Lisa Configurations", "Ask Lisa Configuration AID");
twoLevelMenu.Add(externalConfigMenu);

TopMenuItem accessiblityRulesMenu = new TopMenuItem(eImageType.Accessibility, $"{GingerCore.General.GetEnumValueDescription(typeof(eTermResKey), nameof(eTermResKey.AccessibilityRules))}", ConsoleKey.T, $"{GingerCore.General.GetEnumValueDescription(typeof(eTermResKey), nameof(eTermResKey.AccessibilityRules))}", "Name & rules of the Accessibility which been present current json");
accessiblityRulesMenu.Add(eImageType.Application, "", GetAccessibilityRulePage, ConsoleKey.T, "", "AID");
twoLevelMenu.Add(accessiblityRulesMenu);

return twoLevelMenu;
}

Expand Down Expand Up @@ -155,5 +159,10 @@ private static Page OthersPage()
{
return new Page();
}

private static Page GetAccessibilityRulePage()
{
return (new AccessibilityRulePage());
}
}
}
37 changes: 37 additions & 0 deletions Ginger/Ginger/SolutionWindows/AccessibilityRulePage.xaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,37 @@
<Page x:Class="Ginger.SolutionWindows.AccessibilityRulePage"
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:local="clr-namespace:Ginger.SolutionWindows"
xmlns:Ginger="clr-namespace:Ginger"
mc:Ignorable="d"
d:DesignHeight="450" d:DesignWidth="800"
Title="Accessibility Rule Page">

<Page.Resources>
<DataTemplate x:Key="CheckBoxTemplate">
<CheckBox IsChecked="{Binding Active}" HorizontalAlignment="Center" Click="CheckBox_Click"/>
</DataTemplate>
</Page.Resources>

<Grid Background="{StaticResource $BackgroundColor_White}">
<Grid.RowDefinitions>
<RowDefinition
Height="Auto" />
<RowDefinition
Height="*" />
</Grid.RowDefinitions>
<!--<TextBlock
FontSize="10">
<TextBlock.Inlines>
<Run
Text="NOTE: "
FontWeight="Bold" />
<Run
Text="Active items can be analyzed for accessibility." />
</TextBlock.Inlines>
</TextBlock>-->
<Ginger:ucGrid Grid.Row="1" x:Name="xAccessibilityRulesGrid" Title="Accessibility rule list" ShowRefresh="Collapsed" ShowUndo="Collapsed" ShowAdd="Collapsed" ShowSaveAllChanges="Collapsed" ShowSaveSelectedChanges="Collapsed" ShowEdit="Collapsed" ShowClearAll="Collapsed" ShowDelete="Collapsed" ShowUpDown="Collapsed" d:IsHidden="True"/>
</Grid>
</Page>
137 changes: 137 additions & 0 deletions Ginger/Ginger/SolutionWindows/AccessibilityRulePage.xaml.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,137 @@
using amdocs.ginger.GingerCoreNET;
using Amdocs.Ginger;
using Amdocs.Ginger.Common;
using Amdocs.Ginger.CoreNET.ActionsLib.UI.Web;
using Amdocs.Ginger.CoreNET.GeneralLib;
using Amdocs.Ginger.Repository;
using Ginger.Configurations;
using Ginger.Run;
using Ginger.SolutionGeneral;
using Ginger.UserControls;
using GingerCore;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Windows;
using System.Windows.Controls;
using System.Windows.Data;
using System.Windows.Documents;
using System.Windows.Input;
using System.Windows.Media;
using System.Windows.Media.Imaging;
using System.Windows.Navigation;
using System.Windows.Shapes;

namespace Ginger.SolutionWindows
{
/// <summary>
/// Interaction logic for AccessibilityRulePage.xaml
/// </summary>
public partial class AccessibilityRulePage : Page
{
Solution mSolution;
string AppName;
private AccessibilityConfiguration mAccessibilityConfiguration;
private static ActAccessibilityTesting actAccessibilityTesting = new ActAccessibilityTesting();
public AccessibilityRulePage()
{
InitializeComponent();
mSolution = WorkSpace.Instance.Solution;
string allProperties = string.Empty;
LoadGridData();
SetAppsGrid();
mAccessibilityConfiguration = !WorkSpace.Instance.SolutionRepository.GetAllRepositoryItems<AccessibilityConfiguration>().Any() ? new AccessibilityConfiguration() : WorkSpace.Instance.SolutionRepository.GetFirstRepositoryItem<AccessibilityConfiguration>();
mAccessibilityConfiguration.ExcludedRules = mAccessibilityConfiguration.ExcludedRules != null ? mAccessibilityConfiguration.ExcludedRules : new ();
}

private void SetAppsGrid()
{
xAccessibilityRulesGrid.SetGridEnhancedHeader(Amdocs.Ginger.Common.Enums.eImageType.Accessibility, $"{GingerCore.General.GetEnumValueDescription(typeof(eTermResKey), nameof(eTermResKey.AccessibilityRules))}", null, null, true);
GridViewDef view = new GridViewDef(GridViewDef.DefaultViewName);
view.GridColsView = new ObservableList<GridColView>();
view.GridColsView.Add(new GridColView()
{
Field = nameof(AccessibilityRuleData.Active),
WidthWeight = 2,
StyleType = GridColView.eGridColStyleType.Template,
CellTemplate = (DataTemplate)FindResource("CheckBoxTemplate"),
AllowSorting = true
});
view.GridColsView.Add(new GridColView()
{
Field = nameof(AccessibilityRuleData.RuleID),
Header = "RuleID",
ReadOnly = true,
WidthWeight = 15,
AllowSorting = true
});
view.GridColsView.Add(new GridColView()
{
Field = nameof(AccessibilityRuleData.Description),
Header = "Description",
WidthWeight = 40,
ReadOnly = true
});
view.GridColsView.Add(new GridColView()
{
Field = nameof(AccessibilityRuleData.Impact),
Header = "Severity",
WidthWeight = 5,
ReadOnly = true,
AllowSorting = true
});
view.GridColsView.Add(new GridColView()
{
Field = nameof(AccessibilityRuleData.Tags),
WidthWeight = 30,
ReadOnly = true
});

xAccessibilityRulesGrid.AddLabel("Note: Ginger will only analyze the active accessibility testing rules; inactive rules will not be considered.");

xAccessibilityRulesGrid.SetAllColumnsDefaultView(view);
xAccessibilityRulesGrid.InitViewItems();
}

private void LoadGridData()
{
List<AccessibilityRuleData> sortedList = actAccessibilityTesting.RulesItemsdata.OrderByDescending(data => !data.Active).ToList();
prashelke marked this conversation as resolved.
Show resolved Hide resolved
ObservableList<AccessibilityRuleData> accessibilityRuleDatas = [.. sortedList];
xAccessibilityRulesGrid.DataSourceList = accessibilityRuleDatas;
}
prashelke marked this conversation as resolved.
Show resolved Hide resolved

private void CheckBox_Click(object sender, RoutedEventArgs e)
{
CheckBox checkBox = sender as CheckBox;
if (checkBox != null && checkBox.DataContext is AccessibilityRuleData data)
{
// Do something with data, for example:
data.Active = checkBox.IsChecked ?? false;
mAccessibilityConfiguration.StartDirtyTracking();
if (!data.Active)
{
if(!mAccessibilityConfiguration.ExcludedRules.Any())
{
GingerCoreNET.GeneralLib.General.CreateDefaultAccessiblityconfiguration();
mAccessibilityConfiguration = WorkSpace.Instance.SolutionRepository.GetFirstRepositoryItem<AccessibilityConfiguration>();
mAccessibilityConfiguration.ExcludedRules = mAccessibilityConfiguration.ExcludedRules != null ? mAccessibilityConfiguration.ExcludedRules : new();
}

if (!mAccessibilityConfiguration.ExcludedRules.Any(x => x.Equals(data.RuleID)))
{
mAccessibilityConfiguration.ExcludedRules.Add(data);
}
}
else
{
if (mAccessibilityConfiguration.ExcludedRules.Any(x => x.Equals(data.RuleID)))
{
mAccessibilityConfiguration.ExcludedRules.Remove(data);
}
}
}
}
}
}
1 change: 1 addition & 0 deletions Ginger/Ginger/SolutionWindows/AddSolutionPage.xaml.cs
Original file line number Diff line number Diff line change
Expand Up @@ -134,6 +134,7 @@ private void OKButton_Click(object sender, RoutedEventArgs e)
GingerCoreNET.GeneralLib.General.CreateDefaultEnvironment();
WorkSpace.Instance.SolutionRepository.AddRepositoryItem(WorkSpace.Instance.GetNewBusinessFlow("Flow 1", true));
mSolution.SolutionOperations.SetReportsConfigurations();
GingerCoreNET.GeneralLib.General.CreateDefaultAccessiblityconfiguration();

//Save again to keep all defualt configurations setup
mSolution.SolutionOperations.SaveSolution(false);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -286,6 +286,10 @@ private void SetImage()
case eImageType.Building:
SetAsFontAwesomeIcon(EFontAwesomeIcon.Solid_Building);
break;

case eImageType.Accessibility:
SetAsFontAwesomeIcon(EFontAwesomeIcon.Solid_UniversalAccess);
break;
#endregion


Expand Down
2 changes: 1 addition & 1 deletion Ginger/Ginger/UserControlsLib/ucGridView/ucGrid.xaml
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@
<DockPanel x:Name="xEnhancedHeader" DockPanel.Dock="Top" VerticalAlignment="Center" Background="{StaticResource $BackgroundColor_White}" Visibility="Collapsed">
<StackPanel Orientation="Horizontal" DockPanel.Dock="Top" Margin="5,5,5,0">
<usercontrols:ImageMakerControl x:Name="xEnhancedHeaderIcon" ImageType="Empty" SetAsFontImageWithSize="20" VerticalAlignment="Top" HorizontalAlignment="Left" ImageForeground="{StaticResource $BackgroundColor_DarkGray}" Margin="0,12,0,0"/>
<Label x:Name="xEnhancedHeaderTitle" Content="Item Name" FontSize="20" Foreground="{StaticResource $BackgroundColor_Black}" VerticalAlignment="Top" HorizontalAlignment="Left" Margin="0,0,0,0" />
<Label x:Name="xEnhancedHeaderTitle" Content="Item Name" FontSize="20" Foreground="{StaticResource $BackgroundColor_Black}" VerticalAlignment="Center" HorizontalAlignment="Center" Margin="0,0,0,0" />
</StackPanel>
<GridSplitter Height="1" ResizeDirection="Rows" DockPanel.Dock="Bottom" Grid.Row="0" VerticalAlignment="Bottom" HorizontalAlignment="Stretch" Margin="0,5,0,5" IsEnabled="False" Background="LightGray" />
<DockPanel x:Name="xEnhancedHeaderToolsPnl" DockPanel.Dock="Bottom" Margin="0,20,0,0" HorizontalAlignment="Left">
Expand Down
4 changes: 4 additions & 0 deletions Ginger/GingerCoreCommon/Dictionaries/GingerDicser.cs
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,10 @@ public enum eTermResKey
Variable, Variables,
RunSet, RunSets,
TargetApplication,

[EnumValueDescription("Accessibility Rules")]
AccessibilityRules,

Parameter
}

Expand Down
1 change: 1 addition & 0 deletions Ginger/GingerCoreCommon/EnumsLib/eImageType.cs
Original file line number Diff line number Diff line change
Expand Up @@ -354,6 +354,7 @@ public enum eImageType
PlusSquare,
DataTable,
Robot,
Accessibility,
AnglesArrowLeft,
AnglesArrowRight,

Expand Down
Loading
Loading