diff --git a/Lombiq.Tests.UI/Extensions/AxeResultItemExtensions.cs b/Lombiq.Tests.UI/Extensions/AxeResultItemExtensions.cs new file mode 100644 index 000000000..83d8b397d --- /dev/null +++ b/Lombiq.Tests.UI/Extensions/AxeResultItemExtensions.cs @@ -0,0 +1,16 @@ +using Lombiq.Tests.UI.Services; +using Selenium.Axe; +using Shouldly; +using System.Collections.Generic; + +namespace Lombiq.Tests.UI.Extensions; + +public static class AxeResultItemExtensions +{ + /// + /// Asserts if is empty, and if not then produces an error with s converted into human-readable strings. + /// + public static void AxeResultItemsShouldBeEmpty(this IEnumerable axeResultItems) => + axeResultItems.ShouldBeEmpty(AccessibilityCheckingConfiguration.AxeResultItemsToString(axeResultItems)); +} diff --git a/Lombiq.Tests.UI/Services/AccessibilityCheckingConfiguration.cs b/Lombiq.Tests.UI/Services/AccessibilityCheckingConfiguration.cs index 10fddfd52..3e9f80c13 100644 --- a/Lombiq.Tests.UI/Services/AccessibilityCheckingConfiguration.cs +++ b/Lombiq.Tests.UI/Services/AccessibilityCheckingConfiguration.cs @@ -1,6 +1,6 @@ +using Lombiq.Tests.UI.Extensions; using Lombiq.Tests.UI.Helpers; using Selenium.Axe; -using Shouldly; using System; using System.Collections.Generic; using System.Linq; @@ -62,8 +62,8 @@ public class AccessibilityCheckingConfiguration public static readonly Action AssertAxeResultIsEmpty = axeResult => { - axeResult.Violations.ShouldBeEmpty(AxeResultItemsToString(axeResult.Violations)); - axeResult.Incomplete.ShouldBeEmpty(AxeResultItemsToString(axeResult.Incomplete)); + axeResult.Violations.AxeResultItemsShouldBeEmpty(); + axeResult.Incomplete.AxeResultItemsShouldBeEmpty(); }; public static readonly Func, string> AxeResultItemsToString =