From 245d4d08dcfb5152862013eda250b5e7c7d78115 Mon Sep 17 00:00:00 2001 From: prashelke Date: Thu, 1 Aug 2024 01:00:44 +0530 Subject: [PATCH 1/8] Accessibility configuration Added for Exclude Rule from analysis --- .../ActAccessibilityTestingEditPage.xaml.cs | 32 +- Ginger/Ginger/MenusLib/ConfigurationsMenu.cs | 9 + .../SolutionWindows/AccessiblityRulePage.xaml | 37 + .../AccessiblityRulePage.xaml.cs | 147 ++++ .../ImageMakerLib/ImageMakerControl.xaml.cs | 4 + .../UserControlsLib/ucGridView/ucGrid.xaml | 2 +- .../Dictionaries/GingerDicser.cs | 4 + .../GingerCoreCommon/EnumsLib/eImageType.cs | 1 + .../AccessibilityConfiguration.cs | 222 +----- .../Configurations/AccessibilityRuleData.cs | 21 +- .../GingerCoreCommon/WorkSpaceLib/Solution.cs | 24 +- .../UI/Web/ActAccessibilityTesting.cs | 79 +- .../AccessiblityRules.json | 748 ++++++++++++++++++ Ginger/GingerCoreNET/GingerCoreNET.csproj | 8 +- .../ActionsLib/UI/Web/AccessiblityTests.cs | 157 ++++ .../GingerCoreNETUnitTest.csproj | 4 + .../TestResources/Html/TestAccessiblity.html | 78 ++ 17 files changed, 1312 insertions(+), 265 deletions(-) create mode 100644 Ginger/Ginger/SolutionWindows/AccessiblityRulePage.xaml create mode 100644 Ginger/Ginger/SolutionWindows/AccessiblityRulePage.xaml.cs create mode 100644 Ginger/GingerCoreNET/Drivers/CoreDrivers/Web/Selenium/AccessibilityTestResources/AccessiblityRules.json create mode 100644 Ginger/GingerCoreNETUnitTest/ActionsLib/UI/Web/AccessiblityTests.cs create mode 100644 Ginger/GingerCoreNETUnitTest/TestResources/Html/TestAccessiblity.html diff --git a/Ginger/Ginger/Actions/ActionEditPages/ActAccessibilityTestingEditPage.xaml.cs b/Ginger/Ginger/Actions/ActionEditPages/ActAccessibilityTestingEditPage.xaml.cs index 9834bc17fb..da7e649361 100644 --- a/Ginger/Ginger/Actions/ActionEditPages/ActAccessibilityTestingEditPage.xaml.cs +++ b/Ginger/Ginger/Actions/ActionEditPages/ActAccessibilityTestingEditPage.xaml.cs @@ -106,8 +106,8 @@ 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(); @@ -115,7 +115,7 @@ public ActAccessibilityTestingEditPage(ActAccessibilityTesting act) 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; } @@ -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 :"; @@ -232,13 +232,13 @@ private void SetLocateValueControls() public ObservableList GetStandardTagslist() { ObservableList StandardTagList = new ObservableList(); - 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; } @@ -246,10 +246,10 @@ public ObservableList GetSeverityList() { ObservableList SeverityList = new ObservableList(); - 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; } diff --git a/Ginger/Ginger/MenusLib/ConfigurationsMenu.cs b/Ginger/Ginger/MenusLib/ConfigurationsMenu.cs index 717db9db43..c074504702 100644 --- a/Ginger/Ginger/MenusLib/ConfigurationsMenu.cs +++ b/Ginger/Ginger/MenusLib/ConfigurationsMenu.cs @@ -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, "", GeAccessiblityRulePage, ConsoleKey.T, "", "AID"); + twoLevelMenu.Add(accessiblityRulesMenu); + return twoLevelMenu; } @@ -155,5 +159,10 @@ private static Page OthersPage() { return new Page(); } + + private static Page GeAccessiblityRulePage() + { + return (new AccessiblityRulePage()); + } } } diff --git a/Ginger/Ginger/SolutionWindows/AccessiblityRulePage.xaml b/Ginger/Ginger/SolutionWindows/AccessiblityRulePage.xaml new file mode 100644 index 0000000000..2586f100b4 --- /dev/null +++ b/Ginger/Ginger/SolutionWindows/AccessiblityRulePage.xaml @@ -0,0 +1,37 @@ + + + + + + + + + + + + + + + + + + + + + + diff --git a/Ginger/Ginger/SolutionWindows/AccessiblityRulePage.xaml.cs b/Ginger/Ginger/SolutionWindows/AccessiblityRulePage.xaml.cs new file mode 100644 index 0000000000..1014792ef2 --- /dev/null +++ b/Ginger/Ginger/SolutionWindows/AccessiblityRulePage.xaml.cs @@ -0,0 +1,147 @@ +using amdocs.ginger.GingerCoreNET; +using Amdocs.Ginger.Common; +using Amdocs.Ginger.CoreNET.ActionsLib.UI.Web; +using Amdocs.Ginger.CoreNET.GeneralLib; +using Ginger.Configurations; +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 +{ + /// + /// Interaction logic for AccessiblityRulePage.xaml + /// + public partial class AccessiblityRulePage : Page + { + Solution mSolution; + string AppName; + List DefaultExcludeRulesList; + private AccessibilityConfiguration mAccessibilityConfiguration; + public AccessiblityRulePage() + { + InitializeComponent(); + mSolution = WorkSpace.Instance.Solution; + string allProperties = string.Empty; + WorkSpace.Instance.PropertyChanged += WorkSpacePropertyChanged; + LoadGridData(); + SetAppsGrid(); + mAccessibilityConfiguration = new(); + DefaultExcludeRulesList = WorkSpace.Instance.Solution.DefaultExcludeRule.DefaultExcludeRules != null ? WorkSpace.Instance.Solution.DefaultExcludeRule.DefaultExcludeRules.Split(',').ToList() : new(); + } + + private void WorkSpacePropertyChanged(object sender, System.ComponentModel.PropertyChangedEventArgs e) + { + if (e.PropertyName == nameof(WorkSpace.Solution)) + { + mSolution = WorkSpace.Instance.Solution; + LoadGridData(); + } + } + + private void SetAppsGrid() + { + xAccessiblityRulesGrid.SetGridEnhancedHeader(Amdocs.Ginger.Common.Enums.eImageType.Accessibility, $"{GingerCore.General.GetEnumValueDescription(typeof(eTermResKey), nameof(eTermResKey.AccessibilityRules))}", saveAllHandler: SaveHandler, null, true); + GridViewDef view = new GridViewDef(GridViewDef.DefaultViewName); + view.GridColsView = new ObservableList(); + 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.Tags), + WidthWeight = 30, + 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.Description), + Header = "Description", + WidthWeight = 40, + ReadOnly = true + }); + + + xAccessiblityRulesGrid.SetAllColumnsDefaultView(view); + xAccessiblityRulesGrid.InitViewItems(); + } + + private void LoadGridData() + { + ActAccessibilityTesting actAccessibilityTesting = new ActAccessibilityTesting(); + List sortedList = actAccessibilityTesting.RulesItemsdata.OrderByDescending(data => !data.Active).ToList(); + ObservableList accessibilityRuleDatas = [.. sortedList]; + xAccessiblityRulesGrid.DataSourceList = accessibilityRuleDatas; + } + + 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; + WorkSpace.Instance.Solution.DefaultExcludeRule.StartDirtyTracking(); + if (data.Active == false) + { + if (!DefaultExcludeRulesList.Any(x => x.Equals(data.RuleID))) + { + DefaultExcludeRulesList.Add(data.RuleID); + + mAccessibilityConfiguration.DefaultExcludeRules = String.Join(",", DefaultExcludeRulesList.Select(x => x)); + WorkSpace.Instance.Solution.DefaultExcludeRule = mAccessibilityConfiguration; + } + } + else + { + if (DefaultExcludeRulesList.Any(x => x.Equals(data.RuleID))) + { + DefaultExcludeRulesList.Remove(data.RuleID); + mAccessibilityConfiguration.DefaultExcludeRules = String.Join(",", DefaultExcludeRulesList.Select(x => x)); + WorkSpace.Instance.Solution.DefaultExcludeRule = mAccessibilityConfiguration; + } + } + } + } + + private void SaveHandler(object sender, RoutedEventArgs e) + { + mSolution.SolutionOperations.SaveSolution(true, Solution.eSolutionItemToSave.DefaultExcludeRule); + } + } +} diff --git a/Ginger/Ginger/UserControlsLib/ImageMakerLib/ImageMakerControl.xaml.cs b/Ginger/Ginger/UserControlsLib/ImageMakerLib/ImageMakerControl.xaml.cs index 127370dac4..b9ca88a3b1 100644 --- a/Ginger/Ginger/UserControlsLib/ImageMakerLib/ImageMakerControl.xaml.cs +++ b/Ginger/Ginger/UserControlsLib/ImageMakerLib/ImageMakerControl.xaml.cs @@ -286,6 +286,10 @@ private void SetImage() case eImageType.Building: SetAsFontAwesomeIcon(EFontAwesomeIcon.Solid_Building); break; + + case eImageType.Accessibility: + SetAsFontAwesomeIcon(EFontAwesomeIcon.Solid_UniversalAccess); + break; #endregion diff --git a/Ginger/Ginger/UserControlsLib/ucGridView/ucGrid.xaml b/Ginger/Ginger/UserControlsLib/ucGridView/ucGrid.xaml index b78d0d572b..5c38dfc17d 100644 --- a/Ginger/Ginger/UserControlsLib/ucGridView/ucGrid.xaml +++ b/Ginger/Ginger/UserControlsLib/ucGridView/ucGrid.xaml @@ -19,7 +19,7 @@ - diff --git a/Ginger/GingerCoreCommon/Dictionaries/GingerDicser.cs b/Ginger/GingerCoreCommon/Dictionaries/GingerDicser.cs index 934213bd16..03e67104db 100644 --- a/Ginger/GingerCoreCommon/Dictionaries/GingerDicser.cs +++ b/Ginger/GingerCoreCommon/Dictionaries/GingerDicser.cs @@ -32,6 +32,10 @@ public enum eTermResKey Variable, Variables, RunSet, RunSets, TargetApplication, + + [EnumValueDescription("Accessibility Rules")] + AccessibilityRules, + Parameter } diff --git a/Ginger/GingerCoreCommon/EnumsLib/eImageType.cs b/Ginger/GingerCoreCommon/EnumsLib/eImageType.cs index cfe5e42a77..952a04c3d9 100644 --- a/Ginger/GingerCoreCommon/EnumsLib/eImageType.cs +++ b/Ginger/GingerCoreCommon/EnumsLib/eImageType.cs @@ -354,6 +354,7 @@ public enum eImageType PlusSquare, DataTable, Robot, + Accessibility, #region Comparison Status Images Unchanged, diff --git a/Ginger/GingerCoreCommon/External/Configurations/AccessibilityConfiguration.cs b/Ginger/GingerCoreCommon/External/Configurations/AccessibilityConfiguration.cs index fb647b50de..5a32e4100b 100644 --- a/Ginger/GingerCoreCommon/External/Configurations/AccessibilityConfiguration.cs +++ b/Ginger/GingerCoreCommon/External/Configurations/AccessibilityConfiguration.cs @@ -1,4 +1,4 @@ -#region License +#region License /* Copyright © 2014-2024 European Support Limited @@ -29,231 +29,25 @@ namespace Ginger.Configurations { public class AccessibilityConfiguration : RepositoryItemBase { - private string mStandard; - [IsSerializedForLocalRepository] - public string Standard - { - get - { - return mStandard; - } - set - { - if (mStandard != value) - { - mStandard = value; - OnPropertyChanged(nameof(Standard)); - } - } - } - - private ObservableList mDefaultRuleList; - - [IsSerializedForLocalRepository] - public ObservableList DefaultRuleList - { - get - { - return mDefaultRuleList; - } - set - { - if (value != mDefaultRuleList) - { - mDefaultRuleList = value; - OnPropertyChanged(nameof(DefaultRuleList)); - } - } - } - - - private string mSeverity; - [IsSerializedForLocalRepository] - public string Severity - { - get - { - return mSeverity; - } - set - { - if (mSeverity != value) - { - mSeverity = value; - OnPropertyChanged(nameof(Severity)); - } - } - } - - private Dictionary _items = new Dictionary(); - - public Dictionary Items - { - get - { - return _items; - } - set - { - _items = value; - - } - } - - private ObservableList mOperationValueList; - [IsSerializedForLocalRepository] - public ObservableList OperationValueList - { - get - { - return mOperationValueList; - } - set - { - if (value != mOperationValueList) - { - mOperationValueList = value; - OnPropertyChanged(nameof(OperationValueList)); - } - } - } - - private Dictionary _SeverityItems = new Dictionary(); - - public Dictionary SeverityItems - { - get - { - return _SeverityItems; - } - set - { - _SeverityItems = value; - - } - } + public override string ItemName { get => throw new System.NotImplementedException(); set => throw new System.NotImplementedException(); } - private ObservableList mSeverityOperationValueList; + string mDefaultExcludeRules; [IsSerializedForLocalRepository] - public ObservableList SeverityOperationValueList + public string DefaultExcludeRules { get { - return mSeverityOperationValueList; + return mDefaultExcludeRules; } set { - if (value != mSeverityOperationValueList) + if (mDefaultExcludeRules != value) { - mSeverityOperationValueList = value; - OnPropertyChanged(nameof(SeverityOperationValueList)); + mDefaultExcludeRules = value; + OnPropertyChanged(nameof(DefaultExcludeRules)); } } } - - - public override string ItemName { get => throw new System.NotImplementedException(); set => throw new System.NotImplementedException(); } - - public ObservableList GetAccessibilityRules() - { - ObservableList accessibilityRules = new ObservableList(); - accessibilityRules.Add( new AccessibilityRuleData { Active = false, RuleID = "area-alt", Description = "Ensures elements of image maps have alternate text", Impact = "Critical", Tags = "wcag2a" ,ACTRules = "c487ae"}); - accessibilityRules.Add( new AccessibilityRuleData { Active = false, RuleID = "aria-allowed-attr", Description = "Ensures an element's role supports its ARIA attributes", Impact = "Critical", Tags = "wcag2a" ,ACTRules = "5c01ea"}); - accessibilityRules.Add( new AccessibilityRuleData { Active = false, RuleID = "aria-braille-equivalent", Description = "Ensure aria-braillelabel and aria-brailleroledescription have a non-braille equivalent", Impact = "Serious", Tags = "wcag2a" ,ACTRules = ""}); - accessibilityRules.Add( new AccessibilityRuleData { Active = false, RuleID = "aria-command-name", Description = "Ensures every ARIA button, link and menuitem has an accessible name", Impact = "Serious", Tags = "wcag2a" ,ACTRules = "97a4e1"}); - accessibilityRules.Add( new AccessibilityRuleData { Active = false, RuleID = "aria-conditional-attr", Description = "Ensures ARIA attributes are used as described in the specification of the element's role", Impact = "Serious", Tags = "wcag2a" ,ACTRules = "5c01ea"}); - accessibilityRules.Add( new AccessibilityRuleData { Active = false, RuleID = "aria-deprecated-role", Description = "Ensures elements do not use deprecated roles", Impact = "Minor", Tags = "wcag2a" ,ACTRules = "674b10"}); - accessibilityRules.Add( new AccessibilityRuleData { Active = false, RuleID = "aria-hidden-body", Description = "Ensures aria-hidden = true is not present on the document body.", Impact = "Critical", Tags = "wcag2a" ,ACTRules = ""}); - accessibilityRules.Add( new AccessibilityRuleData { Active = false, RuleID = "aria-hidden-focus", Description = "Ensures aria-hidden elements are not focusable nor contain focusable elements", Impact = "Serious", Tags = "wcag2a" ,ACTRules = "6cfa84"}); - accessibilityRules.Add( new AccessibilityRuleData { Active = false, RuleID = "aria-input-field-name", Description = "Ensures every ARIA input field has an accessible name", Impact = "Serious", Tags = "wcag2a" ,ACTRules = "e086e5"}); - accessibilityRules.Add( new AccessibilityRuleData { Active = false, RuleID = "aria-meter-name", Description = "Ensures every ARIA meter node has an accessible name", Impact = "Serious", Tags = "wcag2a" ,ACTRules = ""}); - accessibilityRules.Add( new AccessibilityRuleData { Active = false, RuleID = "aria-progressbar-name", Description = "Ensures every ARIA progressbar node has an accessible name", Impact = "Serious", Tags = "wcag2a" ,ACTRules = ""}); - accessibilityRules.Add( new AccessibilityRuleData { Active = false, RuleID = "aria-prohibited-attr", Description = "Ensures ARIA attributes are not prohibited for an element's role", Impact = "Serious", Tags = "wcag2a" ,ACTRules = "5c01ea"}); - accessibilityRules.Add( new AccessibilityRuleData { Active = false, RuleID = "aria-required-attr", Description = "Ensures elements with ARIA roles have all required ARIA attributes", Impact = "Critical", Tags = "wcag2a" ,ACTRules = "4e8ab6"}); - accessibilityRules.Add( new AccessibilityRuleData { Active = false, RuleID = "aria-required-children", Description = "Ensures elements with an ARIA role that require child roles contain them", Impact = "Critical", Tags = "wcag2a" ,ACTRules = "bc4a75, ff89c9"}); - accessibilityRules.Add( new AccessibilityRuleData { Active = false, RuleID = "aria-required-parent", Description = "Ensures elements with an ARIA role that require parent roles are contained by them", Impact = "Critical", Tags = "wcag2a" ,ACTRules = "ff89c9"}); - accessibilityRules.Add( new AccessibilityRuleData { Active = false, RuleID = "aria-roles", Description = "Ensures all elements with a role attribute use a valid value", Impact = "Critical", Tags = "wcag2a" ,ACTRules = "674b10"}); - accessibilityRules.Add( new AccessibilityRuleData { Active = false, RuleID = "aria-toggle-field-name", Description = "Ensures every ARIA toggle field has an accessible name", Impact = "Serious", Tags = "wcag2a" ,ACTRules = "e086e5"}); - accessibilityRules.Add( new AccessibilityRuleData { Active = false, RuleID = "aria-tooltip-name", Description = "Ensures every ARIA tooltip node has an accessible name", Impact = "Serious", Tags = "wcag2a" ,ACTRules = ""}); - accessibilityRules.Add( new AccessibilityRuleData { Active = false, RuleID = "aria-valid-attr-value", Description = "Ensures all ARIA attributes have valid values", Impact = "Critical", Tags = "wcag2a" ,ACTRules = "6a7281"}); - accessibilityRules.Add( new AccessibilityRuleData { Active = false, RuleID = "aria-valid-attr", Description = "Ensures attributes that begin with aria- are valid ARIA attributes", Impact = "Critical", Tags = "wcag2a" ,ACTRules = "5f99a7"}); - accessibilityRules.Add( new AccessibilityRuleData { Active = false, RuleID = "blink", Description = "Ensures elements are not used", Impact = "Serious", Tags = "wcag2a" ,ACTRules = ""}); - accessibilityRules.Add( new AccessibilityRuleData { Active = false, RuleID = "button-name", Description = "Ensures buttons have discernible text", Impact = "Critical", Tags = "wcag2a" ,ACTRules = "97a4e1, m6b1q3"}); - accessibilityRules.Add( new AccessibilityRuleData { Active = false, RuleID = "bypass", Description = "Ensures each page has at least one mechanism for a user to bypass navigation and jump straight to the content", Impact = "Serious", Tags = "wcag2a" ,ACTRules = "cf77f2, 047fe0, b40fd1, 3e12e1, ye5d6e"}); - accessibilityRules.Add( new AccessibilityRuleData { Active = false, RuleID = "color-contrast", Description = "Ensures the contrast between foreground and background colors meets WCAG 2 AA minimum contrast ratio thresholds", Impact = "Serious", Tags = "wcag2aa" ,ACTRules = "afw4f7, 09o5cg"}); - accessibilityRules.Add( new AccessibilityRuleData { Active = false, RuleID = "definition-list", Description = "Ensures
elements are structured correctly", Impact = "Serious", Tags = "wcag2a" ,ACTRules = ""}); - accessibilityRules.Add( new AccessibilityRuleData { Active = false, RuleID = "dlitem", Description = "Ensures
and
elements are contained by a
", Impact = "Serious", Tags = "wcag2a" ,ACTRules = ""}); - accessibilityRules.Add( new AccessibilityRuleData { Active = false, RuleID = "document-title", Description = "Ensures each HTML document contains a non-empty element", Impact = "Serious", Tags = "wcag2a" ,ACTRules = "2779a5"}); - accessibilityRules.Add( new AccessibilityRuleData { Active = false, RuleID = "duplicate-id-aria", Description = "Ensures every id attribute value used in ARIA and in labels is unique", Impact = "Critical", Tags = "wcag2a" ,ACTRules = "3ea0c8"}); - accessibilityRules.Add( new AccessibilityRuleData { Active = false, RuleID = "form-field-multiple-labels", Description = "Ensures form field does not have multiple label elements", Impact = "Moderate", Tags = "wcag2a" ,ACTRules = ""}); - accessibilityRules.Add( new AccessibilityRuleData { Active = false, RuleID = "frame-focusable-content", Description = "Ensures <frame> and <iframe> elements with focusable content do not have tabindex=-1", Impact = "Serious", Tags = "wcag2a" ,ACTRules = "akn7bn"}); - accessibilityRules.Add( new AccessibilityRuleData { Active = false, RuleID = "frame-title-unique", Description = "Ensures <iframe> and <frame> elements contain a unique title attribute", Impact = "Serious", Tags = "wcag2a" ,ACTRules = "4b1c6c"}); - accessibilityRules.Add( new AccessibilityRuleData { Active = false, RuleID = "frame-title", Description = "Ensures <iframe> and <frame> elements have an accessible name", Impact = "Serious", Tags = "wcag2a" ,ACTRules = "cae760"}); - accessibilityRules.Add( new AccessibilityRuleData { Active = false, RuleID = "html-has-lang", Description = "Ensures every HTML document has a lang attribute", Impact = "Serious", Tags = "wcag2a" ,ACTRules = "b5c3f8"}); - accessibilityRules.Add( new AccessibilityRuleData { Active = false, RuleID = "html-lang-valid", Description = "Ensures the lang attribute of the <html> element has a valid value", Impact = "Serious", Tags = "wcag2a" ,ACTRules = "bf051a"}); - accessibilityRules.Add( new AccessibilityRuleData { Active = false, RuleID = "html-xml-lang-mismatch", Description = "Ensure that HTML elements with both valid lang and xml:lang attributes agree on the base language of the page", Impact = "Moderate", Tags = "wcag2a" ,ACTRules = "5b7ae0"}); - accessibilityRules.Add( new AccessibilityRuleData { Active = false, RuleID = "image-alt", Description = "Ensures <img> elements have alternate text or a role of none or presentation", Impact = "Critical", Tags = "wcag2a" ,ACTRules = "23a2a8"}); - accessibilityRules.Add( new AccessibilityRuleData { Active = false, RuleID = "input-button-name", Description = "Ensures input buttons have discernible text", Impact = "Critical", Tags = "wcag2a" ,ACTRules = "97a4e1"}); - accessibilityRules.Add( new AccessibilityRuleData { Active = false, RuleID = "input-image-alt", Description = "Ensures < input type = image > elements have alternate text", Impact = "Critical", Tags = "wcag2a" ,ACTRules = "59796f"}); - accessibilityRules.Add( new AccessibilityRuleData { Active = false, RuleID = "label", Description = "Ensures every form element has a label", Impact = "Critical", Tags = "wcag2a" ,ACTRules = "e086e5"}); - accessibilityRules.Add( new AccessibilityRuleData { Active = false, RuleID = "link-in-text-block", Description = "Ensure links are distinguished from surrounding text in a way that does not rely on color", Impact = "Serious", Tags = "wcag2a" ,ACTRules = ""}); - accessibilityRules.Add( new AccessibilityRuleData { Active = false, RuleID = "link-name", Description = "Ensures links have discernible text", Impact = "Serious", Tags = "wcag2a" ,ACTRules = "c487ae"}); - accessibilityRules.Add( new AccessibilityRuleData { Active = false, RuleID = "list", Description = "Ensures that lists are structured correctly", Impact = "Serious", Tags = "wcag2a" ,ACTRules = ""}); - accessibilityRules.Add( new AccessibilityRuleData { Active = false, RuleID = "listitem", Description = "Ensures <li> elements are used semantically", Impact = "Serious", Tags = "wcag2a" ,ACTRules = ""}); - accessibilityRules.Add( new AccessibilityRuleData { Active = false, RuleID = "marquee", Description = "Ensures <marquee> elements are not used", Impact = "Serious", Tags = "wcag2a" ,ACTRules = ""}); - accessibilityRules.Add( new AccessibilityRuleData { Active = false, RuleID = "meta-refresh", Description = "Ensures < meta http - equiv = refresh > is not used for delayed refresh", Impact = "Critical", Tags = "wcag2a", ACTRules = "bc659a, bisz58"}); - accessibilityRules.Add( new AccessibilityRuleData { Active = false, RuleID = "meta-viewport", Description = "Ensures < meta name = viewport > does not disable text scaling and zooming", Impact = "Critical", Tags = "wcag2aa" ,ACTRules = "b4f0c3"}); - accessibilityRules.Add( new AccessibilityRuleData { Active = false, RuleID = "nested-interactive", Description = "Ensures interactive controls are not nested as they are not always announced by screen readers or can cause focus problems for assistive technologies", Impact = "Serious", Tags = "wcag2a" ,ACTRules = "307n5z"}); - accessibilityRules.Add( new AccessibilityRuleData { Active = false, RuleID = "no-autoplay-audio", Description = "Ensures <video> or <audio> elements do not autoplay audio for more than 3 seconds without a control mechanism to stop or mute the audio", Impact = "Moderate", Tags = "wcag2a" ,ACTRules = "80f0bf"}); - accessibilityRules.Add( new AccessibilityRuleData { Active = false, RuleID = "object-alt", Description = "Ensures <object> elements have alternate text", Impact = "Serious", Tags = "wcag2a" ,ACTRules = "8fc3b6"}); - accessibilityRules.Add( new AccessibilityRuleData { Active = false, RuleID = "role-img-alt", Description = "Ensures[role = img] elements have alternate text", Impact = "Serious", Tags = "wcag2a" ,ACTRules = "23a2a8"}); - accessibilityRules.Add( new AccessibilityRuleData { Active = false, RuleID = "scrollable-region-focusable", Description = "Ensure elements that have scrollable content are accessible by keyboard", Impact = "Serious", Tags = "wcag2a" ,ACTRules = "0ssw9k"}); - accessibilityRules.Add( new AccessibilityRuleData { Active = false, RuleID = "select-name", Description = "Ensures select element has an accessible name", Impact = "Critical", Tags = "wcag2a" ,ACTRules = "e086e5"}); - accessibilityRules.Add( new AccessibilityRuleData { Active = false, RuleID = "server-side-image-map", Description = "Ensures that server-side image maps are not used", Impact = "Minor", Tags = "wcag2a" ,ACTRules = ""}); - accessibilityRules.Add( new AccessibilityRuleData { Active = false, RuleID = "svg-img-alt", Description = "Ensures <svg> elements with an img, graphics-document or graphics-symbol role have an accessible text", Impact = "Serious", Tags = "wcag2a" ,ACTRules = "7d6734"}); - accessibilityRules.Add( new AccessibilityRuleData { Active = false, RuleID = "td-headers-attr", Description = "Ensure that each cell in a table that uses the headers attribute refers only to other cells in that table", Impact = "Serious", Tags = "wcag2a" ,ACTRules = "a25f45"}); - accessibilityRules.Add( new AccessibilityRuleData { Active = false, RuleID = "th-has-data-cells", Description = "Ensure that <th> elements and elements with role=columnheader/rowheader have data cells they describe", Impact = "Serious", Tags = "wcag2a" ,ACTRules = "d0f69e"}); - accessibilityRules.Add( new AccessibilityRuleData { Active = false, RuleID = "valid-lang", Description = "Ensures lang attributes have valid values", Impact = "Serious", Tags = "wcag2aa" ,ACTRules = "de46e4"}); - accessibilityRules.Add( new AccessibilityRuleData { Active = false, RuleID = "video-caption", Description = "Ensures <video> elements have captions", Impact = "Critical", Tags = "wcag2a" ,ACTRules = "eac66b"}); - accessibilityRules.Add( new AccessibilityRuleData { Active = false, RuleID = "autocomplete-valid", Description = "Ensure the autocomplete attribute is correct and suitable for the form field", Impact = "Serious", Tags = "wcag21aa" ,ACTRules = "73f2c2"}); - accessibilityRules.Add( new AccessibilityRuleData { Active = false, RuleID = "avoid-inline-spacing", Description = "Ensure that text spacing set through style attributes can be adjusted with custom stylesheets", Impact = "Serious", Tags = "wcag21aa" ,ACTRules = "24afc2, 9e45ec, 78fd32"}); - accessibilityRules.Add( new AccessibilityRuleData { Active = false, RuleID = "target-size", Description = "Ensure touch target have sufficient size and space", Impact = "Serious", Tags = "wcag22aa" ,ACTRules = ""}); - accessibilityRules.Add( new AccessibilityRuleData { Active = false, RuleID = "accesskeys", Description = "Ensures every accesskey attribute value is unique", Impact = "Serious", Tags = "bestpractice" ,ACTRules = ""}); - accessibilityRules.Add( new AccessibilityRuleData { Active = false, RuleID = "aria-allowed-role", Description = "Ensures role attribute has an appropriate value for the element", Impact = "Minor", Tags = "bestpractice" ,ACTRules = ""}); - accessibilityRules.Add( new AccessibilityRuleData { Active = false, RuleID = "aria-dialog-name", Description = "Ensures every ARIA dialog and alertdialog node has an accessible name", Impact = "Serious", Tags = "bestpractice" ,ACTRules = ""}); - accessibilityRules.Add( new AccessibilityRuleData { Active = false, RuleID = "aria-text", Description = "Ensures role = text is used on elements with no focusable descendants", Impact = "Serious", Tags = "bestpractice" ,ACTRules = ""}); - accessibilityRules.Add( new AccessibilityRuleData { Active = false, RuleID = "aria-treeitem-name", Description = "Ensures every ARIA treeitem node has an accessible name", Impact = "Serious", Tags = "bestpractice" ,ACTRules = ""}); - accessibilityRules.Add( new AccessibilityRuleData { Active = false, RuleID = "empty-heading", Description = "Ensures headings have discernible text", Impact = "Minor", Tags = "bestpractice" ,ACTRules = "ffd0e9"}); - accessibilityRules.Add( new AccessibilityRuleData { Active = false, RuleID = "empty-table-header", Description = "Ensures table headers have discernible text", Impact = "Minor", Tags = "bestpractice" ,ACTRules = ""}); - accessibilityRules.Add( new AccessibilityRuleData { Active = false, RuleID = "frame-tested", Description = "Ensures <iframe> and <frame> elements contain the axe-core script", Impact = "Critical", Tags = "bestpractice" ,ACTRules = ""}); - accessibilityRules.Add( new AccessibilityRuleData { Active = false, RuleID = "heading-order", Description = "Ensures the order of headings is semantically correct", Impact = "Moderate", Tags = "bestpractice" ,ACTRules = ""}); - accessibilityRules.Add( new AccessibilityRuleData { Active = false, RuleID = "image-redundant-alt", Description = "Ensure image alternative is not repeated as text", Impact = "Minor", Tags = "bestpractice" ,ACTRules = ""}); - accessibilityRules.Add( new AccessibilityRuleData { Active = false, RuleID = "label-title-only", Description = "Ensures that every form element has a visible label and is not solely labeled using hidden labels, or the title or aria-describedby attributes", Impact = "Serious", Tags = "bestpractice" ,ACTRules = ""}); - accessibilityRules.Add( new AccessibilityRuleData { Active = false, RuleID = "landmark-banner-is-top-level", Description = "Ensures the banner landmark is at top level", Impact = "Moderate", Tags = "bestpractice" ,ACTRules = ""}); - accessibilityRules.Add( new AccessibilityRuleData { Active = false, RuleID = "landmark-complementary-is-top-level", Description = "Ensures the complementary landmark or aside is at top level", Impact = "Moderate", Tags = "bestpractice" ,ACTRules = ""}); - accessibilityRules.Add( new AccessibilityRuleData { Active = false, RuleID = "landmark-contentinfo-is-top-level", Description = "Ensures the contentinfo landmark is at top level", Impact = "Moderate", Tags = "bestpractice" ,ACTRules = ""}); - accessibilityRules.Add( new AccessibilityRuleData { Active = false, RuleID = "landmark-main-is-top-level", Description = "Ensures the main landmark is at top level", Impact = "Moderate", Tags = "bestpractice" ,ACTRules = ""}); - accessibilityRules.Add( new AccessibilityRuleData { Active = false, RuleID = "landmark-no-duplicate-banner", Description = "Ensures the document has at most one banner landmark", Impact = "Moderate", Tags = "bestpractice" ,ACTRules = ""}); - accessibilityRules.Add( new AccessibilityRuleData { Active = false, RuleID = "landmark-no-duplicate-contentinfo", Description = "Ensures the document has at most one contentinfo landmark", Impact = "Moderate", Tags = "bestpractice" ,ACTRules = ""}); - accessibilityRules.Add( new AccessibilityRuleData { Active = false, RuleID = "landmark-no-duplicate-main", Description = "Ensures the document has at most one main landmark", Impact = "Moderate", Tags = "bestpractice" ,ACTRules = ""}); - accessibilityRules.Add( new AccessibilityRuleData { Active = false, RuleID = "landmark-one-main", Description = "Ensures the document has a main landmark", Impact = "Moderate", Tags = "bestpractice" ,ACTRules = ""}); - accessibilityRules.Add( new AccessibilityRuleData { Active = false, RuleID = "landmark-unique", Description = "Landmarks should have a unique role or role/label/title (i.e. accessible name) combination", Impact = "Moderate", Tags = "bestpractice" ,ACTRules = ""}); - accessibilityRules.Add( new AccessibilityRuleData { Active = false, RuleID = "meta-viewport-large", Description = "Ensures < meta name = viewport > can scale a significant amount", Impact = "Minor", Tags = "bestpractice" ,ACTRules = ""}); - accessibilityRules.Add( new AccessibilityRuleData { Active = false, RuleID = "page-has-heading-one", Description = "Ensure that the page, or at least one of its frames contains a level-one heading", Impact = "Moderate", Tags = "bestpractice" ,ACTRules = ""}); - accessibilityRules.Add( new AccessibilityRuleData { Active = false, RuleID = "presentation-role-conflict", Description = "Elements marked as presentational should not have global ARIA or tabindex to ensure all screen readers ignore them", Impact = "Minor", Tags = "bestpractice" ,ACTRules = "46ca7f"}); - accessibilityRules.Add( new AccessibilityRuleData { Active = false, RuleID = "region", Description = "Ensures all page content is contained by landmarks", Impact = "Moderate", Tags = "bestpractice" ,ACTRules = ""}); - accessibilityRules.Add( new AccessibilityRuleData { Active = false, RuleID = "scope-attr-valid", Description = "Ensures the scope attribute is used correctly on tables", Impact = "Moderate", Tags = "bestpractice" ,ACTRules = ""}); - accessibilityRules.Add( new AccessibilityRuleData { Active = false, RuleID = "skip-link", Description = "Ensure all skip links have a focusable target", Impact = "Moderate", Tags = "bestpractice" ,ACTRules = ""}); - accessibilityRules.Add( new AccessibilityRuleData { Active = false, RuleID = "tabindex", Description = "Ensures tabindex attribute values are not greater than 0", Impact = "Serious", Tags = "bestpractice" ,ACTRules = ""}); - accessibilityRules.Add( new AccessibilityRuleData { Active = false, RuleID = "table-duplicate-name", Description = "Ensure the <caption> element does not contain the same text as the summary attribute", Impact = "Minor", Tags = "bestpractice" ,ACTRules = ""}); - accessibilityRules.Add( new AccessibilityRuleData { Active = false, RuleID = "color-contrast-enhanced", Description = "Ensures the contrast between foreground and background colors meets WCAG 2 AAA enhanced contrast ratio thresholds", Impact = "Serious", Tags = "wcag2aaa" ,ACTRules = "09o5cg"}); - accessibilityRules.Add( new AccessibilityRuleData { Active = false, RuleID = "identical-links-same-purpose", Description = "Ensure that links with the same accessible name serve a similar purpose", Impact = "Minor", Tags = "wcag2aaa" ,ACTRules = "b20e66"}); - accessibilityRules.Add( new AccessibilityRuleData { Active = false, RuleID = "meta-refresh-no-exceptions", Description = "Ensures < meta http - equiv = refresh > is not used for delayed refresh", Impact = "Minor", Tags = "wcag2aaa", ACTRules = "bisz58"}); - return accessibilityRules; - } - - - } } diff --git a/Ginger/GingerCoreCommon/External/Configurations/AccessibilityRuleData.cs b/Ginger/GingerCoreCommon/External/Configurations/AccessibilityRuleData.cs index 7124dd375b..db2f2bbca3 100644 --- a/Ginger/GingerCoreCommon/External/Configurations/AccessibilityRuleData.cs +++ b/Ginger/GingerCoreCommon/External/Configurations/AccessibilityRuleData.cs @@ -1,4 +1,4 @@ -#region License +#region License /* Copyright © 2014-2024 European Support Limited @@ -22,7 +22,9 @@ limitations under the License. using System.Linq; using System.Text; using System.Threading.Tasks; +using Amdocs.Ginger.Common; using Amdocs.Ginger.Repository; +using Newtonsoft.Json; namespace Ginger.Configurations { @@ -35,21 +37,20 @@ public class AccessibilityRuleData : RepositoryItemBase, INotifyPropertyChanged /// <summary> /// Gets or sets the Active associated with the accessibility rule. /// </summary> - [IsSerializedForLocalRepository] public bool Active { get { return mActive; } set { if (mActive != value) { mActive = value; OnPropertyChanged(nameof(Active)); } } } private string mRuleID; /// <summary> /// Gets or sets the Rule Id associated with the accessibility rule. /// </summary> - [IsSerializedForLocalRepository] + public string RuleID { get { return mRuleID; } set { if (mRuleID != value) { mRuleID = value; OnPropertyChanged(nameof(RuleID)); } } } private string mTags; /// <summary> /// Gets or sets the tags associated with the accessibility rule. /// </summary> - [IsSerializedForLocalRepository] + public string Tags { get { return mTags; } set { if (mTags != value) { mTags = value; OnPropertyChanged(nameof(Tags)); } } } private string mImpact; @@ -62,10 +63,22 @@ public class AccessibilityRuleData : RepositoryItemBase, INotifyPropertyChanged public string ACTRules { get { return mACTRules; } set { if (mACTRules != value) { mACTRules = value; OnPropertyChanged(nameof(ACTRules)); } } } public override string ItemName { get; set; } + public ObservableList<AccessibilityRuleData> GetAccessibilityRules(string AccessbiltyString) + { + ObservableList<AccessibilityRuleData> accessibilityRules = new ObservableList<AccessibilityRuleData>(); + Root data = JsonConvert.DeserializeObject<Root>(AccessbiltyString); + return data.accessibilityRules; + } + public void OnPropertyChanged(string name) { PropertyChanged?.Invoke(this, new PropertyChangedEventArgs(name)); } } + + public class Root + { + public ObservableList<AccessibilityRuleData> accessibilityRules { get; set; } + } } diff --git a/Ginger/GingerCoreCommon/WorkSpaceLib/Solution.cs b/Ginger/GingerCoreCommon/WorkSpaceLib/Solution.cs index 4f8e8ddeb9..161cdaa844 100644 --- a/Ginger/GingerCoreCommon/WorkSpaceLib/Solution.cs +++ b/Ginger/GingerCoreCommon/WorkSpaceLib/Solution.cs @@ -51,9 +51,10 @@ public class Solution : RepositoryItemBase, ISolution public Solution() { Tags = new ObservableList<RepositoryItemTag>(); + DefaultExcludeRule = new AccessibilityConfiguration(); } - public enum eSolutionItemToSave { GeneralDetails, TargetApplications, GlobalVariabels, Tags, ALMSettings, SourceControlSettings, LoggerConfiguration, ReportConfiguration } + public enum eSolutionItemToSave { GeneralDetails, TargetApplications, GlobalVariabels, Tags, ALMSettings, SourceControlSettings, LoggerConfiguration, ReportConfiguration, DefaultExcludeRule } string mName; [IsSerializedForLocalRepository] @@ -78,6 +79,27 @@ public string Name [IsSerializedForLocalRepository] public ObservableList<RepositoryItemTag> Tags; + + private AccessibilityConfiguration mDefaultExcludeRule; + + [IsSerializedForLocalRepository] + public AccessibilityConfiguration DefaultExcludeRule + { + get + { + return mDefaultExcludeRule; + } + set + { + if (mDefaultExcludeRule != value) + { + mDefaultExcludeRule = value; + OnPropertyChanged(nameof(DefaultExcludeRule)); + } + } + } + + private string mAccount; /// <summary> diff --git a/Ginger/GingerCoreNET/ActionsLib/UI/Web/ActAccessibilityTesting.cs b/Ginger/GingerCoreNET/ActionsLib/UI/Web/ActAccessibilityTesting.cs index c1fcf65ae2..ec3bb39297 100644 --- a/Ginger/GingerCoreNET/ActionsLib/UI/Web/ActAccessibilityTesting.cs +++ b/Ginger/GingerCoreNET/ActionsLib/UI/Web/ActAccessibilityTesting.cs @@ -32,6 +32,7 @@ limitations under the License. using GingerCore.Platforms; using GingerCoreNET.SolutionRepositoryLib.RepositoryObjectsLib.PlatformsLib; using HtmlAgilityPack; +using Microsoft.VisualStudio.Services.Common; using Newtonsoft.Json; using OpenQA.Selenium; using System; @@ -303,11 +304,24 @@ public ObservableList<AccessibilityRuleData> RulesItemsdata public ObservableList<AccessibilityRuleData> GetRuleList() { - AccessibilityConfiguration accessibilityConfiguration = new(); - ObservableList<AccessibilityRuleData> ruleDatalist = []; + AccessibilityRuleData AccessibilityRuleDataObjet = new AccessibilityRuleData(); + List<string> DefaultExcludeRuleList = WorkSpace.Instance.Solution != null && WorkSpace.Instance.Solution.DefaultExcludeRule.DefaultExcludeRules != null ? WorkSpace.Instance.Solution.DefaultExcludeRule.DefaultExcludeRules.Split(',').ToList() : new(); + ObservableList<AccessibilityRuleData> ruleDatalist = new ObservableList<AccessibilityRuleData>(); try { - ruleDatalist = accessibilityConfiguration.GetAccessibilityRules(); + string AccessbiltyString = GetAccessiblityrules(); + ruleDatalist = AccessibilityRuleDataObjet.GetAccessibilityRules(AccessbiltyString); + foreach (AccessibilityRuleData ruleData in ruleDatalist) + { + if (DefaultExcludeRuleList != null && DefaultExcludeRuleList.Contains(ruleData.RuleID)) + { + ruleData.Active = false; + } + else + { + ruleData.Active = true; + } + } } catch (Exception ex) { @@ -356,6 +370,11 @@ public enum ReportTypes All = 15 } + private static string GetAccessiblityrules() + { + return EmbeddedResourceProvider.ReadEmbeddedFile("AccessiblityRules.json"); + } + public void CreateAxeHtmlReport(ISearchContext context, AxeResult results, string destination, ReportTypes requestedResults) { // Get the unwrapped element if we are using a wrapped element @@ -733,7 +752,7 @@ public void AnalyzerAccessibility(IWebDriver Driver,IWebElement element) string path = String.Empty; - if (WorkSpace.Instance.Solution.LoggerConfigurations.CalculatedLoggerFolder != null) + if (WorkSpace.Instance.Solution != null && WorkSpace.Instance.Solution.LoggerConfigurations.CalculatedLoggerFolder != null) { string folderPath = Path.Combine(WorkSpace.Instance.Solution.LoggerConfigurations.CalculatedLoggerFolder, @"AccessibilityReport"); if (!Directory.Exists(folderPath)) @@ -743,12 +762,10 @@ public void AnalyzerAccessibility(IWebDriver Driver,IWebElement element) string DatetimeFormate = DateTime.Now.ToString("ddMMyyyy_HHmmssfff"); string reportname = $"{ItemName}_AccessibilityReport_{DatetimeFormate}.html"; path = $"{folderPath}{Path.DirectorySeparatorChar}{reportname}"; - Act.AddArtifactToAction(Path.GetFileName(path), this, path); + Act.AddArtifactToAction(Path.GetFileName(path), this, path); + CreateAxeHtmlReport(Driver, axeResult, path, ActAccessibilityTesting.ReportTypes.All); + AddOrUpdateReturnParamActual(ParamName: "Accessibility report", ActualValue: path); } - - CreateAxeHtmlReport(Driver, axeResult, path, ActAccessibilityTesting.ReportTypes.All); - AddOrUpdateReturnParamActual(ParamName: "Accessibility report", ActualValue: path); - SetAxeResultToAction(axeResult); } catch (Exception ex) @@ -761,6 +778,7 @@ public void AnalyzerAccessibility(IWebDriver Driver,IWebElement element) public AxeBuilder CreateAxeBuilder(IWebDriver Driver) { + ObservableList<AccessibilityRuleData> RuleData = RulesItemsdata; AxeBuilder axeBuilder = null; List<string> sevritylist = null; axeBuilder = new AxeBuilder(Driver) @@ -769,15 +787,16 @@ public AxeBuilder CreateAxeBuilder(IWebDriver Driver) XPath = true }); - - if (GetInputParamValue(ActAccessibilityTesting.Fields.Analyzer) == ActAccessibilityTesting.eAnalyzer.ByStandard.ToString()) + //Active field is for configuration page rules which are Active needs to Exclude in Analysis + string[] ExcludeRules = RuleData.Where(x => !x.Active).Select(i => i.RuleID.ToString()).ToArray(); + if (GetInputParamValue(ActAccessibilityTesting.Fields.Analyzer) == nameof(ActAccessibilityTesting.eAnalyzer.ByStandard)) { if (StandardList != null && StandardList.Any()) { string[] Tag_array = StandardList.Select(i => i.Value.ToString()).ToArray(); - for(int i=0;i<Tag_array.Length;i++) + for (int i = 0; i < Tag_array.Length; i++) { - if (Tag_array[i].Equals("bestpractice",StringComparison.OrdinalIgnoreCase)) + if (Tag_array[i].Equals("bestpractice", StringComparison.OrdinalIgnoreCase)) { Tag_array[i] = "best-practice"; } @@ -790,53 +809,57 @@ public AxeBuilder CreateAxeBuilder(IWebDriver Driver) Error = "Standard list is empty or not set."; return axeBuilder; } + if (SeverityList != null && SeverityList.Any()) { sevritylist = SeverityList.Select(x => x.Value.ToLower()).ToList(); - string[] ExcludeRules = RulesItemsdata.Where(x => sevritylist.Contains(x.Impact.ToLower())).Select(i => i.RuleID.ToString()).ToArray(); - if (ExcludeRules != null && ExcludeRules.Any()) - { - axeBuilder.DisableRules(ExcludeRules); - } + + string[] SeverityExcludeRules = RuleData.Where(x => !ExcludeRules.Contains(x.RuleID) && sevritylist.Contains(x.Impact.ToLower())).Select(i => i.RuleID.ToString()).ToArray(); + ExcludeRules = ExcludeRules.Concat(SeverityExcludeRules).ToArray(); + } + + if (ExcludeRules != null && ExcludeRules.Any()) + { + axeBuilder.DisableRules(ExcludeRules); } - } - else if (GetInputParamValue(ActAccessibilityTesting.Fields.Analyzer) == ActAccessibilityTesting.eAnalyzer.BySeverity.ToString()) + else if (GetInputParamValue(ActAccessibilityTesting.Fields.Analyzer) == nameof(ActAccessibilityTesting.eAnalyzer.BySeverity)) { if (SeverityList != null && SeverityList.Any()) { sevritylist = SeverityList.Select(x => x.Value.ToLower()).ToList(); - string[] IncludeRules = RulesItemsdata.Where(x => sevritylist.Contains(x.Impact.ToLower())).Select(i => i.RuleID.ToString()).ToArray(); - if (IncludeRules != null && IncludeRules.Any()) + string[] SevarityIncludeRules = RuleData.Where(x => !ExcludeRules.Contains(x.RuleID) && sevritylist.Contains(x.Impact.ToLower())).Select(i => i.RuleID.ToString()).ToArray(); + if (SevarityIncludeRules != null && SevarityIncludeRules.Any()) { - axeBuilder.WithRules(IncludeRules); + axeBuilder.WithRules(SevarityIncludeRules); } } - else if(SeverityList == null || !SeverityList.Any()) + else if (SeverityList == null || !SeverityList.Any()) { Status = eRunStatus.Failed; Error = "Severity list is empty or not set."; return axeBuilder; } + + } return axeBuilder; } - public void SetAxeResultToAction(AxeResult axeResult) { bool hasAnyViolations = axeResult.Violations.Any(); bool ActionResult = true; IEnumerable<string> AcceptableSeverity = Enumerable.Empty<string>().ToList(); IEnumerable<string> Violationseverity = Enumerable.Empty<string>().ToList(); - if (GetInputParamValue(ActAccessibilityTesting.Fields.Analyzer) == ActAccessibilityTesting.eAnalyzer.ByStandard.ToString() && SeverityList != null && SeverityList.Any()) + if (GetInputParamValue(ActAccessibilityTesting.Fields.Analyzer) == nameof(ActAccessibilityTesting.eAnalyzer.ByStandard) && SeverityList != null && SeverityList.Any()) { AcceptableSeverity = SeverityList.Select(x => x.Value.ToLower()).ToList(); Violationseverity = axeResult.Violations.Any() ? axeResult.Violations.Select(x => x.Impact.ToLower()) : Enumerable.Empty<string>().ToList(); ActionResult = Violationseverity.Intersect(AcceptableSeverity).Any(); } - else if (GetInputParamValue(ActAccessibilityTesting.Fields.Analyzer) == ActAccessibilityTesting.eAnalyzer.BySeverity.ToString() && SeverityList != null && SeverityList.Any()) + else if (GetInputParamValue(ActAccessibilityTesting.Fields.Analyzer) == nameof(ActAccessibilityTesting.eAnalyzer.BySeverity) && SeverityList != null && SeverityList.Any()) { List<string> sevritylist = SeverityList.Select(x => x.Value.ToLower()).ToList(); Violationseverity = axeResult.Violations.Any() ? axeResult.Violations.Select(x => x.Impact.ToLower()) : Enumerable.Empty<string>().ToList(); @@ -884,6 +907,8 @@ public void SetAxeResultToAction(AxeResult axeResult) Status = eRunStatus.Passed; } } + + } internal static class EmbeddedResourceProvider diff --git a/Ginger/GingerCoreNET/Drivers/CoreDrivers/Web/Selenium/AccessibilityTestResources/AccessiblityRules.json b/Ginger/GingerCoreNET/Drivers/CoreDrivers/Web/Selenium/AccessibilityTestResources/AccessiblityRules.json new file mode 100644 index 0000000000..58cad31aa0 --- /dev/null +++ b/Ginger/GingerCoreNET/Drivers/CoreDrivers/Web/Selenium/AccessibilityTestResources/AccessiblityRules.json @@ -0,0 +1,748 @@ +{ + "accessibilityRules": [ + { + "RuleID": "area-alt", + "Description": "Ensure <area> elements of image maps have alternate text", + "Impact": "Critical", + "Tags": "cat.text-alternatives, wcag2a, wcag244, wcag412, section508, section508.22.a, TTv5, TT6.a, EN-301-549, EN-9.2.4.4, EN-9.4.1.2, ACT", + "Issue Type": "failure, needs review", + "ACT Rules": "c487ae" + }, + { + "RuleID": "aria-allowed-attr", + "Description": "Ensure an element's role supports its ARIA attributes", + "Impact": "Critical", + "Tags": "cat.aria, wcag2a, wcag412, EN-301-549, EN-9.4.1.2", + "Issue Type": "failure, needs review", + "ACT Rules": "5c01ea" + }, + { + "RuleID": "aria-braille-equivalent", + "Description": "Ensure aria-braillelabel and aria-brailleroledescription have a non-braille equivalent", + "Impact": "Serious", + "Tags": "cat.aria, wcag2a, wcag412, EN-301-549, EN-9.4.1.2", + "Issue Type": "needs review", + "ACT Rules": "" + }, + { + "RuleID": "aria-command-name", + "Description": "Ensure every ARIA button, link and menuitem has an accessible name", + "Impact": "Serious", + "Tags": "cat.aria, wcag2a, wcag412, TTv5, TT6.a, EN-301-549, EN-9.4.1.2, ACT", + "Issue Type": "failure, needs review", + "ACT Rules": "97a4e1" + }, + { + "RuleID": "summary-name", + "Description": "Ensure summary elements have discernible text", + "Impact": "Serious", + "Tags": "cat.name-role-value, wcag2a, wcag412, section508, section508.22.a, TTv5, TT6.a, EN-301-549, EN-9.4.1.2", + "Issue Type": "failure, needs review", + "ACT Rules": "" + }, + { + "RuleID": "aria-conditional-attr", + "Description": "Ensure ARIA attributes are used as described in the specification of the element's role", + "Impact": "Serious", + "Tags": "cat.aria, wcag2a, wcag412, EN-301-549, EN-9.4.1.2", + "Issue Type": "failure", + "ACT Rules": "5c01ea" + }, + { + "RuleID": "aria-deprecated-role", + "Description": "Ensure elements do not use deprecated roles", + "Impact": "Minor", + "Tags": "cat.aria, wcag2a, wcag412, EN-301-549, EN-9.4.1.2", + "Issue Type": "failure", + "ACT Rules": "674b10" + }, + { + "RuleID": "aria-hidden-body", + "Description": "Ensure aria-hidden=\"\"true\"\" is not present on the document body.", + "Impact": "Critical", + "Tags": "cat.aria, wcag2a, wcag131, wcag412, EN-301-549, EN-9.1.3.1, EN-9.4.1.2", + "Issue Type": "failure", + "ACT Rules": "" + }, + { + "RuleID": "aria-hidden-focus", + "Description": "Ensure aria-hidden elements are not focusable nor contain focusable elements", + "Impact": "Serious", + "Tags": "cat.name-role-value, wcag2a, wcag412, TTv5, TT6.a, EN-301-549, EN-9.4.1.2", + "Issue Type": "failure, needs review", + "ACT Rules": "6cfa84" + }, + { + "RuleID": "aria-input-field-name", + "Description": "Ensure every ARIA input field has an accessible name", + "Impact": "Serious", + "Tags": "cat.aria, wcag2a, wcag412, TTv5, TT5.c, EN-301-549, EN-9.4.1.2, ACT", + "Issue Type": "failure, needs review", + "ACT Rules": "e086e5" + }, + { + "RuleID": "aria-meter-name", + "Description": "Ensure every ARIA meter node has an accessible name", + "Impact": "Serious", + "Tags": "cat.aria, wcag2a, wcag111, EN-301-549, EN-9.1.1.1", + "Issue Type": "failure, needs review", + "ACT Rules": "" + }, + { + "RuleID": "aria-progressbar-name", + "Description": "Ensure every ARIA progressbar node has an accessible name", + "Impact": "Serious", + "Tags": "cat.aria, wcag2a, wcag111, EN-301-549, EN-9.1.1.1", + "Issue Type": "failure, needs review", + "ACT Rules": "" + }, + { + "RuleID": "aria-prohibited-attr", + "Description": "Ensure ARIA attributes are not prohibited for an element's role", + "Impact": "Serious", + "Tags": "cat.aria, wcag2a, wcag412, EN-301-549, EN-9.4.1.2", + "Issue Type": "failure, needs review", + "ACT Rules": "5c01ea" + }, + { + "RuleID": "aria-required-attr", + "Description": "Ensure elements with ARIA roles have all required ARIA attributes", + "Impact": "Critical", + "Tags": "cat.aria, wcag2a, wcag412, EN-301-549, EN-9.4.1.2", + "Issue Type": "failure", + "ACT Rules": "4e8ab6" + }, + { + "RuleID": "aria-required-children", + "Description": "Ensure elements with an ARIA role that require child roles contain them", + "Impact": "Critical", + "Tags": "cat.aria, wcag2a, wcag131, EN-301-549, EN-9.1.3.1", + "Issue Type": "failure, needs review", + "ACT Rules": "bc4a75, ff89c9" + }, + { + "RuleID": "aria-required-parent", + "Description": "Ensure elements with an ARIA role that require parent roles are contained by them", + "Impact": "Critical", + "Tags": "cat.aria, wcag2a, wcag131, EN-301-549, EN-9.1.3.1", + "Issue Type": "failure", + "ACT Rules": "ff89c9" + }, + { + "RuleID": "aria-roles", + "Description": "Ensure all elements with a role attribute use a valid value", + "Impact": "Critical", + "Tags": "cat.aria, wcag2a, wcag412, EN-301-549, EN-9.4.1.2", + "Issue Type": "failure", + "ACT Rules": "674b10" + }, + { + "RuleID": "aria-toggle-field-name", + "Description": "Ensure every ARIA toggle field has an accessible name", + "Impact": "Serious", + "Tags": "cat.aria, wcag2a, wcag412, TTv5, TT5.c, EN-301-549, EN-9.4.1.2, ACT", + "Issue Type": "failure, needs review", + "ACT Rules": "e086e5" + }, + { + "RuleID": "aria-tooltip-name", + "Description": "Ensure every ARIA tooltip node has an accessible name", + "Impact": "Serious", + "Tags": "cat.aria, wcag2a, wcag412, EN-301-549, EN-9.4.1.2", + "Issue Type": "failure, needs review", + "ACT Rules": "" + }, + { + "RuleID": "aria-valid-attr-value", + "Description": "Ensure all ARIA attributes have valid values", + "Impact": "Critical", + "Tags": "cat.aria, wcag2a, wcag412, EN-301-549, EN-9.4.1.2", + "Issue Type": "failure, needs review", + "ACT Rules": "6a7281" + }, + { + "RuleID": "aria-valid-attr", + "Description": "Ensure attributes that begin with aria- are valid ARIA attributes", + "Impact": "Critical", + "Tags": "cat.aria, wcag2a, wcag412, EN-301-549, EN-9.4.1.2", + "Issue Type": "failure", + "ACT Rules": "5f99a7" + }, + { + "RuleID": "blink", + "Description": "Ensure <blink> elements are not used", + "Impact": "Serious", + "Tags": "cat.time-and-media, wcag2a, wcag222, section508, section508.22.j, TTv5, TT2.b, EN-301-549, EN-9.2.2.2", + "Issue Type": "failure", + "ACT Rules": "" + }, + { + "RuleID": "button-name", + "Description": "Ensure buttons have discernible text", + "Impact": "Critical", + "Tags": "cat.name-role-value, wcag2a, wcag412, section508, section508.22.a, TTv5, TT6.a, EN-301-549, EN-9.4.1.2, ACT", + "Issue Type": "failure, needs review", + "ACT Rules": "97a4e1, m6b1q3" + }, + { + "RuleID": "bypass", + "Description": "Ensure each page has at least one mechanism for a user to bypass navigation and jump straight to the content", + "Impact": "Serious", + "Tags": "cat.keyboard, wcag2a, wcag241, section508, section508.22.o, TTv5, TT9.a, EN-301-549, EN-9.2.4.1", + "Issue Type": "needs review", + "ACT Rules": "cf77f2, 047fe0, b40fd1, 3e12e1, ye5d6e" + }, + { + "RuleID": "color-contrast", + "Description": "Ensure the contrast between foreground and background colors meets WCAG 2 AA minimum contrast ratio thresholds", + "Impact": "Serious", + "Tags": "cat.color, wcag2aa, wcag143, TTv5, TT13.c, EN-301-549, EN-9.1.4.3, ACT", + "Issue Type": "failure, needs review", + "ACT Rules": "afw4f7, 09o5cg" + }, + { + "RuleID": "definition-list", + "Description": "Ensure <dl> elements are structured correctly", + "Impact": "Serious", + "Tags": "cat.structure, wcag2a, wcag131, EN-301-549, EN-9.1.3.1", + "Issue Type": "failure", + "ACT Rules": "" + }, + { + "RuleID": "dlitem", + "Description": "Ensure <dt> and <dd> elements are contained by a <dl>", + "Impact": "Serious", + "Tags": "cat.structure, wcag2a, wcag131, EN-301-549, EN-9.1.3.1", + "Issue Type": "failure", + "ACT Rules": "" + }, + { + "RuleID": "document-title", + "Description": "Ensure each HTML document contains a non-empty <title> element", + "Impact": "Serious", + "Tags": "cat.text-alternatives, wcag2a, wcag242, TTv5, TT12.a, EN-301-549, EN-9.2.4.2, ACT", + "Issue Type": "failure", + "ACT Rules": "2779a5" + }, + { + "RuleID": "duplicate-id-aria", + "Description": "Ensure every id attribute value used in ARIA and in labels is unique", + "Impact": "Critical", + "Tags": "cat.parsing, wcag2a, wcag412, EN-301-549, EN-9.4.1.2", + "Issue Type": "needs review", + "ACT Rules": "3ea0c8" + }, + { + "RuleID": "form-field-multiple-labels", + "Description": "Ensure form field does not have multiple label elements", + "Impact": "Moderate", + "Tags": "cat.forms, wcag2a, wcag332, TTv5, TT5.c, EN-301-549, EN-9.3.3.2", + "Issue Type": "needs review", + "ACT Rules": "" + }, + { + "RuleID": "frame-focusable-content", + "Description": "Ensure <frame> and <iframe> elements with focusable content do not have tabindex=-1", + "Impact": "Serious", + "Tags": "cat.keyboard, wcag2a, wcag211, TTv5, TT4.a, EN-301-549, EN-9.2.1.1", + "Issue Type": "failure, needs review", + "ACT Rules": "akn7bn" + }, + { + "RuleID": "frame-title-unique", + "Description": "Ensure <iframe> and <frame> elements contain a unique title attribute", + "Impact": "Serious", + "Tags": "cat.text-alternatives, wcag2a, wcag412, TTv5, TT12.d, EN-301-549, EN-9.4.1.2", + "Issue Type": "needs review", + "ACT Rules": "4b1c6c" + }, + { + "RuleID": "frame-title", + "Description": "Ensure <iframe> and <frame> elements have an accessible name", + "Impact": "Serious", + "Tags": "cat.text-alternatives, wcag2a, wcag412, section508, section508.22.i, TTv5, TT12.d, EN-301-549, EN-9.4.1.2", + "Issue Type": "failure, needs review", + "ACT Rules": "cae760" + }, + { + "RuleID": "html-has-lang", + "Description": "Ensure every HTML document has a lang attribute", + "Impact": "Serious", + "Tags": "cat.language, wcag2a, wcag311, TTv5, TT11.a, EN-301-549, EN-9.3.1.1, ACT", + "Issue Type": "failure", + "ACT Rules": "b5c3f8" + }, + { + "RuleID": "html-lang-valid", + "Description": "Ensure the lang attribute of the <html> element has a valid value", + "Impact": "Serious", + "Tags": "cat.language, wcag2a, wcag311, TTv5, TT11.a, EN-301-549, EN-9.3.1.1, ACT", + "Issue Type": "failure", + "ACT Rules": "bf051a" + }, + { + "RuleID": "html-xml-lang-mismatch", + "Description": "Ensure that HTML elements with both valid lang and xml:lang attributes agree on the base language of the page", + "Impact": "Moderate", + "Tags": "cat.language, wcag2a, wcag311, EN-301-549, EN-9.3.1.1, ACT", + "Issue Type": "failure", + "ACT Rules": "5b7ae0" + }, + { + "RuleID": "image-alt", + "Description": "Ensure <img> elements have alternate text or a role of none or presentation", + "Impact": "Critical", + "Tags": "cat.text-alternatives, wcag2a, wcag111, section508, section508.22.a, TTv5, TT7.a, TT7.b, EN-301-549, EN-9.1.1.1, ACT", + "Issue Type": "failure, needs review", + "ACT Rules": "23a2a8" + }, + { + "RuleID": "input-button-name", + "Description": "Ensure input buttons have discernible text", + "Impact": "Critical", + "Tags": "cat.name-role-value, wcag2a, wcag412, section508, section508.22.a, TTv5, TT5.c, EN-301-549, EN-9.4.1.2, ACT", + "Issue Type": "failure, needs review", + "ACT Rules": "97a4e1" + }, + { + "RuleID": "input-image-alt", + "Description": "Ensure <input type=\"\"image\"\"> elements have alternate text", + "Impact": "Critical", + "Tags": "cat.text-alternatives, wcag2a, wcag111, wcag412, section508, section508.22.a, TTv5, TT7.a, EN-301-549, EN-9.1.1.1, EN-9.4.1.2, ACT", + "Issue Type": "failure, needs review", + "ACT Rules": "59796f" + }, + { + "RuleID": "label", + "Description": "Ensure every form element has a label", + "Impact": "Critical", + "Tags": "cat.forms, wcag2a, wcag412, section508, section508.22.n, TTv5, TT5.c, EN-301-549, EN-9.4.1.2, ACT", + "Issue Type": "failure, needs review", + "ACT Rules": "e086e5" + }, + { + "RuleID": "link-in-text-block", + "Description": "Ensure links are distinguished from surrounding text in a way that does not rely on color", + "Impact": "Serious", + "Tags": "cat.color, wcag2a, wcag141, TTv5, TT13.a, EN-301-549, EN-9.1.4.1", + "Issue Type": "failure, needs review", + "ACT Rules": "" + }, + { + "RuleID": "link-name", + "Description": "Ensure links have discernible text", + "Impact": "Serious", + "Tags": "cat.name-role-value, wcag2a, wcag244, wcag412, section508, section508.22.a, TTv5, TT6.a, EN-301-549, EN-9.2.4.4, EN-9.4.1.2, ACT", + "Issue Type": "failure, needs review", + "ACT Rules": "c487ae" + }, + { + "RuleID": "list", + "Description": "Ensure that lists are structured correctly", + "Impact": "Serious", + "Tags": "cat.structure, wcag2a, wcag131, EN-301-549, EN-9.1.3.1", + "Issue Type": "failure", + "ACT Rules": "" + }, + { + "RuleID": "listitem", + "Description": "Ensure <li> elements are used semantically", + "Impact": "Serious", + "Tags": "cat.structure, wcag2a, wcag131, EN-301-549, EN-9.1.3.1", + "Issue Type": "failure", + "ACT Rules": "" + }, + { + "RuleID": "marquee", + "Description": "Ensure <marquee> elements are not used", + "Impact": "Serious", + "Tags": "cat.parsing, wcag2a, wcag222, TTv5, TT2.b, EN-301-549, EN-9.2.2.2", + "Issue Type": "failure", + "ACT Rules": "" + }, + { + "RuleID": "meta-refresh", + "Description": "Ensure <meta http-equiv=\"\"refresh\"\"> is not used for delayed refresh", + "Impact": "Critical", + "Tags": "cat.time-and-media, wcag2a, wcag221, TTv5, TT8.a, EN-301-549, EN-9.2.2.1", + "Issue Type": "failure", + "ACT Rules": "bc659a, bisz58" + }, + { + "RuleID": "meta-viewport", + "Description": "Ensure <meta name=\"\"viewport\"\"> does not disable text scaling and zooming", + "Impact": "Critical", + "Tags": "cat.sensory-and-visual-cues, wcag2aa, wcag144, EN-301-549, EN-9.1.4.4, ACT", + "Issue Type": "failure", + "ACT Rules": "b4f0c3" + }, + { + "RuleID": "nested-interactive", + "Description": "Ensure interactive controls are not nested as they are not always announced by screen readers or can cause focus problems for assistive technologies", + "Impact": "Serious", + "Tags": "cat.keyboard, wcag2a, wcag412, TTv5, TT6.a, EN-301-549, EN-9.4.1.2", + "Issue Type": "failure, needs review", + "ACT Rules": "307n5z" + }, + { + "RuleID": "no-autoplay-audio", + "Description": "Ensure <video> or <audio> elements do not autoplay audio for more than 3 seconds without a control mechanism to stop or mute the audio", + "Impact": "Moderate", + "Tags": "cat.time-and-media, wcag2a, wcag142, TTv5, TT2.a, EN-301-549, EN-9.1.4.2, ACT", + "Issue Type": "needs review", + "ACT Rules": "80f0bf" + }, + { + "RuleID": "object-alt", + "Description": "Ensure <object> elements have alternate text", + "Impact": "Serious", + "Tags": "cat.text-alternatives, wcag2a, wcag111, section508, section508.22.a, EN-301-549, EN-9.1.1.1", + "Issue Type": "failure, needs review", + "ACT Rules": "8fc3b6" + }, + { + "RuleID": "role-img-alt", + "Description": "Ensure [role=\"\"img\"\"] elements have alternate text", + "Impact": "Serious", + "Tags": "cat.text-alternatives, wcag2a, wcag111, section508, section508.22.a, TTv5, TT7.a, EN-301-549, EN-9.1.1.1, ACT", + "Issue Type": "failure, needs review", + "ACT Rules": "23a2a8" + }, + { + "RuleID": "scrollable-region-focusable", + "Description": "Ensure elements that have scrollable content are accessible by keyboard", + "Impact": "Serious", + "Tags": "cat.keyboard, wcag2a, wcag211, wcag213, TTv5, TT4.a, EN-301-549, EN-9.2.1.1, EN-9.2.1.3", + "Issue Type": "failure", + "ACT Rules": "0ssw9k" + }, + { + "RuleID": "select-name", + "Description": "Ensure select element has an accessible name", + "Impact": "Critical", + "Tags": "cat.forms, wcag2a, wcag412, section508, section508.22.n, TTv5, TT5.c, EN-301-549, EN-9.4.1.2, ACT", + "Issue Type": "failure, needs review", + "ACT Rules": "e086e5" + }, + { + "RuleID": "server-side-image-map", + "Description": "Ensure that server-side image maps are not used", + "Impact": "Minor", + "Tags": "cat.text-alternatives, wcag2a, wcag211, section508, section508.22.f, TTv5, TT4.a, EN-301-549, EN-9.2.1.1", + "Issue Type": "needs review", + "ACT Rules": "" + }, + { + "RuleID": "svg-img-alt", + "Description": "Ensure <svg> elements with an img, graphics-document or graphics-symbol role have an accessible text", + "Impact": "Serious", + "Tags": "cat.text-alternatives, wcag2a, wcag111, section508, section508.22.a, TTv5, TT7.a, EN-301-549, EN-9.1.1.1, ACT", + "Issue Type": "failure, needs review", + "ACT Rules": "7d6734" + }, + { + "RuleID": "td-headers-attr", + "Description": "Ensure that each cell in a table that uses the headers attribute refers only to other cells in that table", + "Impact": "Serious", + "Tags": "cat.tables, wcag2a, wcag131, section508, section508.22.g, TTv5, TT14.b, EN-301-549, EN-9.1.3.1", + "Issue Type": "failure, needs review", + "ACT Rules": "a25f45" + }, + { + "RuleID": "th-has-data-cells", + "Description": "Ensure that <th> elements and elements with role=columnheader/rowheader have data cells they describe", + "Impact": "Serious", + "Tags": "cat.tables, wcag2a, wcag131, section508, section508.22.g, TTv5, TT14.b, EN-301-549, EN-9.1.3.1", + "Issue Type": "failure, needs review", + "ACT Rules": "d0f69e" + }, + { + "RuleID": "valid-lang", + "Description": "Ensure lang attributes have valid values", + "Impact": "Serious", + "Tags": "cat.language, wcag2aa, wcag312, TTv5, TT11.b, EN-301-549, EN-9.3.1.2, ACT", + "Issue Type": "failure", + "ACT Rules": "de46e4" + }, + { + "RuleID": "video-caption", + "Description": "Ensure <video> elements have captions", + "Impact": "Critical", + "Tags": "cat.text-alternatives, wcag2a, wcag122, section508, section508.22.a, TTv5, TT17.a, EN-301-549, EN-9.1.2.2", + "Issue Type": "needs review", + "ACT Rules": "eac66b" + }, + { + "RuleID": "autocomplete-valid", + "Description": "Ensure the autocomplete attribute is correct and suitable for the form field", + "Impact": "Serious", + "Tags": "cat.forms, wcag21aa, wcag135, EN-301-549, EN-9.1.3.5, ACT", + "Issue Type": "failure, needs review", + "ACT Rules": "73f2c2" + }, + { + "RuleID": "avoid-inline-spacing", + "Description": "Ensure that text spacing set through style attributes can be adjusted with custom stylesheets", + "Impact": "Serious", + "Tags": "cat.structure, wcag21aa, wcag1412, EN-301-549, EN-9.1.4.12, ACT", + "Issue Type": "failure", + "ACT Rules": "24afc2, 9e45ec, 78fd32" + }, + { + "RuleID": "target-size", + "Description": "Ensure touch targets have sufficient size and space", + "Impact": "Serious", + "Tags": "cat.sensory-and-visual-cues, wcag22aa, wcag258", + "Issue Type": "failure, needs review", + "ACT Rules": "" + }, + { + "RuleID": "accesskeys", + "Description": "Ensure every accesskey attribute value is unique", + "Impact": "Serious", + "Tags": "cat.keyboard, best-practice", + "Issue Type": "failure", + "ACT Rules": "" + }, + { + "RuleID": "aria-allowed-role", + "Description": "Ensure role attribute has an appropriate value for the element", + "Impact": "Minor", + "Tags": "cat.aria, best-practice", + "Issue Type": "failure, needs review", + "ACT Rules": "" + }, + { + "RuleID": "aria-dialog-name", + "Description": "Ensure every ARIA dialog and alertdialog node has an accessible name", + "Impact": "Serious", + "Tags": "cat.aria, best-practice", + "Issue Type": "failure, needs review", + "ACT Rules": "" + }, + { + "RuleID": "aria-text", + "Description": "Ensure role=\"\"text\"\" is used on elements with no focusable descendants", + "Impact": "Serious", + "Tags": "cat.aria, best-practice", + "Issue Type": "failure, needs review", + "ACT Rules": "" + }, + { + "RuleID": "aria-treeitem-name", + "Description": "Ensure every ARIA treeitem node has an accessible name", + "Impact": "Serious", + "Tags": "cat.aria, best-practice", + "Issue Type": "failure, needs review", + "ACT Rules": "" + }, + { + "RuleID": "empty-heading", + "Description": "Ensure headings have discernible text", + "Impact": "Minor", + "Tags": "cat.name-role-value, best-practice", + "Issue Type": "failure, needs review", + "ACT Rules": "ffd0e9" + }, + { + "RuleID": "empty-table-header", + "Description": "Ensure table headers have discernible text", + "Impact": "Minor", + "Tags": "cat.name-role-value, best-practice", + "Issue Type": "failure, needs review", + "ACT Rules": "" + }, + { + "RuleID": "frame-tested", + "Description": "Ensure <iframe> and <frame> elements contain the axe-core script", + "Impact": "Critical", + "Tags": "cat.structure, best-practice, review-item", + "Issue Type": "failure, needs review", + "ACT Rules": "" + }, + { + "RuleID": "heading-order", + "Description": "Ensure the order of headings is semantically correct", + "Impact": "Moderate", + "Tags": "cat.semantics, best-practice", + "Issue Type": "failure, needs review", + "ACT Rules": "" + }, + { + "RuleID": "image-redundant-alt", + "Description": "Ensure image alternative is not repeated as text", + "Impact": "Minor", + "Tags": "cat.text-alternatives, best-practice", + "Issue Type": "failure", + "ACT Rules": "" + }, + { + "RuleID": "label-title-only", + "Description": "Ensure that every form element has a visible label and is not solely labeled using hidden labels, or the title or aria-describedby attributes", + "Impact": "Serious", + "Tags": "cat.forms, best-practice", + "Issue Type": "failure", + "ACT Rules": "" + }, + { + "RuleID": "landmark-banner-is-top-level", + "Description": "Ensure the banner landmark is at top level", + "Impact": "Moderate", + "Tags": "cat.semantics, best-practice", + "Issue Type": "failure", + "ACT Rules": "" + }, + { + "RuleID": "landmark-complementary-is-top-level", + "Description": "Ensure the complementary landmark or aside is at top level", + "Impact": "Moderate", + "Tags": "cat.semantics, best-practice", + "Issue Type": "failure", + "ACT Rules": "" + }, + { + "RuleID": "landmark-contentinfo-is-top-level", + "Description": "Ensure the contentinfo landmark is at top level", + "Impact": "Moderate", + "Tags": "cat.semantics, best-practice", + "Issue Type": "failure", + "ACT Rules": "" + }, + { + "RuleID": "landmark-main-is-top-level", + "Description": "Ensure the main landmark is at top level", + "Impact": "Moderate", + "Tags": "cat.semantics, best-practice", + "Issue Type": "failure", + "ACT Rules": "" + }, + { + "RuleID": "landmark-no-duplicate-banner", + "Description": "Ensure the document has at most one banner landmark", + "Impact": "Moderate", + "Tags": "cat.semantics, best-practice", + "Issue Type": "failure", + "ACT Rules": "" + }, + { + "RuleID": "landmark-no-duplicate-contentinfo", + "Description": "Ensure the document has at most one contentinfo landmark", + "Impact": "Moderate", + "Tags": "cat.semantics, best-practice", + "Issue Type": "failure", + "ACT Rules": "" + }, + { + "RuleID": "landmark-no-duplicate-main", + "Description": "Ensure the document has at most one main landmark", + "Impact": "Moderate", + "Tags": "cat.semantics, best-practice", + "Issue Type": "failure", + "ACT Rules": "" + }, + { + "RuleID": "landmark-one-main", + "Description": "Ensure the document has a main landmark", + "Impact": "Moderate", + "Tags": "cat.semantics, best-practice", + "Issue Type": "failure", + "ACT Rules": "" + }, + { + "RuleID": "landmark-unique", + "Description": "Ensure landmarks are unique", + "Impact": "Moderate", + "Tags": "cat.semantics, best-practice", + "Issue Type": "failure", + "ACT Rules": "" + }, + { + "RuleID": "meta-viewport-large", + "Description": "Ensure <meta name=\"\"viewport\"\"> can scale a significant amount", + "Impact": "Minor", + "Tags": "cat.sensory-and-visual-cues, best-practice", + "Issue Type": "failure", + "ACT Rules": "" + }, + { + "RuleID": "page-has-heading-one", + "Description": "Ensure that the page, or at least one of its frames contains a level-one heading", + "Impact": "Moderate", + "Tags": "cat.semantics, best-practice", + "Issue Type": "failure", + "ACT Rules": "" + }, + { + "RuleID": "presentation-role-conflict", + "Description": "Elements marked as presentational should not have global ARIA or tabindex to ensure all screen readers ignore them", + "Impact": "Minor", + "Tags": "cat.aria, best-practice, ACT", + "Issue Type": "failure", + "ACT Rules": "46ca7f" + }, + { + "RuleID": "region", + "Description": "Ensure all page content is contained by landmarks", + "Impact": "Moderate", + "Tags": "cat.keyboard, best-practice", + "Issue Type": "failure", + "ACT Rules": "" + }, + { + "RuleID": "scope-attr-valid", + "Description": "Ensure the scope attribute is used correctly on tables", + "Impact": "Moderate", + "Tags": "cat.tables, best-practice", + "Issue Type": "failure", + "ACT Rules": "" + }, + { + "RuleID": "skip-link", + "Description": "Ensure all skip links have a focusable target", + "Impact": "Moderate", + "Tags": "cat.keyboard, best-practice", + "Issue Type": "failure, needs review", + "ACT Rules": "" + }, + { + "RuleID": "tabindex", + "Description": "Ensure tabindex attribute values are not greater than 0", + "Impact": "Serious", + "Tags": "cat.keyboard, best-practice", + "Issue Type": "failure", + "ACT Rules": "" + }, + { + "RuleID": "table-duplicate-name", + "Description": "Ensure the <caption> element does not contain the same text as the summary attribute", + "Impact": "Minor", + "Tags": "cat.tables, best-practice", + "Issue Type": "failure, needs review", + "ACT Rules": "" + }, + { + "RuleID": "color-contrast-enhanced", + "Description": "Ensure the contrast between foreground and background colors meets WCAG 2 AAA enhanced contrast ratio thresholds", + "Impact": "Serious", + "Tags": "cat.color, wcag2aaa, wcag146, ACT", + "Issue Type": "failure, needs review", + "ACT Rules": "09o5cg" + }, + { + "RuleID": "identical-links-same-purpose", + "Description": "Ensure that links with the same accessible name serve a similar purpose", + "Impact": "Minor", + "Tags": "cat.semantics, wcag2aaa, wcag249", + "Issue Type": "needs review", + "ACT Rules": "b20e66" + }, + { + "RuleID": "meta-refresh-no-exceptions", + "Description": "Ensure <meta http-equiv=\"\"refresh\"\"> is not used for delayed refresh", + "Impact": "Minor", + "Tags": "cat.time-and-media, wcag2aaa, wcag224, wcag325", + "Issue Type": "failure", + "ACT Rules": "bisz58" + } + ] +} diff --git a/Ginger/GingerCoreNET/GingerCoreNET.csproj b/Ginger/GingerCoreNET/GingerCoreNET.csproj index fa0f498759..6d6ebc66be 100644 --- a/Ginger/GingerCoreNET/GingerCoreNET.csproj +++ b/Ginger/GingerCoreNET/GingerCoreNET.csproj @@ -55,6 +55,7 @@ <None Remove="DLLS\SikuliStandardNet.dll" /> <None Remove="DLLS\ZephyrEntStdSDK.dll" /> <None Remove="DLLS\Zepyhr_Ent_Repository_Std.dll" /> + <None Remove="Drivers\CoreDrivers\Web\Selenium\AccessibilityTestResources\AccessiblityRules.json" /> <None Remove="Drivers\CoreDrivers\Web\Selenium\AccessibilityTestResources\htmlReporter.css" /> <None Remove="Drivers\CoreDrivers\Web\Selenium\AccessibilityTestResources\htmlReporterElements.js" /> <None Remove="Drivers\WebServicesDriver\WebServicesDriverWindow.xaml" /> @@ -201,6 +202,9 @@ <EmbeddedResource Include="DLLS\GingerHbaseFilter.dll"> <CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory> </EmbeddedResource> + <EmbeddedResource Include="Drivers\CoreDrivers\Web\Selenium\AccessibilityTestResources\AccessiblityRules.json"> + <CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory> + </EmbeddedResource> <EmbeddedResource Include="Drivers\CoreDrivers\Web\Selenium\AccessibilityTestResources\htmlReporterElements.js"> <CopyToOutputDirectory>Always</CopyToOutputDirectory> </EmbeddedResource> @@ -245,9 +249,9 @@ <PackageReference Include="CouchbaseNetClient" Version="2.7.11" /> - <PackageReference Include="Deque.AxeCore.Commons" Version="4.8.0" /> + <PackageReference Include="Deque.AxeCore.Commons" Version="4.9.1" /> - <PackageReference Include="Deque.AxeCore.Selenium" Version="4.8.0" /> + <PackageReference Include="Deque.AxeCore.Selenium" Version="4.9.1" /> <PackageReference Include="EnterpriseLibrary.TransientFaultHandling" Version="6.0.1304" /> diff --git a/Ginger/GingerCoreNETUnitTest/ActionsLib/UI/Web/AccessiblityTests.cs b/Ginger/GingerCoreNETUnitTest/ActionsLib/UI/Web/AccessiblityTests.cs new file mode 100644 index 0000000000..4089c97525 --- /dev/null +++ b/Ginger/GingerCoreNETUnitTest/ActionsLib/UI/Web/AccessiblityTests.cs @@ -0,0 +1,157 @@ +#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.GingerCoreNET; +using Amdocs.Ginger.Common; +using Amdocs.Ginger.Common.VariablesLib; +using Amdocs.Ginger.CoreNET.ActionsLib.UI.Web; +using Amdocs.Ginger.Repository; +using Deque.AxeCore.Selenium; +using Ginger.AnalyzerLib; +using Ginger.Configurations; +using GingerCore; +using GingerCoreNETUnitTest.WorkSpaceLib; +using GingerTestHelper; +using Microsoft.VisualStudio.TestTools.UnitTesting; +using OpenQA.Selenium; +using OpenQA.Selenium.Chrome; +using System.IO; +using System.Linq; + +namespace GingerCoreNETUnitTest.ActionsLib.UI.Web +{ + [TestClass] + [TestCategory(TestCategory.UnitTest)] + public class AccessiblityTests + { + + private static IWebDriver _driver; + static ActAccessibilityTesting mact; + IWebElement e = null; + + [ClassInitialize()] + public static void ClassInit(TestContext TC) + { + //// Initialize the WebDriver (Chrome in this case) + _driver = new ChromeDriver(); + mact = new ActAccessibilityTesting(); + mact.GetOrCreateInputParam(ActAccessibilityTesting.Fields.Target, ActAccessibilityTesting.eTarget.Page); + mact.SeverityList = GetSeverityList(); + mact.StandardList = GetStandardTagslist(); + } + + [ClassCleanup] + public static void ClassCleanup() + { + _driver.Quit(); + } + + [TestMethod] + public void TestAnalyzerAccessibility_Standard_Failed() + { + _driver.Navigate().GoToUrl($"https://ginger.amdocs.com/"); + mact.GetOrCreateInputParam(ActAccessibilityTesting.Fields.Analyzer, ActAccessibilityTesting.eAnalyzer.ByStandard); + if (mact.GetInputParamValue(ActAccessibilityTesting.Fields.Analyzer) == nameof(ActAccessibilityTesting.eAnalyzer.ByStandard)) + { + mact.SeverityList = new ObservableList<OperationValues>(); + } + mact.AnalyzerAccessibility(_driver, e); + Assert.AreEqual(mact.Status,Amdocs.Ginger.CoreNET.Execution.eRunStatus.Failed); + } + + [TestMethod] + public void TestAnalyzerAccessibility_Severity_Failed() + { + _driver.Navigate().GoToUrl($"https://ginger.amdocs.com/"); + mact.GetOrCreateInputParam(ActAccessibilityTesting.Fields.Analyzer, ActAccessibilityTesting.eAnalyzer.BySeverity); + if (mact.GetInputParamValue(ActAccessibilityTesting.Fields.Analyzer) == nameof(ActAccessibilityTesting.eAnalyzer.BySeverity)) + { + mact.SeverityList.RemoveAt(1); + } + mact.AnalyzerAccessibility(_driver, e); + Assert.AreEqual(mact.Status, Amdocs.Ginger.CoreNET.Execution.eRunStatus.Failed); + } + + [TestMethod] + public void TestAnalyzerAccessibility_Standard_Pass() + { + string htmlFilePath = Path.Combine(TestResources.GetTestResourcesFolder("Html"), "TestAccessiblity.html"); + _driver.Navigate().GoToUrl(htmlFilePath); + mact.GetOrCreateInputParam(ActAccessibilityTesting.Fields.Analyzer, ActAccessibilityTesting.eAnalyzer.ByStandard); + if (mact.GetInputParamValue(ActAccessibilityTesting.Fields.Analyzer) == nameof(ActAccessibilityTesting.eAnalyzer.ByStandard)) + { + mact.SeverityList = new ObservableList<OperationValues>(); + } + mact.AnalyzerAccessibility(_driver, e); + Assert.AreEqual(mact.Status, Amdocs.Ginger.CoreNET.Execution.eRunStatus.Passed); + } + + [TestMethod] + public void TestAnalyzerAccessibility_Severity_Pass() + { + string htmlFilePath = Path.Combine(TestResources.GetTestResourcesFolder("Html"), "TestAccessiblity.html"); + _driver.Navigate().GoToUrl(htmlFilePath); + mact.GetOrCreateInputParam(ActAccessibilityTesting.Fields.Analyzer, ActAccessibilityTesting.eAnalyzer.BySeverity); + if (mact.GetInputParamValue(ActAccessibilityTesting.Fields.Analyzer) == nameof(ActAccessibilityTesting.eAnalyzer.BySeverity)) + { + mact.SeverityList.RemoveAt(1); + } + mact.AnalyzerAccessibility(_driver, e); + Assert.AreEqual(mact.Status, Amdocs.Ginger.CoreNET.Execution.eRunStatus.Passed); + } + + [TestMethod] + public void TestCreateAxeBuilder_IsNotNull() + { + AxeBuilder axeBuilder = mact.CreateAxeBuilder(_driver); + Assert.AreNotEqual(null, axeBuilder); + } + + [TestMethod] + public void TestGetRuleList_isNotNull() + { + ObservableList<AccessibilityRuleData> ruleList = mact.GetRuleList(); + Assert.AreNotEqual(null, ruleList); + Assert.AreEqual(93, ruleList.Count); + } + + public static ObservableList<OperationValues> GetStandardTagslist() + { + ObservableList<OperationValues> StandardTagList = new ObservableList<OperationValues>(); + StandardTagList.Add(new OperationValues() { Value = nameof(ActAccessibilityTesting.eTags.wcag2a) }); + StandardTagList.Add(new OperationValues() { Value = nameof(ActAccessibilityTesting.eTags.wcag2aa) }); + StandardTagList.Add(new OperationValues() { Value = nameof(ActAccessibilityTesting.eTags.wcag21a) }); + StandardTagList.Add(new OperationValues() { Value = nameof(ActAccessibilityTesting.eTags.wcag21aa) }); + StandardTagList.Add(new OperationValues() { Value = nameof(ActAccessibilityTesting.eTags.wcag22a) }); + StandardTagList.Add(new OperationValues() { Value = nameof(ActAccessibilityTesting.eTags.wcag22aa) }); + StandardTagList.Add(new OperationValues() { Value = nameof(ActAccessibilityTesting.eTags.bestpractice) }); + return StandardTagList; + } + + public static ObservableList<OperationValues> GetSeverityList() + { + ObservableList<OperationValues> SeverityList = new ObservableList<OperationValues>(); + + 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; + } + } +} diff --git a/Ginger/GingerCoreNETUnitTest/GingerCoreNETUnitTest.csproj b/Ginger/GingerCoreNETUnitTest/GingerCoreNETUnitTest.csproj index b13996003c..047a3a350c 100644 --- a/Ginger/GingerCoreNETUnitTest/GingerCoreNETUnitTest.csproj +++ b/Ginger/GingerCoreNETUnitTest/GingerCoreNETUnitTest.csproj @@ -29,6 +29,7 @@ <None Remove="TestResources\Files\ScriptWithGingerOutput.vbs" /> <None Remove="TestResources\Files\ScriptWithGingerOutputIndexZero.vbs" /> <None Remove="TestResources\Files\ScriptWithoutOutput.vbs" /> + <None Remove="TestResources\Html\TestAccessiblity.html" /> <None Remove="TestResources\JSON\Request JSON.TXT" /> <None Remove="TestResources\Repository\Default Run Set.Ginger.RunSetConfig.xml" /> <None Remove="TestResources\Repository\dummyAction.xml" /> @@ -50,6 +51,9 @@ <Content Include="TestResources\Files\ScriptWithoutOutput.vbs"> <CopyToOutputDirectory>Always</CopyToOutputDirectory> </Content> + <Content Include="TestResources\Html\TestAccessiblity.html"> + <CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory> + </Content> <Content Include="TestResources\JSON\Request JSON.TXT"> <CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory> </Content> diff --git a/Ginger/GingerCoreNETUnitTest/TestResources/Html/TestAccessiblity.html b/Ginger/GingerCoreNETUnitTest/TestResources/Html/TestAccessiblity.html new file mode 100644 index 0000000000..ee0bfae26b --- /dev/null +++ b/Ginger/GingerCoreNETUnitTest/TestResources/Html/TestAccessiblity.html @@ -0,0 +1,78 @@ +<!DOCTYPE html> +<html lang="en"> +<head> + <meta charset="UTF-8"> + <meta name="viewport" content="width=device-width, initial-scale=1.0"> + <title>Accessibility Testing Page + + + +
+

Accessibility Testing Page

+ +
+ +
+
+

Section 1: Images

+ A descriptive text about the image + +
+ +
+

Section 2: Links and Buttons

+

Visit the example website for more information.

+ +
+ +
+

Form

+
+ + +

+ + +

+
+ Gender + + +
+
+ +
+
+ +
+

Keyboard Navigation

+

Use Tab and Shift + Tab to navigate through interactive elements.

+
+
+ +
+

© 2024 Accessibility Testing

+
+ + From cf08c3ec6d9c9c1e33d73d1306dc43e9a3cec5df Mon Sep 17 00:00:00 2001 From: prashelke Date: Thu, 1 Aug 2024 16:37:05 +0530 Subject: [PATCH 2/8] Updated Code --- Ginger/Ginger/MenusLib/ConfigurationsMenu.cs | 6 +- ...lePage.xaml => AccessibilityRulePage.xaml} | 12 ++-- ....xaml.cs => AccessibilityRulePage.xaml.cs} | 29 +++++----- .../AccessibilityConfiguration.cs | 5 +- .../Configurations/AccessibilityRuleData.cs | 12 +++- .../ActionsLib/UI/Web/AccessiblityTests.cs | 55 +++++++++++++++++-- 6 files changed, 87 insertions(+), 32 deletions(-) rename Ginger/Ginger/SolutionWindows/{AccessiblityRulePage.xaml => AccessibilityRulePage.xaml} (66%) rename Ginger/Ginger/SolutionWindows/{AccessiblityRulePage.xaml.cs => AccessibilityRulePage.xaml.cs} (84%) diff --git a/Ginger/Ginger/MenusLib/ConfigurationsMenu.cs b/Ginger/Ginger/MenusLib/ConfigurationsMenu.cs index c074504702..bea03e486b 100644 --- a/Ginger/Ginger/MenusLib/ConfigurationsMenu.cs +++ b/Ginger/Ginger/MenusLib/ConfigurationsMenu.cs @@ -93,7 +93,7 @@ private static TwoLevelMenu GetMenu() 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, "", GeAccessiblityRulePage, ConsoleKey.T, "", "AID"); + accessiblityRulesMenu.Add(eImageType.Application, "", GetAccessibilityRulePage, ConsoleKey.T, "", "AID"); twoLevelMenu.Add(accessiblityRulesMenu); return twoLevelMenu; @@ -160,9 +160,9 @@ private static Page OthersPage() return new Page(); } - private static Page GeAccessiblityRulePage() + private static Page GetAccessibilityRulePage() { - return (new AccessiblityRulePage()); + return (new AccessibilityRulePage()); } } } diff --git a/Ginger/Ginger/SolutionWindows/AccessiblityRulePage.xaml b/Ginger/Ginger/SolutionWindows/AccessibilityRulePage.xaml similarity index 66% rename from Ginger/Ginger/SolutionWindows/AccessiblityRulePage.xaml rename to Ginger/Ginger/SolutionWindows/AccessibilityRulePage.xaml index 2586f100b4..3d47dce4e3 100644 --- a/Ginger/Ginger/SolutionWindows/AccessiblityRulePage.xaml +++ b/Ginger/Ginger/SolutionWindows/AccessibilityRulePage.xaml @@ -1,4 +1,4 @@ - + Title="Accessibility Rule Page"> @@ -22,16 +22,16 @@ - + Text="Active items can be analyzed for accessibility." /> - - + --> + diff --git a/Ginger/Ginger/SolutionWindows/AccessiblityRulePage.xaml.cs b/Ginger/Ginger/SolutionWindows/AccessibilityRulePage.xaml.cs similarity index 84% rename from Ginger/Ginger/SolutionWindows/AccessiblityRulePage.xaml.cs rename to Ginger/Ginger/SolutionWindows/AccessibilityRulePage.xaml.cs index 1014792ef2..d1e0e1339c 100644 --- a/Ginger/Ginger/SolutionWindows/AccessiblityRulePage.xaml.cs +++ b/Ginger/Ginger/SolutionWindows/AccessibilityRulePage.xaml.cs @@ -24,15 +24,15 @@ namespace Ginger.SolutionWindows { /// - /// Interaction logic for AccessiblityRulePage.xaml + /// Interaction logic for AccessibilityRulePage.xaml /// - public partial class AccessiblityRulePage : Page + public partial class AccessibilityRulePage : Page { Solution mSolution; string AppName; List DefaultExcludeRulesList; private AccessibilityConfiguration mAccessibilityConfiguration; - public AccessiblityRulePage() + public AccessibilityRulePage() { InitializeComponent(); mSolution = WorkSpace.Instance.Solution; @@ -41,7 +41,7 @@ public AccessiblityRulePage() LoadGridData(); SetAppsGrid(); mAccessibilityConfiguration = new(); - DefaultExcludeRulesList = WorkSpace.Instance.Solution.DefaultExcludeRule.DefaultExcludeRules != null ? WorkSpace.Instance.Solution.DefaultExcludeRule.DefaultExcludeRules.Split(',').ToList() : new(); + DefaultExcludeRulesList = WorkSpace.Instance.Solution.DefaultExcludeRule.DefaultExcludeRules?.Split(',').ToList() ?? new List(); } private void WorkSpacePropertyChanged(object sender, System.ComponentModel.PropertyChangedEventArgs e) @@ -55,7 +55,7 @@ private void WorkSpacePropertyChanged(object sender, System.ComponentModel.Prope private void SetAppsGrid() { - xAccessiblityRulesGrid.SetGridEnhancedHeader(Amdocs.Ginger.Common.Enums.eImageType.Accessibility, $"{GingerCore.General.GetEnumValueDescription(typeof(eTermResKey), nameof(eTermResKey.AccessibilityRules))}", saveAllHandler: SaveHandler, null, true); + xAccessibilityRulesGrid.SetGridEnhancedHeader(Amdocs.Ginger.Common.Enums.eImageType.Accessibility, $"{GingerCore.General.GetEnumValueDescription(typeof(eTermResKey), nameof(eTermResKey.AccessibilityRules))}", saveAllHandler: SaveHandler, null, true); GridViewDef view = new GridViewDef(GridViewDef.DefaultViewName); view.GridColsView = new ObservableList(); view.GridColsView.Add(new GridColView() @@ -76,8 +76,9 @@ private void SetAppsGrid() }); view.GridColsView.Add(new GridColView() { - Field = nameof(AccessibilityRuleData.Tags), - WidthWeight = 30, + Field = nameof(AccessibilityRuleData.Description), + Header = "Description", + WidthWeight = 40, ReadOnly = true }); view.GridColsView.Add(new GridColView() @@ -90,15 +91,15 @@ private void SetAppsGrid() }); view.GridColsView.Add(new GridColView() { - Field = nameof(AccessibilityRuleData.Description), - Header = "Description", - WidthWeight = 40, + Field = nameof(AccessibilityRuleData.Tags), + WidthWeight = 30, ReadOnly = true }); + xAccessibilityRulesGrid.AddLabel("Note: We will analyze the active items from the list below for accessibility. Testing and deactivating items won't be taken into account for accessibility testing."); - xAccessiblityRulesGrid.SetAllColumnsDefaultView(view); - xAccessiblityRulesGrid.InitViewItems(); + xAccessibilityRulesGrid.SetAllColumnsDefaultView(view); + xAccessibilityRulesGrid.InitViewItems(); } private void LoadGridData() @@ -106,7 +107,7 @@ private void LoadGridData() ActAccessibilityTesting actAccessibilityTesting = new ActAccessibilityTesting(); List sortedList = actAccessibilityTesting.RulesItemsdata.OrderByDescending(data => !data.Active).ToList(); ObservableList accessibilityRuleDatas = [.. sortedList]; - xAccessiblityRulesGrid.DataSourceList = accessibilityRuleDatas; + xAccessibilityRulesGrid.DataSourceList = accessibilityRuleDatas; } private void CheckBox_Click(object sender, RoutedEventArgs e) @@ -117,7 +118,7 @@ private void CheckBox_Click(object sender, RoutedEventArgs e) // Do something with data, for example: data.Active = checkBox.IsChecked ?? false; WorkSpace.Instance.Solution.DefaultExcludeRule.StartDirtyTracking(); - if (data.Active == false) + if (!data.Active) { if (!DefaultExcludeRulesList.Any(x => x.Equals(data.RuleID))) { diff --git a/Ginger/GingerCoreCommon/External/Configurations/AccessibilityConfiguration.cs b/Ginger/GingerCoreCommon/External/Configurations/AccessibilityConfiguration.cs index 5a32e4100b..344fae57b9 100644 --- a/Ginger/GingerCoreCommon/External/Configurations/AccessibilityConfiguration.cs +++ b/Ginger/GingerCoreCommon/External/Configurations/AccessibilityConfiguration.cs @@ -29,7 +29,10 @@ namespace Ginger.Configurations { public class AccessibilityConfiguration : RepositoryItemBase { - public override string ItemName { get => throw new System.NotImplementedException(); set => throw new System.NotImplementedException(); } + private string mName; + [IsSerializedForLocalRepository] + public string Name { get { return mName; } set { if (mName != value) { mName = value; OnPropertyChanged(nameof(Name)); } } } + public override string ItemName { get => "Accessibility Configuration"; set { /* set logic here */ } } string mDefaultExcludeRules; [IsSerializedForLocalRepository] diff --git a/Ginger/GingerCoreCommon/External/Configurations/AccessibilityRuleData.cs b/Ginger/GingerCoreCommon/External/Configurations/AccessibilityRuleData.cs index db2f2bbca3..3c8d561976 100644 --- a/Ginger/GingerCoreCommon/External/Configurations/AccessibilityRuleData.cs +++ b/Ginger/GingerCoreCommon/External/Configurations/AccessibilityRuleData.cs @@ -65,8 +65,16 @@ public class AccessibilityRuleData : RepositoryItemBase, INotifyPropertyChanged public ObservableList GetAccessibilityRules(string AccessbiltyString) { - ObservableList accessibilityRules = new ObservableList(); - Root data = JsonConvert.DeserializeObject(AccessbiltyString); + Root data = new(); + try + { + data = JsonConvert.DeserializeObject(AccessbiltyString); + } + catch(Exception ex) + { + Reporter.ToLog(eLogLevel.ERROR, "Failed to deserialize accessibility rules.", ex); + } + return data.accessibilityRules; } diff --git a/Ginger/GingerCoreNETUnitTest/ActionsLib/UI/Web/AccessiblityTests.cs b/Ginger/GingerCoreNETUnitTest/ActionsLib/UI/Web/AccessiblityTests.cs index 4089c97525..947a78d84e 100644 --- a/Ginger/GingerCoreNETUnitTest/ActionsLib/UI/Web/AccessiblityTests.cs +++ b/Ginger/GingerCoreNETUnitTest/ActionsLib/UI/Web/AccessiblityTests.cs @@ -30,13 +30,16 @@ limitations under the License. using Microsoft.VisualStudio.TestTools.UnitTesting; using OpenQA.Selenium; using OpenQA.Selenium.Chrome; +using System; using System.IO; using System.Linq; +using System.Runtime.Versioning; namespace GingerCoreNETUnitTest.ActionsLib.UI.Web { [TestClass] - [TestCategory(TestCategory.UnitTest)] + [TestCategory(TestCategory.IntegrationTest)] + [Ignore] public class AccessiblityTests { @@ -44,26 +47,40 @@ public class AccessiblityTests static ActAccessibilityTesting mact; IWebElement e = null; - [ClassInitialize()] - public static void ClassInit(TestContext TC) + [TestInitialize()] + public static void TestInit(TestContext TC) { - //// Initialize the WebDriver (Chrome in this case) - _driver = new ChromeDriver(); + if (!OperatingSystem.IsLinux()) + { + return; + } + mact = new ActAccessibilityTesting(); mact.GetOrCreateInputParam(ActAccessibilityTesting.Fields.Target, ActAccessibilityTesting.eTarget.Page); mact.SeverityList = GetSeverityList(); mact.StandardList = GetStandardTagslist(); } - [ClassCleanup] + [TestCleanup] public static void ClassCleanup() { _driver.Quit(); } + public void InitDriver() + { + //// Initialize the WebDriver (Chrome in this case) + _driver = new ChromeDriver(); + } + [TestMethod] public void TestAnalyzerAccessibility_Standard_Failed() { + if (!OperatingSystem.IsLinux()) + { + return; + } + InitDriver(); _driver.Navigate().GoToUrl($"https://ginger.amdocs.com/"); mact.GetOrCreateInputParam(ActAccessibilityTesting.Fields.Analyzer, ActAccessibilityTesting.eAnalyzer.ByStandard); if (mact.GetInputParamValue(ActAccessibilityTesting.Fields.Analyzer) == nameof(ActAccessibilityTesting.eAnalyzer.ByStandard)) @@ -77,6 +94,11 @@ public void TestAnalyzerAccessibility_Standard_Failed() [TestMethod] public void TestAnalyzerAccessibility_Severity_Failed() { + if (!OperatingSystem.IsLinux()) + { + return; + } + InitDriver(); _driver.Navigate().GoToUrl($"https://ginger.amdocs.com/"); mact.GetOrCreateInputParam(ActAccessibilityTesting.Fields.Analyzer, ActAccessibilityTesting.eAnalyzer.BySeverity); if (mact.GetInputParamValue(ActAccessibilityTesting.Fields.Analyzer) == nameof(ActAccessibilityTesting.eAnalyzer.BySeverity)) @@ -90,6 +112,11 @@ public void TestAnalyzerAccessibility_Severity_Failed() [TestMethod] public void TestAnalyzerAccessibility_Standard_Pass() { + if (!OperatingSystem.IsLinux()) + { + return; + } + InitDriver(); string htmlFilePath = Path.Combine(TestResources.GetTestResourcesFolder("Html"), "TestAccessiblity.html"); _driver.Navigate().GoToUrl(htmlFilePath); mact.GetOrCreateInputParam(ActAccessibilityTesting.Fields.Analyzer, ActAccessibilityTesting.eAnalyzer.ByStandard); @@ -104,6 +131,11 @@ public void TestAnalyzerAccessibility_Standard_Pass() [TestMethod] public void TestAnalyzerAccessibility_Severity_Pass() { + if (!OperatingSystem.IsLinux()) + { + return; + } + InitDriver(); string htmlFilePath = Path.Combine(TestResources.GetTestResourcesFolder("Html"), "TestAccessiblity.html"); _driver.Navigate().GoToUrl(htmlFilePath); mact.GetOrCreateInputParam(ActAccessibilityTesting.Fields.Analyzer, ActAccessibilityTesting.eAnalyzer.BySeverity); @@ -116,15 +148,26 @@ public void TestAnalyzerAccessibility_Severity_Pass() } [TestMethod] + [TestCategory(TestCategory.UnitTest)] public void TestCreateAxeBuilder_IsNotNull() { + if (!OperatingSystem.IsLinux()) + { + return; + } + InitDriver(); AxeBuilder axeBuilder = mact.CreateAxeBuilder(_driver); Assert.AreNotEqual(null, axeBuilder); } [TestMethod] + [TestCategory(TestCategory.UnitTest)] public void TestGetRuleList_isNotNull() { + if (!OperatingSystem.IsLinux()) + { + return; + } ObservableList ruleList = mact.GetRuleList(); Assert.AreNotEqual(null, ruleList); Assert.AreEqual(93, ruleList.Count); From 4554b0d5adf241831bb71c05fa32384e33c2f556 Mon Sep 17 00:00:00 2001 From: prashelke Date: Thu, 1 Aug 2024 17:12:27 +0530 Subject: [PATCH 3/8] Updated --- .../AccessibilityConfiguration.cs | 3 ++- .../ActionsLib/UI/Web/AccessiblityTests.cs | 23 ++++++++++--------- 2 files changed, 14 insertions(+), 12 deletions(-) diff --git a/Ginger/GingerCoreCommon/External/Configurations/AccessibilityConfiguration.cs b/Ginger/GingerCoreCommon/External/Configurations/AccessibilityConfiguration.cs index 344fae57b9..24bd2164ce 100644 --- a/Ginger/GingerCoreCommon/External/Configurations/AccessibilityConfiguration.cs +++ b/Ginger/GingerCoreCommon/External/Configurations/AccessibilityConfiguration.cs @@ -32,7 +32,7 @@ public class AccessibilityConfiguration : RepositoryItemBase private string mName; [IsSerializedForLocalRepository] public string Name { get { return mName; } set { if (mName != value) { mName = value; OnPropertyChanged(nameof(Name)); } } } - public override string ItemName { get => "Accessibility Configuration"; set { /* set logic here */ } } + string mDefaultExcludeRules; [IsSerializedForLocalRepository] @@ -52,5 +52,6 @@ public string DefaultExcludeRules } } + public override string ItemName { get => throw new NotImplementedException(); set => throw new NotImplementedException(); } } } diff --git a/Ginger/GingerCoreNETUnitTest/ActionsLib/UI/Web/AccessiblityTests.cs b/Ginger/GingerCoreNETUnitTest/ActionsLib/UI/Web/AccessiblityTests.cs index 947a78d84e..db5fb1be60 100644 --- a/Ginger/GingerCoreNETUnitTest/ActionsLib/UI/Web/AccessiblityTests.cs +++ b/Ginger/GingerCoreNETUnitTest/ActionsLib/UI/Web/AccessiblityTests.cs @@ -47,21 +47,20 @@ public class AccessiblityTests static ActAccessibilityTesting mact; IWebElement e = null; - [TestInitialize()] - public static void TestInit(TestContext TC) + [ClassInitialize()] + public static void ClassInit(TestContext TC) { - if (!OperatingSystem.IsLinux()) + if (!OperatingSystem.IsWindows()) { return; } - mact = new ActAccessibilityTesting(); mact.GetOrCreateInputParam(ActAccessibilityTesting.Fields.Target, ActAccessibilityTesting.eTarget.Page); mact.SeverityList = GetSeverityList(); mact.StandardList = GetStandardTagslist(); } - [TestCleanup] + [ClassCleanup] public static void ClassCleanup() { _driver.Quit(); @@ -76,7 +75,7 @@ public void InitDriver() [TestMethod] public void TestAnalyzerAccessibility_Standard_Failed() { - if (!OperatingSystem.IsLinux()) + if (!OperatingSystem.IsWindows()) { return; } @@ -94,7 +93,7 @@ public void TestAnalyzerAccessibility_Standard_Failed() [TestMethod] public void TestAnalyzerAccessibility_Severity_Failed() { - if (!OperatingSystem.IsLinux()) + if (!OperatingSystem.IsWindows()) { return; } @@ -110,9 +109,10 @@ public void TestAnalyzerAccessibility_Severity_Failed() } [TestMethod] + [Ignore] public void TestAnalyzerAccessibility_Standard_Pass() { - if (!OperatingSystem.IsLinux()) + if (!OperatingSystem.IsWindows()) { return; } @@ -129,9 +129,10 @@ public void TestAnalyzerAccessibility_Standard_Pass() } [TestMethod] + [Ignore] public void TestAnalyzerAccessibility_Severity_Pass() { - if (!OperatingSystem.IsLinux()) + if (!OperatingSystem.IsWindows()) { return; } @@ -151,7 +152,7 @@ public void TestAnalyzerAccessibility_Severity_Pass() [TestCategory(TestCategory.UnitTest)] public void TestCreateAxeBuilder_IsNotNull() { - if (!OperatingSystem.IsLinux()) + if (!OperatingSystem.IsWindows()) { return; } @@ -164,7 +165,7 @@ public void TestCreateAxeBuilder_IsNotNull() [TestCategory(TestCategory.UnitTest)] public void TestGetRuleList_isNotNull() { - if (!OperatingSystem.IsLinux()) + if (!OperatingSystem.IsWindows()) { return; } From eac3961ab8876b628ff9baaed892f88d8fbed111 Mon Sep 17 00:00:00 2001 From: prashelke Date: Thu, 1 Aug 2024 17:21:46 +0530 Subject: [PATCH 4/8] Update Test --- .../ActionsLib/UI/Web/AccessiblityTests.cs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Ginger/GingerCoreNETUnitTest/ActionsLib/UI/Web/AccessiblityTests.cs b/Ginger/GingerCoreNETUnitTest/ActionsLib/UI/Web/AccessiblityTests.cs index db5fb1be60..d7a8818795 100644 --- a/Ginger/GingerCoreNETUnitTest/ActionsLib/UI/Web/AccessiblityTests.cs +++ b/Ginger/GingerCoreNETUnitTest/ActionsLib/UI/Web/AccessiblityTests.cs @@ -66,7 +66,7 @@ public static void ClassCleanup() _driver.Quit(); } - public void InitDriver() + public static void InitDriver() { //// Initialize the WebDriver (Chrome in this case) _driver = new ChromeDriver(); From d9b80dd68ef75ff15b345f1d06a76a79c1d72039 Mon Sep 17 00:00:00 2001 From: prashelke Date: Mon, 5 Aug 2024 19:36:51 +0530 Subject: [PATCH 5/8] Accessibility configuration xml Added --- Ginger/.editorconfig | 1 - .../AccessibilityRulePage.xaml.cs | 25 ++++++------ .../SolutionWindows/AddSolutionPage.xaml.cs | 1 + .../AccessibilityConfiguration.cs | 28 ++++++++++---- .../Configurations/AccessibilityRuleData.cs | 12 ++++-- .../Repository/GingerSolutionRepository.cs | 5 ++- .../UI/Web/ActAccessibilityTesting.cs | 38 ++++++++++++++----- Ginger/GingerCoreNET/GeneralLib/General.cs | 15 ++++++++ .../ActionsLib/UI/Web/AccessiblityTests.cs | 38 +++++++++++-------- 9 files changed, 112 insertions(+), 51 deletions(-) diff --git a/Ginger/.editorconfig b/Ginger/.editorconfig index 1d5ec4144e..6624fe59dc 100644 --- a/Ginger/.editorconfig +++ b/Ginger/.editorconfig @@ -75,7 +75,6 @@ csharp_style_prefer_extended_property_pattern = true:suggestion csharp_style_var_for_built_in_types = true:none csharp_style_var_when_type_is_apparent = true:none csharp_style_var_elsewhere = true:none -csharp_indent_braces = true [*.vb] #### Naming styles #### diff --git a/Ginger/Ginger/SolutionWindows/AccessibilityRulePage.xaml.cs b/Ginger/Ginger/SolutionWindows/AccessibilityRulePage.xaml.cs index d1e0e1339c..0a1b4ef340 100644 --- a/Ginger/Ginger/SolutionWindows/AccessibilityRulePage.xaml.cs +++ b/Ginger/Ginger/SolutionWindows/AccessibilityRulePage.xaml.cs @@ -1,8 +1,11 @@ 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; @@ -40,10 +43,9 @@ public AccessibilityRulePage() WorkSpace.Instance.PropertyChanged += WorkSpacePropertyChanged; LoadGridData(); SetAppsGrid(); - mAccessibilityConfiguration = new(); - DefaultExcludeRulesList = WorkSpace.Instance.Solution.DefaultExcludeRule.DefaultExcludeRules?.Split(',').ToList() ?? new List(); + mAccessibilityConfiguration = WorkSpace.Instance.SolutionRepository.GetFirstRepositoryItem(); + mAccessibilityConfiguration.DefaultExcludeRule = mAccessibilityConfiguration.DefaultExcludeRule != null ? mAccessibilityConfiguration.DefaultExcludeRule : new (); } - private void WorkSpacePropertyChanged(object sender, System.ComponentModel.PropertyChangedEventArgs e) { if (e.PropertyName == nameof(WorkSpace.Solution)) @@ -117,24 +119,21 @@ private void CheckBox_Click(object sender, RoutedEventArgs e) { // Do something with data, for example: data.Active = checkBox.IsChecked ?? false; - WorkSpace.Instance.Solution.DefaultExcludeRule.StartDirtyTracking(); + mAccessibilityConfiguration.StartDirtyTracking(); if (!data.Active) { - if (!DefaultExcludeRulesList.Any(x => x.Equals(data.RuleID))) + if (!mAccessibilityConfiguration.DefaultExcludeRule.Any(x => x.Equals(data.RuleID))) { - DefaultExcludeRulesList.Add(data.RuleID); - - mAccessibilityConfiguration.DefaultExcludeRules = String.Join(",", DefaultExcludeRulesList.Select(x => x)); - WorkSpace.Instance.Solution.DefaultExcludeRule = mAccessibilityConfiguration; + mAccessibilityConfiguration.DefaultExcludeRule.Add(data); } + } else { - if (DefaultExcludeRulesList.Any(x => x.Equals(data.RuleID))) + if (mAccessibilityConfiguration.DefaultExcludeRule.Any(x => x.Equals(data.RuleID))) { - DefaultExcludeRulesList.Remove(data.RuleID); - mAccessibilityConfiguration.DefaultExcludeRules = String.Join(",", DefaultExcludeRulesList.Select(x => x)); - WorkSpace.Instance.Solution.DefaultExcludeRule = mAccessibilityConfiguration; + mAccessibilityConfiguration.DefaultExcludeRule.Remove(data); + } } } diff --git a/Ginger/Ginger/SolutionWindows/AddSolutionPage.xaml.cs b/Ginger/Ginger/SolutionWindows/AddSolutionPage.xaml.cs index 28769f22c3..4305a2a632 100644 --- a/Ginger/Ginger/SolutionWindows/AddSolutionPage.xaml.cs +++ b/Ginger/Ginger/SolutionWindows/AddSolutionPage.xaml.cs @@ -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); diff --git a/Ginger/GingerCoreCommon/External/Configurations/AccessibilityConfiguration.cs b/Ginger/GingerCoreCommon/External/Configurations/AccessibilityConfiguration.cs index 24bd2164ce..5c5f7fa768 100644 --- a/Ginger/GingerCoreCommon/External/Configurations/AccessibilityConfiguration.cs +++ b/Ginger/GingerCoreCommon/External/Configurations/AccessibilityConfiguration.cs @@ -18,6 +18,7 @@ limitations under the License. using System; using System.Collections.Generic; +using System.Data; using System.Linq; using System.Text; using System.Threading.Tasks; @@ -34,24 +35,37 @@ public class AccessibilityConfiguration : RepositoryItemBase public string Name { get { return mName; } set { if (mName != value) { mName = value; OnPropertyChanged(nameof(Name)); } } } - string mDefaultExcludeRules; + + ObservableList mDefaultExcludeRule; [IsSerializedForLocalRepository] - public string DefaultExcludeRules + public ObservableList DefaultExcludeRule { get { - return mDefaultExcludeRules; + return mDefaultExcludeRule; } set { - if (mDefaultExcludeRules != value) + if (mDefaultExcludeRule != value) { - mDefaultExcludeRules = value; - OnPropertyChanged(nameof(DefaultExcludeRules)); + mDefaultExcludeRule = value; + OnPropertyChanged(nameof(DefaultExcludeRule)); } } } - public override string ItemName { get => throw new NotImplementedException(); set => throw new NotImplementedException(); } + public override string ItemName + { + get + { + return this.Name; + } + set + { + this.Name = value; + } + } + + public override string GetNameForFileName() { return Name; } } } diff --git a/Ginger/GingerCoreCommon/External/Configurations/AccessibilityRuleData.cs b/Ginger/GingerCoreCommon/External/Configurations/AccessibilityRuleData.cs index 3c8d561976..abf8923c37 100644 --- a/Ginger/GingerCoreCommon/External/Configurations/AccessibilityRuleData.cs +++ b/Ginger/GingerCoreCommon/External/Configurations/AccessibilityRuleData.cs @@ -24,6 +24,8 @@ limitations under the License. using System.Threading.Tasks; using Amdocs.Ginger.Common; using Amdocs.Ginger.Repository; +using Ginger.Run; +using GingerCore; using Newtonsoft.Json; namespace Ginger.Configurations @@ -43,14 +45,14 @@ public class AccessibilityRuleData : RepositoryItemBase, INotifyPropertyChanged /// /// Gets or sets the Rule Id associated with the accessibility rule. /// - + [IsSerializedForLocalRepository] public string RuleID { get { return mRuleID; } set { if (mRuleID != value) { mRuleID = value; OnPropertyChanged(nameof(RuleID)); } } } private string mTags; /// /// Gets or sets the tags associated with the accessibility rule. /// - + public string Tags { get { return mTags; } set { if (mTags != value) { mTags = value; OnPropertyChanged(nameof(Tags)); } } } private string mImpact; @@ -70,7 +72,7 @@ public ObservableList GetAccessibilityRules(string Access { data = JsonConvert.DeserializeObject(AccessbiltyString); } - catch(Exception ex) + catch (Exception ex) { Reporter.ToLog(eLogLevel.ERROR, "Failed to deserialize accessibility rules.", ex); } @@ -83,10 +85,12 @@ public void OnPropertyChanged(string name) PropertyChanged?.Invoke(this, new PropertyChangedEventArgs(name)); } - } +} public class Root { public ObservableList accessibilityRules { get; set; } } + + } diff --git a/Ginger/GingerCoreCommon/Repository/GingerSolutionRepository.cs b/Ginger/GingerCoreCommon/Repository/GingerSolutionRepository.cs index 7faac129fb..8f92ae0ee3 100644 --- a/Ginger/GingerCoreCommon/Repository/GingerSolutionRepository.cs +++ b/Ginger/GingerCoreCommon/Repository/GingerSolutionRepository.cs @@ -1,4 +1,4 @@ -#region License +#region License /* Copyright © 2014-2024 European Support Limited @@ -19,6 +19,7 @@ limitations under the License. using System.IO; using Amdocs.Ginger.Common.Run; using Amdocs.Ginger.Repository; +using Ginger.Configurations; using Ginger.Reports; using Ginger.Run; using GingerCore; @@ -66,6 +67,8 @@ public static SolutionRepository CreateGingerSolutionRepository() SR.AddItemInfo("*.Ginger.RemoteServiceGrid.xml", SolutionRepository.cSolutionRootFolderSign + "RemoteServiceGrid", true, "RemoteServiceGrid", PropertyNameForFileName: nameof(RemoteServiceGrid.Name)); + SR.AddItemInfo("*.Ginger.Configuration.xml", SolutionRepository.cSolutionRootFolderSign + "Configurations", true, "AccessibilityConfiguration", PropertyNameForFileName: nameof(AccessibilityConfiguration.Name)); + return SR; } } diff --git a/Ginger/GingerCoreNET/ActionsLib/UI/Web/ActAccessibilityTesting.cs b/Ginger/GingerCoreNET/ActionsLib/UI/Web/ActAccessibilityTesting.cs index ec3bb39297..844834a891 100644 --- a/Ginger/GingerCoreNET/ActionsLib/UI/Web/ActAccessibilityTesting.cs +++ b/Ginger/GingerCoreNET/ActionsLib/UI/Web/ActAccessibilityTesting.cs @@ -18,6 +18,7 @@ limitations under the License. using amdocs.ginger.GingerCoreNET; using Amdocs.Ginger.Common; +using Amdocs.Ginger.Common.Enums; using Amdocs.Ginger.Common.GeneralLib; using Amdocs.Ginger.Common.InterfacesLib; using Amdocs.Ginger.Common.UIElement; @@ -305,7 +306,8 @@ public ObservableList RulesItemsdata public ObservableList GetRuleList() { AccessibilityRuleData AccessibilityRuleDataObjet = new AccessibilityRuleData(); - List DefaultExcludeRuleList = WorkSpace.Instance.Solution != null && WorkSpace.Instance.Solution.DefaultExcludeRule.DefaultExcludeRules != null ? WorkSpace.Instance.Solution.DefaultExcludeRule.DefaultExcludeRules.Split(',').ToList() : new(); + AccessibilityConfiguration mAccessibilityConfiguration = WorkSpace.Instance.SolutionRepository.GetFirstRepositoryItem(); + mAccessibilityConfiguration.DefaultExcludeRule = mAccessibilityConfiguration.DefaultExcludeRule != null ? mAccessibilityConfiguration.DefaultExcludeRule : new(); ObservableList ruleDatalist = new ObservableList(); try { @@ -313,7 +315,7 @@ public ObservableList GetRuleList() ruleDatalist = AccessibilityRuleDataObjet.GetAccessibilityRules(AccessbiltyString); foreach (AccessibilityRuleData ruleData in ruleDatalist) { - if (DefaultExcludeRuleList != null && DefaultExcludeRuleList.Contains(ruleData.RuleID)) + if (mAccessibilityConfiguration.DefaultExcludeRule != null && mAccessibilityConfiguration.DefaultExcludeRule.Select(x=>x.RuleID).Contains(ruleData.RuleID)) { ruleData.Active = false; } @@ -370,6 +372,8 @@ public enum ReportTypes All = 15 } + public override eImageType Image { get { return eImageType.Accessibility; } } + private static string GetAccessiblityrules() { return EmbeddedResourceProvider.ReadEmbeddedFile("AccessiblityRules.json"); @@ -853,21 +857,37 @@ public void SetAxeResultToAction(AxeResult axeResult) bool ActionResult = true; IEnumerable AcceptableSeverity = Enumerable.Empty().ToList(); IEnumerable Violationseverity = Enumerable.Empty().ToList(); - if (GetInputParamValue(ActAccessibilityTesting.Fields.Analyzer) == nameof(ActAccessibilityTesting.eAnalyzer.ByStandard) && SeverityList != null && SeverityList.Any()) + if (GetInputParamValue(ActAccessibilityTesting.Fields.Analyzer) == nameof(ActAccessibilityTesting.eAnalyzer.ByStandard)) { - AcceptableSeverity = SeverityList.Select(x => x.Value.ToLower()).ToList(); Violationseverity = axeResult.Violations.Any() ? axeResult.Violations.Select(x => x.Impact.ToLower()) : Enumerable.Empty().ToList(); - ActionResult = Violationseverity.Intersect(AcceptableSeverity).Any(); + if (SeverityList != null && SeverityList.Any()) + { + AcceptableSeverity = SeverityList.Select(x => x.Value.ToLower()).ToList(); + ActionResult = Violationseverity.Intersect(AcceptableSeverity).Any(); + } + else + { + ActionResult = Violationseverity.Any(); + } } - else if (GetInputParamValue(ActAccessibilityTesting.Fields.Analyzer) == nameof(ActAccessibilityTesting.eAnalyzer.BySeverity) && SeverityList != null && SeverityList.Any()) + else if (GetInputParamValue(ActAccessibilityTesting.Fields.Analyzer) == nameof(ActAccessibilityTesting.eAnalyzer.BySeverity)) { - List sevritylist = SeverityList.Select(x => x.Value.ToLower()).ToList(); Violationseverity = axeResult.Violations.Any() ? axeResult.Violations.Select(x => x.Impact.ToLower()) : Enumerable.Empty().ToList(); - foreach (string severity in sevritylist) + if (SeverityList != null && SeverityList.Any()) + { + List sevritylist = SeverityList.Select(x => x.Value.ToLower()).ToList(); + foreach (string severity in sevritylist) + { + ActionResult = Violationseverity.Any(y => y.Equals(severity)); + } + } + else { - ActionResult = Violationseverity.Any(y => y.Equals(severity)); + ActionResult = Violationseverity.Any(); } + } + var jsonresponse = JsonConvert.SerializeObject(axeResult, Newtonsoft.Json.Formatting.Indented); RawResponseValues = jsonresponse; AddOrUpdateReturnParamActual(ParamName: "Raw Response", ActualValue: jsonresponse); diff --git a/Ginger/GingerCoreNET/GeneralLib/General.cs b/Ginger/GingerCoreNET/GeneralLib/General.cs index 4ea3f75398..69061bcf26 100644 --- a/Ginger/GingerCoreNET/GeneralLib/General.cs +++ b/Ginger/GingerCoreNET/GeneralLib/General.cs @@ -21,6 +21,7 @@ limitations under the License. using Amdocs.Ginger.Common.Repository.SolutionCategories; using Amdocs.Ginger.CoreNET.Run.SolutionCategory; using Amdocs.Ginger.Repository; +using Ginger.Configurations; using GingerCore; using GingerCore.Actions; using GingerCore.ALM; @@ -615,6 +616,20 @@ public static string CreateReportLinkPerFlow(string HtmlReportUrl, string Execut } return ""; } + + public static bool CreateDefaultAccessiblityconfiguration() + { + if (!WorkSpace.Instance.SolutionRepository.GetAllRepositoryItems().Any()) + { + AccessibilityConfiguration newAccessibilityConfiguration = new AccessibilityConfiguration() { Name = "Accessibility" }; + WorkSpace.Instance.SolutionRepository.AddRepositoryItem(newAccessibilityConfiguration); + return true; + } + else + { + return false; + } + } } } diff --git a/Ginger/GingerCoreNETUnitTest/ActionsLib/UI/Web/AccessiblityTests.cs b/Ginger/GingerCoreNETUnitTest/ActionsLib/UI/Web/AccessiblityTests.cs index d7a8818795..c4535b77de 100644 --- a/Ginger/GingerCoreNETUnitTest/ActionsLib/UI/Web/AccessiblityTests.cs +++ b/Ginger/GingerCoreNETUnitTest/ActionsLib/UI/Web/AccessiblityTests.cs @@ -28,6 +28,7 @@ limitations under the License. using GingerCoreNETUnitTest.WorkSpaceLib; using GingerTestHelper; using Microsoft.VisualStudio.TestTools.UnitTesting; +using OfficeOpenXml.Attributes; using OpenQA.Selenium; using OpenQA.Selenium.Chrome; using System; @@ -39,7 +40,6 @@ namespace GingerCoreNETUnitTest.ActionsLib.UI.Web { [TestClass] [TestCategory(TestCategory.IntegrationTest)] - [Ignore] public class AccessiblityTests { @@ -54,10 +54,7 @@ public static void ClassInit(TestContext TC) { return; } - mact = new ActAccessibilityTesting(); - mact.GetOrCreateInputParam(ActAccessibilityTesting.Fields.Target, ActAccessibilityTesting.eTarget.Page); - mact.SeverityList = GetSeverityList(); - mact.StandardList = GetStandardTagslist(); + _driver = new ChromeDriver(); } [ClassCleanup] @@ -71,83 +68,94 @@ public static void InitDriver() //// Initialize the WebDriver (Chrome in this case) _driver = new ChromeDriver(); } + public static void CleanDriver() + { + _driver.Quit(); + } [TestMethod] + [TestProperty("ExecutionOrder", "1")] public void TestAnalyzerAccessibility_Standard_Failed() { if (!OperatingSystem.IsWindows()) { return; } - InitDriver(); _driver.Navigate().GoToUrl($"https://ginger.amdocs.com/"); + mact = new ActAccessibilityTesting(); + mact.GetOrCreateInputParam(ActAccessibilityTesting.Fields.Target, ActAccessibilityTesting.eTarget.Page); mact.GetOrCreateInputParam(ActAccessibilityTesting.Fields.Analyzer, ActAccessibilityTesting.eAnalyzer.ByStandard); if (mact.GetInputParamValue(ActAccessibilityTesting.Fields.Analyzer) == nameof(ActAccessibilityTesting.eAnalyzer.ByStandard)) { mact.SeverityList = new ObservableList(); + mact.StandardList = GetStandardTagslist(); } mact.AnalyzerAccessibility(_driver, e); Assert.AreEqual(mact.Status,Amdocs.Ginger.CoreNET.Execution.eRunStatus.Failed); } [TestMethod] + [TestProperty("ExecutionOrder", "2")] public void TestAnalyzerAccessibility_Severity_Failed() { if (!OperatingSystem.IsWindows()) { return; } - InitDriver(); _driver.Navigate().GoToUrl($"https://ginger.amdocs.com/"); + mact = new ActAccessibilityTesting(); + mact.GetOrCreateInputParam(ActAccessibilityTesting.Fields.Target, ActAccessibilityTesting.eTarget.Page); mact.GetOrCreateInputParam(ActAccessibilityTesting.Fields.Analyzer, ActAccessibilityTesting.eAnalyzer.BySeverity); if (mact.GetInputParamValue(ActAccessibilityTesting.Fields.Analyzer) == nameof(ActAccessibilityTesting.eAnalyzer.BySeverity)) { + mact.SeverityList = GetSeverityList(); mact.SeverityList.RemoveAt(1); } mact.AnalyzerAccessibility(_driver, e); Assert.AreEqual(mact.Status, Amdocs.Ginger.CoreNET.Execution.eRunStatus.Failed); } - [TestMethod] - [Ignore] + [TestProperty("ExecutionOrder", "3")] public void TestAnalyzerAccessibility_Standard_Pass() { if (!OperatingSystem.IsWindows()) { return; } - InitDriver(); string htmlFilePath = Path.Combine(TestResources.GetTestResourcesFolder("Html"), "TestAccessiblity.html"); _driver.Navigate().GoToUrl(htmlFilePath); + mact = new ActAccessibilityTesting(); + mact.GetOrCreateInputParam(ActAccessibilityTesting.Fields.Target, ActAccessibilityTesting.eTarget.Page); mact.GetOrCreateInputParam(ActAccessibilityTesting.Fields.Analyzer, ActAccessibilityTesting.eAnalyzer.ByStandard); if (mact.GetInputParamValue(ActAccessibilityTesting.Fields.Analyzer) == nameof(ActAccessibilityTesting.eAnalyzer.ByStandard)) { mact.SeverityList = new ObservableList(); + mact.StandardList = GetStandardTagslist(); } mact.AnalyzerAccessibility(_driver, e); Assert.AreEqual(mact.Status, Amdocs.Ginger.CoreNET.Execution.eRunStatus.Passed); } - [TestMethod] - [Ignore] + [TestProperty("ExecutionOrder", "4")] public void TestAnalyzerAccessibility_Severity_Pass() { if (!OperatingSystem.IsWindows()) { return; } - InitDriver(); string htmlFilePath = Path.Combine(TestResources.GetTestResourcesFolder("Html"), "TestAccessiblity.html"); _driver.Navigate().GoToUrl(htmlFilePath); + mact = new ActAccessibilityTesting(); + mact.GetOrCreateInputParam(ActAccessibilityTesting.Fields.Target, ActAccessibilityTesting.eTarget.Page); mact.GetOrCreateInputParam(ActAccessibilityTesting.Fields.Analyzer, ActAccessibilityTesting.eAnalyzer.BySeverity); if (mact.GetInputParamValue(ActAccessibilityTesting.Fields.Analyzer) == nameof(ActAccessibilityTesting.eAnalyzer.BySeverity)) { + mact.SeverityList = GetSeverityList(); mact.SeverityList.RemoveAt(1); } mact.AnalyzerAccessibility(_driver, e); Assert.AreEqual(mact.Status, Amdocs.Ginger.CoreNET.Execution.eRunStatus.Passed); } - [TestMethod] [TestCategory(TestCategory.UnitTest)] public void TestCreateAxeBuilder_IsNotNull() @@ -156,11 +164,9 @@ public void TestCreateAxeBuilder_IsNotNull() { return; } - InitDriver(); AxeBuilder axeBuilder = mact.CreateAxeBuilder(_driver); Assert.AreNotEqual(null, axeBuilder); } - [TestMethod] [TestCategory(TestCategory.UnitTest)] public void TestGetRuleList_isNotNull() From 3cea8eb40b4afa4fe53d94cf01dbca649e4939ec Mon Sep 17 00:00:00 2001 From: prashelke Date: Tue, 6 Aug 2024 17:37:53 +0530 Subject: [PATCH 6/8] Accessiblity Review comment handled --- .../AccessibilityRulePage.xaml.cs | 43 ++++++++----------- .../AccessibilityConfiguration.cs | 12 +++--- .../Configurations/AccessibilityRuleData.cs | 1 + .../GingerCoreCommon/WorkSpaceLib/Solution.cs | 23 +--------- .../UI/Web/ActAccessibilityTesting.cs | 35 ++++++++++++--- .../AccessiblityRules.json | 8 ---- Ginger/GingerCoreNET/GeneralLib/General.cs | 18 +++++--- .../GingerCoreNET/WorkSpaceLib/WorkSpace.cs | 1 + .../ActionsLib/UI/Web/AccessiblityTests.cs | 6 ++- 9 files changed, 72 insertions(+), 75 deletions(-) diff --git a/Ginger/Ginger/SolutionWindows/AccessibilityRulePage.xaml.cs b/Ginger/Ginger/SolutionWindows/AccessibilityRulePage.xaml.cs index 0a1b4ef340..e8777425e1 100644 --- a/Ginger/Ginger/SolutionWindows/AccessibilityRulePage.xaml.cs +++ b/Ginger/Ginger/SolutionWindows/AccessibilityRulePage.xaml.cs @@ -33,31 +33,23 @@ public partial class AccessibilityRulePage : Page { Solution mSolution; string AppName; - List DefaultExcludeRulesList; private AccessibilityConfiguration mAccessibilityConfiguration; + private static ActAccessibilityTesting actAccessibilityTesting; public AccessibilityRulePage() { InitializeComponent(); mSolution = WorkSpace.Instance.Solution; string allProperties = string.Empty; - WorkSpace.Instance.PropertyChanged += WorkSpacePropertyChanged; + actAccessibilityTesting = new ActAccessibilityTesting(); LoadGridData(); SetAppsGrid(); - mAccessibilityConfiguration = WorkSpace.Instance.SolutionRepository.GetFirstRepositoryItem(); - mAccessibilityConfiguration.DefaultExcludeRule = mAccessibilityConfiguration.DefaultExcludeRule != null ? mAccessibilityConfiguration.DefaultExcludeRule : new (); - } - private void WorkSpacePropertyChanged(object sender, System.ComponentModel.PropertyChangedEventArgs e) - { - if (e.PropertyName == nameof(WorkSpace.Solution)) - { - mSolution = WorkSpace.Instance.Solution; - LoadGridData(); - } + mAccessibilityConfiguration = !WorkSpace.Instance.SolutionRepository.GetAllRepositoryItems().Any() ? new AccessibilityConfiguration() : WorkSpace.Instance.SolutionRepository.GetFirstRepositoryItem(); + 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))}", saveAllHandler: SaveHandler, null, true); + 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(); view.GridColsView.Add(new GridColView() @@ -98,7 +90,7 @@ private void SetAppsGrid() ReadOnly = true }); - xAccessibilityRulesGrid.AddLabel("Note: We will analyze the active items from the list below for accessibility. Testing and deactivating items won't be taken into account for accessibility testing."); + xAccessibilityRulesGrid.AddLabel("Note: Ginger will only analyze the active accessibility testing rules; inactive rules will not be considered."); xAccessibilityRulesGrid.SetAllColumnsDefaultView(view); xAccessibilityRulesGrid.InitViewItems(); @@ -106,7 +98,6 @@ private void SetAppsGrid() private void LoadGridData() { - ActAccessibilityTesting actAccessibilityTesting = new ActAccessibilityTesting(); List sortedList = actAccessibilityTesting.RulesItemsdata.OrderByDescending(data => !data.Active).ToList(); ObservableList accessibilityRuleDatas = [.. sortedList]; xAccessibilityRulesGrid.DataSourceList = accessibilityRuleDatas; @@ -122,26 +113,26 @@ private void CheckBox_Click(object sender, RoutedEventArgs e) mAccessibilityConfiguration.StartDirtyTracking(); if (!data.Active) { - if (!mAccessibilityConfiguration.DefaultExcludeRule.Any(x => x.Equals(data.RuleID))) + if(!mAccessibilityConfiguration.ExcludedRules.Any()) + { + GingerCoreNET.GeneralLib.General.CreateDefaultAccessiblityconfiguration(); + mAccessibilityConfiguration = WorkSpace.Instance.SolutionRepository.GetFirstRepositoryItem(); + mAccessibilityConfiguration.ExcludedRules = mAccessibilityConfiguration.ExcludedRules != null ? mAccessibilityConfiguration.ExcludedRules : new(); + } + + if (!mAccessibilityConfiguration.ExcludedRules.Any(x => x.Equals(data.RuleID))) { - mAccessibilityConfiguration.DefaultExcludeRule.Add(data); + mAccessibilityConfiguration.ExcludedRules.Add(data); } - } else { - if (mAccessibilityConfiguration.DefaultExcludeRule.Any(x => x.Equals(data.RuleID))) + if (mAccessibilityConfiguration.ExcludedRules.Any(x => x.Equals(data.RuleID))) { - mAccessibilityConfiguration.DefaultExcludeRule.Remove(data); - + mAccessibilityConfiguration.ExcludedRules.Remove(data); } } } } - - private void SaveHandler(object sender, RoutedEventArgs e) - { - mSolution.SolutionOperations.SaveSolution(true, Solution.eSolutionItemToSave.DefaultExcludeRule); - } } } diff --git a/Ginger/GingerCoreCommon/External/Configurations/AccessibilityConfiguration.cs b/Ginger/GingerCoreCommon/External/Configurations/AccessibilityConfiguration.cs index 5c5f7fa768..33ac90fb56 100644 --- a/Ginger/GingerCoreCommon/External/Configurations/AccessibilityConfiguration.cs +++ b/Ginger/GingerCoreCommon/External/Configurations/AccessibilityConfiguration.cs @@ -36,20 +36,20 @@ public class AccessibilityConfiguration : RepositoryItemBase - ObservableList mDefaultExcludeRule; + ObservableList mExcludedRules; [IsSerializedForLocalRepository] - public ObservableList DefaultExcludeRule + public ObservableList ExcludedRules { get { - return mDefaultExcludeRule; + return mExcludedRules; } set { - if (mDefaultExcludeRule != value) + if (mExcludedRules != value) { - mDefaultExcludeRule = value; - OnPropertyChanged(nameof(DefaultExcludeRule)); + mExcludedRules = value; + OnPropertyChanged(nameof(ExcludedRules)); } } } diff --git a/Ginger/GingerCoreCommon/External/Configurations/AccessibilityRuleData.cs b/Ginger/GingerCoreCommon/External/Configurations/AccessibilityRuleData.cs index abf8923c37..8ccc775ec5 100644 --- a/Ginger/GingerCoreCommon/External/Configurations/AccessibilityRuleData.cs +++ b/Ginger/GingerCoreCommon/External/Configurations/AccessibilityRuleData.cs @@ -68,6 +68,7 @@ public class AccessibilityRuleData : RepositoryItemBase, INotifyPropertyChanged public ObservableList GetAccessibilityRules(string AccessbiltyString) { Root data = new(); + data.accessibilityRules = []; try { data = JsonConvert.DeserializeObject(AccessbiltyString); diff --git a/Ginger/GingerCoreCommon/WorkSpaceLib/Solution.cs b/Ginger/GingerCoreCommon/WorkSpaceLib/Solution.cs index 161cdaa844..9dbd9c5482 100644 --- a/Ginger/GingerCoreCommon/WorkSpaceLib/Solution.cs +++ b/Ginger/GingerCoreCommon/WorkSpaceLib/Solution.cs @@ -51,10 +51,9 @@ public class Solution : RepositoryItemBase, ISolution public Solution() { Tags = new ObservableList(); - DefaultExcludeRule = new AccessibilityConfiguration(); } - public enum eSolutionItemToSave { GeneralDetails, TargetApplications, GlobalVariabels, Tags, ALMSettings, SourceControlSettings, LoggerConfiguration, ReportConfiguration, DefaultExcludeRule } + public enum eSolutionItemToSave { GeneralDetails, TargetApplications, GlobalVariabels, Tags, ALMSettings, SourceControlSettings, LoggerConfiguration, ReportConfiguration } string mName; [IsSerializedForLocalRepository] @@ -80,26 +79,6 @@ public string Name public ObservableList Tags; - private AccessibilityConfiguration mDefaultExcludeRule; - - [IsSerializedForLocalRepository] - public AccessibilityConfiguration DefaultExcludeRule - { - get - { - return mDefaultExcludeRule; - } - set - { - if (mDefaultExcludeRule != value) - { - mDefaultExcludeRule = value; - OnPropertyChanged(nameof(DefaultExcludeRule)); - } - } - } - - private string mAccount; /// diff --git a/Ginger/GingerCoreNET/ActionsLib/UI/Web/ActAccessibilityTesting.cs b/Ginger/GingerCoreNET/ActionsLib/UI/Web/ActAccessibilityTesting.cs index 844834a891..8e6e521ff5 100644 --- a/Ginger/GingerCoreNET/ActionsLib/UI/Web/ActAccessibilityTesting.cs +++ b/Ginger/GingerCoreNET/ActionsLib/UI/Web/ActAccessibilityTesting.cs @@ -306,16 +306,31 @@ public ObservableList RulesItemsdata public ObservableList GetRuleList() { AccessibilityRuleData AccessibilityRuleDataObjet = new AccessibilityRuleData(); - AccessibilityConfiguration mAccessibilityConfiguration = WorkSpace.Instance.SolutionRepository.GetFirstRepositoryItem(); - mAccessibilityConfiguration.DefaultExcludeRule = mAccessibilityConfiguration.DefaultExcludeRule != null ? mAccessibilityConfiguration.DefaultExcludeRule : new(); - ObservableList ruleDatalist = new ObservableList(); + AccessibilityConfiguration mAccessibilityConfiguration = new (); + if (WorkSpace.Instance.SolutionRepository != null) + { + if(!WorkSpace.Instance.SolutionRepository.GetAllRepositoryItems().Any()) + { + mAccessibilityConfiguration = new(); + } + else + { + mAccessibilityConfiguration = WorkSpace.Instance.SolutionRepository.GetFirstRepositoryItem(); + } + } + else + { + mAccessibilityConfiguration = new (); + } + mAccessibilityConfiguration.ExcludedRules = mAccessibilityConfiguration.ExcludedRules != null ? mAccessibilityConfiguration.ExcludedRules : new(); + ObservableList ruleDatalist = new (); try { string AccessbiltyString = GetAccessiblityrules(); ruleDatalist = AccessibilityRuleDataObjet.GetAccessibilityRules(AccessbiltyString); foreach (AccessibilityRuleData ruleData in ruleDatalist) { - if (mAccessibilityConfiguration.DefaultExcludeRule != null && mAccessibilityConfiguration.DefaultExcludeRule.Select(x=>x.RuleID).Contains(ruleData.RuleID)) + if (mAccessibilityConfiguration.ExcludedRules != null && mAccessibilityConfiguration.ExcludedRules.Select(x=>x.RuleID).Contains(ruleData.RuleID)) { ruleData.Active = false; } @@ -328,7 +343,7 @@ public ObservableList GetRuleList() catch (Exception ex) { Error = "Error: during accessibility testing:" + ex.Message; - Reporter.ToLog(eLogLevel.ERROR, "Error: during accessibility testing", ex); + Reporter.ToLog(eLogLevel.ERROR, $"Error: during accessibility testing in GetRuleList. Configuration: {mAccessibilityConfiguration?.Name}", ex); } return ruleDatalist; } @@ -376,7 +391,15 @@ public enum ReportTypes private static string GetAccessiblityrules() { - return EmbeddedResourceProvider.ReadEmbeddedFile("AccessiblityRules.json"); + try + { + return EmbeddedResourceProvider.ReadEmbeddedFile("AccessiblityRules.json"); + } + catch (Exception ex) + { + Reporter.ToLog(eLogLevel.ERROR, "Error reading accessibility rules from embedded file", ex); + return string.Empty; + } } public void CreateAxeHtmlReport(ISearchContext context, AxeResult results, string destination, ReportTypes requestedResults) diff --git a/Ginger/GingerCoreNET/Drivers/CoreDrivers/Web/Selenium/AccessibilityTestResources/AccessiblityRules.json b/Ginger/GingerCoreNET/Drivers/CoreDrivers/Web/Selenium/AccessibilityTestResources/AccessiblityRules.json index 58cad31aa0..d543b1b93b 100644 --- a/Ginger/GingerCoreNET/Drivers/CoreDrivers/Web/Selenium/AccessibilityTestResources/AccessiblityRules.json +++ b/Ginger/GingerCoreNET/Drivers/CoreDrivers/Web/Selenium/AccessibilityTestResources/AccessiblityRules.json @@ -32,14 +32,6 @@ "Issue Type": "failure, needs review", "ACT Rules": "97a4e1" }, - { - "RuleID": "summary-name", - "Description": "Ensure summary elements have discernible text", - "Impact": "Serious", - "Tags": "cat.name-role-value, wcag2a, wcag412, section508, section508.22.a, TTv5, TT6.a, EN-301-549, EN-9.4.1.2", - "Issue Type": "failure, needs review", - "ACT Rules": "" - }, { "RuleID": "aria-conditional-attr", "Description": "Ensure ARIA attributes are used as described in the specification of the element's role", diff --git a/Ginger/GingerCoreNET/GeneralLib/General.cs b/Ginger/GingerCoreNET/GeneralLib/General.cs index 69061bcf26..87dc093959 100644 --- a/Ginger/GingerCoreNET/GeneralLib/General.cs +++ b/Ginger/GingerCoreNET/GeneralLib/General.cs @@ -619,14 +619,22 @@ public static string CreateReportLinkPerFlow(string HtmlReportUrl, string Execut public static bool CreateDefaultAccessiblityconfiguration() { - if (!WorkSpace.Instance.SolutionRepository.GetAllRepositoryItems().Any()) + try { - AccessibilityConfiguration newAccessibilityConfiguration = new AccessibilityConfiguration() { Name = "Accessibility" }; - WorkSpace.Instance.SolutionRepository.AddRepositoryItem(newAccessibilityConfiguration); - return true; + if (!WorkSpace.Instance.SolutionRepository.GetAllRepositoryItems().Any()) + { + AccessibilityConfiguration newAccessibilityConfiguration = new AccessibilityConfiguration() { Name = "Accessibility" }; + WorkSpace.Instance.SolutionRepository.AddRepositoryItem(newAccessibilityConfiguration); + return true; + } + else + { + return false; + } } - else + catch (Exception ex) { + Reporter.ToLog(eLogLevel.ERROR, "Error creating default accessibility configuration", ex); return false; } } diff --git a/Ginger/GingerCoreNET/WorkSpaceLib/WorkSpace.cs b/Ginger/GingerCoreNET/WorkSpaceLib/WorkSpace.cs index 7886fc61e7..4f2c88c273 100644 --- a/Ginger/GingerCoreNET/WorkSpaceLib/WorkSpace.cs +++ b/Ginger/GingerCoreNET/WorkSpaceLib/WorkSpace.cs @@ -414,6 +414,7 @@ private void CheckForExistingEnterpriseFeaturesConfiguration() { WorkSpace.Instance.UserProfile.ShowEnterpriseFeatures = true; } + } public bool OpenSolution(string solutionFolder, string encryptionKey = null) diff --git a/Ginger/GingerCoreNETUnitTest/ActionsLib/UI/Web/AccessiblityTests.cs b/Ginger/GingerCoreNETUnitTest/ActionsLib/UI/Web/AccessiblityTests.cs index c4535b77de..88ef5d02cc 100644 --- a/Ginger/GingerCoreNETUnitTest/ActionsLib/UI/Web/AccessiblityTests.cs +++ b/Ginger/GingerCoreNETUnitTest/ActionsLib/UI/Web/AccessiblityTests.cs @@ -44,7 +44,7 @@ public class AccessiblityTests { private static IWebDriver _driver; - static ActAccessibilityTesting mact; + ActAccessibilityTesting mact; IWebElement e = null; [ClassInitialize()] @@ -164,6 +164,7 @@ public void TestCreateAxeBuilder_IsNotNull() { return; } + mact = new ActAccessibilityTesting(); AxeBuilder axeBuilder = mact.CreateAxeBuilder(_driver); Assert.AreNotEqual(null, axeBuilder); } @@ -175,9 +176,10 @@ public void TestGetRuleList_isNotNull() { return; } + mact = new ActAccessibilityTesting(); ObservableList ruleList = mact.GetRuleList(); Assert.AreNotEqual(null, ruleList); - Assert.AreEqual(93, ruleList.Count); + Assert.AreEqual(92, ruleList.Count); } public static ObservableList GetStandardTagslist() From d53461ebb0bf94ba34b55381b0da37ff5f284d3c Mon Sep 17 00:00:00 2001 From: prashelke Date: Tue, 6 Aug 2024 18:51:24 +0530 Subject: [PATCH 7/8] Updated --- .../SolutionWindows/AccessibilityRulePage.xaml.cs | 1 - .../ActionsLib/UI/Web/ActAccessibilityTesting.cs | 7 ++++--- .../ActionsLib/UI/Web/AccessiblityTests.cs | 13 ++++++------- 3 files changed, 10 insertions(+), 11 deletions(-) diff --git a/Ginger/Ginger/SolutionWindows/AccessibilityRulePage.xaml.cs b/Ginger/Ginger/SolutionWindows/AccessibilityRulePage.xaml.cs index e8777425e1..bf99462967 100644 --- a/Ginger/Ginger/SolutionWindows/AccessibilityRulePage.xaml.cs +++ b/Ginger/Ginger/SolutionWindows/AccessibilityRulePage.xaml.cs @@ -40,7 +40,6 @@ public AccessibilityRulePage() InitializeComponent(); mSolution = WorkSpace.Instance.Solution; string allProperties = string.Empty; - actAccessibilityTesting = new ActAccessibilityTesting(); LoadGridData(); SetAppsGrid(); mAccessibilityConfiguration = !WorkSpace.Instance.SolutionRepository.GetAllRepositoryItems().Any() ? new AccessibilityConfiguration() : WorkSpace.Instance.SolutionRepository.GetFirstRepositoryItem(); diff --git a/Ginger/GingerCoreNET/ActionsLib/UI/Web/ActAccessibilityTesting.cs b/Ginger/GingerCoreNET/ActionsLib/UI/Web/ActAccessibilityTesting.cs index 8e6e521ff5..4aa0d09510 100644 --- a/Ginger/GingerCoreNET/ActionsLib/UI/Web/ActAccessibilityTesting.cs +++ b/Ginger/GingerCoreNET/ActionsLib/UI/Web/ActAccessibilityTesting.cs @@ -306,7 +306,7 @@ public ObservableList RulesItemsdata public ObservableList GetRuleList() { AccessibilityRuleData AccessibilityRuleDataObjet = new AccessibilityRuleData(); - AccessibilityConfiguration mAccessibilityConfiguration = new (); + AccessibilityConfiguration mAccessibilityConfiguration; if (WorkSpace.Instance.SolutionRepository != null) { if(!WorkSpace.Instance.SolutionRepository.GetAllRepositoryItems().Any()) @@ -323,7 +323,7 @@ public ObservableList GetRuleList() mAccessibilityConfiguration = new (); } mAccessibilityConfiguration.ExcludedRules = mAccessibilityConfiguration.ExcludedRules != null ? mAccessibilityConfiguration.ExcludedRules : new(); - ObservableList ruleDatalist = new (); + ObservableList ruleDatalist; try { string AccessbiltyString = GetAccessiblityrules(); @@ -339,13 +339,14 @@ public ObservableList GetRuleList() ruleData.Active = true; } } + return ruleDatalist; } catch (Exception ex) { Error = "Error: during accessibility testing:" + ex.Message; Reporter.ToLog(eLogLevel.ERROR, $"Error: during accessibility testing in GetRuleList. Configuration: {mAccessibilityConfiguration?.Name}", ex); } - return ruleDatalist; + return []; } private Dictionary _items; diff --git a/Ginger/GingerCoreNETUnitTest/ActionsLib/UI/Web/AccessiblityTests.cs b/Ginger/GingerCoreNETUnitTest/ActionsLib/UI/Web/AccessiblityTests.cs index 88ef5d02cc..f2abb5c965 100644 --- a/Ginger/GingerCoreNETUnitTest/ActionsLib/UI/Web/AccessiblityTests.cs +++ b/Ginger/GingerCoreNETUnitTest/ActionsLib/UI/Web/AccessiblityTests.cs @@ -44,7 +44,6 @@ public class AccessiblityTests { private static IWebDriver _driver; - ActAccessibilityTesting mact; IWebElement e = null; [ClassInitialize()] @@ -82,7 +81,7 @@ public void TestAnalyzerAccessibility_Standard_Failed() return; } _driver.Navigate().GoToUrl($"https://ginger.amdocs.com/"); - mact = new ActAccessibilityTesting(); + ActAccessibilityTesting mact = new ActAccessibilityTesting(); mact.GetOrCreateInputParam(ActAccessibilityTesting.Fields.Target, ActAccessibilityTesting.eTarget.Page); mact.GetOrCreateInputParam(ActAccessibilityTesting.Fields.Analyzer, ActAccessibilityTesting.eAnalyzer.ByStandard); if (mact.GetInputParamValue(ActAccessibilityTesting.Fields.Analyzer) == nameof(ActAccessibilityTesting.eAnalyzer.ByStandard)) @@ -103,7 +102,7 @@ public void TestAnalyzerAccessibility_Severity_Failed() return; } _driver.Navigate().GoToUrl($"https://ginger.amdocs.com/"); - mact = new ActAccessibilityTesting(); + ActAccessibilityTesting mact = new ActAccessibilityTesting(); mact.GetOrCreateInputParam(ActAccessibilityTesting.Fields.Target, ActAccessibilityTesting.eTarget.Page); mact.GetOrCreateInputParam(ActAccessibilityTesting.Fields.Analyzer, ActAccessibilityTesting.eAnalyzer.BySeverity); if (mact.GetInputParamValue(ActAccessibilityTesting.Fields.Analyzer) == nameof(ActAccessibilityTesting.eAnalyzer.BySeverity)) @@ -124,7 +123,7 @@ public void TestAnalyzerAccessibility_Standard_Pass() } string htmlFilePath = Path.Combine(TestResources.GetTestResourcesFolder("Html"), "TestAccessiblity.html"); _driver.Navigate().GoToUrl(htmlFilePath); - mact = new ActAccessibilityTesting(); + ActAccessibilityTesting mact = new ActAccessibilityTesting(); mact.GetOrCreateInputParam(ActAccessibilityTesting.Fields.Target, ActAccessibilityTesting.eTarget.Page); mact.GetOrCreateInputParam(ActAccessibilityTesting.Fields.Analyzer, ActAccessibilityTesting.eAnalyzer.ByStandard); if (mact.GetInputParamValue(ActAccessibilityTesting.Fields.Analyzer) == nameof(ActAccessibilityTesting.eAnalyzer.ByStandard)) @@ -145,7 +144,7 @@ public void TestAnalyzerAccessibility_Severity_Pass() } string htmlFilePath = Path.Combine(TestResources.GetTestResourcesFolder("Html"), "TestAccessiblity.html"); _driver.Navigate().GoToUrl(htmlFilePath); - mact = new ActAccessibilityTesting(); + ActAccessibilityTesting mact = new ActAccessibilityTesting(); mact.GetOrCreateInputParam(ActAccessibilityTesting.Fields.Target, ActAccessibilityTesting.eTarget.Page); mact.GetOrCreateInputParam(ActAccessibilityTesting.Fields.Analyzer, ActAccessibilityTesting.eAnalyzer.BySeverity); if (mact.GetInputParamValue(ActAccessibilityTesting.Fields.Analyzer) == nameof(ActAccessibilityTesting.eAnalyzer.BySeverity)) @@ -164,7 +163,7 @@ public void TestCreateAxeBuilder_IsNotNull() { return; } - mact = new ActAccessibilityTesting(); + ActAccessibilityTesting mact = new ActAccessibilityTesting(); AxeBuilder axeBuilder = mact.CreateAxeBuilder(_driver); Assert.AreNotEqual(null, axeBuilder); } @@ -176,7 +175,7 @@ public void TestGetRuleList_isNotNull() { return; } - mact = new ActAccessibilityTesting(); + ActAccessibilityTesting mact = new ActAccessibilityTesting(); ObservableList ruleList = mact.GetRuleList(); Assert.AreNotEqual(null, ruleList); Assert.AreEqual(92, ruleList.Count); From b5f8ed8a866f6bfd8330bf84e78af82697cb2efb Mon Sep 17 00:00:00 2001 From: prashelke Date: Tue, 6 Aug 2024 20:00:47 +0530 Subject: [PATCH 8/8] Updated --- Ginger/Ginger/SolutionWindows/AccessibilityRulePage.xaml.cs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Ginger/Ginger/SolutionWindows/AccessibilityRulePage.xaml.cs b/Ginger/Ginger/SolutionWindows/AccessibilityRulePage.xaml.cs index bf99462967..9950bbbcce 100644 --- a/Ginger/Ginger/SolutionWindows/AccessibilityRulePage.xaml.cs +++ b/Ginger/Ginger/SolutionWindows/AccessibilityRulePage.xaml.cs @@ -34,7 +34,7 @@ public partial class AccessibilityRulePage : Page Solution mSolution; string AppName; private AccessibilityConfiguration mAccessibilityConfiguration; - private static ActAccessibilityTesting actAccessibilityTesting; + private static ActAccessibilityTesting actAccessibilityTesting = new ActAccessibilityTesting(); public AccessibilityRulePage() { InitializeComponent();