Overview

edit

Meziantou.AspNetCore.Testing runs your tests in a browser engine written in .NET (Meziantou.Framework.WebPlatform): the pages have a real DOM, the CSS applies, the layout computes the boxes, the scripts run, and the input of the tests goes through the hit testing of the page, as the input of a user does.

dotnet package add Meziantou.AspNetCore.Testing

The package tests two things:

You testUsePage
A Blazor component alone, with fake servicesComponentTestHostBlazor components
The pages of an application (MVC, Razor Pages, Blazor, minimal APIs...), in memory or on a serverWebAppBrowserWeb applications, Blazor applications

Both pages are a TestPage: they share the locators and the assertions (find the elements by role, label or text as Playwright does, wait until they are actionable, retry the assertions), the user input and the snapshots.