CymruBlazor.Testing.Axe 1.13.0

dotnet add package CymruBlazor.Testing.Axe --version 1.13.0
                    
NuGet\Install-Package CymruBlazor.Testing.Axe -Version 1.13.0
                    
This command is intended to be used within the Package Manager Console in Visual Studio, as it uses the NuGet module's version of Install-Package.
<PackageReference Include="CymruBlazor.Testing.Axe" Version="1.13.0" />
                    
For projects that support PackageReference, copy this XML node into the project file to reference the package.
<PackageVersion Include="CymruBlazor.Testing.Axe" Version="1.13.0" />
                    
Directory.Packages.props
<PackageReference Include="CymruBlazor.Testing.Axe" />
                    
Project file
For projects that support Central Package Management (CPM), copy this XML node into the solution Directory.Packages.props file to version the package.
paket add CymruBlazor.Testing.Axe --version 1.13.0
                    
#r "nuget: CymruBlazor.Testing.Axe, 1.13.0"
                    
#r directive can be used in F# Interactive and Polyglot Notebooks. Copy this into the interactive tool or source code of the script to reference the package.
#:package CymruBlazor.Testing.Axe@1.13.0
                    
#:package directive can be used in C# file-based apps starting in .NET 10 preview 4. Copy this into a .cs file before any lines of code to reference the package.
#addin nuget:?package=CymruBlazor.Testing.Axe&version=1.13.0
                    
Install as a Cake Addin
#tool nuget:?package=CymruBlazor.Testing.Axe&version=1.13.0
                    
Install as a Cake Tool

CymruBlazor.Testing.Axe

Browser accessibility tests for apps built with CymruBlazor. It renders a component with bUnit, loads the markup with the library's own CSS into Chromium through Playwright, and scans it with axe-core, so it finds what depends on the CSS: contrast, focus visibility, hidden text, in the light, dark and high-contrast themes.

using CymruBlazor.Testing.Axe;

public sealed class ReferralFormAccessibilityTests : CymruAxeTestBase
{
    [Theory]
    [InlineData("light")]
    [InlineData("dark")]
    [InlineData("high-contrast")]
    public async Task Referral_form_has_no_violations(string theme)
    {
        var result = await ScanComponentAsync<ReferralForm>(theme: theme);

        result.ShouldHaveNoViolations();   // names each rule, how to fix it and the elements affected
    }
}

Install the browser once per machine, after building the test project once so the script exists:

pwsh bin/Debug/net10.0/playwright.ps1 install chromium
  • CymruAxeTestBase derives from CymruTestContext (from CymruBlazor.Testing, which this package brings), so you can also use bUnit assertions and ShouldHaveNoMarkupProblems() in the same class. ScanComponentAsync<T>() and ScanMarkupAsync() scan; GetPageAsync() gives you the Playwright page for tests that drive focus or the keyboard. The browser starts on the first scan.
  • AppCss: return the text of your own stylesheet to scan your overrides too.
  • CssDirectory: the library's stylesheet is read from the CymruBlazor package's static web assets, found from where CymruBlazor.dll was restored or from a web project's asset manifest. Override CssDirectory or set the CYMRUBLAZOR_CSS_DIR environment variable to the package's staticwebassets folder if neither works.
  • ShouldHaveNoViolations() throws CymruAxeViolationException (with Violations).

A scan covers what is rendered, so render the open state of a dialog or menu to scan it. Playwright is large (about 184 MB of packages) and needs a browser: keep these tests in a separate project from your bUnit tests. The Playwright and axe versions come with this package; if you reference Microsoft.Playwright yourself, use the same version.

The package version always matches the CymruBlazor version it was built against. See the testing guide.

Product Compatible and additional computed target framework versions.
.NET net10.0 is compatible.  net10.0-android was computed.  net10.0-browser was computed.  net10.0-ios was computed.  net10.0-maccatalyst was computed.  net10.0-macos was computed.  net10.0-tvos was computed.  net10.0-windows was computed. 
Compatible target framework(s)
Included target framework(s) (in package)
Learn more about Target Frameworks and .NET Standard.

NuGet packages

This package is not used by any NuGet packages.

GitHub repositories

This package is not used by any popular GitHub repositories.

Version Downloads Last Updated
1.13.0 0 10/12/2026