## 1. Project Overview & Quickstart (testing-library/react-testing-library)

<hr />


[![Build Status][build-badge]][build]
[![Code Coverage][coverage-badge]][coverage]
[![version][version-badge]][package]
[![downloads][downloads-badge]][npmtrends]
[![MIT License][license-badge]][license]
[
[![PRs Welcome][prs-badge]][prs]
[![Code of Conduct][coc-badge]][coc]
[![Discord][discord-badge]][discord]

[![Watch on GitHub][github-watch-badge]][github-watch]
[![Star on GitHub][github-star-badge]][github-star]
[![Tweet][twitter-badge]][twitter]




## Table of Contents




- [The problem](#the-problem)
- [The solution](#the-solution)
- [Installation](#installation)
  - [Suppressing unnecessary warnings on React DOM 16.8](#suppressing-unnecessary-warnings-on-react-dom-168)
- [Examples](#examples)
  - [Basic Example](#basic-example)
  - [Complex Example](#complex-example)
  - [More Examples](#more-examples)
- [Hooks](#hooks)
- [Guiding Principles](#guiding-principles)
- [Docs](#docs)
- [Issues](#issues)
  - [🐛 Bugs](#-bugs)
  - [💡 Feature Requests](#-feature-requests)
  - [❓ Questions](#-questions)
- [Contributors](#contributors)
- [LICENSE](#license)



## The problem

You want to write maintainable tests for your React components. As a part of
this goal, you want your tests to avoid including implementation details of your
components and rather focus on making your tests give you the confidence for
which they are intended. As part of this, you want your testbase to be
maintainable in the long run so refactors of your components (changes to
implementation but not functionality) don't break your tests and slow you and
your team down.

## The solution

The `React Testing Library` is a very lightweight solution for testing React
components. It provides light utility functions on top of `react-dom` and
`react-dom/test-utils`, in a way that encourages better testing practices. Its
primary guiding principle is:

> [The more your tests resemble the way your software is used, the more
> confidence they can give you.][guiding-principle]

## Installation

This module is distributed via [npm][npm] which is bundled with [node][node] and
should be installed as one of your project's `devDependencies`.  
Starting from RTL version 16, you'll also need to install
`@testing-library/dom`:

```
npm install --save-dev @testing-library/react @testing-library/dom
```

or

for installation via [yarn][yarn]

```
yarn add --dev @testing-library/react @testing-library/dom
```

This library has `peerDependencies` listings for `react`, `react-dom` and
starting from RTL version 16 also `@testing-library/dom`.

_React Testing Library versions 13+ require React v18. If your project uses an
older version of React, be sure to install version 12:_

```
npm install --save-dev @testing-library/react@12


yarn add --dev @testing-library/react@12
```

You may also be interested in installing `@testing-library/jest-dom` so you can
use [the custom jest matchers](https://github.com/testing-library/jest-dom).

> [**Docs**](https://testing-library.com/react)

### Suppressing unnecessary warnings on React DOM 16.8

There is a known compatibility issue with React DOM 16.8 where you will see the
following warning:

```
Warning: An update to ComponentName inside a test was not wrapped in act(...).
```

If you cannot upgrade to React DOM 16.9, you may suppress the warnings by adding
the following snippet to your test configuration
([learn more](https://github.com/testing-library/react-testing-library/issues/281)):

```js
// this is just a little hack to silence a warning that we'll get until we
// upgrade to 16.9. See also: https://github.com/facebook/react/pull/14853
const originalError = console.error
beforeAll(() => {
  console.error = (...args) => {
    if (/Warning.*not wrapped in act/.test(args[0])) {
      return
    }
    originalError.call(console, ...args)
  }
})

afterAll(() => {
  console.error = originalError
})
```

## Examples

### Basic Example

```jsx
// hidden-message.js
import * as React from 'react'

// NOTE: React Testing Library works well with React Hooks and classes.
// Your tests will be the same regardless of how you write your components.
function HiddenMessage({children}) {
  const [showMessage, setShowMessage] = React.useState(false)
  return (
    
      <label htmlFor="toggle">Show Message</label>
       setShowMessage(e.target.checked)}
        checked={showMessage}
      />
      {showMessage ? children : null}
    
  )
}

export default HiddenMessage
```

```jsx
// __tests__/hidden-message.js
// these imports are something you'd normally configure Jest to import for you
// automatically. Learn more in the setup docs: https://testing-library.com/docs/react-testing-library/setup#cleanup
import '@testing-library/jest-dom'
// NOTE: jest-dom adds handy assertions to Jest and is recommended, but not required

import * as React from 'react'
import {render, fireEvent, screen} from '@testing-library/react'
import HiddenMessage from '../hidden-message'

test('shows the children when the checkbox is checked', () => {
  const testMessage = 'Test Message'
  render(<HiddenMessage>{testMessage}</HiddenMessage>)

  // query* functions will return the element or null if it cannot be found
  // get* functions will return the element or throw an error if it cannot be found
  expect(screen.queryByText(testMessage)).toBeNull()

  // the queries can accept a regex to make your selectors more resilient to content tweaks and changes.
  fireEvent.click(screen.getByLabelText(/show/i))

  // .toBeInTheDocument() is an assertion that comes from jest-dom
  // otherwise you could use .toBeDefined()
  expect(screen.getByText(testMessage)).toBeInTheDocument()
})
```

### Complex Example

```jsx
// login.js
import * as React from 'react'

function Login() {
  const [state, setState] = React.useReducer((s, a) => ({...s, ...a}), {
    resolved: false,
    loading: false,
    error: null,
  })

  function handleSubmit(event) {
    event.preventDefault()
    const {usernameInput, passwordInput} = event.target.elements

    setState({loading: true, resolved: false, error: null})

    window
      .fetch('/api/login', {
        method: 'POST',
        headers: {'Content-Type': 'application/json'},
        body: JSON.stringify({
          username: usernameInput.value,
          password: passwordInput.value,
        }),
      })
      .then(r => r.json().then(data => (r.ok ? data : Promise.reject(data))))
      .then(
        user => {
          setState({loading: false, resolved: true, error: null})
          window.localStorage.setItem('token', user.token)
        },
        error => {
          setState({loading: false, resolved: false, error: error.message})
        },
      )
  }

  return (
    
      <form onSubmit={handleSubmit}>
        
          <label htmlFor="usernameInput">Username</label>
          
        
        
          <label htmlFor="passwordInput">Password</label>
          
        
        Submit{state.loading ? '...' : null}
      </form>
      {state.error ? {state.error} : null}
      {state.resolved ? (
        Congrats! You're signed in!
      ) : null}
    
  )
}

export default Login
```

```
/* Detailed source-code truncated for AI context efficiency. */
```

> We recommend using [Mock Service Worker](https://github.com/mswjs/msw) library
> to declaratively mock API communication in your tests instead of stubbing
> `window.fetch`, or relying on third-party adapters.

### More Examples

> We're in the process of moving examples to the
> [docs site](https://testing-library.com/docs/example-codesandbox)

You'll find runnable examples of testing with different libraries in
[the `react-testing-library-examples` codesandbox](https://codesandbox.io/s/github/kentcdodds/react-testing-library-examples).
Some included are:

- [`react-redux`](https://codesandbox.io/s/github/kentcdodds/react-testing-library-examples/tree/main/?fontsize=14&module=%2Fsrc%2F__tests__%2Freact-redux.js&previewwindow=tests)
- [`react-router`](https://codesandbox.io/s/github/kentcdodds/react-testing-library-examples/tree/main/?fontsize=14&module=%2Fsrc%2F__tests__%2Freact-router.js&previewwindow=tests)
- [`react-context`](https://codesandbox.io/s/github/kentcdodds/react-testing-library-examples/tree/main/?fontsize=14&module=%2Fsrc%2F__tests__%2Freact-context.js&previewwindow=tests)

## Hooks

If you are interested in testing a custom hook, check out [React Hooks Testing
Library][react-hooks-testing-library].

> NOTE: it is not recommended to test single-use custom hooks in isolation from
> the components where it's being used. It's better to test the component that's
> using the hook rather than the hook itself. The `React Hooks Testing Library`
> is intended to be used for reusable hooks/libraries.

## Guiding Principles

> [The more your tests resemble the way your software is used, the more
> confidence they can give you.][guiding-principle]

We try to only expose methods and utilities that encourage you to write tests
that closely resemble how your React components are used.

Utilities are included in this project based on the following guiding
principles:

1.  If it relates to rendering components, it deals with DOM nodes rather than
    component instances, nor should it encourage dealing with component
    instances.
2.  It should be generally useful for testing individual React components or
    full React applications. While this library is focused on `react-dom`,
    utilities could be included even if they don't directly relate to
    `react-dom`.
3.  Utility implementations and APIs should be simple and flexible.

Most importantly, we want React Testing Library to be pretty light-weight,
simple, and easy to understand.

## Docs

[**Read The Docs**](https://testing-library.com/react) |
[Edit the docs](https://github.com/testing-library/testing-library-docs)

## Issues

Looking to contribute? Look for the [Good First Issue][good-first-issue] label.

### 🐛 Bugs

Please file an issue for bugs, missing documentation, or unexpected behavior.

[**See Bugs**][bugs]

### 💡 Feature Requests

Please file an issue to suggest new features. Vote on feature requests by adding
a 👍. This helps maintainers prioritize what to work on.

[**See Feature Requests**][requests]

### ❓ Questions

For questions related to using the library, please visit a support community
instead of filing an issue on GitHub.

- [Discord][discord]
- [Stack Overflow][stackoverflow]

## Contributors

Thanks goes to these people ([emoji key][emojis]):






| [**Kent C. Dodds**](https://kentcdodds.com)[💻](https://github.com/testing-library/react-testing-library/commits?author=kentcdodds) [📖](https://github.com/testing-library/react-testing-library/commits?author=kentcdodds) [🚇](#infra-kentcdodds) [⚠️](https://github.com/testing-library/react-testing-library/commits?author=kentcdodds) | [**Ryan Castner**](http://audiolion.github.io)[📖](https://github.com/testing-library/react-testing-library/commits?author=audiolion) | [**Daniel Sandiego**](https://www.dnlsandiego.com)[💻](https://github.com/testing-library/react-testing-library/commits?author=dnlsandiego) | [**Paweł Mikołajczyk**](https://github.com/Miklet)[💻](https://github.com/testing-library/react-testing-library/commits?author=Miklet) | [**Alejandro Ñáñez Ortiz**](http://co.linkedin.com/in/alejandronanez/)[📖](https://github.com/testing-library/react-testing-library/commits?author=alejandronanez) | [**Matt Parrish**](https://github.com/pbomb)[🐛](https://github.com/testing-library/react-testing-library/issues?q=author%3Apbomb) [💻](https://github.com/testing-library/react-testing-library/commits?author=pbomb) [📖](https://github.com/testing-library/react-testing-library/commits?author=pbomb) [⚠️](https://github.com/testing-library/react-testing-library/commits?author=pbomb) | [**Justin Hall**](https://github.com/wKovacs64)[📦](#platform-wKovacs64) |
| --- | --- | --- | --- | --- | --- | --- |
| [**Anto Aravinth**](https://github.com/antoaravinth)[💻](https://github.com/testing-library/react-testing-library/commits?author=antoaravinth) [⚠️](https://github.com/testing-library/react-testing-library/commits?author=antoaravinth) [📖](https://github.com/testing-library/react-testing-library/commits?author=antoaravinth) | [**Jonah Moses**](https://github.com/JonahMoses)[📖](https://github.com/testing-library/react-testing-library/commits?author=JonahMoses) | [**Łukasz Gandecki**](http://team.thebrain.pro)[💻](https://github.com/testing-library/react-testing-library/commits?author=lgandecki) [⚠️](https://github.com/testing-library/react-testing-library/commits?author=lgandecki) [📖](https://github.com/testing-library/react-testing-library/commits?author=lgandecki) | [**Ivan Babak**](https://sompylasar.github.io)[🐛](https://github.com/testing-library/react-testing-library/issues?q=author%3Asompylasar) [🤔](#ideas-sompylasar) | [**Jesse Day**](https://github.com/jday3)[💻](https://github.com/testing-library/react-testing-library/commits?author=jday3) | [**Ernesto García**](http://gnapse.github.io)[💬](#question-gnapse) [💻](https://github.com/testing-library/react-testing-library/commits?author=gnapse) [📖](https://github.com/testing-library/react-testing-library/commits?author=gnapse) | [**Josef Maxx Blake**](http://jomaxx.com)[💻](https://github.com/testing-library/react-testing-library/commits?author=jomaxx) [📖](https://github.com/testing-library/react-testing-library/commits?author=jomaxx) [⚠️](https://github.com/testing-library/react-testing-library/commits?author=jomaxx) |
| [**Michal Baranowski**](https://twitter.com/baranovskim)[📝](#blog-mbaranovski) [✅](#tutorial-mbaranovski) | [**Arthur Puthin**](https://github.com/aputhin)[📖](https://github.com/testing-library/react-testing-library/commits?author=aputhin) | [**Thomas Chia**](https://github.com/thchia)[💻](https://github.com/testing-library/react-testing-library/commits?author=thchia) [📖](https://github.com/testing-library/react-testing-library/commits?author=thchia) | [**Thiago Galvani**](http://ilegra.com/)[📖](https://github.com/testing-library/react-testing-library/commits?author=thiagopaiva99) | [**Christian**](http://Chriswcs.github.io)[⚠️](https://github.com/testing-library/react-testing-library/commits?author=ChrisWcs) | [**Alex Krolick**](https://alexkrolick.com)[💬](#question-alexkrolick) [📖](https://github.com/testing-library/react-testing-library/commits?author=alexkrolick) [💡](#example-alexkrolick) [🤔](#ideas-alexkrolick) | [**Johann Hubert Sonntagbauer**](https://github.com/johann-sonntagbauer)[💻](https://github.com/testing-library/react-testing-library/commits?author=johann-sonntagbauer) [📖](https://github.com/testing-library/react-testing-library/commits?author=johann-sonntagbauer) [⚠️](https://github.com/testing-library/react-testing-library/commits?author=johann-sonntagbauer) |
| [**Maddi Joyce**](http://www.maddijoyce.com)[💻](https://github.com/testing-library/react-testing-library/commits?author=maddijoyce) | [**Ryan Vice**](http://www.vicesoftware.com)[📖](https://github.com/testing-library/react-testing-library/commits?author=RyanAtViceSoftware) | [**Ian Wilson**](https://ianwilson.io)[📝](#blog-iwilsonq) [✅](#tutorial-iwilsonq) | [**Daniel**](https://github.com/InExtremaRes)[🐛](https://github.com/testing-library/react-testing-library/issues?q=author%3AInExtremaRes) [💻](https://github.com/testing-library/react-testing-library/commits?author=InExtremaRes) | [**Giorgio Polvara**](https://twitter.com/Gpx)[🐛](https://github.com/testing-library/react-testing-library/issues?q=author%3AGpx) [🤔](#ideas-Gpx) | [**John Gozde**](https://github.com/jgoz)[💻](https://github.com/testing-library/react-testing-library/commits?author=jgoz) | [**Sam Horton**](https://twitter.com/SavePointSam)[📖](https://github.com/testing-library/react-testing-library/commits?author=SavePointSam) [💡](#example-SavePointSam) [🤔](#ideas-SavePointSam) |
| [**Richard Kotze (mobile)**](http://www.richardkotze.com)[📖](https://github.com/testing-library/react-testing-library/commits?author=rkotze) | [**Brahian E. Soto Mercedes**](https://github.com/sotobuild)[📖](https://github.com/testing-library/react-testing-library/commits?author=sotobuild) | [**Benoit de La Forest**](https://github.com/bdelaforest)[📖](https://github.com/testing-library/react-testing-library/commits?author=bdelaforest) | [**Salah**](https://github.com/thesalah)[💻](https://github.com/testing-library/react-testing-library/commits?author=thesalah) [⚠️](https://github.com/testing-library/react-testing-library/commits?author=thesalah) | [**Adam Gordon**](http://gordonizer.com)[🐛](https://github.com/testing-library/react-testing-library/issues?q=author%3Aicfantv) [💻](https://github.com/testing-library/react-testing-library/commits?author=icfantv) | [**Matija Marohnić**](https://silvenon.com)[📖](https://github.com/testing-library/react-testing-library/commits?author=silvenon) | [**Justice Mba**](https://github.com/Dajust)[📖](https://github.com/testing-library/react-testing-library/commits?author=Dajust) |
| [**Mark Pollmann**](https://markpollmann.com/)[📖](https://github.com/testing-library/react-testing-library/commits?author=MarkPollmann) | [**Ehtesham Kafeel**](https://github.com/ehteshamkafeel)[💻](https://github.com/testing-library/react-testing-library/commits?author=ehteshamkafeel) [📖](https://github.com/testing-library/react-testing-library/commits?author=ehteshamkafeel) | [**Julio Pavón**](http://jpavon.com)[💻](https://github.com/testing-library/react-testing-library/commits?author=jpavon) | [**Duncan L**](http://www.duncanleung.com/)[📖](https://github.com/testing-library/react-testing-library/commits?author=duncanleung) [💡](#example-duncanleung) | [**Tiago Almeida**](https://www.linkedin.com/in/tyagow/?locale=en_US)[📖](https://github.com/testing-library/react-testing-library/commits?author=tyagow) | [**Robert Smith**](http://rbrtsmith.com/)[🐛](https://github.com/testing-library/react-testing-library/issues?q=author%3Arbrtsmith) | [**Zach Green**](https://offbyone.tech)[📖](https://github.com/testing-library/react-testing-library/commits?author=zgreen) |
| [**dadamssg**](https://github.com/dadamssg)[📖](https://github.com/testing-library/react-testing-library/commits?author=dadamssg) | [**Yazan Aabed**](https://www.yaabed.com/)[📝](#blog-YazanAabeed) | [**Tim**](https://github.com/timbonicus)[🐛](https://github.com/testing-library/react-testing-library/issues?q=author%3Atimbonicus) [💻](https://github.com/testing-library/react-testing-library/commits?author=timbonicus) [📖](https://github.com/testing-library/react-testing-library/commits?author=timbonicus) [⚠️](https://github.com/testing-library/react-testing-library/commits?author=timbonicus) | [**Divyanshu Maithani**](http://divyanshu.xyz)[✅](#tutorial-divyanshu013) [📹](#video-divyanshu013) | [**Deepak Grover**](https://www.linkedin.com/in/metagrover)[✅](#tutorial-metagrover) [📹](#video-metagrover) | [**Eyal Cohen**](https://github.com/eyalcohen4)[📖](https://github.com/testing-library/react-testing-library/commits?author=eyalcohen4) | [**Peter Makowski**](https://github.com/petermakowski)[📖](https://github.com/testing-library/react-testing-library/commits?author=petermakowski) |
| [**Michiel Nuyts**](https://github.com/Michielnuyts)[📖](https://github.com/testing-library/react-testing-library/commits?author=Michielnuyts) | [**Joe Ng'ethe**](https://github.com/joeynimu)[💻](https://github.com/testing-library/react-testing-library/commits?author=joeynimu) [📖](https://github.com/testing-library/react-testing-library/commits?author=joeynimu) | [**Kate**](https://github.com/Enikol)[📖](https://github.com/testing-library/react-testing-library/commits?author=Enikol) | [**Sean**](http://www.seanrparker.com)[📖](https://github.com/testing-library/react-testing-library/commits?author=SeanRParker) | [**James Long**](http://jlongster.com)[🤔](#ideas-jlongster) [📦](#platform-jlongster) | [**Herb Hagely**](https://github.com/hhagely)[💡](#example-hhagely) | [**Alex Wendte**](http://www.wendtedesigns.com/)[💡](#example-themostcolm) |
| [**Monica Powell**](http://www.aboutmonica.com)[📖](https://github.com/testing-library/react-testing-library/commits?author=M0nica) | [**Vitaly Sivkov**](http://sivkoff.com)[💻](https://github.com/testing-library/react-testing-library/commits?author=sivkoff) | [**Weyert de Boer**](https://github.com/weyert)[🤔](#ideas-weyert) [👀](https://github.com/testing-library/react-testing-library/pulls?q=is%3Apr+reviewed-by%3Aweyert) [🎨](#design-weyert) | [**EstebanMarin**](https://github.com/EstebanMarin)[📖](https://github.com/testing-library/react-testing-library/commits?author=EstebanMarin) | [**Victor Martins**](https://github.com/vctormb)[📖](https://github.com/testing-library/react-testing-library/commits?author=vctormb) | [**Royston Shufflebotham**](https://github.com/RoystonS)[🐛](https://github.com/testing-library/react-testing-library/issues?q=author%3ARoystonS) [📖](https://github.com/testing-library/react-testing-library/commits?author=RoystonS) [💡](#example-RoystonS) | [**chrbala**](https://github.com/chrbala)[💻](https://github.com/testing-library/react-testing-library/commits?author=chrbala) |
| [**Donavon West**](http://donavon.com)[💻](https://github.com/testing-library/react-testing-library/commits?author=donavon) [📖](https://github.com/testing-library/react-testing-library/commits?author=donavon) [🤔](#ideas-donavon) [⚠️](https://github.com/testing-library/react-testing-library/commits?author=donavon) | [**Richard Maisano**](https://github.com/maisano)[💻](https://github.com/testing-library/react-testing-library/commits?author=maisano) | [**Marco Biedermann**](https://www.marcobiedermann.com)[💻](https://github.com/testing-library/react-testing-library/commits?author=marcobiedermann) [🚧](#maintenance-marcobiedermann) [⚠️](https://github.com/testing-library/react-testing-library/commits?author=marcobiedermann) | [**Alex Zherdev**](https://github.com/alexzherdev)[🐛](https://github.com/testing-library/react-testing-library/issues?q=author%3Aalexzherdev) [💻](https://github.com/testing-library/react-testing-library/commits?author=alexzherdev) | [**André Matulionis dos Santos**](https://twitter.com/Andrewmat)[💻](https://github.com/testing-library/react-testing-library/commits?author=Andrewmat) [💡](#example-Andrewmat) [⚠️](https://github.com/testing-library/react-testing-library/commits?author=Andrewmat) | [**Daniel K.**](https://github.com/FredyC)[🐛](https://github.com/testing-library/react-testing-library/issues?q=author%3AFredyC) [💻](https://github.com/testing-library/react-testing-library/commits?author=FredyC) [🤔](#ideas-FredyC) [⚠️](https://github.com/testing-library/react-testing-library/commits?author=FredyC) [👀](https://github.com/testing-library/react-testing-library/pulls?q=is%3Apr+reviewed-by%3AFredyC) | [**mohamedmagdy17593**](https://github.com/mohamedmagdy17593)[💻](https://github.com/testing-library/react-testing-library/commits?author=mohamedmagdy17593) |
| [**Loren ☺️**](http://lorensr.me)[📖](https://github.com/testing-library/react-testing-library/commits?author=lorensr) | [**MarkFalconbridge**](https://github.com/MarkFalconbridge)[🐛](https://github.com/testing-library/react-testing-library/issues?q=author%3AMarkFalconbridge) [💻](https://github.com/testing-library/react-testing-library/commits?author=MarkFalconbridge) | [**Vinicius**](https://github.com/viniciusavieira)[📖](https://github.com/testing-library/react-testing-library/commits?author=viniciusavieira) [💡](#example-viniciusavieira) | [**Peter Schyma**](https://github.com/pschyma)[💻](https://github.com/testing-library/react-testing-library/commits?author=pschyma) | [**Ian Schmitz**](https://github.com/ianschmitz)[📖](https://github.com/testing-library/react-testing-library/commits?author=ianschmitz) | [**Joel Marcotte**](https://github.com/joual)[🐛](https://github.com/testing-library/react-testing-library/issues?q=author%3Ajoual) [⚠️](https://github.com/testing-library/react-testing-library/commits?author=joual) [💻](https://github.com/testing-library/react-testing-library/commits?author=joual) | [**Alejandro Dustet**](http://aledustet.com)[🐛](https://github.com/testing-library/react-testing-library/issues?q=author%3Aaledustet) |
| [**Brandon Carroll**](https://github.com/bcarroll22)[📖](https://github.com/testing-library/react-testing-library/commits?author=bcarroll22) | [**Lucas Machado**](https://github.com/lucas0707)[📖](https://github.com/testing-library/react-testing-library/commits?author=lucas0707) | [**Pascal Duez**](http://pascalduez.me)[📦](#platform-pascalduez) | [**Minh Nguyen**](https://twitter.com/minh_ngvyen)[💻](https://github.com/testing-library/react-testing-library/commits?author=NMinhNguyen) | [**LiaoJimmy**](http://iababy46.blogspot.tw/)[📖](https://github.com/testing-library/react-testing-library/commits?author=LiaoJimmy) | [**Sunil Pai**](https://github.com/threepointone)[💻](https://github.com/testing-library/react-testing-library/commits?author=threepointone) [⚠️](https://github.com/testing-library/react-testing-library/commits?author=threepointone) | [**Dan Abramov**](http://twitter.com/dan_abramov)[👀](https://github.com/testing-library/react-testing-library/pulls?q=is%3Apr+reviewed-by%3Agaearon) |
| [**Christian Murphy**](https://github.com/ChristianMurphy)[🚇](#infra-ChristianMurphy) | [**Ivakhnenko Dmitry**](https://jeetiss.github.io/)[💻](https://github.com/testing-library/react-testing-library/commits?author=jeetiss) | [**James George**](https://ghuser.io/jamesgeorge007)[📖](https://github.com/testing-library/react-testing-library/commits?author=jamesgeorge007) | [**João Fernandes**](https://joaofernandes.me/)[📖](https://github.com/testing-library/react-testing-library/commits?author=JSFernandes) | [**Alejandro Perea**](https://github.com/alejandroperea)[👀](https://github.com/testing-library/react-testing-library/pulls?q=is%3Apr+reviewed-by%3Aalejandroperea) | [**Nick McCurdy**](https://nickmccurdy.com/)[👀](https://github.com/testing-library/react-testing-library/pulls?q=is%3Apr+reviewed-by%3Anickmccurdy) [💬](#question-nickmccurdy) [🚇](#infra-nickmccurdy) | [**Sebastian Silbermann**](https://twitter.com/sebsilbermann)[👀](https://github.com/testing-library/react-testing-library/pulls?q=is%3Apr+reviewed-by%3Aeps1lon) |
| [**Adrià Fontcuberta**](https://afontcu.dev)[👀](https://github.com/testing-library/react-testing-library/pulls?q=is%3Apr+reviewed-by%3Aafontcu) [📖](https://github.com/testing-library/react-testing-library/commits?author=afontcu) | [**John Reilly**](https://blog.johnnyreilly.com/)[👀](https://github.com/testing-library/react-testing-library/pulls?q=is%3Apr+reviewed-by%3Ajohnnyreilly) | [**Michaël De Boey**](https://michaeldeboey.be)[👀](https://github.com/testing-library/react-testing-library/pulls?q=is%3Apr+reviewed-by%3AMichaelDeBoey) [💻](https://github.com/testing-library/react-testing-library/commits?author=MichaelDeBoey) | [**Tim Yates**](https://cimbul.com)[👀](https://github.com/testing-library/react-testing-library/pulls?q=is%3Apr+reviewed-by%3Acimbul) | [**Brian Donovan**](https://github.com/eventualbuddha)[💻](https://github.com/testing-library/react-testing-library/commits?author=eventualbuddha) | [**Noam Gabriel Jacobson**](https://github.com/JaysQubeXon)[📖](https://github.com/testing-library/react-testing-library/commits?author=JaysQubeXon) | [**Ronald van der Kooij**](https://github.com/rvdkooy)[⚠️](https://github.com/testing-library/react-testing-library/commits?author=rvdkooy) [💻](https://github.com/testing-library/react-testing-library/commits?author=rvdkooy) |
| [**Aayush Rajvanshi**](https://github.com/aayushrajvanshi)[📖](https://github.com/testing-library/react-testing-library/commits?author=aayushrajvanshi) | [**Ely Alamillo**](https://elyalamillo.com)[💻](https://github.com/testing-library/react-testing-library/commits?author=ely-alamillo) [⚠️](https://github.com/testing-library/react-testing-library/commits?author=ely-alamillo) | [**Daniel Afonso**](https://github.com/danieljcafonso)[💻](https://github.com/testing-library/react-testing-library/commits?author=danieljcafonso) [⚠️](https://github.com/testing-library/react-testing-library/commits?author=danieljcafonso) | [**Laurens Bosscher**](http://www.laurensbosscher.nl)[💻](https://github.com/testing-library/react-testing-library/commits?author=LaurensBosscher) | [**Sakito Mukai**](https://twitter.com/__sakito__)[📖](https://github.com/testing-library/react-testing-library/commits?author=sakito21) | [**Türker Teke**](http://turkerteke.com)[📖](https://github.com/testing-library/react-testing-library/commits?author=tteke) | [**Zach Brogan**](http://linkedin.com/in/zachbrogan)[💻](https://github.com/testing-library/react-testing-library/commits?author=zbrogz) [⚠️](https://github.com/testing-library/react-testing-library/commits?author=zbrogz) |
| [**Ryota Murakami**](https://ryota-murakami.github.io/)[📖](https://github.com/testing-library/react-testing-library/commits?author=ryota-murakami) | [**Michael Hottman**](https://github.com/hottmanmichael)[🤔](#ideas-hottmanmichael) | [**Steven Fitzpatrick**](https://github.com/stevenfitzpatrick)[🐛](https://github.com/testing-library/react-testing-library/issues?q=author%3Astevenfitzpatrick) | [**Juan Je García**](https://github.com/juangl)[📖](https://github.com/testing-library/react-testing-library/commits?author=juangl) | [**Championrunner**](https://ghuser.io/Ishaan28malik)[📖](https://github.com/testing-library/react-testing-library/commits?author=Ishaan28malik) | [**Sam Tsai**](https://github.com/samtsai)[💻](https://github.com/testing-library/react-testing-library/commits?author=samtsai) [⚠️](https://github.com/testing-library/react-testing-library/commits?author=samtsai) [📖](https://github.com/testing-library/react-testing-library/commits?author=samtsai) | [**Christian Rackerseder**](https://www.echooff.dev)[💻](https://github.com/testing-library/react-testing-library/commits?author=screendriver) |
| [**Andrei Picus**](https://github.com/NiGhTTraX)[🐛](https://github.com/testing-library/react-testing-library/issues?q=author%3ANiGhTTraX) [👀](https://github.com/testing-library/react-testing-library/pulls?q=is%3Apr+reviewed-by%3ANiGhTTraX) | [**Artem Zakharchenko**](https://redd.one)[📖](https://github.com/testing-library/react-testing-library/commits?author=kettanaito) | [**Michael**](http://michaelsiek.com)[📖](https://github.com/testing-library/react-testing-library/commits?author=michael-siek) | [**Braden Lee**](http://2dubbing.tistory.com)[📖](https://github.com/testing-library/react-testing-library/commits?author=2dubbing) | [**Kamran Ayub**](http://kamranicus.com/)[💻](https://github.com/testing-library/react-testing-library/commits?author=kamranayub) [⚠️](https://github.com/testing-library/react-testing-library/commits?author=kamranayub) | [**Matan Borenkraout**](https://twitter.com/matanbobi)[💻](https://github.com/testing-library/react-testing-library/commits?author=MatanBobi) | [**Ryan Bigg**](http://ryanbigg.com)[🚧](#maintenance-radar) |
| [**Anton Halim**](https://antonhalim.com)[📖](https://github.com/testing-library/react-testing-library/commits?author=antonhalim) | [**Artem Malko**](http://artmalko.ru)[💻](https://github.com/testing-library/react-testing-library/commits?author=artem-malko) | [**Gerrit Alex**](http://gerritalex.de)[💻](https://github.com/testing-library/react-testing-library/commits?author=ljosberinn) | [**Karthick Raja**](https://github.com/karthick3018)[💻](https://github.com/testing-library/react-testing-library/commits?author=karthick3018) | [**Abdelrahman Ashraf**](https://github.com/theashraf)[💻](https://github.com/testing-library/react-testing-library/commits?author=theashraf) | [**Lidor Avitan**](https://github.com/lidoravitan)[📖](https://github.com/testing-library/react-testing-library/commits?author=lidoravitan) | [**Jordan Harband**](https://github.com/ljharb)[👀](https://github.com/testing-library/react-testing-library/pulls?q=is%3Apr+reviewed-by%3Aljharb) [🤔](#ideas-ljharb) |
| [**Marco Moretti**](https://github.com/marcosvega91)[💻](https://github.com/testing-library/react-testing-library/commits?author=marcosvega91) | [**sanchit121**](https://github.com/sanchit121)[🐛](https://github.com/testing-library/react-testing-library/issues?q=author%3Asanchit121) [💻](https://github.com/testing-library/react-testing-library/commits?author=sanchit121) | [**Solufa**](https://github.com/solufa)[🐛](https://github.com/testing-library/react-testing-library/issues?q=author%3Asolufa) [💻](https://github.com/testing-library/react-testing-library/commits?author=solufa) | [**Ari Perkkiö**](https://codepen.io/ariperkkio/)[⚠️](https://github.com/testing-library/react-testing-library/commits?author=AriPerkkio) | [**Johannes Ewald**](https://github.com/jhnns)[💻](https://github.com/testing-library/react-testing-library/commits?author=jhnns) | [**Angus J. Pope**](https://github.com/anpaopao)[📖](https://github.com/testing-library/react-testing-library/commits?author=anpaopao) | [**Dominik Lesch**](https://github.com/leschdom)[📖](https://github.com/testing-library/react-testing-library/commits?author=leschdom) |
| [**Marcos Gómez**](https://github.com/ImADrafter)[📖](https://github.com/testing-library/react-testing-library/commits?author=ImADrafter) | [**Akash Shyam**](https://www.akashshyam.online/)[🐛](https://github.com/testing-library/react-testing-library/issues?q=author%3Aakashshyamdev) | [**Fabian Meumertzheim**](https://hen.ne.ke)[💻](https://github.com/testing-library/react-testing-library/commits?author=fmeum) [🐛](https://github.com/testing-library/react-testing-library/issues?q=author%3Afmeum) | [**Sebastian Malton**](https://github.com/Nokel81)[🐛](https://github.com/testing-library/react-testing-library/issues?q=author%3ANokel81) [💻](https://github.com/testing-library/react-testing-library/commits?author=Nokel81) | [**Martin Böttcher**](https://github.com/mboettcher)[💻](https://github.com/testing-library/react-testing-library/commits?author=mboettcher) | [**Dominik Dorfmeister**](http://tkdodo.eu)[💻](https://github.com/testing-library/react-testing-library/commits?author=TkDodo) | [**Stephen Sauceda**](https://stephensauceda.com)[📖](https://github.com/testing-library/react-testing-library/commits?author=stephensauceda) |
| [**Colin Diesh**](http://cmdcolin.github.io)[📖](https://github.com/testing-library/react-testing-library/commits?author=cmdcolin) | [**Yusuke Iinuma**](http://yinm.info)[💻](https://github.com/testing-library/react-testing-library/commits?author=yinm) | [**Jeff Way**](https://github.com/trappar)[💻](https://github.com/testing-library/react-testing-library/commits?author=trappar) | [**Bernardo Belchior**](http://belchior.me)[💻](https://github.com/testing-library/react-testing-library/commits?author=bernardobelchior) [📖](https://github.com/testing-library/react-testing-library/commits?author=bernardobelchior) |  |  |  |








This project follows the [all-contributors][all-contributors] specification.
Contributions of any kind welcome!

## LICENSE

[MIT](LICENSE)



[npm]: https://www.npmjs.com/
[yarn]: https://classic.yarnpkg.com
[node]: https://nodejs.org
[build-badge]: https://img.shields.io/github/actions/workflow/status/testing-library/react-testing-library/validate.yml?branch=main&logo=github
[build]: https://github.com/testing-library/react-testing-library/actions?query=workflow%3Avalidate
[coverage-badge]: https://img.shields.io/codecov/c/github/testing-library/react-testing-library.svg?style=flat-square
[coverage]: https://codecov.io/github/testing-library/react-testing-library
[version-badge]: https://img.shields.io/npm/v/@testing-library/react.svg?style=flat-square
[package]: https://www.npmjs.com/package/@testing-library/react
[downloads-badge]: https://img.shields.io/npm/dm/@testing-library/react.svg?style=flat-square
[npmtrends]: http://www.npmtrends.com/@testing-library/react
[license-badge]: https://img.shields.io/npm/l/@testing-library/react.svg?style=flat-square
[license]: https://github.com/testing-library/react-testing-library/blob/main/LICENSE
[prs-badge]: https://img.shields.io/badge/PRs-welcome-brightgreen.svg?style=flat-square
[prs]: http://makeapullrequest.com
[coc-badge]: https://img.shields.io/badge/code%20of-conduct-ff69b4.svg?style=flat-square
[coc]: https://github.com/testing-library/react-testing-library/blob/main/CODE_OF_CONDUCT.md
[github-watch-badge]: https://img.shields.io/github/watchers/testing-library/react-testing-library.svg?style=social
[github-watch]: https://github.com/testing-library/react-testing-library/watchers
[github-star-badge]: https://img.shields.io/github/stars/testing-library/react-testing-library.svg?style=social
[github-star]: https://github.com/testing-library/react-testing-library/stargazers
[twitter]: https://twitter.com/intent/tweet?text=Check%20out%20react-testing-library%20by%20%40@TestingLib%20https%3A%2F%2Fgithub.com%2Ftesting-library%2Freact-testing-library%20%F0%9F%91%8D
[twitter-badge]: https://img.shields.io/twitter/url/https/github.com/testing-library/react-testing-library.svg?style=social
[emojis]: https://github.com/all-contributors/all-contributors#emoji-key
[all-contributors]: https://github.com/all-contributors/all-contributors
[all-contributors-badge]: https://img.shields.io/github/all-contributors/testing-library/react-testing-library?color=orange&style=flat-square
[guiding-principle]: https://twitter.com/kentcdodds/status/977018512689455106
[bugs]: https://github.com/testing-library/react-testing-library/issues?q=is%3Aissue+is%3Aopen+label%3Abug+sort%3Acreated-desc
[requests]: https://github.com/testing-library/react-testing-library/issues?q=is%3Aissue+sort%3Areactions-%2B1-desc+label%3Aenhancement+is%3Aopen
[good-first-issue]: https://github.com/testing-library/react-testing-library/issues?utf8=✓&q=is%3Aissue+is%3Aopen+sort%3Areactions-%2B1-desc+label%3A"good+first+issue"+
[discord-badge]: https://img.shields.io/discord/723559267868737556.svg?color=7389D8&labelColor=6A7EC2&logo=discord&logoColor=ffffff&style=flat-square
[discord]: https://discord.gg/testing-library
[stackoverflow]: https://stackoverflow.com/questions/tagged/react-testing-library
[react-hooks-testing-library]: https://github.com/testing-library/react-hooks-testing-library

## 2. Official Technical Reference & Guides (testing-library/testing-library-docs)

## File: README.md

## testing-library-docs


[
[![Code of Conduct][coc-badge]][coc]


Documentation site for
[React Testing Library](https://github.com/testing-library/react-testing-library),
[DOM Testing Library](https://github.com/testing-library/dom-testing-library),
[Angular Testing Library](https://github.com/testing-library/angular-testing-library),
and [related projects](https://github.com/testing-library)

**https://testing-library.com**

**Build Status**:

[![Netlify Status][netlify-badge]][build]

[netlify-badge]:
  https://api.netlify.com/api/v1/badges/24366204-84ca-41e9-b573-2a64f0845e46/deploy-status
[build]: https://app.netlify.com/sites/testing-library/deploys
[allcontributors-badge]:
  https://img.shields.io/github/all-contributors/testing-library/testing-library-docs?color=ee8449&style=flat-square
[coc-badge]:
  https://img.shields.io/badge/code%20of-conduct-ff69b4.svg?style=flat-square
[coc]:
  https://github.com/testing-library/react-testing-library/blob/main/CODE_OF_CONDUCT.md

This website was created with [Docusaurus](https://v2.docusaurus.io).

# What's In This Document

- [Get Started in 5 Minutes](#get-started-in-5-minutes)
- [Editing Content](#editing-content)
- [Adding Content](#adding-content)

# Get Started in 5 Minutes

1. Make sure all the dependencies for the website are installed:

```sh
# Install dependencies
$ npm install
```

2. Run your dev server:

```sh
# Start the site
$ npm start
```

# Editing Content

## Editing an existing docs page

Edit docs by navigating to `docs/` and editing the corresponding document:

`docs/doc-to-be-edited.mdx`

```markdown
---
id: page-needs-edit
title: This Doc Needs To Be Edited
---

Edit me...
```

For more information about docs, click [here](https://v2.docusaurus.io/docs)

## Editing an existing blog post

Edit blog posts by navigating to `blog` and editing the corresponding post:

`blog/post-to-be-edited.mdx`

```markdown
---
id: post-needs-edit
title: This Blog Post Needs To Be Edited
---

Edit me...
```

For more information about blog posts, click
[here](https://v2.docusaurus.io/docs/blog)

# Adding Content

## Adding a new docs page to an existing sidebar

1. Create the doc as a new markdown file in `/docs`, example
   `docs/newly-created-doc.mdx`:

```md
---
id: newly-created-doc
title: This Doc Needs To Be Edited
---

My new content here..
```

Note: Ensure the file name and the id value do not include non-url safe
characters i.e. '\*'.

2. Refer to that doc's ID in an existing sidebar in `sidebar.json`:

```javascript
// Add newly-created-doc to the Getting Started category of docs
{
  "docs": {
    "Getting Started": [
      "quick-start",
      "newly-created-doc" // new doc here
    ],
    ...
  },
  ...
}
```

For more information about adding new docs, click
[here](https://v2.docusaurus.io/docs/)

## Contributors

Thanks goes to these wonderful people
([emoji key](https://allcontributors.org/docs/en/emoji-key)):






| [**Kent C. Dodds**](https://kentcdodds.com)[🚧](#maintenance-kentcdodds) | [**Alex Krolick**](https://alexkrolick.com)[🚧](#maintenance-alexkrolick) | [**Sidak Singh Aulakh**](http://sidak.ml)[💻](https://github.com/testing-library/testing-library-docs/commits?author=co16353sidak) | [**Brandon Carroll**](https://github.com/bcarroll22)[💻](https://github.com/testing-library/testing-library-docs/commits?author=bcarroll22) | [**David**](https://github.com/dbismut)[📖](https://github.com/testing-library/testing-library-docs/commits?author=dbismut) | [**Ryan James**](http://ryanwilsonjames.com)[📖](https://github.com/testing-library/testing-library-docs/commits?author=dangerismycat) | [**Brandon Johnson**](https://github.com/bjohn465)[📖](https://github.com/testing-library/testing-library-docs/commits?author=bjohn465) |
| --- | --- | --- | --- | --- | --- | --- |
| [**Edward Coleridge Smith**](https://edcs.me)[📖](https://github.com/testing-library/testing-library-docs/commits?author=edcs) | [**Adrià Fontcuberta**](https://afontcu.dev)[📖](https://github.com/testing-library/testing-library-docs/commits?author=afontcu) [👀](https://github.com/testing-library/testing-library-docs/pulls?q=is%3Apr+reviewed-by%3Aafontcu) | [**Tim Deschryver**](http://timdeschryver.dev)[📖](https://github.com/testing-library/testing-library-docs/commits?author=timdeschryver) [💻](https://github.com/testing-library/testing-library-docs/commits?author=timdeschryver) | [**Ben Monro**](https://github.com/benmonro)[📖](https://github.com/testing-library/testing-library-docs/commits?author=benmonro) | [**Scott Sauber**](http://scottsauber.com)[📝](#blog-scottsauber) | [**Shota Tamura**](https://www.yuuniworks.com/)[🖋](#content-junkboy0315) [📖](https://github.com/testing-library/testing-library-docs/commits?author=junkboy0315) | [**Giorgio Polvara**](https://twitter.com/Gpx)[📖](https://github.com/testing-library/testing-library-docs/commits?author=Gpx) |
| [**michalak111**](https://twitter.com/jasi3k11)[📖](https://github.com/testing-library/testing-library-docs/commits?author=michalak111) [⚠️](https://github.com/testing-library/testing-library-docs/commits?author=michalak111) | [**Huyen Nguyen**](https://github.com/huyenltnguyen)[📖](https://github.com/testing-library/testing-library-docs/commits?author=huyenltnguyen) | [**Kieren Hughes**](http://www.kierenhughes.com)[📖](https://github.com/testing-library/testing-library-docs/commits?author=kierenhughes) | [**Sean McPherson**](https://seanmcp.com)[📖](https://github.com/testing-library/testing-library-docs/commits?author=SeanMcP) | [**Michael Lasky**](https://github.com/michaellasky)[📖](https://github.com/testing-library/testing-library-docs/commits?author=michaellasky) | [**Thomas Lombart**](http://thomlom.dev)[📖](https://github.com/testing-library/testing-library-docs/commits?author=thomlom) | [**Patrick K Long**](https://pklong.io)[📖](https://github.com/testing-library/testing-library-docs/commits?author=Pklong) |
| [**Pedro Filho**](https://github.com/pedroapfilho)[📖](https://github.com/testing-library/testing-library-docs/commits?author=pedroapfilho) | [**Tanguy Antoine**](https://github.com/tanguyantoine)[📖](https://github.com/testing-library/testing-library-docs/commits?author=tanguyantoine) | [**Kevin Anderson**](https://kevinanderson.codes)[📖](https://github.com/testing-library/testing-library-docs/commits?author=Agentkma) | [**Dustin Myers**](https://github.com/dustinmyers)[📖](https://github.com/testing-library/testing-library-docs/commits?author=dustinmyers) | [**Vojta Holik**](http://vojta.io)[🎨](#design-vojtaholik) | [**Steve Schwarz**](http://tech.agilitynerd.com/)[📖](https://github.com/testing-library/testing-library-docs/commits?author=saschwarz) | [**Aayush Rajvanshi**](https://github.com/aayushrajvanshi)[📖](https://github.com/testing-library/testing-library-docs/commits?author=aayushrajvanshi) |
| [**Eugie Limpin**](http://eugielimpin.com)[📖](https://github.com/testing-library/testing-library-docs/commits?author=eugiellimpin) | [**Kevin**](https://hsiangyu.com)[📖](https://github.com/testing-library/testing-library-docs/commits?author=KevinHu2014) | [**Jennifer Shehane**](https://github.com/jennifer-shehane)[📖](https://github.com/testing-library/testing-library-docs/commits?author=jennifer-shehane) | [**Steve Taggart**](https://github.com/stevetaggart)[📖](https://github.com/testing-library/testing-library-docs/commits?author=stevetaggart) | [**Stephen Sugden**](http://stephensugden.com)[📖](https://github.com/testing-library/testing-library-docs/commits?author=grncdr) | [**Blai Samitier**](http://samitier.github.io)[📖](https://github.com/testing-library/testing-library-docs/commits?author=Samitier) | [**Vernon Kesner**](https://github.com/vernonk)[📖](https://github.com/testing-library/testing-library-docs/commits?author=vernonk) |
| [**Will Douglas**](https://github.com/wdoug)[📖](https://github.com/testing-library/testing-library-docs/commits?author=wdoug) | [**Head**](https://velog.io/@head)[📖](https://github.com/testing-library/testing-library-docs/commits?author=HTMLhead) | [**Lee**](https://github.com/mynar7)[📖](https://github.com/testing-library/testing-library-docs/commits?author=mynar7) | [**Mario Beltrán Alarcón**](https://mario.dev)[📖](https://github.com/testing-library/testing-library-docs/commits?author=Belco90) | [**jameslevine**](https://github.com/jameslevine)[📖](https://github.com/testing-library/testing-library-docs/commits?author=jameslevine) | [**Rahim Alwer**](https://github.com/mihar-22)[📖](https://github.com/testing-library/testing-library-docs/commits?author=mihar-22) | [**Chenjia**](http://www.btorange.com)[📖](https://github.com/testing-library/testing-library-docs/commits?author=ariesjia) |
| [**Olivier Le Thanh Duong**](http://blog.staz.be)[📖](https://github.com/testing-library/testing-library-docs/commits?author=olethanh) | [**Jakub Jastrzębski**](https://kubajastrz.com)[📖](https://github.com/testing-library/testing-library-docs/commits?author=KubaJastrz) | [**Ivan Galiatin**](http://russianbrandgardeners.com)[📖](https://github.com/testing-library/testing-library-docs/commits?author=trurl-master) | [**Hendrik Röhm**](https://github.com/HendrikRoehm)[📖](https://github.com/testing-library/testing-library-docs/commits?author=HendrikRoehm) | [**Sam Kauffman**](https://samvk.com)[📖](https://github.com/testing-library/testing-library-docs/commits?author=samvk) | [**Turadg Aleahmad**](http://turadg.aleahmad.net/)[📖](https://github.com/testing-library/testing-library-docs/commits?author=turadg) | [**mark g romano**](https://github.com/MarkGeeRomano)[📖](https://github.com/testing-library/testing-library-docs/commits?author=MarkGeeRomano) |
| [**Arturo Romero**](https://github.com/arturoromeroslc)[📖](https://github.com/testing-library/testing-library-docs/commits?author=arturoromeroslc) | [**Dustin Masters**](https://www.dustinsoftware.com)[📖](https://github.com/testing-library/testing-library-docs/commits?author=dustinsoftware) | [**Darren Lester**](https://www.darrenlester.com)[📖](https://github.com/testing-library/testing-library-docs/commits?author=darren-lester) | [**Iswara Chaitanya**](https://github.com/iswara108)[📖](https://github.com/testing-library/testing-library-docs/commits?author=iswara108) | [**Nataliia Pylypenko**](https://github.com/pylnata)[📖](https://github.com/testing-library/testing-library-docs/commits?author=pylnata) | [**Hu Chen**](https://huchen.dev)[📖](https://github.com/testing-library/testing-library-docs/commits?author=huchenme) | [**Josh**](https://github.com/jkdowdle)[📖](https://github.com/testing-library/testing-library-docs/commits?author=jkdowdle) |
| [**numb86**](https://numb86.net/)[📖](https://github.com/testing-library/testing-library-docs/commits?author=numb86) | [**Nicholas Boll**](https://github.com/NicholasBoll)[📖](https://github.com/testing-library/testing-library-docs/commits?author=NicholasBoll) | [**Billy Matthews**](https://github.com/Billy-)[📢](#talk-Billy-) [📖](https://github.com/testing-library/testing-library-docs/commits?author=Billy-) | [**Dale French**](https://github.com/dale-french)[📖](https://github.com/testing-library/testing-library-docs/commits?author=dale-french) | [**aw-davidson**](https://github.com/aw-davidson)[📖](https://github.com/testing-library/testing-library-docs/commits?author=aw-davidson) | [**Benjamin Blackwood**](https://twitter.com/B_Blackwo)[📖](https://github.com/testing-library/testing-library-docs/commits?author=BBlackwo) | [**Ben**](https://github.com/rockingskier)[📖](https://github.com/testing-library/testing-library-docs/commits?author=rockingskier) |
| [**Daniel Afonso**](https://github.com/danieljcafonso)[📖](https://github.com/testing-library/testing-library-docs/commits?author=danieljcafonso) | [**Noman Gul**](https://dev.to/nomangul)[📖](https://github.com/testing-library/testing-library-docs/commits?author=NomanGul) | [**Rafael Souza**](http://rafatech.tk)[📖](https://github.com/testing-library/testing-library-docs/commits?author=rafaelangical) | [**Pavel Pustovalov**](http://pustovalov.dev)[📖](https://github.com/testing-library/testing-library-docs/commits?author=pustovalov) | [**Dyma**](https://github.com/dymafr)[📖](https://github.com/testing-library/testing-library-docs/commits?author=dymafr) | [**Matan Borenkraout**](https://twitter.com/matan_bobi)[📖](https://github.com/testing-library/testing-library-docs/commits?author=MatanBobi) [💻](https://github.com/testing-library/testing-library-docs/commits?author=MatanBobi) | [**timrobinson33**](https://github.com/timrobinson33)[📖](https://github.com/testing-library/testing-library-docs/commits?author=timrobinson33) |
| [**Manuel Dugué**](http://manueldugue.de)[📖](https://github.com/testing-library/testing-library-docs/commits?author=mdugue) | [**karthik20**](https://github.com/karthik20)[📖](https://github.com/testing-library/testing-library-docs/commits?author=karthik20) | [**Pob Ch**](https://github.com/pobch)[📖](https://github.com/testing-library/testing-library-docs/commits?author=pobch) | [**Mohammad Kermani**](https://github.com/mkermani144)[📖](https://github.com/testing-library/testing-library-docs/commits?author=mkermani144) | [**Adeel Imran**](http://twitter.com/adeelibr)[📖](https://github.com/testing-library/testing-library-docs/commits?author=adeelibr) | [**Varun Dey**](https://varundey.me)[📖](https://github.com/testing-library/testing-library-docs/commits?author=varundey) | [**Pablo R. Dinella**](http://pablodinella.com/)[📖](https://github.com/testing-library/testing-library-docs/commits?author=PabloDinella) |
| [**Jamie**](https://jamie.tokyo)[📖](https://github.com/testing-library/testing-library-docs/commits?author=jamsinclair) | [**Cory House**](http://www.bitnative.com)[📖](https://github.com/testing-library/testing-library-docs/commits?author=coryhouse) | [**Jack Zhao**](http://fb.me/yz)[📖](https://github.com/testing-library/testing-library-docs/commits?author=bugzpodder) | [**Ryan Kennel**](https://github.com/rkennel)[📖](https://github.com/testing-library/testing-library-docs/commits?author=rkennel) | [**Jesus Hernandez**](https://github.com/JesuHrz)[📖](https://github.com/testing-library/testing-library-docs/commits?author=JesuHrz) | [**Aaron Pettengill**](https://github.com/airjp73)[📖](https://github.com/testing-library/testing-library-docs/commits?author=airjp73) | [**Izhaki**](https://github.com/Izhaki)[📖](https://github.com/testing-library/testing-library-docs/commits?author=Izhaki) |
| [**Robin Wieruch**](https://www.robinwieruch.de)[✅](#tutorial-rwieruch) | [**Alexander Sokolov**](https://github.com/Alex-Sokolov)[📖](https://github.com/testing-library/testing-library-docs/commits?author=Alex-Sokolov) | [**Sascha Tandel**](https://github.com/sastan)[📖](https://github.com/testing-library/testing-library-docs/commits?author=sastan) | [**Gyuwon Yi**](https://gyuwon.github.io/)[📖](https://github.com/testing-library/testing-library-docs/commits?author=gyuwon) | [**Boris Serdiuk**](https://twitter.com/boriscoder)[📖](https://github.com/testing-library/testing-library-docs/commits?author=just-boris) | [**balavishnuvj**](https://github.com/balavishnuvj)[📖](https://github.com/testing-library/testing-library-docs/commits?author=balavishnuvj) | [**Sharmila Jesupaul**](http://jesupaul.com/)[📖](https://github.com/testing-library/testing-library-docs/commits?author=sharmilajesupaul) |
| [**Batuhan Wilhelm**](https://github.com/BatuhanW)[📖](https://github.com/testing-library/testing-library-docs/commits?author=BatuhanW) | [**Dennis Kaffer**](https://github.com/deadkff01)[📖](https://github.com/testing-library/testing-library-docs/commits?author=deadkff01) | [**Cam Jackson**](http://camjackson.net)[📖](https://github.com/testing-library/testing-library-docs/commits?author=camjackson) | [**Jared Luxenberg**](http://www.jaredlux.com)[📖](https://github.com/testing-library/testing-library-docs/commits?author=jluxenberg) | [**Yakir Narkis**](https://github.com/yakirn)[📖](https://github.com/testing-library/testing-library-docs/commits?author=yakirn) | [**Rahul Bhooteshwar**](https://rahulbhooteshwar.github.io/)[📖](https://github.com/testing-library/testing-library-docs/commits?author=rahulbhooteshwar) | [**Maja Wichrowska**](https://github.com/majapw)[📖](https://github.com/testing-library/testing-library-docs/commits?author=majapw) |
| [**Kermani**](http://medium.com/@kermani)[📖](https://github.com/testing-library/testing-library-docs/commits?author=m98) [👀](https://github.com/testing-library/testing-library-docs/pulls?q=is%3Apr+reviewed-by%3Am98) | [**Vasily Malykhin**](https://malykhinvi.dev)[📖](https://github.com/testing-library/testing-library-docs/commits?author=malykhinvi) | [**Brian Alexis**](https://github.com/brrianalexis)[📖](https://github.com/testing-library/testing-library-docs/commits?author=brrianalexis) | [**Kalpesh Singh**](http://KnowKalpesh.in)[📖](https://github.com/testing-library/testing-library-docs/commits?author=kalpeshsingh) | [**Gerrit Alex**](http://gerritalex.de)[📖](https://github.com/testing-library/testing-library-docs/commits?author=ljosberinn) | [**Winter LaMon**](https://github.com/winterlamon)[📖](https://github.com/testing-library/testing-library-docs/commits?author=winterlamon) | [**Juliano Penna**](https://github.com/jpenna)[📖](https://github.com/testing-library/testing-library-docs/commits?author=jpenna) |
| [**Paul Coroneos**](http://www.pcoroneos.com)[📖](https://github.com/testing-library/testing-library-docs/commits?author=PaulACoroneos) | [**Sebastian Silbermann**](https://solverfox.dev)[📖](https://github.com/testing-library/testing-library-docs/commits?author=eps1lon) [👀](https://github.com/testing-library/testing-library-docs/pulls?q=is%3Apr+reviewed-by%3Aeps1lon) | [**Paul Salaets**](https://paulsalaets.com/)[📖](https://github.com/testing-library/testing-library-docs/commits?author=psalaets) | [**Michaël De Boey**](https://michaeldeboey.be)[📖](https://github.com/testing-library/testing-library-docs/commits?author=michaeldeboey) | [**Washington Soares**](https://thewashington.dev)[📖](https://github.com/testing-library/testing-library-docs/commits?author=washingtonsoares) | [**Jami Suomalainen**](https://github.com/jamisuomalainen)[📖](https://github.com/testing-library/testing-library-docs/commits?author=jamisuomalainen) | [**Oriol Puig**](http://www.oriolpuig.com)[📖](https://github.com/testing-library/testing-library-docs/commits?author=oriolpuig) |
| [**hedgecox**](https://hedgecox.dev/)[📖](https://github.com/testing-library/testing-library-docs/commits?author=hedgecox) | [**Sherman Hui**](https://github.com/shermanhui)[📖](https://github.com/testing-library/testing-library-docs/commits?author=shermanhui) | [**Jesu Castillo**](https://github.com/jesujcastillom)[📖](https://github.com/testing-library/testing-library-docs/commits?author=jesujcastillom) | [**Core HTML5 Canvas, the book**](http://gearysite.com/)[📖](https://github.com/testing-library/testing-library-docs/commits?author=corehtml5canvas) | [**John Sterling**](https://github.com/johnste)[📖](https://github.com/testing-library/testing-library-docs/commits?author=johnste) | [**Velu S Gautam**](http://www.velusgautam.com)[📖](https://github.com/testing-library/testing-library-docs/commits?author=velusgautam) | [**Richard Oliver Bray**](https://www.youtube.com/c/RichardBray)[📖](https://github.com/testing-library/testing-library-docs/commits?author=RichardBray) |
| [**Yanlin Jiang**](https://github.com/cncolder)[📖](https://github.com/testing-library/testing-library-docs/commits?author=cncolder) | [**Lidor Avitan**](https://github.com/lidoravitan)[📖](https://github.com/testing-library/testing-library-docs/commits?author=lidoravitan) | [**Isaiah Thomason**](https://github.com/ITenthusiasm)[📖](https://github.com/testing-library/testing-library-docs/commits?author=ITenthusiasm) | [**Denis Barushev**](http://barushev.net)[📖](https://github.com/testing-library/testing-library-docs/commits?author=denis) | [**Domas**](https://github.com/domasx2)[📖](https://github.com/testing-library/testing-library-docs/commits?author=domasx2) | [**Anton Niklasson**](http://www.antn.se)[📖](https://github.com/testing-library/testing-library-docs/commits?author=AntonNiklasson) | [**Nikolai Yakuschenko**](https://github.com/nick722)[📖](https://github.com/testing-library/testing-library-docs/commits?author=nick722) |
| [**Jan Schröder**](https://github.com/vier31)[📖](https://github.com/testing-library/testing-library-docs/commits?author=vier31) | [**Nick McCurdy**](https://nickmccurdy.com/)[📖](https://github.com/testing-library/testing-library-docs/commits?author=nickmccurdy) [👀](https://github.com/testing-library/testing-library-docs/pulls?q=is%3Apr+reviewed-by%3Anickmccurdy) [💻](https://github.com/testing-library/testing-library-docs/commits?author=nickmccurdy) | [**Sudhanshu**](http://sudhanshu-ranjan.tech)[📖](https://github.com/testing-library/testing-library-docs/commits?author=tsuki42) | [**Aleksandr Chernov**](http://newrope.biz)[📖](https://github.com/testing-library/testing-library-docs/commits?author=aleks-rope) | [**Mathias**](https://github.com/mathiassoeholm)[📖](https://github.com/testing-library/testing-library-docs/commits?author=mathiassoeholm) | [**davidseow**](https://github.com/davidseow)[📖](https://github.com/testing-library/testing-library-docs/commits?author=davidseow) | [**Tony Hallett**](https://github.com/tonyhallett)[📖](https://github.com/testing-library/testing-library-docs/commits?author=tonyhallett) |
| [**prsdta**](https://github.com/prsdta)[📖](https://github.com/testing-library/testing-library-docs/commits?author=prsdta) | [**tal-joffe**](https://github.com/tal-joffe)[📖](https://github.com/testing-library/testing-library-docs/commits?author=tal-joffe) | [**Mayank Jethva**](http://mayankjethva.xyz)[📖](https://github.com/testing-library/testing-library-docs/commits?author=mayank23) | [**Elad Israeli**](https://github.com/EladIsraeli)[📖](https://github.com/testing-library/testing-library-docs/commits?author=EladIsraeli) | [**Francis Chartrand**](https://francischartrand.com)[📖](https://github.com/testing-library/testing-library-docs/commits?author=chartrandf) | [**Preston Carman**](https://github.com/prestoncarman)[📖](https://github.com/testing-library/testing-library-docs/commits?author=prestoncarman) | [**Olivier Wilkinson**](https://github.com/olivierwilkinson)[📖](https://github.com/testing-library/testing-library-docs/commits?author=olivierwilkinson) |
| [**Amit Miran**](https://github.com/amitmiran137)[📖](https://github.com/testing-library/testing-library-docs/commits?author=amitmiran137) | [**Paul Melero**](https://graficos.net)[📖](https://github.com/testing-library/testing-library-docs/commits?author=gangsthub) | [**jonathan schatz**](https://modo.sc)[📖](https://github.com/testing-library/testing-library-docs/commits?author=modosc) | [**Ricky Sullivan Himself**](https://github.com/rickysullivan)[📖](https://github.com/testing-library/testing-library-docs/commits?author=rickysullivan) | [**Armin**](https://github.com/wuarmin)[📖](https://github.com/testing-library/testing-library-docs/commits?author=wuarmin) | [**Dale Baldwin**](http://linktr.ee/dalebaldwin)[📖](https://github.com/testing-library/testing-library-docs/commits?author=dalebaldwin) | [**AdriSolid**](https://www.linkedin.com/in/adrisolid/)[📖](https://github.com/testing-library/testing-library-docs/commits?author=AdriSolid) |
| [**Naruth Kongurai**](https://naruth.dev)[📖](https://github.com/testing-library/testing-library-docs/commits?author=naruthk) | [**Erfan Mirzapour**](https://github.com/ErfanMirzapour)[📖](https://github.com/testing-library/testing-library-docs/commits?author=ErfanMirzapour) | [**Shem Mahluf**](https://github.com/shemExelate)[💻](https://github.com/testing-library/testing-library-docs/commits?author=shemExelate) [🚇](#infra-shemExelate) [📖](https://github.com/testing-library/testing-library-docs/commits?author=shemExelate) | [**Phil Gibbins**](https://github.com/scoobster17)[📖](https://github.com/testing-library/testing-library-docs/commits?author=scoobster17) | [**Liad Shiran**](https://github.com/Liadshiran)[📖](https://github.com/testing-library/testing-library-docs/commits?author=Liadshiran) | [**Eduardo Simón Picón**](https://github.com/EduardoSimon)[📖](https://github.com/testing-library/testing-library-docs/commits?author=EduardoSimon) | [**Sanjeev Sharma**](https://thesanjeevsharma.now.sh)[📖](https://github.com/testing-library/testing-library-docs/commits?author=thesanjeevsharma) |
| [**dror-heller**](https://github.com/drorheller)[📖](https://github.com/testing-library/testing-library-docs/commits?author=drorheller) | [**Aleksei Arro**](https://github.com/yialo)[📖](https://github.com/testing-library/testing-library-docs/commits?author=yialo) | [**Carlo Beltrame**](https://github.com/carlobeltrame)[📖](https://github.com/testing-library/testing-library-docs/commits?author=carlobeltrame) | [**ggorlen**](https://github.com/ggorlen)[📖](https://github.com/testing-library/testing-library-docs/commits?author=ggorlen) | [**mattstobbs**](https://blog.scottlogic.com/mstobbs/)[📖](https://github.com/testing-library/testing-library-docs/commits?author=mattstobbs) | [**Zach**](https://vxxce.github.io)[📖](https://github.com/testing-library/testing-library-docs/commits?author=vxxce) | [**Angus J. Pope**](https://github.com/anpaopao)[📖](https://github.com/testing-library/testing-library-docs/commits?author=anpaopao) |
| [**Dylan Piercey**](https://twitter.com/dylan_piercey)[📖](https://github.com/testing-library/testing-library-docs/commits?author=DylanPiercey) | [**Ruhollah**](https://github.com/ruhollahh)[📖](https://github.com/testing-library/testing-library-docs/commits?author=ruhollahh) | [**Michael Gwynne**](https://votemike.co.uk)[📖](https://github.com/testing-library/testing-library-docs/commits?author=votemike) | [**Dominik Broj**](https://github.com/thetric)[📖](https://github.com/testing-library/testing-library-docs/commits?author=thetric) | [**Stephen Wade**](https://github.com/stephenwade)[📖](https://github.com/testing-library/testing-library-docs/commits?author=stephenwade) | [**Luiz Baldi**](https://luizbaldi.com)[📖](https://github.com/testing-library/testing-library-docs/commits?author=luizbaldi) | [**Thomas Ingram**](http://www.ravinggenius.com/)[📖](https://github.com/testing-library/testing-library-docs/commits?author=ravinggenius) |
| [**David Johnston**](https://blacksheepcode.com)[📖](https://github.com/testing-library/testing-library-docs/commits?author=dwjohnston) | [**Rupert McKay**](https://fildon.me)[📖](https://github.com/testing-library/testing-library-docs/commits?author=fildon) | [**Sebastián Maciel**](http://www.sebastianmaciel.com)[📖](https://github.com/testing-library/testing-library-docs/commits?author=SebastianMaciel) | [**Sidharth Vinod**](http://sidharth.dev)[📖](https://github.com/testing-library/testing-library-docs/commits?author=sidharthv96) | [**Honza Kalfus**](https://github.com/jankalfus)[📖](https://github.com/testing-library/testing-library-docs/commits?author=jankalfus) | [**Christopher Laidler**](https://github.com/claidler)[📖](https://github.com/testing-library/testing-library-docs/commits?author=claidler) | [**Nik Savchenko**](https://github.com/savcni01)[📖](https://github.com/testing-library/testing-library-docs/commits?author=savcni01) |
| [**Steven Frieson**](http://stevenfrieson.com)[📖](https://github.com/testing-library/testing-library-docs/commits?author=sfrieson) | [**Andrew Rosário**](https://andrewrosario.medium.com/)[📖](https://github.com/testing-library/testing-library-docs/commits?author=andrewarosario) | [**Daniel RB**](http://danielrb.dev)[📖](https://github.com/testing-library/testing-library-docs/commits?author=brleinad) | [**HonkingGoose**](https://github.com/HonkingGoose)[📖](https://github.com/testing-library/testing-library-docs/commits?author=HonkingGoose) | [**Daniel Kolev**](https://github.com/Daniel-Kolev)[📖](https://github.com/testing-library/testing-library-docs/commits?author=Daniel-Kolev) | [**Arryangga Aliev Pratamaputra**](http://www.kopi.dev)[📖](https://github.com/testing-library/testing-library-docs/commits?author=arryanggaputra) | [**Andrew Hansen**](http://arahansen.com)[📖](https://github.com/testing-library/testing-library-docs/commits?author=arahansen) |
| [**JOAO GABRIEL SANTOS NEVES**](https://www.linkedin.com/in/jgsneves/)[📖](https://github.com/testing-library/testing-library-docs/commits?author=jgsneves) | [**Luke Ingalls**](http://lukeingalls.com)[📖](https://github.com/testing-library/testing-library-docs/commits?author=lukeingalls) | [**Aleksey Levenstein**](https://github.com/levenleven)[📖](https://github.com/testing-library/testing-library-docs/commits?author=levenleven) | [**Tomas Zaicevas**](https://medium.com/@zaicevas)[📖](https://github.com/testing-library/testing-library-docs/commits?author=zaicevas) | [**Sriram Thiagarajan**](https://github.com/tsriram)[📖](https://github.com/testing-library/testing-library-docs/commits?author=tsriram) | [**Esteban Borai**](http://estebanborai.com)[📖](https://github.com/testing-library/testing-library-docs/commits?author=EstebanBorai) | [**Arti Villa**](https://twitter.com/artivilla)[📖](https://github.com/testing-library/testing-library-docs/commits?author=artivilla) |
| [**Jake Boone**](https://github.com/jakeboone02)[📖](https://github.com/testing-library/testing-library-docs/commits?author=jakeboone02) | [**Dennis273**](https://github.com/Dennis273)[📖](https://github.com/testing-library/testing-library-docs/commits?author=Dennis273) | [**Mosh Feu**](https://www.linkedin.com/in/moshfeu/)[📖](https://github.com/testing-library/testing-library-docs/commits?author=moshfeu) | [**Notas Hellout**](https://fosstodon.org/@sudonymouse)[📖](https://github.com/testing-library/testing-library-docs/commits?author=make-github-pseudonymous-again) | [**Max Smolens**](https://maxsmolens.org)[📖](https://github.com/testing-library/testing-library-docs/commits?author=msmolens) | [**Nima Ebrazeh**](https://github.com/nimaebra)[📖](https://github.com/testing-library/testing-library-docs/commits?author=nimaebra) | [**Philipp Fritsche**](http://ph-fritsche.github.io)[👀](https://github.com/testing-library/testing-library-docs/pulls?q=is%3Apr+reviewed-by%3Aph-fritsche) |
| [**Clément Plantier**](https://github.com/clemp6r)[📖](https://github.com/testing-library/testing-library-docs/commits?author=clemp6r) | [**pppp606**](https://github.com/pppp606)[📖](https://github.com/testing-library/testing-library-docs/commits?author=pppp606) | [**Bilou**](https://github.com/bilouw)[📖](https://github.com/testing-library/testing-library-docs/commits?author=bilouw) | [**David Hewson**](https://github.com/dten)[📖](https://github.com/testing-library/testing-library-docs/commits?author=dten) | [**Alex Kim**](https://github.com/alex-kim-dev)[📖](https://github.com/testing-library/testing-library-docs/commits?author=alex-kim-dev) | [**PaquitoSoft**](http://paquitosoftware.com)[📖](https://github.com/testing-library/testing-library-docs/commits?author=PaquitoSoft) | [**Márcio Gabriel**](https://br.linkedin.com/in/marcioggs)[📖](https://github.com/testing-library/testing-library-docs/commits?author=marcioggs) |
| [**Krychaxp**](http://krychaxp.pl)[📖](https://github.com/testing-library/testing-library-docs/commits?author=krychaxp) | [**momokolo**](https://github.com/mohetti)[📖](https://github.com/testing-library/testing-library-docs/commits?author=mohetti) | [**AndyG**](https://github.com/meatnordrink)[📖](https://github.com/testing-library/testing-library-docs/commits?author=meatnordrink) | [**Jason Butz**](http://www.jasonbutz.info)[🚇](#infra-jbutz) | [**Oleg**](https://github.com/olejech)[📖](https://github.com/testing-library/testing-library-docs/commits?author=olejech) | [**Dany Paredes**](http://www.danywalls.com)[📖](https://github.com/testing-library/testing-library-docs/commits?author=danywalls) | [**Abel**](https://github.com/abelhbeyene)[📖](https://github.com/testing-library/testing-library-docs/commits?author=abelhbeyene) |
| [**Patrick Brady**](https://github.com/patrady)[📖](https://github.com/testing-library/testing-library-docs/commits?author=patrady) | [**Grant Eaton**](https://github.com/GrantIsEaton)[📖](https://github.com/testing-library/testing-library-docs/commits?author=GrantIsEaton) | [**Aaron Dunphy**](https://aarondunphy.com)[📖](https://github.com/testing-library/testing-library-docs/commits?author=aarondunphy) | [**Tom Mrazauskas**](https://github.com/mrazauskas)[📖](https://github.com/testing-library/testing-library-docs/commits?author=mrazauskas) | [**Supermaryy**](http://supermaryy.com)[📖](https://github.com/testing-library/testing-library-docs/commits?author=LuckyMona) | [**Ben Newton**](http://BenENewton.com)[📖](https://github.com/testing-library/testing-library-docs/commits?author=bennewton999) | [**Matija Marohnić**](https://silvenon.com)[📖](https://github.com/testing-library/testing-library-docs/commits?author=silvenon) |
| [**Thaddeus Jiang**](https://thaddeusjiang.com/)[📖](https://github.com/testing-library/testing-library-docs/commits?author=ThaddeusJiang) | [**Robin Drexler**](https://www.robin-drexler.com/)[📖](https://github.com/testing-library/testing-library-docs/commits?author=robin-drexler) | [**Thomas McKee**](https://github.com/caffeine-storm)[📖](https://github.com/testing-library/testing-library-docs/commits?author=caffeine-storm) | [**satanTime**](https://sudo.eu/)[📖](https://github.com/testing-library/testing-library-docs/commits?author=satanTime) | [**polinamochan**](https://github.com/polinamochan)[📖](https://github.com/testing-library/testing-library-docs/commits?author=polinamochan) | [**Shai Rose**](https://github.com/shaiRose)[📖](https://github.com/testing-library/testing-library-docs/commits?author=shaiRose) | [**AldinRekic**](https://github.com/AldinRekic)[🎨](#design-AldinRekic) |
| [**Son Nguyen**](https://sonng.dev/)[📖](https://github.com/testing-library/testing-library-docs/commits?author=thanhsonng) | [**Lirlev48**](https://github.com/Lirlev48)[📖](https://github.com/testing-library/testing-library-docs/commits?author=Lirlev48) | [**Tarjei Huse**](https://github.com/tarjei)[📖](https://github.com/testing-library/testing-library-docs/commits?author=tarjei) | [**Obie Munoz**](https://www.linkedin.com/in/obedmunozjr/)[📖](https://github.com/testing-library/testing-library-docs/commits?author=ObieMunoz) | [**Bert B**](https://github.com/bertybot)[📖](https://github.com/testing-library/testing-library-docs/commits?author=bertybot) | [**Alireza Heydari**](https://github.com/alirezahi)[📖](https://github.com/testing-library/testing-library-docs/commits?author=alirezahi) | [**Gleb Radutsky**](https://github.com/glebinsky)[📖](https://github.com/testing-library/testing-library-docs/commits?author=glebinsky) |
| [**giovanniPepi**](https://github.com/giovanniPepi)[📖](https://github.com/testing-library/testing-library-docs/commits?author=giovanniPepi) | [**Maciej Jastrzebski**](https://github.com/mdjastrzebski)[📖](https://github.com/testing-library/testing-library-docs/commits?author=mdjastrzebski) | [**Sergio Moreno**](https://semoal.github.io/sergiomoreno/)[💻](https://github.com/testing-library/testing-library-docs/commits?author=semoal) | [**David Nixon**](https://github.com/davidnixon)[📖](https://github.com/testing-library/testing-library-docs/commits?author=davidnixon) | [**Anton Khitrenovich**](http://technotes.khitrenovich.com/)[📖](https://github.com/testing-library/testing-library-docs/commits?author=khitrenovich) | [**Kostas Minaidis**](https://plethorathemes.com)[📖](https://github.com/testing-library/testing-library-docs/commits?author=kostasx) | [**Than Hutchins**](https://github.com/MynockSpit)[📖](https://github.com/testing-library/testing-library-docs/commits?author=MynockSpit) |
| [**Jordan Edmunds**](https://github.com/edmundsj)[📖](https://github.com/testing-library/testing-library-docs/commits?author=edmundsj) | [**mouse**](https://portfolio.mouse484.vercel.app/)[📖](https://github.com/testing-library/testing-library-docs/commits?author=mouse484) | [**Roberto Molina**](https://roberto-molina.netlify.app/)[📖](https://github.com/testing-library/testing-library-docs/commits?author=robertoms99) | [**Louis Young**](https://www.louisyoung.co.uk)[📖](https://github.com/testing-library/testing-library-docs/commits?author=louis-young) | [**Lukas Elmer**](https://www.linkedin.com/in/lukaselmer/)[📖](https://github.com/testing-library/testing-library-docs/commits?author=lukaselmer) | [**Brent Guffens**](https://github.com/brentguf)[📖](https://github.com/testing-library/testing-library-docs/commits?author=brentguf) | [**Esteban**](https://github.com/estebanfelipep)[📖](https://github.com/testing-library/testing-library-docs/commits?author=estebanfelipep) |
| [**Tibor Barsi**](https://github.com/tiborbarsi)[📖](https://github.com/testing-library/testing-library-docs/commits?author=tiborbarsi) | [**Tomoya Kashifuku**](https://github.com/tnyo43)[📖](https://github.com/testing-library/testing-library-docs/commits?author=tnyo43) | [**Leo**](https://leonerd.gatsbyjs.io/)[📖](https://github.com/testing-library/testing-library-docs/commits?author=wtlin1228) | [**Erik Metz**](http://spray-r.com)[📖](https://github.com/testing-library/testing-library-docs/commits?author=erik-metz) | [**Vaibhav Tyagi**](https://github.com/mrtyagi07)[📖](https://github.com/testing-library/testing-library-docs/commits?author=mrtyagi07) | [**Aleksei Drokin**](https://github.com/alleksei37)[📖](https://github.com/testing-library/testing-library-docs/commits?author=alleksei37) | [**Torsten Knauf**](https://github.com/shaman-apprentice)[📖](https://github.com/testing-library/testing-library-docs/commits?author=shaman-apprentice) |
| [**John Harlow**](http://jharlow.uk)[📖](https://github.com/testing-library/testing-library-docs/commits?author=jharlowuk) | [**Morgan Hunter**](https://github.com/morgan121)[📖](https://github.com/testing-library/testing-library-docs/commits?author=morgan121) | [**Louis Moselhi**](https://github.com/Mozl)[📖](https://github.com/testing-library/testing-library-docs/commits?author=Mozl) | [**Ryan McGill**](https://github.com/rydash)[📖](https://github.com/testing-library/testing-library-docs/commits?author=rydash) | [**Renan Andrade**](http://rensoares.com)[📖](https://github.com/testing-library/testing-library-docs/commits?author=renansoares) | [**Vasilii Boldurean**](https://github.com/boldurean)[📖](https://github.com/testing-library/testing-library-docs/commits?author=boldurean) | [**Josias Schneider**](http://theoutsider.dev)[📖](https://github.com/testing-library/testing-library-docs/commits?author=josiasds) |
| [**Denis LE**](https://github.com/ledenis)[📖](https://github.com/testing-library/testing-library-docs/commits?author=ledenis) | [**Nicolas Frizzarin**](https://github.com/Nicoss54)[📖](https://github.com/testing-library/testing-library-docs/commits?author=Nicoss54) | [**Santosh Yadav**](https://github.com/santoshyadavdev)[📖](https://github.com/testing-library/testing-library-docs/commits?author=santoshyadavdev) | [**Ilê Caian**](http://caian.dev)[📖](https://github.com/testing-library/testing-library-docs/commits?author=caiangums) | [**Alex Khomenko**](https://claritydev.net)[📖](https://github.com/testing-library/testing-library-docs/commits?author=Clarity-89) | [**Luís Campos**](https://llcampos.com)[📖](https://github.com/testing-library/testing-library-docs/commits?author=LLCampos) | [**Alexandr Zhidovlenko**](https://github.com/YozhEzhi)[📖](https://github.com/testing-library/testing-library-docs/commits?author=YozhEzhi) |
| [**lyannel**](https://github.com/lyannel)[️️️️♿️](#a11y-lyannel) | [**Yanick Champoux**](https://techblog.babyl.ca)[📖](https://github.com/testing-library/testing-library-docs/commits?author=yanick) | [**Ali**](https://ali-dev.medium.com)[📖](https://github.com/testing-library/testing-library-docs/commits?author=ali-kamalizade) | [**Milan Jaritz**](https://github.com/macmillen)[📖](https://github.com/testing-library/testing-library-docs/commits?author=macmillen) | [**Rokas Brazdžionis**](https://github.com/dzonatan)[📖](https://github.com/testing-library/testing-library-docs/commits?author=dzonatan) | [**Laforge Thomas**](https://thomaslaforge.dev/home)[📖](https://github.com/testing-library/testing-library-docs/commits?author=tomalaforge) | [**Steph Nathai**](https://github.com/StephNathai)[💻](https://github.com/testing-library/testing-library-docs/commits?author=StephNathai) [️️️️♿️](#a11y-StephNathai) |
| [**Frieder Bluemle**](https://github.com/friederbluemle)[📖](https://github.com/testing-library/testing-library-docs/commits?author=friederbluemle) | [**Gromit (전민재)**](https://blog.naver.com/ssi02014)[📖](https://github.com/testing-library/testing-library-docs/commits?author=ssi02014) | [**Cesar S**](https://github.com/csantos1113)[📖](https://github.com/testing-library/testing-library-docs/commits?author=csantos1113) | [**Corbin Crutchley**](https://crutchcorn.dev)[📖](https://github.com/testing-library/testing-library-docs/commits?author=crutchcorn) | [**Roman Batsenko**](https://github.com/rbatsenko)[📖](https://github.com/testing-library/testing-library-docs/commits?author=rbatsenko) | [**snjro**](https://github.com/snjro)[📖](https://github.com/testing-library/testing-library-docs/commits?author=snjro) | [**taro**](https://bento.me/taro)[📖](https://github.com/testing-library/testing-library-docs/commits?author=taro-28) |
| [**Andreas Nordahl**](https://github.com/andnorda)[📖](https://github.com/testing-library/testing-library-docs/commits?author=andnorda) | [**neaumusic**](https://neaumusic.github.io)[📖](https://github.com/testing-library/testing-library-docs/commits?author=neaumusic) | [**Joyel Johny**](https://github.com/JoyelJohny)[💻](https://github.com/testing-library/testing-library-docs/commits?author=JoyelJohny) | [**bsheps**](https://github.com/bsheps)[📖](https://github.com/testing-library/testing-library-docs/commits?author=bsheps) | [**Kyle Nazario**](http://www.kylenazario.com)[📖](https://github.com/testing-library/testing-library-docs/commits?author=kyle-n) | [**Giuliano Crivelli**](https://github.com/thefalked)[📖](https://github.com/testing-library/testing-library-docs/commits?author=thefalked) | [**mrkv**](https://t.me/markov_ka)[📖](https://github.com/testing-library/testing-library-docs/commits?author=mroforolhc) |
| [**smk267**](https://github.com/smk267)[🚇](#infra-smk267) | [**Dylan Gordon**](https://www.dylangordon.co.nz/)[📖](https://github.com/testing-library/testing-library-docs/commits?author=agentdylan) | [**Michael Cousins**](https://michael.cousins.io)[📖](https://github.com/testing-library/testing-library-docs/commits?author=mcous) [👀](https://github.com/testing-library/testing-library-docs/pulls?q=is%3Apr+reviewed-by%3Amcous) | [**Artem Zakharchenko**](https://kettanaito.com)[📖](https://github.com/testing-library/testing-library-docs/commits?author=kettanaito) | [**Vadim Shvetsov**](https://github.com/vadimshvetsov)[📖](https://github.com/testing-library/testing-library-docs/commits?author=vadimshvetsov) | [**Domantas Petrauskas**](https://domnantas.lt)[📖](https://github.com/testing-library/testing-library-docs/commits?author=domnantas) | [**Efim**](https://portfolio.edkt.ru)[📖](https://github.com/testing-library/testing-library-docs/commits?author=Efim-Kapliy) |
| [**denisx**](https://github.com/denisx)[💻](https://github.com/testing-library/testing-library-docs/commits?author=denisx) | [**Giovanni Gualiato**](https://github.com/ggualiato)[📖](https://github.com/testing-library/testing-library-docs/commits?author=ggualiato) | [**Saud Baig**](https://github.com/saubaig456)[📖](https://github.com/testing-library/testing-library-docs/commits?author=saubaig456) | [**Ren Adachi**](https://github.com/moeyashi)[📖](https://github.com/testing-library/testing-library-docs/commits?author=moeyashi) | [**Ty Mick**](https://tymick.me)[📖](https://github.com/testing-library/testing-library-docs/commits?author=TyMick) | [**Enmanuel Durán**](https://enmascript.com)[📖](https://github.com/testing-library/testing-library-docs/commits?author=enmanuelduran) | [**Galeel Bhasha Satthar**](https://github.com/gbhasha)[📖](https://github.com/testing-library/testing-library-docs/commits?author=gbhasha) |
| [**Ian Létourneau**](https://noma.to)[📖](https://github.com/testing-library/testing-library-docs/commits?author=ianlet) | [**brianlu2610**](https://github.com/brianlu2610)[💻](https://github.com/testing-library/testing-library-docs/commits?author=brianlu2610) | [**Erin**](https://github.com/ezzatron)[📖](https://github.com/testing-library/testing-library-docs/commits?author=ezzatron) | [**Nan Chen**](https://www.linkedin.com/in/nan-chen-000/)[📖](https://github.com/testing-library/testing-library-docs/commits?author=nchen000) | [**Alexander Burdiss**](http://alexanderburdiss.com)[📖](https://github.com/testing-library/testing-library-docs/commits?author=aburdiss) | [**Peter Hentges**](https://github.com/peterh-capella)[📖](https://github.com/testing-library/testing-library-docs/commits?author=peterh-capella) | [**neknalb**](https://github.com/neknalb)[📖](https://github.com/testing-library/testing-library-docs/commits?author=neknalb) |
| [**fetsorn**](https://github.com/fetsorn)[📖](https://github.com/testing-library/testing-library-docs/commits?author=fetsorn) | [**Uaena_Alex_John**](https://hdalex.top/)[📖](https://github.com/testing-library/testing-library-docs/commits?author=13RTK) | [**zakingslayerv22**](https://github.com/zakingslayerv22)[📖](https://github.com/testing-library/testing-library-docs/commits?author=zakingslayerv22) | [**time1043**](https://github.com/time1043)[📖](https://github.com/testing-library/testing-library-docs/commits?author=time1043) | [**Brandon Zylstra**](https://github.com/brandonzylstra)[📖](https://github.com/testing-library/testing-library-docs/commits?author=brandonzylstra) | [**Matt Morse**](https://github.com/flashgordon2016)[📖](https://github.com/testing-library/testing-library-docs/commits?author=flashgordon2016) |  |








This project follows the
[all-contributors](https://github.com/all-contributors/all-contributors)
specification. Contributions of any kind welcome!

---

## File: docs/queries/about.mdx

---
id: about
title: About Queries
---

import Tabs from '@theme/Tabs'
import TabItem from '@theme/TabItem'

## Overview

Queries are the methods that Testing Library gives you to find elements on the
page. There are several [types of queries](#types-of-queries) ("get", "find",
"query"); the difference between them is whether the query will throw an error
if no element is found or if it will return a Promise and retry. Depending on
what page content you are selecting, different queries may be more or less
appropriate. See the [priority guide](#priority) for recommendations on how to
make use of semantic queries to test your page in the most accessible way.

After selecting an element, you can use the
[Events API](dom-testing-library/api-events.mdx) or
[user-event](user-event/intro.mdx) to fire events and simulate user interactions
with the page, or use Jest and [jest-dom](ecosystem-jest-dom.mdx) to make
assertions about the element.

There are Testing Library helper methods that work with queries. As elements
appear and disappear in response to actions,
[Async APIs](dom-testing-library/api-async.mdx) like
[`waitFor`](dom-testing-library/api-async.mdx#waitfor) or
[`findBy` queries](dom-testing-library/api-async.mdx#findby-queries) can be used
to await the changes in the DOM. To find only elements that are children of a
specific element, you can use [`within`](dom-testing-library/api-within.mdx). If
necessary, there are also a few options you can
[configure](dom-testing-library/api-configuration.mdx), like the timeout for
retries and the default testID attribute.

## Example

```jsx
import {render, screen} from '@testing-library/react' // (or /dom, /vue, ...)

test('should show login form', () => {
  render(<Login />)
  const input = screen.getByLabelText('Username')
  // Events and assertions...
})
```

## Types of Queries

- Single Elements
  - `getBy...`: Returns the matching node for a query, and throw a descriptive
    error if no elements match _or_ if more than one match is found (use
    `getAllBy` instead if more than one element is expected).
  - `queryBy...`: Returns the matching node for a query, and return `null` if no
    elements match. This is useful for asserting an element that is not present.
    Throws an error if more than one match is found (use `queryAllBy` instead if
    this is OK).
  - `findBy...`: Returns a Promise which resolves when an element is found which
    matches the given query. The promise is rejected if no element is found or
    if more than one element is found after a default timeout of 1000ms. If you
    need to find more than one element, use `findAllBy`.
- Multiple Elements
  - `getAllBy...`: Returns an array of all matching nodes for a query, and
    throws an error if no elements match.
  - `queryAllBy...`: Returns an array of all matching nodes for a query, and
    return an empty array (`[]`) if no elements match.
  - `findAllBy...`: Returns a promise which resolves to an array of elements
    when any elements are found which match the given query. The promise is
    rejected if no elements are found after a default timeout of `1000`ms.
    - `findBy` methods are a combination of `getBy*` queries and
      [`waitFor`](../dom-testing-library/api-async.mdx#waitfor). They accept the
      `waitFor` options as the last argument (i.e.
      `await screen.findByText('text', queryOptions, waitForOptions)`)



Summary Table



| Type of Query         | 0 Matches     | 1 Match        | >1 Matches   | Retry (Async/Await) |
| --------------------- | ------------- | -------------- | ------------ | :-----------------: |
| **Single Element**    |               |                |              |                     |
| `getBy...`            | Throw error   | Return element | Throw error  |         No          |
| `queryBy...`          | Return `null` | Return element | Throw error  |         No          |
| `findBy...`           | Throw error   | Return element | Throw error  |         Yes         |
| **Multiple Elements** |               |                |              |                     |
| `getAllBy...`         | Throw error   | Return array   | Return array |         No          |
| `queryAllBy...`       | Return `[]`   | Return array   | Return array |         No          |
| `findAllBy...`        | Throw error   | Return array   | Return array |         Yes         |



## Priority

Based on [the Guiding Principles](guiding-principles.mdx), your test should
resemble how users interact with your code (component, page, etc.) as much as
possible. With this in mind, we recommend this order of priority:

1. **Queries Accessible to Everyone** Queries that reflect the experience of
   visual/mouse users as well as those that use assistive technology.
   1. `getByRole`: This can be used to query every element that is exposed in
      the
      [accessibility tree](https://developer.mozilla.org/en-US/docs/Glossary/AOM).
      With the `name` option you can filter the returned elements by their
      [accessible name](https://www.w3.org/TR/accname-1.1/). This should be your
      top preference for just about everything. There's not much you can't get
      with this (if you can't, it's possible your UI is inaccessible). Most
      often, this will be used with the `name` option like so:
      `getByRole('button', {name: /submit/i})`. Check the
      [list of roles](https://developer.mozilla.org/en-US/docs/Web/Accessibility/ARIA/ARIA_Techniques#Roles).
   1. `getByLabelText`: This method is really good for form fields. When
      navigating through a website form, users find elements using label text.
      This method emulates that behavior, so it should be your top preference.
   1. `getByPlaceholderText`:
      [A placeholder is not a substitute for a label](https://www.nngroup.com/articles/form-design-placeholders/).
      But if that's all you have, then it's better than alternatives.
   1. `getByText`: Outside of forms, text content is the main way users find
      elements. This method can be used to find non-interactive elements (like
      divs, spans, and paragraphs).
   1. `getByDisplayValue`: The current value of a form element can be useful
      when navigating a page with filled-in values.
1. **Semantic Queries** HTML5 and ARIA compliant selectors. Note that the user
   experience of interacting with these attributes varies greatly across
   browsers and assistive technology.
   1. `getByAltText`: If your element is one which supports `alt` text (`img`,
      `area`, `input`, and any custom element), then you can use this to find
      that element.
   1. `getByTitle`: The title attribute is not consistently read by
      screenreaders, and is not visible by default for sighted users
1. **Test IDs**
   1. `getByTestId`: The user cannot see (or hear) these, so this is only
      recommended for cases where you can't match by role or text or it doesn't
      make sense (e.g. the text is dynamic).

## Using Queries

The base queries from DOM Testing Library require you to pass a `container` as
the first argument. Most framework-implementations of Testing Library provide a
pre-bound version of these queries when you render your components with them
which means you _do not have to provide a container_. In addition, if you just
want to query `document.body` then you can use the [`screen`](#screen) export as
demonstrated below (using `screen` is recommended).

The primary argument to a query can be a _string_, _regular expression_, or
_function_. There are also options to adjust how node text is parsed. See
[TextMatch](#textmatch) for documentation on what can be passed to a query.

Given the following DOM elements (which can be rendered by React, Vue, Angular,
or plain HTML code):

```js

  
    <label for="username-input">Username</label>
    
  

```

You can use a query to find an element (byLabelText, in this case):

```js
import {screen, getByLabelText} from '@testing-library/dom'

// With screen:
const inputNode1 = screen.getByLabelText('Username')

// Without screen, you need to provide a container:
const container = document.querySelector('#app')
const inputNode2 = getByLabelText(container, 'Username')
```

### `queryOptions`

You can pass a `queryOptions` object with the query type. See the docs for each
query type to see available options, e.g. [byRole API](queries/byrole.mdx#api).

### `screen`

All of the queries exported by DOM Testing Library accept a `container` as the
first argument. Because querying the entire `document.body` is very common, DOM
Testing Library also exports a `screen` object which has every query that is
pre-bound to `document.body` (using the
[`within`](dom-testing-library/api-within.mdx) functionality). Wrappers such as
React Testing Library re-export `screen` so you can use it the same way.

Here's how you use it:

<Tabs
  defaultValue="native"
  values={[
    { label: 'Native', value: 'native', },
    { label: 'React', value: 'react', },
    { label: 'Angular', value: 'angular', },
    { label: 'Cypress', value: 'cypress', },
  ]
}>
<TabItem value="native">

```js
import {screen} from '@testing-library/dom'

document.body.innerHTML = `
  <label for="example">Example</label>
  
`

const exampleInput = screen.getByLabelText('Example')
```

  </TabItem>
  <TabItem value="react">

```jsx
import {render, screen} from '@testing-library/react'

render(
  
    <label htmlFor="example">Example</label>
    
  ,
)

const exampleInput = screen.getByLabelText('Example')
```

  </TabItem>
  <TabItem value="angular">

```ts
import {render, screen} from '@testing-library/angular'

await render(`
  
    <label for="example">Example</label>
    
  
`)

const exampleInput = screen.getByLabelText('Example')
```

  </TabItem>
  <TabItem value="cypress">

```js
cy.findByLabelText('Example').should('exist')
```

  </TabItem>
  </Tabs>

> **Note**
>
> You need a global DOM environment to use `screen`. If you're using jest, with
> the
> [testEnvironment](https://jestjs.io/docs/en/configuration#testenvironment-string)
> set to `jsdom`, a global DOM environment will be available for you.
>
> If you're loading your test with a `script` tag, make sure it comes after the
> `body`. An example can be seen
> [here](https://github.com/testing-library/dom-testing-library/issues/700#issuecomment-692218886).

## `TextMatch`

Most of the query APIs take a `TextMatch` as an argument, which means the
argument can be either a _string_, _regex_, or a _function_ of signature
`(content?: string, element?: Element | null) => boolean` which returns `true`
for a match and `false` for a mismatch.

### TextMatch Examples

Given the following HTML:

```html
Hello World
```

**_Will_ find the div:**

```javascript
// Matching a string:
screen.getByText('Hello World') // full string match
screen.getByText('llo Worl', {exact: false}) // substring match
screen.getByText('hello world', {exact: false}) // ignore case

// Matching a regex:
screen.getByText(/World/) // substring match
screen.getByText(/world/i) // substring match, ignore case
screen.getByText(/^hello world$/i) // full string match, ignore case
screen.getByText(/Hello W?oRlD/i) // substring match, ignore case, searches for "hello world" or "hello orld"

// Matching with a custom function:
screen.getByText((content, element) => content.startsWith('Hello'))
```

**_Will not_ find the div:**

```javascript
// full string does not match
screen.getByText('Goodbye World')

// case-sensitive regex with different case
screen.getByText(/hello world/)

// function looking for a span when it's actually a div:
screen.getByText((content, element) => {
  return element.tagName.toLowerCase() === 'span' && content.startsWith('Hello')
})
```

### Precision

Queries that take a `TextMatch` also accept an object as the final argument that
can contain options that affect the precision of string matching:

- `exact`: Defaults to `true`; matches full strings, case-sensitive. When false,
  matches substrings and is not case-sensitive.
  - it has no effect when used together with `regex` or `function` arguments.
  - in most cases, using a regex instead of a string combined with `{ exact: false }`
    gives you more control over fuzzy matching so it should be preferred.
- `normalizer`: An optional function which overrides normalization behavior. See
  [`Normalization`](#normalization).

### Normalization

Before running any matching logic against text in the DOM, `DOM Testing Library`
automatically normalizes that text. By default, normalization consists of
trimming whitespace from the start and end of text, and **collapsing multiple
adjacent whitespace characters within the string into a single space**.

If you want to prevent that normalization, or provide alternative normalization
(e.g. to remove Unicode control characters), you can provide a `normalizer`
function in the options object. This function will be given a string and is
expected to return a normalized version of that string.

> **Note**
>
> Specifying a value for `normalizer` _replaces_ the built-in normalization, but
> you can call `getDefaultNormalizer` to obtain a built-in normalizer, either to
> adjust that normalization or to call it from your own normalizer.

`getDefaultNormalizer` takes an options object which allows the selection of
behaviour:

- `trim`: Defaults to `true`. Trims leading and trailing whitespace
- `collapseWhitespace`: Defaults to `true`. Collapses inner whitespace
  (newlines, tabs, repeated spaces) into a single space.

#### Normalization Examples

To perform a match against text without trimming:

```javascript
screen.getByText('text', {
  normalizer: getDefaultNormalizer({trim: false}),
})
```

To override normalization to remove some Unicode characters whilst keeping some
(but not all) of the built-in normalization behavior:

```javascript
screen.getByText('text', {
  normalizer: str =>
    getDefaultNormalizer({trim: false})(str).replace(/[\u200E-\u200F]*/g, ''),
})
```

## Manual Queries

On top of the queries provided by the testing library, you can use the regular
[`querySelector` DOM API](https://developer.mozilla.org/en-US/docs/Web/API/Document/querySelector)
to query elements. Note that using this as an escape hatch to query by class or
id is not recommended because they are invisible to the user. Use a testid if
you have to, to make your intention to fall back to non-semantic queries clear
and establish a stable API contract in the HTML.

```jsx
// @testing-library/react
const {container} = render(<MyComponent />)
const foo = container.querySelector('[data-foo="bar"]')
```

## Browser extension

Do you still have problems knowing how to use Testing Library queries?

There is a very cool Browser extension for Chrome named
[Testing Playground](https://chrome.google.com/webstore/detail/testing-playground/hejbmebodbijjdhflfknehhcgaklhano),
and it helps you find the best queries to select elements. It allows you to
inspect the element hierarchies in the Browser's Developer Tools, and provides
you with suggestions on how to select them, while encouraging good testing
practices.

## Playground

If you want to get more familiar with these queries, you can try them out on
[testing-playground.com](https://testing-playground.com). Testing Playground is
an interactive sandbox where you can run different queries against your own
html, and get visual feedback matching the rules mentioned above.

---

## File: docs/queries/byalttext.mdx

---
id: byalttext
title: ByAltText
---

import Tabs from '@theme/Tabs'
import TabItem from '@theme/TabItem'

> getByAltText, queryByAltText, getAllByAltText, queryAllByAltText,
> findByAltText, findAllByAltText

## API

```typescript
getByAltText(
  // If you're using `screen`, then skip the container argument:
  container: HTMLElement,
  text: TextMatch,
  options?: {
    exact?: boolean = true,
    normalizer?: NormalizerFn,
  }): HTMLElement
```

This will return the element (normally an ``) that has the given `alt`
text. Note that it only supports elements which accept an `alt` attribute or
[custom elements](https://developer.mozilla.org/en-US/docs/Web/Web_Components/Using_custom_elements)
(since we don't know if a custom element implements `alt` or not):
[``](https://developer.mozilla.org/en-US/docs/Web/HTML/Element/img),
[``](https://developer.mozilla.org/en-US/docs/Web/HTML/Element/input),
and [`<area>`](https://developer.mozilla.org/en-US/docs/Web/HTML/Element/area)
(intentionally excluding
[`<applet>`](https://developer.mozilla.org/en-US/docs/Web/HTML/Element/applet)
as it's deprecated).

```html

```

<Tabs
  defaultValue="native"
  values={[
    { label: 'Native', value: 'native', },
    { label: 'React', value: 'react', },
    { label: 'Angular', value: 'angular', },
    { label: 'Cypress', value: 'cypress', },
  ]
}>
<TabItem value="native">

```js
import {screen} from '@testing-library/dom'

const incrediblesPosterImg = screen.getByAltText(/incredibles.*? poster/i)
```

  </TabItem>
  <TabItem value="react">

```jsx
import {render, screen} from '@testing-library/react'

render(<MyComponent />)
const incrediblesPosterImg = screen.getByAltText(/incredibles.*? poster/i)
```

  </TabItem>
  <TabItem value="angular">

```ts
import {render, screen} from '@testing-library/angular'

await render(MyComponent)
const incrediblesPosterImg = screen.getByAltText(/incredibles.*? poster/i)
```

  </TabItem>
  <TabItem value="cypress">

```js
cy.findByAltText(/incredibles.*? poster/i).should('exist')
```

  </TabItem>
  </Tabs>

## Options

[TextMatch](queries/about.mdx#textmatch) options

---

## File: docs/queries/bydisplayvalue.mdx

---
id: bydisplayvalue
title: ByDisplayValue
---

import Tabs from '@theme/Tabs'
import TabItem from '@theme/TabItem'

> getByDisplayValue, queryByDisplayValue, getAllByDisplayValue,
> queryAllByDisplayValue, findByDisplayValue, findAllByDisplayValue

## API

```typescript
getByDisplayValue(
  // If you're using `screen`, then skip the container argument:
  container: HTMLElement,
  value: TextMatch,
  options?: {
    exact?: boolean = true,
    normalizer?: NormalizerFn,
  }): HTMLElement
```

Returns the `input`, `textarea`, or `select` element that has the matching
display value.

### `input` tags

```html

```

```js
document.getElementById('lastName').value = 'Norris'
```

<Tabs
  defaultValue="native"
  values={[
    { label: 'Native', value: 'native', },
    { label: 'React', value: 'react', },
    { label: 'Angular', value: 'angular', },
    { label: 'Cypress', value: 'cypress', },
  ]
}>
<TabItem value="native">

```js
import {screen} from '@testing-library/dom'

const lastNameInput = screen.getByDisplayValue('Norris')
```

  </TabItem>
  <TabItem value="react">

```jsx
import {render, screen} from '@testing-library/react'

render(<MyComponent />)
const lastNameInput = screen.getByDisplayValue('Norris')
```

  </TabItem>
  <TabItem value="angular">

```ts
import {render, screen} from '@testing-library/angular'

await render(MyComponent)
const lastNameInput = screen.getByDisplayValue('Norris')
```

  </TabItem>
  <TabItem value="cypress">

```js
cy.findByDisplayValue('Norris').should('exist')
```

  </TabItem>
  </Tabs>

### `textarea` tags

```html
<textarea id="messageTextArea" />
```

```js
document.getElementById('messageTextArea').value = 'Hello World'
```

<Tabs
  defaultValue="native"
  values={[
    { label: 'Native', value: 'native', },
    { label: 'React', value: 'react', },
    { label: 'Angular', value: 'angular', },
    { label: 'Cypress', value: 'cypress', },
  ]
}>
<TabItem value="native">

```js
import {screen} from '@testing-library/dom'

const messageTextArea = screen.getByDisplayValue('Hello World')
```

  </TabItem>
  <TabItem value="react">

```jsx
import {render, screen} from '@testing-library/react'

render(<MyComponent />)
const messageTextArea = screen.getByDisplayValue('Hello World')
```

  </TabItem>
  <TabItem value="angular">

```ts
import {render, screen} from '@testing-library/angular'

await render(MyComponent)
const messageTextArea = screen.getByDisplayValue('Hello World')
```

  </TabItem>
  <TabItem value="cypress">

```js
cy.findByDisplayValue('Hello World').should('exist')
```

  </TabItem>
  </Tabs>

### `select` tags

In case of `select`, this will search for a `<select>` whose selected `<option>`
matches the given [`TextMatch`](queries/about.mdx#textmatch).

```html
<select>
  <option value="">State</option>
  <option value="AL">Alabama</option>
  <option selected value="AK">Alaska</option>
  <option value="AZ">Arizona</option>
</select>
```

<Tabs
  defaultValue="native"
  values={[
    { label: 'Native', value: 'native', },
    { label: 'React', value: 'react', },
    { label: 'Angular', value: 'angular', },
    { label: 'Cypress', value: 'cypress', },
  ]
}>
<TabItem value="native">

```js
import {screen} from '@testing-library/dom'

const selectElement = screen.getByDisplayValue('Alaska')
```

  </TabItem>
  <TabItem value="react">

```jsx
import {render, screen} from '@testing-library/react'

render(<MyComponent />)
const selectElement = screen.getByDisplayValue('Alaska')
```

  </TabItem>
  <TabItem value="angular">

```ts
import {render, screen} from '@testing-library/angular'

await render(MyComponent)
const selectElement = screen.getByDisplayValue('Alaska')
```

  </TabItem>
  <TabItem value="cypress">

```js
cy.findByDisplayValue('Alaska').should('exist')
```

  </TabItem>
  </Tabs>

## Options

[TextMatch](queries/about.mdx#textmatch) options

---

## File: docs/queries/bylabeltext.mdx

---
id: bylabeltext
title: ByLabelText
---

import Tabs from '@theme/Tabs'
import TabItem from '@theme/TabItem'

> getByLabelText, queryByLabelText, getAllByLabelText, queryAllByLabelText,
> findByLabelText, findAllByLabelText

## API

```typescript
getByLabelText(
  // If you're using `screen`, then skip the container argument:
  container: HTMLElement,
  text: TextMatch,
  options?: {
    selector?: string = '*',
    exact?: boolean = true,
    normalizer?: NormalizerFn,
  }): HTMLElement
```

This will search for the label that matches the given
[`TextMatch`](queries/about.mdx#textmatch), then find the element associated
with that label.

The example below will find the input node for the following DOM structures:

```js
// for/htmlFor relationship between label and form element id
<label for="username-input">Username</label>


// The aria-labelledby attribute with form elements
<label id="username-label">Username</label>


// Wrapper labels
<label>Username </label>

// Wrapper labels where the label text is in another child element
<label>
  Username
  
</label>

// aria-label attributes
// Take care because this is not a label that users can see on the page,
// so the purpose of your input must be obvious to visual users.

```

<Tabs
  defaultValue="native"
  values={[
    { label: 'Native', value: 'native', },
    { label: 'React', value: 'react', },
    { label: 'Angular', value: 'angular', },
    { label: 'Cypress', value: 'cypress', },
  ]
}>
<TabItem value="native">

```js
import {screen} from '@testing-library/dom'

const inputNode = screen.getByLabelText('Username')
```

  </TabItem>
  <TabItem value="react">

```jsx
import {render, screen} from '@testing-library/react'

render(<Login />)

const inputNode = screen.getByLabelText('Username')
```

  </TabItem>
  <TabItem value="angular">

```ts
import {render, screen} from '@testing-library/angular'

await render(Login)

const inputNode = screen.getByLabelText('Username')
```

  </TabItem>
  <TabItem value="cypress">

```js
cy.findByLabelText('Username').should('exist')
```

  </TabItem>
  </Tabs>

## Options

### `name`

The example above does NOT find the input node for label text broken up by
elements. You can use `getByRole('textbox', { name: 'Username' })` instead which
is robust against switching to `aria-label` or `aria-labelledby`.

### `selector`

If it is important that you query a specific element (e.g. an ``) you can
provide a `selector` in the options:

```js
// Multiple elements labelled via aria-labelledby
<label id="username">Username</label>

Please enter your username

// Multiple labels with the same text
<label>
  Username
  
</label>
<label>
  Username
  <textarea></textarea>
</label>
```

```js
const inputNode = screen.getByLabelText('Username', {selector: 'input'})
```

> **Note**
>
> `getByLabelText` will not work in the case where a `for` attribute on a
> `<label>` element matches an `id` attribute on a non-form element.

```js
// This case is not valid
// for/htmlFor between label and an element that is not a form element
<section id="photos-section">
  <label for="photos-section">Photos</label>
</section>
```

---

## File: docs/queries/byplaceholdertext.mdx

---
id: byplaceholdertext
title: ByPlaceholderText
---

import Tabs from '@theme/Tabs'
import TabItem from '@theme/TabItem'

> getByPlaceholderText, queryByPlaceholderText, getAllByPlaceholderText,
> queryAllByPlaceholderText, findByPlaceholderText, findAllByPlaceholderText

## API

```typescript
getByPlaceholderText(
  // If you're using `screen`, then skip the container argument:
  container: HTMLElement,
  text: TextMatch,
  options?: {
    exact?: boolean = true,
    normalizer?: NormalizerFn,
  }): HTMLElement
```

This will search for all elements with a placeholder attribute and find one that
matches the given [`TextMatch`](queries/about.mdx#textmatch).

```html

```

<Tabs
  defaultValue="native"
  values={[
    { label: 'Native', value: 'native', },
    { label: 'React', value: 'react', },
    { label: 'Angular', value: 'angular', },
    { label: 'Cypress', value: 'cypress', },
  ]
}>
<TabItem value="native">

```js
import {screen} from '@testing-library/dom'

const inputNode = screen.getByPlaceholderText('Username')
```

  </TabItem>
  <TabItem value="react">

```jsx
import {render, screen} from '@testing-library/react'

render(<MyComponent />)
const inputNode = screen.getByPlaceholderText('Username')
```

  </TabItem>
  <TabItem value="angular">

```ts
import {render, screen} from '@testing-library/angular'

await render(MyComponent)
const inputNode = screen.getByPlaceholderText('Username')
```

  </TabItem>
  <TabItem value="cypress">

```js
cy.findByPlaceholderText('Username').should('exist')
```

  </TabItem>
  </Tabs>

> **Note**
>
> A placeholder is not a good substitute for a label so you should generally use
> `getByLabelText` instead.

## Options

[TextMatch](queries/about.mdx#textmatch) options

---

## File: docs/queries/byrole.mdx

---
id: byrole
title: ByRole
---

import Tabs from '@theme/Tabs'
import TabItem from '@theme/TabItem'

> getByRole, queryByRole, getAllByRole, queryAllByRole, findByRole,
> findAllByRole

## API

```typescript
getByRole(
  // If you're using `screen`, then skip the container argument:
  container: HTMLElement,
  role: string,
  options?: {
    hidden?: boolean = false,
    name?: TextMatch,
    description?: TextMatch,
    selected?: boolean,
    busy?: boolean,
    checked?: boolean,
    pressed?: boolean,
    suggest?: boolean,
    current?: boolean | string,
    expanded?: boolean,
    queryFallbacks?: boolean,
    level?: number,
    value?: {
      min?: number,
      max?: number,
      now?: number,
      text?: TextMatch,
    }
  }): HTMLElement
```

Queries for elements with the given role (and it also accepts a
[`TextMatch`](queries/about.mdx#textmatch)). Default roles are taken into
consideration e.g. `` has the `button` role without explicitly setting
the `role` attribute. Here you can see
[a table of HTML elements with their default and desired roles](https://www.w3.org/TR/html-aria/#docconformance).

Please note that setting a `role` and/or `aria-*` attribute that matches the
implicit ARIA semantics is unnecessary and is **not recommended** as these
properties are already set by the browser, and we must not use the `role` and
`aria-*` attributes in a manner that conflicts with the semantics described. For
example, a `button` element can't have the `role` attribute of `heading`,
because the `button` element has default characteristics that conflict with the
`heading` role.

> Roles are matched literally by string equality, without inheriting from the
> ARIA role hierarchy. As a result, querying a superclass role like `checkbox`
> will not include elements with a subclass role like `switch`.

You can query the returned element(s) by their
[accessible name or description](https://www.w3.org/TR/accname-1.1/). The
accessible name is for simple cases equal to e.g. the label of a form element,
or the text content of a button, or the value of the `aria-label` attribute. It
can be used to query a specific element if multiple elements with the same role
are present on the rendered content. For an in-depth guide check out
["What is an accessible name?" from TPGi](https://www.tpgi.com/what-is-an-accessible-name/).
If you only query for a single element with `getByText('The name')` it's
oftentimes better to use `getByRole(expectedRole, { name: 'The name' })`. The
accessible name query does not replace other queries such as `*ByAlt` or
`*ByTitle`. While the accessible name can be equal to these attributes, it does
not replace the functionality of these attributes. For example
`` will be returned for
`getByRole('img', { name: 'fancy image' })`. However, the image will not display
its description if `fancy.jpg` could not be loaded. Whether you want to assert
this functionality in your test or not is up to you.

:::tip input type password

Unfortunately, the spec defines that `` has no implicit
role. This means that in order to query this type of element we must fallback to
a less powerful query such as [`ByLabelText`](queries/bylabeltext.mdx).

:::

## Options

### `hidden`

If you set `hidden` to `true` elements that are normally excluded from the
accessibility tree are considered for the query as well. The default behavior
follows https://www.w3.org/TR/wai-aria-1.2/#tree_exclusion with the exception of
`role="none"` and `role="presentation"` which are considered in the query in any
case. For example in

```html

  <main aria-hidden="true">
    Open dialog
  </main>
  
    Close dialog
  

```

`getByRole('button')` would only return the `Close dialog`-button. To make
assertions about the `Open dialog`-button you would need to use
`getAllByRole('button', { hidden: true })`.

The default value for `hidden` can
[be configured](../dom-testing-library/api-configuration.mdx#configuration).

### `selected`

You can filter the returned elements by their selected state by setting
`selected: true` or `selected: false`.

For example in

```html

  
    Native
    React
    Cypress
  

```

you can get the "Native"-tab by calling `getByRole('tab', { selected: true })`.
To learn more about the selected state and which elements can have this state
see [ARIA `aria-selected`](https://www.w3.org/TR/wai-aria-1.2/#aria-selected).

### `busy`

You can filter the returned elements by their busy state by setting `busy: true`
or `busy: false`.

For example in

```html

  <section>
    Login failed
    Error: Loading message...
  </section>

```

you can get the "Login failed" alert by calling
`getByRole('alert', { busy: false })`. To learn more about the busy state see
[ARIA `aria-busy`](https://www.w3.org/TR/wai-aria-1.2/#aria-busy) and
[MDN `aria-busy` attribute](https://developer.mozilla.org/en-US/docs/Web/Accessibility/ARIA/Attributes/aria-busy).

### `checked`

You can filter the returned elements by their checked state by setting
`checked: true` or `checked: false`.

For example in

```html

  <section>
    Sugar
    Gummy bears
    Whipped cream
  </section>

```

you can get the "Sugar" option by calling
`getByRole('checkbox', { checked: true })`. To learn more about the checked
state and which elements can have this state see
[ARIA `aria-checked`](https://www.w3.org/TR/wai-aria-1.2/#aria-checked).

> **Note**
>
> Checkboxes have a "mixed" state, which is considered neither checked nor
> unchecked (details [here](https://www.w3.org/TR/html-aam-1.0/#details-id-56)).

### `current`

You can filter the returned elements by their current state by setting
`current: boolean | string`. Note that no `aria-current` attribute will match
`current: false` since `false` is the default value for `aria-current`.

For example in

```html

  <nav>
    [👍](current/page)
    [👎](another/page)
  </nav>

```

you can get the "👍" link by calling `getByRole('link', { current: 'page' })`
and the "👎" by calling `getByRole('link', { current: false })`. To learn more
about the current state see
[ARIA `aria-current`](https://www.w3.org/TR/wai-aria-1.2/#aria-current).

### `pressed`

Buttons can have a pressed state. You can filter the returned elements by their
pressed state by setting `pressed: true` or `pressed: false`.

For example in

```html

  <section>
    👍
    👎
  </section>

```

you can get the "👍" button by calling `getByRole('button', { pressed: true })`.
To learn more about the pressed state see
[ARIA `aria-pressed`](https://www.w3.org/TR/wai-aria-1.2/#aria-pressed).

### `suggest`

You can disable the ability to
[throw suggestions](../dom-testing-library/api-configuration.mdx#throwsuggestions-experimental)
for a specific query by setting this value to `false`.  
Setting this value to `true` will throw suggestions for the specific query.

### `expanded`

You can filter the returned elements by their expanded state by setting
`expanded: true` or `expanded: false`.

For example in

```html

  <nav>
    
      <li>
        <a aria-expanded="false" aria-haspopup="true" href="..."
          >Expandable Menu Item</a
        >
        
          <li>[Submenu Item 1](#)</li>
          <li>[Submenu Item 1](#)</li>
        
      </li>
      <li>[Regular Menu Item](#)</li>
    
  </nav>

```

you can get the "Expandable Menu Item" link by calling
`getByRole('link', { expanded: false })`. To learn more about the expanded state
and which elements can have this state see
[ARIA `aria-expanded`](https://www.w3.org/TR/wai-aria-1.2/#aria-expanded).

```html
...
```

<Tabs
  defaultValue="native"
  values={[
    { label: 'Native', value: 'native', },
    { label: 'React', value: 'react', },
    { label: 'Angular', value: 'angular', },
    { label: 'Cypress', value: 'cypress', },
  ]
}>
<TabItem value="native">

```js
import {screen} from '@testing-library/dom'

const dialogContainer = screen.getByRole('dialog')
```

  </TabItem>
  <TabItem value="react">

```jsx
import {render, screen} from '@testing-library/react'

render(<MyComponent />)
const dialogContainer = screen.getByRole('dialog')
```

  </TabItem>
  <TabItem value="angular">

```ts
import {render, screen} from '@testing-library/angular'

await render(MyComponent)
const dialogContainer = screen.getByRole('dialog')
```

  </TabItem>
  <TabItem value="cypress">

```js
cy.findByRole('dialog').should('exist')
```

  </TabItem>
  </Tabs>

### `queryFallbacks`

By default, it's assumed that the first role of each element is supported, so
only the first role can be queried. If you need to query an element by any of
its fallback roles instead, you can use `queryFallbacks: true`.

For example, `getByRole('switch')` would always match
`` because it's the first role, while
`getByRole('checkbox')` would not. However,
`getByRole('checkbox', { queryFallbacks: true })` would enable all fallback
roles and therefore match the same element.

> An element doesn't have multiple roles in a given environment. It has a single
> one. Multiple roles in the attribute are evaluated from left to right until
> the environment finds the first role it understands. This is useful when new
> roles get introduced and you want to start supporting those as well as older
> environments that don't understand that role (yet).

### `level`

An element with the `heading` role can be queried by any heading level
`getByRole('heading')` or by a specific heading level using the `level` option
`getByRole('heading', { level: 2 })`.

The `level` option queries the element(s) with the `heading` role matching the
indicated level determined by the semantic HTML heading elements `<h1>-<h6>` or
matching the `aria-level` attribute.

Given the example below,

```html

  <section>
    <h1>Heading Level One</h1>
    <h2>First Heading Level Two</h2>
    <h3>Heading Level Three</h3>
    Second Heading Level Two
  </section>

```

you can query the `Heading Level Three` heading using
`getByRole('heading', { level: 3 })`.

```js
getByRole('heading', {level: 1})
// <h1>Heading Level One</h1>

getAllByRole('heading', {level: 2})
// [
//   <h2>First Heading Level Two</h2>,
//   Second Heading Level Two
// ]
```

While it is possible to explicitly set `role="heading"` and `aria-level`
attribute on an element, it is **strongly encouraged** to use the semantic HTML
headings `<h1>-<h6>`.

To learn more about the `aria-level` property, see
[ARIA `aria-level`](https://www.w3.org/TR/wai-aria-1.2/#aria-level).

> The `level` option is _only_ applicable to the `heading` role. An error will
> be thrown when used with any other role.

### `value`

A range widget can be queried by any value `getByRole('spinbutton')` or by a
specific value using the `level` option
`getByRole('spinbutton', { value: { now: 5, min: 0, max: 10, text: 'medium' } })`.

Note that you don't have to specify all properties in `value`. A subset is
sufficient e.g.
`getByRole('spinbutton', { value: { now: 5, text: 'medium' } })`.

Given the example below,

```html

  <section>
    
      Volume
    
    
      Pitch
    
  </section>

```

you can query specific spinbutton(s) with the following queries,

```js
getByRole('spinbutton', {value: {now: 5}})
// Volume

getAllByRole('spinbutton', {value: {min: 0}})
// [
//   Volume,
//   Pitch
// ]
```

> Every specified property in `value` must match. For example, if you query for
> `{value: {min: 0, now: 3}}` `aria-valuemin` must be equal to 0 **AND** >
> `aria-valuenow` must be equal to 3

> The `value` option is _only_ applicable to certain roles (check the linked MDN
> pages below for applicable roles). An error will be thrown when used with any
> other role.

To learn more about the `aria-value*` properties, see
[MDN `aria-valuemin`](https://developer.mozilla.org/en-US/docs/Web/Accessibility/ARIA/Attributes/aria-valuemin),
[MDN `aria-valuemax`](https://developer.mozilla.org/en-US/docs/Web/Accessibility/ARIA/Attributes/aria-valuemax),
[MDN `aria-valuenow`](https://developer.mozilla.org/en-US/docs/Web/Accessibility/ARIA/Attributes/aria-valuenow),
[MDN `aria-valuetext`](https://developer.mozilla.org/en-US/docs/Web/Accessibility/ARIA/Attributes/aria-valuetext).

### `description`

You can filter the returned elements by their
[accessible description](https://www.w3.org/TR/accname-1.1/#mapping_additional_nd_description)
for those cases where you have several elements with the same role and they
don't have an accessible name but they do have a description. This would
be the case for elements with
[alertdialog](https://www.w3.org/TR/wai-aria-1.1/#alertdialog) role, where the
`aria-describedby` attribute is used to describe the element's content.

For example in

```html

  
    <li role="alertdialog" aria-describedby="notification-id-1">
      Close
      You have unread emails
    </li>
    <li role="alertdialog" aria-describedby="notification-id-2">
      Close
      Your session is about to expire
    </li>
  

```

You can query a specific element like this

```js
getByRole('alertdialog', {description: 'Your session is about to expire'})
```

## Performance

`getByRole` is the most preferred query to use as it most closely resembles the
user experience, however the calculations it must perform to provide this
confidence can be expensive (particularly with large DOM trees).

Where test performance is a concern it may be desirable to trade some of this
confidence for improved performance.

`getByRole` performance can be improved by setting the option
[`hidden`](#hidden) to `true` and thereby avoid expensive visibility checks.
Note that in doing so inaccessible elements will now be included in the result.

Another option may be to substitute `getByRole` for simpler `getByLabelText` and
`getByText` queries which can be significantly faster though less robust
alternatives.

---

## File: docs/queries/bytext.mdx

---
id: bytext
title: ByText
---

import Tabs from '@theme/Tabs'
import TabItem from '@theme/TabItem'

> getByText, queryByText, getAllByText, queryAllByText, findByText,
> findAllByText

## API

```typescript
getByText(
  // If you're using `screen`, then skip the container argument:
  container: HTMLElement,
  text: TextMatch,
  options?: {
    selector?: string = '*',
    exact?: boolean = true,
    ignore?: string|boolean = 'script, style',
    normalizer?: NormalizerFn,
  }): HTMLElement
```

This will search for all elements that have a text node with `textContent`
matching the given [`TextMatch`](queries/about.mdx#textmatch).

```html
[About ℹ️](/about)
```

<Tabs
  defaultValue="native"
  values={[
    { label: 'Native', value: 'native', },
    { label: 'React', value: 'react', },
    { label: 'Angular', value: 'angular', },
    { label: 'Cypress', value: 'cypress', },
  ]
}>
<TabItem value="native">

```js
import {screen} from '@testing-library/dom'

const aboutAnchorNode = screen.getByText(/about/i)
```

  </TabItem>
  <TabItem value="react">

```jsx
import {render, screen} from '@testing-library/react'

render(<MyComponent />)
const aboutAnchorNode = screen.getByText(/about/i)
```

  </TabItem>
  <TabItem value="angular">

```ts
import {render, screen} from '@testing-library/angular'

await render(MyComponent)
const aboutAnchorNode = screen.getByText(/about/i)
```

  </TabItem>
  <TabItem value="cypress">

```js
cy.findByText(/about/i).should('exist')
```

  </TabItem>
  </Tabs>

It also works with `input`s whose `type` attribute is either `submit` or
`button`:

```js

```

## Options

[TextMatch](queries/about.mdx#textmatch) options, plus the following:

### `selector`

> **Note**
>
> See [`getByLabelText`](queries/bylabeltext.mdx#selector) for more details on
> how and when to use the `selector` option

### `ignore`

The `ignore` option accepts a query selector. If the
[`node.matches`](https://developer.mozilla.org/en-US/docs/Web/API/Element/matches)
returns true for that selector, the node will be ignored. This defaults to
`'script, style'` because generally you don't want to select these tags, but if
your content is in an inline script file, then the script tag could be returned.

If you'd rather disable this behavior, set `ignore` to `false`.

---

## File: docs/queries/bytitle.mdx

---
id: bytitle
title: ByTitle
---

import Tabs from '@theme/Tabs'
import TabItem from '@theme/TabItem'

> getByTitle, queryByTitle, getAllByTitle, queryAllByTitle, findByTitle,
> findAllByTitle

## API

```typescript
getByTitle(
  // If you're using `screen`, then skip the container argument:
  container: HTMLElement,
  title: TextMatch,
  options?: {
    exact?: boolean = true,
    normalizer?: NormalizerFn,
  }): HTMLElement
```

Returns the element that has the matching `title` attribute.

Will also find a `title` element within an SVG.

```html

<svg>
  <title>Close</title>
  <g></g>
</svg>
```

<Tabs
  defaultValue="native"
  values={[
    { label: 'Native', value: 'native', },
    { label: 'React', value: 'react', },
    { label: 'Angular', value: 'angular', },
    { label: 'Cypress', value: 'cypress', },
  ]
}>
<TabItem value="native">

```js
import {screen} from '@testing-library/dom'

const deleteElement = screen.getByTitle('Delete')
const closeElement = screen.getByTitle('Close')
```

  </TabItem>
  <TabItem value="react">

```jsx
import {render, screen} from '@testing-library/react'

render(<MyComponent />)
const deleteElement = screen.getByTitle('Delete')
const closeElement = screen.getByTitle('Close')
```

  </TabItem>
  <TabItem value="angular">

```ts
import {render, screen} from '@testing-library/angular'

await render(MyComponent)
const deleteElement = screen.getByTitle('Delete')
const closeElement = screen.getByTitle('Close')
```

  </TabItem>
  <TabItem value="cypress">

```js
cy.findByTitle('Delete').should('exist')
cy.findByTitle('Close').should('exist')
```

  </TabItem>
  </Tabs>

## Options

[TextMatch](queries/about.mdx#textmatch) options

---

## File: docs/user-event/api-clipboard.mdx

---
id: clipboard
title: Clipboard
---

Note that the
[Clipboard API](https://developer.mozilla.org/en-US/docs/Web/API/Clipboard) is
usually not available outside of secure context.  
To enable testing of workflows involving the clipboard,
[`userEvent.setup()`](setup.mdx) replaces `window.navigator.clipboard` with a
stub.

## copy()

```ts
copy(): Promise<DataTransfer|undefined>
```

Copy the current selection.

If [`writeToClipboard`](options.mdx#writetoclipboard) is `true`, this will also
write the data to the `Clipboard`.

## cut()

```ts
cut(): Promise<DataTransfer|undefined>
```

Cut the current selection.

If [`writeToClipboard`](options.mdx#writetoclipboard) is `true`, this will also
write the data to the `Clipboard`.

When performed in editable context, it removes the selected content from the
document.

## paste()

```ts
paste(clipboardData?: DataTransfer|string): Promise<void>
```

Paste data into the document.

When called without `clipboardData`, the content to be pasted is read from the
`Clipboard`.

When performed in editable context, the pasted content is inserted into the
document.