30-04-2021



A short guide to all the exported functions in DOM Testing Library

REST API Cheat Sheet: It’s Only Cheating if You’re Taking a Test For all you Force.com REST developers, we have added the REST API Cheat Sheet to our library of cheat sheets. In addition to reference info, it also has quite a few examples of how you can use REST API to update a field, delete a record, search, and so on. Nyan catwatermelon gaming. How i raised $20,000 in 30 days to selfpublish my first book. API testing kit cheat sheet. This thread is archived. New comments cannot be posted and votes cannot. Protractor API Cheatsheet. GitHub Gist: instantly share code, notes, and snippets.

Queries#

See Which query should I use? Stick war!gaming potatoes.

No Match1 Match1+ MatchAwait?
getBythrowreturnthrowNo
findBythrowreturnthrowYes
queryBynullreturnthrowNo
getAllBythrowarrayarrayNo
findAllBythrowarrayarrayYes
queryAllBy[]arrayarrayNo
  • ByLabelText find by label or aria-label text content
    • getByLabelText
    • queryByLabelText
    • getAllByLabelText
    • queryAllByLabelText
    • findByLabelText
    • findAllByLabelText
  • ByPlaceholderText find by input placeholder value
    • getByPlaceholderText
    • queryByPlaceholderText
    • getAllByPlaceholderText
    • queryAllByPlaceholderText
    • findByPlaceholderText
    • findAllByPlaceholderText
  • ByText find by element text content
    • getByText
    • queryByText
    • getAllByText
    • queryAllByText
    • findByText
    • findAllByText
  • ByDisplayValue find by form element current value
    • getByDisplayValue
    • queryByDisplayValue
    • getAllByDisplayValue
    • queryAllByDisplayValue
    • findByDisplayValue
    • findAllByDisplayValue
  • ByAltText find by img alt attribute
    • getByAltText
    • queryByAltText
    • getAllByAltText
    • queryAllByAltText
    • findByAltText
    • findAllByAltText
  • ByTitle find by title attribute or svg title tag
    • getByTitle
    • queryByTitle
    • getAllByTitle
    • queryAllByTitle
    • findByTitle
    • findAllByTitle
  • ByRole find by aria role
    • getByRole
    • queryByRole
    • getAllByRole
    • queryAllByRole
    • findByRole
    • findAllByRole
  • ByTestId find by)
  • configure change global options:configure({testIdAttribute: 'my-data-test-id'})

Text Match Options#

Given the following HTML:

Will find the div:

getByText(container,'Hello World')// full string match
Example
getByText(container,'llo Worl',{ exact:false})// substring match
getByText(container,'hello world',{ exact:false})// ignore case
// Matching a regex:

Api Testing Cheat Sheet

getByText(container,/world/i)// substring match, ignore case

Api Testing Cheat Sheet Example

getByText(container,/^hello world$/i)// full string match, ignore case
getByText(container,/Hello W?oRlD/i)// advanced regex
// Matching with a custom function:
getByText(container,(content, element)=> content.startsWith('Hello'))

Api Testing Tutorial

Given a button that updates the page after some time:

// Click button
const items =awaitfindByText(node,/Item #[0-9]: /)

Web Api Testing

})