Commit Graph

45 Commits

Author SHA1 Message Date
Maciej Jastrzebski 219adbd9c5 feat: UserEvent pullToRefresh() (#1822) 2026-07-21 17:22:06 +02:00
Maciej Jastrzebski c1978b340c feat: fireEvent.layout (#1931) 2026-07-21 16:43:12 +02:00
Maciej Jastrzebski 34c731d229 feat: user event accessibilityAction (#1930) 2026-07-21 15:16:26 +02:00
Maciej Jastrzebski 8b17683d64 docs: clarify accessible name docs (#1927) 2026-07-20 11:16:19 +02:00
Maciej Jastrzebski a7fa320588 docs: default to v14 (#1916) 2026-06-05 16:27:51 +02:00
Maciej Jastrzebski 9e1b63653d chore: switch to oxfmt (#1913) 2026-05-29 13:27:53 +02:00
Maciej Jastrzębski e2f41610dc docs: tweaks 2026-05-28 17:43:31 +02:00
Maciej Jastrzębski 8443e22e52 chore: move internal agents docs 2026-05-28 10:26:50 +02:00
Maciej Jastrzębski 94454d7391 docs: agent setup instructions 2026-05-28 10:17:41 +02:00
Maciej Jastrzebski 45cc32de75 chore: bundle agent docs (#1908) 2026-05-26 17:13:41 +02:00
Maciej Jastrzębski 0cf4aa0003 chore: refactor agents.md 2026-04-13 21:24:02 +02:00
Kenneth Kwakye-Gyamfi 58055d8998 docs: migrate to Docusaurus v2 (#299)
* Migration to Docusaurus v2.0.0

* update lock file

* add algolia search

* update GH Pages deploy

* make sidebar non-collapsible for now

* update theme colors

* ignore docusaurus-specific import aliases, remove home-container class

Co-authored-by: Michał Pierzchała <thymikee@gmail.com>
2020-05-13 10:28:32 +02:00
Kenneth Kwakye-Gyamfi 53dc00acc9 Redux Integration (#292)
* Redux example

* Reviews implemented

* Redux integration example

* Update docs/ReduxIntegration.md

* Update docs/ReduxIntegration.md

* Resolution of reviews put in by @thymikee

Co-authored-by: Michał Pierzchała <thymikee@gmail.com>
2020-05-08 16:49:49 +02:00
Kenneth Kwakye-Gyamfi 3e125d20f4 Remove use of getByTestID in documentation and tests (#294)
* Switched most tests from using test IDs

* Docs updated to use alternatives
2020-05-08 16:37:28 +02:00
Kenneth Kwakye-Gyamfi 95b4889fe9 docs: add example of testing React Navigation (#277)
* Proof of concept -  CodeSandbox embed

* Prettier fix

* Moved examples below API Reference

* Created the examples directory

Includes react-navigation example

* Article on React Navigation

* Specify rootDir for testing

Prevents CI to run example tests

* remove jest-transform-stub and identity-obj-proxy, add transformIgnorePatterns

* update docs

* rearrange

* remove non-essential files

* rename Navigation -> AppNavigator

* reword comment

* add links and explanations

* remove index file, because it's not an app anyway

Co-authored-by: Michał Pierzchała <thymikee@gmail.com>
2020-04-24 11:08:52 +02:00
Michał Pierzchała 1efb814730 docs: fix a link to example (#286) 2020-04-23 16:33:35 +02:00
Michał Pierzchała 61a83e9bb7 chore: update GettingStarted example with something you can run (#284) 2020-04-23 16:27:01 +02:00
Jesse R Weigel c0e557c44b Fix unclear sentence and misuse of word 'stand' (#278)
* Fix unclear sentence and misuse of word 'stand'

This sentence was not very clear. Also, the word 'stand' was used, but I think the word 'understand' was what was intended.
The sentence has been updated to convey what I think was the intended meaning.

* Update docs/GettingStarted.md

Co-authored-by: Michał Pierzchała <thymikee@gmail.com>
2020-04-21 20:42:05 +02:00
Kacper Wiszczuk 6b02710641 docs: Add new a11y matchers and prepare for 2.x (#263)
* docs: Add new a11y matchers and prepare for 2.x

* Update docs
2020-03-18 14:32:03 +01:00
Michał Pierzchała 6dbf94ff85 docs: clarify how queryBy behaves (#251) 2020-02-01 08:19:19 -06:00
Michał Pierzchała 94ff42527e chore: bump Flow and ESLint preset (#241)
* chore: bump Flow and ESLint preset

* fix name of waitForElement
2019-12-09 11:43:05 +01:00
Alec Larson 4c77f4a7dc feat: add "cleanup" function (#237)
* feat: add "cleanup" function

* docs: add "cleanup" section

* test: "cleanup" function

* don't expose cleanup queue


Co-authored-by: Alec Larson <alec.stanford.larson@gmail.com>
Co-authored-by: Michał Pierzchała <thymikee@gmail.com>
2019-12-09 11:41:48 +01:00
ajubin 69d148023f docs: add fireEvent.scroll example for FlatList (#223) 2019-09-27 10:24:54 +02:00
Kacper Wiszczuk 31f476bb7c feat: support multiple params in event handlers (#203) 2019-07-16 16:19:59 +02:00
Michał Pierzchała fb8a6fc7e2 chore(docs): improve examples to use better APIs 2019-06-11 13:32:26 +02:00
Michał Pierzchała 8778012ed8 chore(docs): improve render and queries description (#191) 2019-06-11 13:07:00 +02:00
Michał Pierzchała a56501b0fb feat: implement ByDisplayValue queries (#190) 2019-06-10 17:30:27 +02:00
Scotty Waggoner f6f0a7091d feat: Add wrapper option to render (#173)
* Add wrapper option to render

* Update TS types and call updateWithAct only once

* wrapUiIfNeeded -> wrap

* reindent snapshots

* adjustments

* change name
2019-05-28 22:31:48 +02:00
Kacper Wiszczuk f9bc0b263d feat: add a11y queries (#178)
* First implementation of matcher generator

* A11y queries added

* extract prepareErrorMessage

* Add tests

* Make aliases

* Move create queryByError

* Add missing aliases

* simplify valid node check

* add docs

* fix types
2019-05-28 20:47:06 +02:00
Kacper Wiszczuk 7a1c264bb0 Docs: Remove shallow API from docs (#154) 2019-04-14 17:39:11 +02:00
Michał Pierzchała e8a817cae4 docs: add and update queries documentation (#151)
### Summary

Adds new "Queries" section inspired by https://testing-library.com/docs/dom-testing-library/api-queries

### Test plan

Reading carefully
2019-04-14 16:12:50 +02:00
Michał Pierzchała 439db6c823 feat: add rerender as an alias for update (#149)
<!-- Please provide enough information so that others can review your pull request. -->
<!-- Keep pull requests small and focused on a single change. -->

### Summary

Users of `react-testing-library` use `rerender` wording instead of `update`. Let's make it easier for them by aliasing it.
See: https://testing-library.com/docs/react-testing-library/api#rerender

### Test plan

Added cases for JS tests and TS typings
2019-04-14 10:09:46 +02:00
Jean-Marie Porchet 859e29c569 docs: provide example for componentDidMount (#144)
### Summary
Some people find it useful to search for specific terms when browsing the docs.
Specifying the concrete utility of the `update` method makes the doc more useful :)
2019-04-01 16:39:01 +02:00
Brad f96d782d26 Improvement: Add act to update call to support hooks (#137)
### Summary
Currently `render` and `fireEvent` are wrapped in `act` to support hooks. This pull request wraps the update call in `act` to support testing component updates (e.g. prop changes).

### Test plan
* I have added a test for update in `__tests__/act.test.js`.
* A useEffect hook should run again on `update` calls (if the hook dependency array is satisfied).
2019-03-25 15:22:34 +01:00
Eli Perkins 97ab842567 improvement: Allow for text to match children who are composed as array (#132)
### Summary

Given a component that renders text by composing together literal text with an inline expression for a dynamic variable, React Native will render this as a `<Text>` element with multiple children. For example:

```js
const BananaCounter = ({ numBananas }) => (
  <Text>There are {numBananas} bananas in the bunch</Text>
);

const { toJSON, debug } = render(<BananaCounter numBananas={3} />);

debug();
/*
      <Text>
        There are
        3
         bananas in the bunch
      </Text>
*/

expect(toJSON()).toMatchInlineSnapshot(`
<Text>
  There are 
  3
   bananas in the bunch
</Text>
`);
```

This makes sense, as the component is a:
- literal string
- a dynamic evaluation
- literal string

Unfortunately, this means that writing a test that finds an element based on that dynamic evaluation fails when using `getByText`.

```js

const { getByText } = render(<BananaCounter numBananas={3} />);
expect(getByText('There are 3 bananas in the bunch')).toBeTruthy(); // Fails
```

This is because we compare the given test string directly against `children`. https://github.com/callstack/react-native-testing-library/blob/ce3bf28f308728672bc5502e120048821c60218b/src/helpers/getByAPI.js#L23-L24

This results in comparing `'There are 3 bananas in the bunch' === ['There are ' 3, ' bananas in the bunch']`, which of course will fail.

The solution is to join children and compare the joined result against the given text string.

### Test plan

A test for this new functionality is provided!
2019-03-18 16:25:13 +01:00
Ingibjörg Ósk Jónsdóttir (Inga) 09f9b9f05a docs: Remove misleading recommendation to use shallow in snapshot tests (#128)
### Summary

I removed misleading recommendation to render components with `shallow` in snapshot tests as a result of the conversation in Issue #127.

### Test plan

Review text in API.md
2019-03-07 20:55:03 +01:00
Kacper Wiszczuk 11489b0e5e feat: wrap render with act() for better React Hooks support (#122) 2019-02-28 21:53:26 +01:00
Enieber Cunha 39d2e7c8d0 chore: add links to more sample of code (#104)
* add links to more sample of code

* Update API.md

* Update API.md
2019-01-15 17:25:28 +01:00
Dana Hartweg af067d0712 docs: Add more details to the fireEvent api documentation. (#102) 2018-12-28 11:51:35 +01:00
Dana Hartweg ee888f1dcd feat: add getByPlaceholder query functionality (#101)
### Summary
There is a helper that exists in `react-testing-library` to query inputs by their `placeholder`. This PR adds that support.

You **could** achieve this by querying for a `placeholder` prop, or querying for react native `TextInput`s manually and then checking their props, but it felt cleaner to have this contained in the testing library itself. It will also allow you to bypass any other instances that may have a `placeholder` prop that aren't `TextInput`s.

If we don't want to expand the surface of the library further, I completely understand that and am fine with this being closed. Just seems like it may be useful and save some time for several scenarios =)

### Test plan
+ Render a `TextInput` with a `placeholder` prop
+ Query the test instance via `getByPlaceholder` for the input
+ Verify the test instance is found
2018-12-22 23:09:28 +01:00
Michał Pierzchała 53b5366393 docs: Rename api.md to API.md (#94)
<!-- Please provide enough information so that others can review your pull request. -->
<!-- Keep pull requests small and focused on a single change. -->

### Summary

Whoopsie

### Test plan

<!-- List the steps with which we can test this change. Provide screenshots if this changes anything visual. -->
2018-12-15 12:34:19 +01:00
Brooks Becton ad61c409e9 docs: add website built with Docusaurus (#74)
* Run docusaurus init

* Add api.md and remove initial files

* Run docusaurus init

* Add api.md and remove initial files

* Add callstack info and remove extra scripts

* Commeent out  extra features on home page and Add link to example

* Re Arrange Docs Folder

* add some adjustments

* fix lint

* fix lint
2018-12-11 19:58:37 +01:00
Michał Pierzchała c5910d94e4 fix: remove deprecated existential Flow type and use any for now (#77)
<!-- Please provide enough information so that others can review your pull request. -->
<!-- Keep pull requests small and focused on a single change. -->

### Summary

Existential type (`*`) is long deprecated, let's just use `any` for now.

### Test plan

Added some more Flow typings to `shallow.test.js` that were failing because of existential type.
2018-11-28 12:49:15 +01:00
Michał Pierzchała 6dfbc6794b docs: add note about new APIs in v1.4 (#76) 2018-11-28 10:09:48 +01:00
Michał Pierzchała 3f2fc16ec2 docs: separate API from main README.md (#70)
### Summary

Separate API docs from main README.md
Relates to #26.

### Test plan

|README.md|api.md|
|--|--|
|<img width="980" alt="screenshot 2018-11-23 at 12 21 42" src="https://user-images.githubusercontent.com/5106466/48941096-740d0a80-ef1a-11e8-8c92-110f1b47826d.png">|<img width="984" alt="screenshot 2018-11-23 at 12 22 05" src="https://user-images.githubusercontent.com/5106466/48941097-740d0a80-ef1a-11e8-872b-a8dfb7814e68.png">|
2018-11-23 15:03:22 +01:00