Skip to content

Commit 566db7d

Browse files
committed
Revert "Code Quality: Added back settings tests (#18311)"
This reverts commit ec9713d.
1 parent 1adc3a4 commit 566db7d

2 files changed

Lines changed: 41 additions & 59 deletions

File tree

tests/Files.InteractionTests/Helper/AxeHelper.cs

Lines changed: 2 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -24,17 +24,9 @@ internal static void InitializeAxe()
2424
AccessibilityScanner = ScannerFactory.CreateScanner(config);
2525
}
2626

27-
public static void AssertNoAccessibilityErrors(Func<ScanResult, bool>? ignoredIssueFilter = null)
27+
public static void AssertNoAccessibilityErrors()
2828
{
29-
var testResult = AccessibilityScanner
30-
.Scan(null)
31-
.WindowScanOutputs
32-
.SelectMany(output => output.Errors)
33-
.Where(error => error.Rule.ID != RuleId.BoundingRectangleNotNull);
34-
35-
if (ignoredIssueFilter is not null)
36-
testResult = testResult.Where(error => !ignoredIssueFilter(error));
37-
29+
var testResult = AccessibilityScanner.Scan(null).WindowScanOutputs.SelectMany(output => output.Errors).Where(error => error.Rule.ID != RuleId.BoundingRectangleNotNull);
3830
if (testResult.Any())
3931
{
4032
StringBuilder sb = new();
@@ -48,17 +40,6 @@ public static void AssertNoAccessibilityErrors(Func<ScanResult, bool>? ignoredIs
4840
}
4941
}
5042

51-
public static bool IsCommunityToolkitWindowsIssue430(ScanResult result)
52-
{
53-
// CommunityToolkit/Windows#430: SettingsExpander internal controls can report
54-
// duplicate Name + LocalizedControlType until the toolkit fix lands.
55-
var description = result.Rule.Description;
56-
return !string.IsNullOrWhiteSpace(description)
57-
&& description.Contains("LocalizedControlType", StringComparison.OrdinalIgnoreCase)
58-
&& description.Contains("Name", StringComparison.OrdinalIgnoreCase)
59-
&& description.Contains("same", StringComparison.OrdinalIgnoreCase);
60-
}
61-
6243
private static string BuildAssertMessage(ScanResult result)
6344
{
6445
// e.g., "Element Button(50000) violated rule 'The Name property of a focusable element must not be null.'."

tests/Files.InteractionTests/Tests/SettingsTests.cs

Lines changed: 39 additions & 38 deletions
Original file line numberDiff line numberDiff line change
@@ -19,47 +19,48 @@ public void Cleanup()
1919
[TestMethod]
2020
public void VerifySettingsAreAccessible()
2121
{
22-
TestHelper.InvokeButtonById("SettingsButton");
23-
AxeHelper.AssertNoAccessibilityErrors(AxeHelper.IsCommunityToolkitWindowsIssue430);
22+
// TODO uncomment after https://github.com/CommunityToolkit/Windows/issues/430 is resolved
23+
//TestHelper.InvokeButtonById("SettingsButton");
24+
//AxeHelper.AssertNoAccessibilityErrors();
2425

25-
var settingsItems = new string[]
26-
{
27-
"SettingsItemGeneral",
28-
"SettingsItemAppearance",
29-
"SettingsItemLayout",
30-
"SettingsItemFolders",
31-
"SettingsItemActions",
32-
"SettingsItemTags",
33-
"SettingsItemDevTools",
34-
"SettingsItemAdvanced",
35-
"SettingsItemAbout"
36-
};
26+
//var settingsItems = new string[]
27+
//{
28+
// "SettingsItemGeneral",
29+
// "SettingsItemAppearance",
30+
// //"SettingsItemLayout", TODO find workaround for the "Group by" setting block issue
31+
// "SettingsItemFolders",
32+
// "SettingsItemActions",
33+
// "SettingsItemTags",
34+
// "SettingsItemDevTools",
35+
// "SettingsItemAdvanced",
36+
// "SettingsItemAbout"
37+
//};
3738

38-
foreach (var item in settingsItems)
39-
{
40-
for (int i = 0; i < 5; i++)
41-
{
42-
try
43-
{
44-
System.Console.WriteLine("Invoking button:" + item);
45-
System.Threading.Thread.Sleep(3000);
46-
TestHelper.InvokeButtonById(item);
47-
i = 1000;
48-
}
49-
catch (System.Exception exc)
50-
{
51-
System.Console.WriteLine("Failed to invoke the button:" + item + " with exception" + exc.Message);
52-
}
39+
//foreach (var item in settingsItems)
40+
//{
41+
// for (int i = 0; i < 5; i++)
42+
// {
43+
// try
44+
// {
45+
// Console.WriteLine("Invoking button:" + item);
46+
// Thread.Sleep(3000);
47+
// TestHelper.InvokeButtonById(item);
48+
// i = 1000;
49+
// }
50+
// catch (Exception exc)
51+
// {
52+
// Console.WriteLine("Failed to invoke the button:" + item + " with exception" + exc.Message);
53+
// }
5354

54-
}
55-
try
56-
{
57-
// First run can be flaky due to external components
58-
AxeHelper.AssertNoAccessibilityErrors(AxeHelper.IsCommunityToolkitWindowsIssue430);
59-
}
60-
catch (System.Exception) { }
61-
AxeHelper.AssertNoAccessibilityErrors(AxeHelper.IsCommunityToolkitWindowsIssue430);
62-
}
55+
// }
56+
// try
57+
// {
58+
// // First run can be flaky due to external components
59+
// AxeHelper.AssertNoAccessibilityErrors();
60+
// }
61+
// catch (System.Exception) { }
62+
// AxeHelper.AssertNoAccessibilityErrors();
63+
//}
6364
}
6465
}
6566
}

0 commit comments

Comments
 (0)