playwright-blazor-testing

Automate Blazor UI testing with Playwright for navigation, authentication, and SignalR updates.

1.1k|101|Updated Nov 12, 2025
One-click install
npx skills add https://github.com/Aaronontheweb/dotnet-skills --skill playwright-blazor-testing
Or copy as Structured Prompt for Agent
Please help me install this Agent Skill.
Skill: playwright-blazor-testing
Source: https://github.com/Aaronontheweb/dotnet-skills/tree/main/skills/playwright-blazor
Command: npx skills add https://github.com/Aaronontheweb/dotnet-skills --skill playwright-blazor-testing

SYSTEM DOCUMENTATION & REQUIREMENTS

What problem does it solve?

Blazor UI testing can be error-prone, time-consuming, and brittle without reliable end-to-end tests. This Skill provides ready-to-use Playwright patterns to validate navigation, authentication, and real-time updates in Blazor apps.

Core Features & Use Cases

  • End-to-end UI testing for Blazor Server and WebAssembly deployments.
  • Robust navigation, component interaction, authentication flows, and SignalR updates.
  • Stable selectors using data-test attributes and accessible roles.
  • Quick Start includes a minimal test scaffold and examples.

Quick Start

  • Install Playwright and browsers using pwsh -Command "playwright install --with-deps"
  • Create a new .NET test project: dotnet new xunit -n BlazorUITests
  • Add the Playwright NuGet package: dotnet add package Microsoft.Playwright
  • Run an initial test to navigate to your Blazor app and verify a heading, e.g. https://localhost:5001

Frequently Asked Questions about playwright-blazor-testing

High-intent search queries and answers about installing and using this skill.

FAQPage Schema
How do I write end-to-end UI tests for Blazor apps with Playwright?

End-to-end UI testing for Blazor apps with Playwright involves using robust selectors like data-test attributes and accessible roles to validate navigation, component interaction, and authentication flows across Server and WebAssembly deployments.

Does Playwright support testing SignalR real-time updates in Blazor?

Yes, Playwright supports testing SignalR real-time updates in Blazor by automating UI interactions and verifying that live component updates render correctly across both Blazor Server and WebAssembly hosting models.

What do I need to set up Playwright tests for a Blazor application?

To set up Playwright tests for a Blazor application, you need to install Playwright, .NET tooling, and browser binaries, then create an xUnit test project and add the Microsoft.Playwright NuGet package.

Can I use Playwright to test authentication flows in Blazor WebAssembly?

You can use Playwright to test authentication flows in Blazor WebAssembly by automating navigation and component interaction sequences using stable selectors to verify user login states and secured UI access.

What is the best way to create stable selectors for Blazor UI testing?

The best way to create stable selectors for Blazor UI testing is using data-test attributes and accessible roles, which ensures selectors remain robust against dynamic rendering changes and DOM mutations during end-to-end test execution.

Why are my Playwright tests for Blazor components error-prone and brittle?

Playwright tests for Blazor components become error-prone and brittle without reliable end-to-end test patterns, but using stable data-test selectors and accessible roles for navigation and component interaction resolves this fragility.