Keeping tests useful · mid
Testing React Native apps: Jest + RNTL, Detox and Maestro
React Native apps use Jest with React Native Testing Library for component and integration tests (RNTL 14 makes render and events async and needs React 19 and RN 0.78+), mock native modules at the boundary, and use Maestro (simple YAML flows, used in Expo's EAS Workflows docs) or Detox (grey-box, synchronises with the app) for end-to-end tests on devices.
Explain it out loud
Explain it out loud to an AI interviewer that follows up, and see where your answer is thin.
Practise by voiceThe notes
What you must know
- Jest preset: @react-native/jest-preset (moved out of react-native in RN 0.85) or jest-expo. Mock native modules (camera, storage, analytics) with jest.mock or library-provided mocks.
- RNTL: the same idea as web RTL (getByRole, getByText, getByLabelText, userEvent). In v14 (June 2026): await render(), await fireEvent..., await renderHook(); requires React 19+ and RN 0.78+; React Test Renderer was replaced.
- Network: MSW works in Jest (Node) for RN tests too.
- Detox: grey-box E2E by Wix; it waits for the app to be idle (network, animations, timers) before acting, which reduces flakiness; needs native build setup.
- Maestro: black-box E2E with YAML flows, very quick to write, works with any app; Expo's EAS Workflows have a maestro job type for running flows on CI builds.
- Also test on real low-end Android devices for performance, and check accessibility labels with TalkBack and VoiceOver.
The red pen
Common traps: mistake → fix
Mistake: "RNTL render is synchronous"
Fix: since v14 it returns a promise and must be awaited.
Mistake: "Unit tests with mocked native modules prove the native integration works"
Fix: only device E2E or manual tests prove that.
Easy to hard
Questions interviewers ask, easy to hard
- How do you test a React Native screen?
- Detox vs Maestro: which and why?
- What do you mock in RN unit tests and what can only be tested on a device?
Practise
Practise with these questions
Explain it out loud
Explain it out loud to an AI interviewer that follows up, and see where your answer is thin.
Practise by voiceYour first interview is free
Sign up and start with a 15-minute interview with the full report, and an English conversation. No card needed.