SnowBank.Testing.Framework.Playwright
7.4.2
dotnet add package SnowBank.Testing.Framework.Playwright --version 7.4.2
NuGet\Install-Package SnowBank.Testing.Framework.Playwright -Version 7.4.2
<PackageReference Include="SnowBank.Testing.Framework.Playwright" Version="7.4.2" />
<PackageVersion Include="SnowBank.Testing.Framework.Playwright" Version="7.4.2" />
<PackageReference Include="SnowBank.Testing.Framework.Playwright" />
paket add SnowBank.Testing.Framework.Playwright --version 7.4.2
#r "nuget: SnowBank.Testing.Framework.Playwright, 7.4.2"
#:package SnowBank.Testing.Framework.Playwright@7.4.2
#addin nuget:?package=SnowBank.Testing.Framework.Playwright&version=7.4.2
#tool nuget:?package=SnowBank.Testing.Framework.Playwright&version=7.4.2
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.ConfigureServices/ConfigureApplicationandOnStartup/OnShutdown: the usual host-configuration and lifecycle hooks.
The PlaywrightPageExtensions helpers add convenience methods on top of the raw IPage, for example waiting until a page has settled.
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.9)
- Microsoft.AspNetCore.SignalR.Client (>= 10.0.9)
- Microsoft.Extensions.Configuration.Binder (>= 10.0.9)
- Microsoft.Extensions.DependencyInjection (>= 10.0.9)
- Microsoft.Extensions.DependencyInjection.Abstractions (>= 10.0.9)
- Microsoft.Extensions.Hosting (>= 10.0.9)
- Microsoft.Extensions.Hosting.Abstractions (>= 10.0.9)
- Microsoft.Extensions.Http (>= 10.0.9)
- Microsoft.Extensions.Logging (>= 10.0.9)
- Microsoft.Extensions.Logging.Abstractions (>= 10.0.9)
- Microsoft.Extensions.Logging.Configuration (>= 10.0.9)
- Microsoft.Extensions.Options (>= 10.0.9)
- Microsoft.Extensions.TimeProvider.Testing (>= 8.10.0)
- Microsoft.IO.RecyclableMemoryStream (>= 3.0.1)
- Microsoft.Net.Http.Headers (>= 10.0.9)
- Microsoft.NET.Test.Sdk (>= 18.7.0)
- Microsoft.Playwright (>= 1.61.0)
- Microsoft.TestPlatform.TestHost (>= 18.7.0)
- Newtonsoft.Json (>= 13.0.4)
- NodaTime (>= 3.3.2)
- NodaTime.Testing (>= 3.3.2)
- 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.2)
- StructuredFieldValues (>= 0.7.7)
- System.Configuration.ConfigurationManager (>= 10.0.9)
- System.IO.Hashing (>= 10.0.9)
-
net11.0
- Grpc.AspNetCore (>= 2.80.0)
- Grpc.Tools (>= 2.81.1)
- Microsoft.AspNetCore.Mvc.Testing (>= 11.0.0-preview.5.26302.115)
- Microsoft.AspNetCore.SignalR.Client (>= 11.0.0-preview.5.26302.115)
- Microsoft.Extensions.Configuration.Binder (>= 11.0.0-preview.5.26302.115)
- Microsoft.Extensions.DependencyInjection (>= 11.0.0-preview.5.26302.115)
- Microsoft.Extensions.Hosting (>= 11.0.0-preview.5.26302.115)
- Microsoft.Extensions.Http (>= 11.0.0-preview.5.26302.115)
- Microsoft.Extensions.Logging (>= 11.0.0-preview.5.26302.115)
- Microsoft.Extensions.Logging.Configuration (>= 11.0.0-preview.5.26302.115)
- Microsoft.Extensions.TimeProvider.Testing (>= 8.10.0)
- Microsoft.IO.RecyclableMemoryStream (>= 3.0.1)
- Microsoft.Net.Http.Headers (>= 11.0.0-preview.5.26302.115)
- Microsoft.NET.Test.Sdk (>= 18.7.0)
- Microsoft.Playwright (>= 1.61.0)
- Microsoft.TestPlatform.TestHost (>= 18.7.0)
- Newtonsoft.Json (>= 13.0.4)
- NodaTime (>= 3.3.2)
- NodaTime.Testing (>= 3.3.2)
- 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.2)
- StructuredFieldValues (>= 0.7.7)
- System.Configuration.ConfigurationManager (>= 11.0.0-preview.5.26302.115)
- System.IO.Hashing (>= 11.0.0-preview.5.26302.115)
-
net8.0
- Grpc.AspNetCore (>= 2.80.0)
- Grpc.Tools (>= 2.81.1)
- Microsoft.AspNetCore.Mvc.Testing (>= 8.0.28)
- Microsoft.AspNetCore.SignalR.Client (>= 10.0.9)
- Microsoft.Bcl.TimeProvider (>= 10.0.9)
- Microsoft.Extensions.Configuration.Binder (>= 10.0.9)
- Microsoft.Extensions.DependencyInjection (>= 10.0.9)
- Microsoft.Extensions.DependencyInjection.Abstractions (>= 10.0.9)
- Microsoft.Extensions.Hosting (>= 10.0.9)
- Microsoft.Extensions.Hosting.Abstractions (>= 10.0.9)
- Microsoft.Extensions.Http (>= 10.0.9)
- Microsoft.Extensions.Logging (>= 10.0.9)
- Microsoft.Extensions.Logging.Abstractions (>= 10.0.9)
- Microsoft.Extensions.Logging.Configuration (>= 10.0.9)
- Microsoft.Extensions.Options (>= 10.0.9)
- Microsoft.Extensions.TimeProvider.Testing (>= 8.10.0)
- Microsoft.IO.RecyclableMemoryStream (>= 3.0.1)
- Microsoft.Net.Http.Headers (>= 8.0.28)
- Microsoft.NET.Test.Sdk (>= 18.7.0)
- Microsoft.Playwright (>= 1.61.0)
- Microsoft.TestPlatform.TestHost (>= 18.7.0)
- Newtonsoft.Json (>= 13.0.4)
- NodaTime (>= 3.3.2)
- NodaTime.Testing (>= 3.3.2)
- 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.2)
- StructuredFieldValues (>= 0.7.7)
- System.Configuration.ConfigurationManager (>= 10.0.9)
- System.IO.Hashing (>= 10.0.9)
- System.IO.Pipelines (>= 10.0.9)
- System.Text.Json (>= 10.0.9)
- System.Threading.Channels (>= 10.0.9)
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.2 | 52 | 7/13/2026 |