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
<PackageReference Include="CymruBlazor.Testing.Axe" Version="1.13.0" />
<PackageVersion Include="CymruBlazor.Testing.Axe" Version="1.13.0" />
<PackageReference Include="CymruBlazor.Testing.Axe" />
paket add CymruBlazor.Testing.Axe --version 1.13.0
#r "nuget: CymruBlazor.Testing.Axe, 1.13.0"
#:package CymruBlazor.Testing.Axe@1.13.0
#addin nuget:?package=CymruBlazor.Testing.Axe&version=1.13.0
#tool nuget:?package=CymruBlazor.Testing.Axe&version=1.13.0
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
CymruAxeTestBasederives fromCymruTestContext(fromCymruBlazor.Testing, which this package brings), so you can also use bUnit assertions andShouldHaveNoMarkupProblems()in the same class.ScanComponentAsync<T>()andScanMarkupAsync()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 whereCymruBlazor.dllwas restored or from a web project's asset manifest. OverrideCssDirectoryor set theCYMRUBLAZOR_CSS_DIRenvironment variable to the package'sstaticwebassetsfolder if neither works.ShouldHaveNoViolations()throwsCymruAxeViolationException(withViolations).
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 | Versions 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. |
-
net10.0
- CymruBlazor.Testing (>= 1.13.0)
- Deque.AxeCore.Playwright (>= 4.13.0)
- Microsoft.Playwright (>= 1.63.0)
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 |