[][src]Module augdom::testing

Quoting from DOM Testing Library's motivations, as this crate's test utilities are similar in design:

The more your tests resemble the way your software is used, the more confidence they can give you.

As part of this goal, the utilities this library provides facilitate querying the DOM in the same way the user would. Finding form elements by their label text (just like a user would), finding links and buttons from their text (like a user would), and more.

These tools lend themselves to this basic test design:

  1. setup test DOM
  2. execute user-oriented queries to find nodes of interest (see Query::find and Finder::by_label_text)
  3. fire events as a user would (see crate::Dom::dispatch)
  4. wait for async queries to complete (see Found::until and Until)
  5. assert on results

TODO write examples that work in doctests

Structs

Finder

Executes a search strategy over a DOM container's subtree via depth-first pre-order traversal.

Found

The final description of a subtree query. The methods on this struct execute the underlying search and return the results in various forms.

Until

A query which resolves asynchronously

Enums

Key

A keyboard "key" which can be entered.

QueryError

The outcome of a failed query.

Traits

Query

A type which can be queried as a DOM container, returning results from its subtree.

TargetExt

Convenience methods for dispatching events to targets, primarily useful for testing.