SnowBank.Testing.Framework.Playwright
7.4.3-rc.2
dotnet add package SnowBank.Testing.Framework.Playwright --version 7.4.3-rc.2
NuGet\Install-Package SnowBank.Testing.Framework.Playwright -Version 7.4.3-rc.2
<PackageReference Include="SnowBank.Testing.Framework.Playwright" Version="7.4.3-rc.2" />
<PackageVersion Include="SnowBank.Testing.Framework.Playwright" Version="7.4.3-rc.2" />
<PackageReference Include="SnowBank.Testing.Framework.Playwright" />
paket add SnowBank.Testing.Framework.Playwright --version 7.4.3-rc.2
#r "nuget: SnowBank.Testing.Framework.Playwright, 7.4.3-rc.2"
#:package SnowBank.Testing.Framework.Playwright@7.4.3-rc.2
#addin nuget:?package=SnowBank.Testing.Framework.Playwright&version=7.4.3-rc.2&prerelease
#tool nuget:?package=SnowBank.Testing.Framework.Playwright&version=7.4.3-rc.2&prerelease
SnowBank.Testing.Framework.Playwright
A virtual web browser component for the SnowBank distributed-test framework, backed by a real Playwright-driven Chromium.
Concept
The SnowBank distributed-test framework (SnowBank.Testing.Framework) lets you spin up several simulated hosts (web hosts, agents, services) on an in-memory virtual network inside a single test, with all of their traffic routed in-process, without real sockets or TCP ports.
This package adds a browser to that network: a real Chromium instance, driven through Playwright, whose HTTP and WebSocket traffic is routed onto the same virtual network. So a genuine browser renders and drives the pages served by your simulated web hosts, end-to-end, with no external server to start and no free port to allocate.
The browser is exposed as an ordinary Playwright IPage (via browser.Page), so everything you already know from Playwright works unchanged (GotoAsync, locators, ClickAsync, ContentAsync, screenshots).
Chromium is downloaded automatically the first time a test runs.
How to use
Add the package to your test project (it pulls in Microsoft.Playwright):
dotnet add package SnowBank.Testing.Framework.Playwright
Then, in a DistributedTest, put a web host and a browser on the same virtual LAN and drive the browser with the standard Playwright API:
public class MyBrowserFacts : DistributedTest
{
[Test]
public async Task Browser_Renders_A_Page_Served_On_The_Virtual_Network()
{
var context = await MakeItSo(env => env.AddSimpleLan(lan =>
{
// a simulated web host serving a page
lan.WithMinimalWebHost("WEB", host =>
{
host.ConfigureApplication(app =>
app.MapGet("/", () => Results.Content("<html><body>hello</body></html>", "text/html")));
});
// a real Chromium on the same virtual network
lan.WithPlaywrightBrowser("BROWSER");
}));
var web = context.GetWebHost("WEB");
var browser = context.GetPlaywrightBrowser("BROWSER");
// `browser.Page` is a standard Playwright IPage; the request is routed over the virtual network
var response = await browser.Page.GotoAsync(web.GetUri("/").ToString(), new() { WaitUntil = WaitUntilState.Load });
Assert.That(response!.Ok, Is.True);
var body = await browser.Page.ContentAsync();
Assert.That(body, Does.Contain("hello"));
}
}
Options
WithPlaywrightBrowser(id, configure) exposes a few options through its builder:
WithVirtualClock(): run the page under a virtual clock, advanced explicitly by the test, for deterministic time-dependent UI.WithRemoteDebugging(port): expose the browser's Chrome DevTools Protocol (CDP) endpoint on a real loopback port, so an external controller (an inspector, or an agent-driven Playwright client) can attach withconnectOverCDPand co-drive the same browser while the component keeps owning all virtual routing.WithBrowserOptions(o => ...)/WithContextOptions(o => ...): tweak the Chromium launch and browser-context options (viewport, UserAgent, ...) on top of the component's defaults, without replacing the whole options object.WithInitScript(js): inject a context-level init script, evaluated before the first page, for application-specific instrumentation (runs after the package's own scripts).WithConsoleFormatter(msg => ...): reformat or drop JS-console lines routed to the test journal (returnnullto drop a line); the default formatting applies when this is not set.WithSnapshots(o => ...): capture full-page screenshots viabrowser.Snapshots.CaptureAsync(page, "label", ct)into the per-test output directory, plus anindex.htmlcontact sheet written at teardown.ConfigureServices/ConfigureApplicationandOnStartup/OnShutdown: the usual host-configuration and lifecycle hooks.
The PlaywrightPageExtensions helpers add convenience methods on top of the raw IPage, for example WaitForPageReadyAsync (wait until a page has settled: DOM ready, network quiet, and optionally an application-readiness predicate you pass).
Note: these tests drive a real Chromium, so they are heavier than pure unit tests and are usually marked
[Explicit]. Chromium is installed automatically on first run.
| Product | Versions Compatible and additional computed target framework versions. |
|---|---|
| .NET | net8.0 is compatible. net8.0-android was computed. net8.0-browser was computed. net8.0-ios was computed. net8.0-maccatalyst was computed. net8.0-macos was computed. net8.0-tvos was computed. net8.0-windows was computed. net9.0 was computed. net9.0-android was computed. net9.0-browser was computed. net9.0-ios was computed. net9.0-maccatalyst was computed. net9.0-macos was computed. net9.0-tvos was computed. net9.0-windows was computed. 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. net11.0 is compatible. |
-
net10.0
- Grpc.AspNetCore (>= 2.80.0)
- Grpc.Tools (>= 2.81.1)
- Microsoft.AspNetCore.Mvc.Testing (>= 10.0.10)
- Microsoft.AspNetCore.SignalR.Client (>= 10.0.10)
- Microsoft.Extensions.Configuration.Binder (>= 10.0.10)
- Microsoft.Extensions.DependencyInjection (>= 10.0.10)
- Microsoft.Extensions.DependencyInjection.Abstractions (>= 10.0.10)
- Microsoft.Extensions.Hosting (>= 10.0.10)
- Microsoft.Extensions.Hosting.Abstractions (>= 10.0.10)
- Microsoft.Extensions.Http (>= 10.0.10)
- Microsoft.Extensions.Logging (>= 10.0.10)
- Microsoft.Extensions.Logging.Abstractions (>= 10.0.10)
- Microsoft.Extensions.Logging.Configuration (>= 10.0.10)
- Microsoft.Extensions.Options (>= 10.0.10)
- Microsoft.Extensions.TimeProvider.Testing (>= 8.10.0)
- Microsoft.IO.RecyclableMemoryStream (>= 3.0.1)
- Microsoft.Net.Http.Headers (>= 10.0.10)
- Microsoft.NET.Test.Sdk (>= 18.8.1)
- Microsoft.Playwright (>= 1.61.0)
- Microsoft.TestPlatform.TestHost (>= 18.8.1)
- NodaTime (>= 3.3.3)
- NodaTime.Testing (>= 3.3.3)
- NUnit (>= 4.6.1)
- NUnit.Console (>= 3.22.0)
- NUnit.ConsoleRunner (>= 3.22.0)
- OpenTelemetry.Api (>= 1.16.0)
- OpenTelemetry.Exporter.OpenTelemetryProtocol (>= 1.16.0)
- SnowBank.Testing.Framework (>= 7.4.3-rc.2)
- StructuredFieldValues (>= 0.7.7)
- System.Configuration.ConfigurationManager (>= 10.0.10)
- System.IO.Hashing (>= 10.0.10)
-
net11.0
- Grpc.AspNetCore (>= 2.80.0)
- Grpc.Tools (>= 2.81.1)
- Microsoft.AspNetCore.Mvc.Testing (>= 11.0.0-preview.6.26359.118)
- Microsoft.AspNetCore.SignalR.Client (>= 11.0.0-preview.6.26359.118)
- Microsoft.Extensions.Configuration.Binder (>= 11.0.0-preview.6.26359.118)
- Microsoft.Extensions.DependencyInjection (>= 11.0.0-preview.6.26359.118)
- Microsoft.Extensions.Hosting (>= 11.0.0-preview.6.26359.118)
- Microsoft.Extensions.Http (>= 11.0.0-preview.6.26359.118)
- Microsoft.Extensions.Logging (>= 11.0.0-preview.6.26359.118)
- Microsoft.Extensions.Logging.Configuration (>= 11.0.0-preview.6.26359.118)
- Microsoft.Extensions.TimeProvider.Testing (>= 8.10.0)
- Microsoft.IO.RecyclableMemoryStream (>= 3.0.1)
- Microsoft.Net.Http.Headers (>= 11.0.0-preview.6.26359.118)
- Microsoft.NET.Test.Sdk (>= 18.8.1)
- Microsoft.Playwright (>= 1.61.0)
- Microsoft.TestPlatform.TestHost (>= 18.8.1)
- NodaTime (>= 3.3.3)
- NodaTime.Testing (>= 3.3.3)
- NUnit (>= 4.6.1)
- NUnit.Console (>= 3.22.0)
- NUnit.ConsoleRunner (>= 3.22.0)
- OpenTelemetry.Api (>= 1.16.0)
- OpenTelemetry.Exporter.OpenTelemetryProtocol (>= 1.16.0)
- SnowBank.Testing.Framework (>= 7.4.3-rc.2)
- StructuredFieldValues (>= 0.7.7)
- System.Configuration.ConfigurationManager (>= 11.0.0-preview.6.26359.118)
- System.IO.Hashing (>= 11.0.0-preview.6.26359.118)
-
net8.0
- Grpc.AspNetCore (>= 2.80.0)
- Grpc.Tools (>= 2.81.1)
- Microsoft.AspNetCore.Mvc.Testing (>= 8.0.29)
- Microsoft.AspNetCore.SignalR.Client (>= 10.0.10)
- Microsoft.Bcl.TimeProvider (>= 10.0.10)
- Microsoft.Extensions.Configuration.Binder (>= 10.0.10)
- Microsoft.Extensions.DependencyInjection (>= 10.0.10)
- Microsoft.Extensions.DependencyInjection.Abstractions (>= 10.0.10)
- Microsoft.Extensions.Hosting (>= 10.0.10)
- Microsoft.Extensions.Hosting.Abstractions (>= 10.0.10)
- Microsoft.Extensions.Http (>= 10.0.10)
- Microsoft.Extensions.Logging (>= 10.0.10)
- Microsoft.Extensions.Logging.Abstractions (>= 10.0.10)
- Microsoft.Extensions.Logging.Configuration (>= 10.0.10)
- Microsoft.Extensions.Options (>= 10.0.10)
- Microsoft.Extensions.TimeProvider.Testing (>= 8.10.0)
- Microsoft.IO.RecyclableMemoryStream (>= 3.0.1)
- Microsoft.Net.Http.Headers (>= 8.0.29)
- Microsoft.NET.Test.Sdk (>= 18.8.1)
- Microsoft.Playwright (>= 1.61.0)
- Microsoft.TestPlatform.TestHost (>= 18.8.1)
- NodaTime (>= 3.3.3)
- NodaTime.Testing (>= 3.3.3)
- NUnit (>= 4.6.1)
- NUnit.Console (>= 3.22.0)
- NUnit.ConsoleRunner (>= 3.22.0)
- OpenTelemetry.Api (>= 1.16.0)
- OpenTelemetry.Exporter.OpenTelemetryProtocol (>= 1.16.0)
- SnowBank.Testing.Framework (>= 7.4.3-rc.2)
- StructuredFieldValues (>= 0.7.7)
- System.Configuration.ConfigurationManager (>= 10.0.10)
- System.IO.Hashing (>= 10.0.10)
- System.IO.Pipelines (>= 10.0.10)
- System.Text.Json (>= 10.0.10)
- System.Threading.Channels (>= 10.0.10)
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 |
|---|---|---|
| 7.4.3-rc.2 | 44 | 8/3/2026 |
| 7.4.3-rc.1 | 42 | 7/30/2026 |
| 7.4.2 | 63 | 7/13/2026 |