Paste a small DOM snapshot, compare Testing Library-style queries and see exactly when getBy, queryBy and AllBy variants pass, return null, return an empty array or throw.
Testing Library pushes tests toward user-visible behavior: roles, labels, text, display values and accessible names before implementation details. This playground gives code review a small, inspectable surface for checking what each query family and variant would do in a sanitized HTML snapshot.
The evaluator uses a detached DOMParser document, removes risky markup and never sends pasted HTML, query text or matched content to a backend.
Choose a preset or paste markup, then switch query family, variant, role and exact matching to inspect result semantics.
Review role, label, placeholder and display value behavior in a normal sign-in form. Throws when there is no match or when multiple elements match.Best default when the element exposes a meaningful role and accessible name.
Run a query to see variant semantics, matched elements, diagnostics and a copyable Testing Library snippet.
Role and accessible name usually describe what the user can perceive. Labels, text and display values come before data-testid when the UI exposes a real semantic handle.
getBy is strict and loud, queryBy is useful for absence checks, and AllBy variants make repeated UI explicit. The same DOM can be correct or failing depending on that choice.
The playground does not import DOM Testing Library at runtime, does not execute RegExp input and does not simulate delayed async DOM updates for findBy.
Query selection often sits next to locator review, matcher semantics and rule testing.
No. The MVP uses a small browser-only evaluator that mirrors common query semantics without adding the full package to the public bundle.
queryBy returns null only for no match. Like getBy, it still throws when more than one element matches.
Not in the runtime evaluator. Plain strings keep the playground predictable and avoid ReDoS-style input risks.
No. The DOM snapshot is parsed and sanitized locally and is not sent to a backend.