This example shows how to write integration tests using React Navigation without mocking it.
There are two types of tests:
- integration tests operating on whole navigators, they should use
renderNavigator
helper to render a navigator component used in the app. It is useful when you want to test a scenario that includes multiple screens. - single screen tests where you would pass mock
navigation
prop, built usingbuildNavigationMock()
helper, androute
prop to the screen component using regularrender
function.
Note that this example applies
includeHiddenElements: false
by default, so all queries will ignore elements on the hidden screens, e.g. inactive tabs or screens present in stack navigators. This option is enabled injest-setup.js
file, usingdefaultIncludeHiddenElements: false
option toconfigure
function.