Meziantou.AspNetCore.Testing namespace

Classes

NameDescription
BrowserPageA page of a WebAppBrowser: navigate it, act on its elements, and check the result.
ClickOptionsConfigures a click.
DomSnapshotSnapshots of DOM subtrees: their HTML formatted for comparisons, and their accessibility tree.
ElementExtensionsThe user actions on the elements of a TestPage (see PageInput).
ElementNotFoundExceptionNo element matches the query.
ElementNotInteractableExceptionThe element cannot receive the input.
ExpectationFailedExceptionAn assertion of Expectations.Expect or Expectations.Expect is still false after its timeout.
ExpectationsThe entry point of the web-first assertions, as Assertions.Expect in Playwright. Import it with using static Meziantou.AspNetCore.Testing.Expectations;, then write await Expect(page.GetByRole("status")).ToHaveTextAsync("Saved");.
FakeClipboardA system clipboard for the tests: FakeClipboard.ProvideContent supplies what the pages paste or read, and FakeClipboard.ContentChanged is called with what they copy or write. Set it in BrowsingContextOptions.Clipboard with TestPageSettings.ConfigureBrowsingContext; the pages that use the same instance share it. Without it, each page has a clipboard of its own.
GetByRoleOptionsConfigures LocatorScope.GetByRole: the states of the elements to find.
LocatorFinds elements of a page, as the locators of Playwright: a locator is a query, evaluated again each time it is used, so it finds the new elements when the page renders again. The actions wait until the locator finds exactly one element and the element is actionable; the assertions of Expectations.Expect wait until they pass. A locator that finds more than one element where one is needed throws a StrictModeViolationException.
LocatorAssertionsThe assertions of a locator, as the web-first assertions of Playwright: each assertion runs the event loop of the page until it passes, and throws an ExpectationFailedException when it still fails after the timeout. The assertions on one element throw a StrictModeViolationException when the locator finds more than one.
LocatorFilterOptionsConfigures Locator.Filter: the conditions that the elements of a locator must satisfy.
LocatorScopeCreates the locators of the elements of a page, of a component or of the elements of another locator, as Playwright does. A locator finds its elements again each time it is used, so it keeps working when the page renders new elements. The texts are matched as substrings, ignoring the case and collapsing the white space, unless they are exact. The elements of the open shadow roots are found too.
MarkupOptionsConfigures the HTML snapshots of the DOM.
PageAssertionsThe assertions of a page, as the web-first assertions of Playwright: each assertion runs the event loop of the page until it passes, and throws an ExpectationFailedException when it still fails after the timeout.
PageInputPlays the user of the page: the mouse, the keyboard and the touch screen. The input is dispatched as trusted events with the default actions of a browser (focus, text input, clicks, form submission, scrolling, drag and drop); the pointer targets the element under the pointer (hit testing), so an element covered by another one does not get the clicks. As in Playwright, each action first waits until the element is actionable (attached, visible, stable, enabled, editable, not covered, depending on the action), then waits until the page is idle.
StrictModeViolationExceptionA locator finds more than one element where the action or the assertion needs exactly one (the strict mode of Playwright). Make the locator more specific, or use Locator.First, Locator.Last or Locator.Nth.
TestDocumentLoadersCreates the loaders that connect the pages to an application in memory, to an HTTP handler, or to folders.
TestPageA page of a browser engine written in .NET (Meziantou.Framework.WebPlatform), driven by a test: the user input, the queries of the elements, the waits, and the snapshots of the DOM, of the accessibility tree and of the pixels. A BrowserPage is a page of an application (see WebAppBrowser).
TestPageSettingsThe settings of the browsing context of a TestPage.
WebAppBrowserA browser connected to a web application: an ASP.NET Core application in memory (TestServer, for instance WebApplicationFactory.Server), or any server. Its pages share their cookies.
WebAppBrowserOptionsConfigures a WebAppBrowser and its pages.

Structs

NameDescription
ElementPositionA position in the border box of an element, in CSS pixels from its top-left corner.

Enums

NameDescription
LocatorStateThe state that Locator.WaitForAsync waits for.
MouseButtonA mouse button (the value of MouseEvent.button).