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:
- setup test DOM
- execute user-oriented queries to find nodes of interest (see
- fire events as a user would (see
- wait for async queries to complete (see
- assert on results
TODO write examples that work in doctests
Executes a search strategy over a DOM container’s subtree via depth-first pre-order traversal.
The final description of a subtree query. The methods on this struct execute the underlying search and return the results in various forms.
A query which resolves asynchronously
A keyboard “key” which can be entered.
The outcome of a failed query.
A type which can be queried as a DOM container, returning results from its subtree.
Convenience methods for dispatching events to targets, primarily useful for testing.