Precept.Web
Browser automation for Precept, built on Playwright: per-scenario isolation and automatic screenshot, trace and video capture on failure.
dotnet add package Precept.Web
services.AddPreceptWeb();
var page = await Browser.PageAsync();
await Assert.That(page).ToHaveTitleAsync(new Regex("Checkout"));
await Assert.That(page.GetByRole(AriaRole.Alert)).Not.ToBeVisibleAsync();
await Assert.That(page.GetByTestId("total"), "the basket total")
.Within(TimeSpan.FromSeconds(10))
.ToHaveTextAsync("£42.00");
Playwright's web-first assertions are mapped onto Precept's sentence, and the retrying stays Playwright's — Precept never polls on top of it — so these need no wait in front of them. A failure keeps Playwright's call log, which is the part that says what the page actually looked like on each attempt.
A test can hold more than one session — Browser.StartAsync("alice") alongside
Browser.StartAsync("bob"), two signed-in users in one scenario sharing a browser and nothing else —
and a suite can sign in once for the whole run rather than once per test.
The module needs Playwright's browsers on the machine, and installs the one it is configured for the first time a launch finds nothing to drive. To install by hand instead, after the first build:
pwsh bin/Debug/net10.0/playwright.ps1 install chromium
Part of Precept, a .NET 10 test automation framework. Full documentation: assertions on a page · page objects · installing browsers · signing in once · artifacts and logging