Precept 0.14.0

Precept.Web

Browser automation for Precept, built on Playwright. Each scenario gets an isolated browser context, and a failing test captures a screenshot and a Playwright trace automatically. Video and network recording are a setting away.

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 assertion sentence. The retrying stays Playwright's, so these need no wait in front of them, and a failure keeps Playwright's call log, which shows what the page looked like on each attempt.

A test can hold more than one session. Browser.StartAsync("alice") and Browser.StartAsync("bob") give two signed-in users in one scenario, sharing a browser and nothing else. A suite can also sign in once for the whole run rather than once per test.

The module needs Playwright's browsers on the machine. The first time a launch finds no browser, it installs the one it is configured for. 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 framework built on Microsoft.Testing.Platform. Full documentation: browsers · assertions on a page · page objects · more than one user · signing in once · artifacts and logging

Precept 0.14.0 · MIT · © 2026

Esc