Skip to content
New issue

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

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

Already on GitHub? Sign in to your account

LMBQ-326: Adding AxeResultItemExtensions #353

Merged
merged 2 commits into from
Mar 28, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
16 changes: 16 additions & 0 deletions Lombiq.Tests.UI/Extensions/AxeResultItemExtensions.cs
Original file line number Diff line number Diff line change
@@ -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
{
/// <summary>
/// Asserts if <paramref name="axeResultItems"/> is empty, and if not then produces an error with <see
/// cref="AxeResultItem"/>s converted into human-readable strings.
/// </summary>
public static void AxeResultItemsShouldBeEmpty(this IEnumerable<AxeResultItem> axeResultItems) =>
axeResultItems.ShouldBeEmpty(AccessibilityCheckingConfiguration.AxeResultItemsToString(axeResultItems));
}
Original file line number Diff line number Diff line change
@@ -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;
Expand Down Expand Up @@ -62,8 +62,8 @@ public class AccessibilityCheckingConfiguration

public static readonly Action<AxeResult> AssertAxeResultIsEmpty = axeResult =>
{
axeResult.Violations.ShouldBeEmpty(AxeResultItemsToString(axeResult.Violations));
axeResult.Incomplete.ShouldBeEmpty(AxeResultItemsToString(axeResult.Incomplete));
axeResult.Violations.AxeResultItemsShouldBeEmpty();
axeResult.Incomplete.AxeResultItemsShouldBeEmpty();
};

public static readonly Func<IEnumerable<AxeResultItem>, string> AxeResultItemsToString =
Expand Down