Testing

getByRole

Select exactly one matching accessible role and optional name; throws if absent or ambiguous.

Formal Syntax & Structure

react syntaxreact
screen.getByRole("button", {name: "Reserve one packet"})

Working Example

Example Snippetreact
screen.getByRole("button", {name: "Reserve one packet"})
React Reference