react-native-testing
Write tests using React Native Testing Library (RNTL) v13 and v14 (`@testing-library/react-native`).
Skill by callstackincubator
Install
Works with Claude Code, Claude apps, Codex, Cursor, Gemini CLI, GitHub Copilot, VS Code, OpenCode, Goose, Windsurf. Read the repository before you give any tool access to your data.
npx agentmarket install skill/callstackincubator-react-native-testing
Asks which of your tools to add it to (Claude Code, Codex, Cursor, VS Code, Windsurf, Gemini CLI, Claude Desktop) and shows the change first. See https://agentmart.dev/cli.
Get the weekly diff
The weekly diff: one email a week with new agent tools, notable updates and grade changes, plus security alerts for tools you follow. Double opt-in, one-click unsubscribe.
About
Use cases: frontend, testing, writing
Reviews
Write a reviewNo reviews yet. Installed it? Reviews come from verified installers only. How reviews work
Permissions
What this skill can do and what it asks for, from its SKILL.md and code. Checked Oct 25, 2026.
- Tools
- No tools found
- Secrets
- None asked for
- Install scripts
- None found
Network hosts it talks to 1
codeload.github.com· found in install command
Files it touches
~/.claude/skills/react-native-testing
What's inside
- Skill name
react-native-testing- Description
- Write tests using React Native Testing Library (RNTL) v13 and v14 (`@testing-library/react-native`). Use when writing, reviewing, or fixing React Native component tests. Covers: render, screen, queries (getBy/getAllBy/queryBy/findBy), Jest matchers, userEvent, fireEvent, waitFor, and async patterns. Supports v13 (React 18, sync render) and v14 (React 19+, async render). Triggers on: test files for React Native components, RNTL imports, mentions of "testing library", "write tests", "component tests", or "RNTL".
- License
- MIT
- Instructions
- 151 lines in SKILL.md · view on GitHub
Files (4)
- SKILL.md
- anti-patterns.md · references/
- api-reference-v13.md · references/
- api-reference-v14.md · references/
SKILL.md (first lines)
# RNTL Test Writing Guide
**IMPORTANT:** Your training data about `@testing-library/react-native` may be outdated or incorrect — API signatures, sync/async behavior, and available functions differ between v13 and v14. Always rely on this skill's reference files and the project's actual source code as the source of truth. Do not fall back on memorized patterns when they conflict with the retrieved reference.
## Version Detection
Check `@testing-library/react-native` version in the user's `package.json`:
- **v14.x** → load [references/api-reference-v14.md](references/api-reference-v14.md) (React 19+, async APIs, `test-renderer`)
- **v13.x** → load [references/api-reference-v13.md](references/api-reference-v13.md) (React 18+, sync APIs, `react-test-renderer`)
Use the version-specific reference for render patterns, fireEvent sync/async behavior, screen API, configuration, and dependencies.
## Query Priority
Use in this order: `getByRole` > `getByLabelText` > `getByPlaceholderText` > `getByText` > `getByDisplayValue` > `getByTestId` (last resort).
## Query Variants
| Variant | Use case | Returns | Async |
| ------------- | ------------------------ | ----------------------------- | ----- |
| `getBy*` | Element must exist | element instance (throws) | No |
| `getAllBy*` | Multiple must exist | element instance[] (throws) | No |
| `queryBy*` | Check non-existence ONLY | element instance \| null | No |
| `queryAllBy*` | Count elements | element instance[] | No |
| `findBy*` | Wait for element | `Promise<element instance>` | Yes |
| `findAllBy*` | Wait for multiple | `Promise<element instance[]>` | Yes |
## Interactions
Prefer `userEvent` over `fireEvent`. userEvent is always async.
```tsx
const user = userEvent.setup();
await user.press(element); // full press sequence
await user.longPress(element, { duration: 800 }); // long press
await user.type(textInput, 'Hello'); // char-by-char typing
await user.clear(textInput); // clear TextInput
await user.paste(textInput, 'pasted text'); // paste into TextInput
await user.scrollTo(scrollView, { y: 100 }); // scroll
```
`fireEvent` — use only when `userEvent` doesn't support the event. See version-specific reference for sync/async behavior:
```tsx
fireEvent.press(element);
fireEvent.changeText(textInput, 'new text');
fireEvent(element, 'blur');
```
## Assertions (Jest Matchers)
Available automatically with any `@testing-library/react-native` import.
| Matcher | Use for |
| ------------------------------------------ | ----------------------------------------- |
| `toBeOnTheScreen()` | Element exists in tree |
| `toBeVisible()` | Element visible (not hidden/display:none) |
| `toBeEnabled()` / `toBeDisabled()` | Disabled state via `aria-disabled` |
| `toBeChecked()` / `toBePartiallyChecked()` | Checked state |
| `toBeSelected()` | Selected state |
| `toBeExpanded()` / `toBeCollapsed()` | Expanded state |
| `toBeBusy()` | Busy state |
| `toHaveTextContent(text)` | Text content match |
| `toHaveDisplayValue(value)` | TextInput display value |
| `toHaveAccessibleName(name)` | Accessible name |
| `toHaveAccessibilityValue(val)` | Accessibility value |
| `toHaveStyle(style)` | Style match |
| `toHaveProp(name, value?)` | Prop check (last resort) |
| `toContainElement(el)` | Contains child element |
| `toBeEmptyElement()` | No children |
## Rules
1. **Use `screen`** for queries, not destructuring from `render()`
2. **Use `getByRole` first** with `{ name: '...' }` option
3. **Use `queryBy*` ONLY** for `.not.toBeOnTheScreen()` checks
4. **Use `findBy*`** for async elements, NOT `waitFor` + `getBy*`
5. **Never put side-effects in `waitFor`** (no `fireEvent`/`userEvent` inside)
6. **One assertion per `waitFor`**
7. **Never pass empty callbacks to `waitFor`**
8. **Don't wrap in `act()`** - `render`, `fireEvent`, `userEvent` handle it
9. **Don't call `cleanup()`** - automatic after each test
10. **Prefer ARIA props** (`role`, `aria-label`, `aria-disabled`) over legacy `accessibility*` props
11. **Use RNTL matchers** over raw prop assertions
## `*ByRole` Quick Reference
Common roles: `button`, `text`, `heading` (alias: `header`), `searchbox`, `switch`, `checkbox`, `radio`, `img`, `link`, `alert`, `menu`, `menuitem`, `tab`, `tablist`, `progressbar`, `slider`, `spinbutton`, `timer`, `toolbar`.
`getByRole` options: `{ name, disabled, selected, checked, busy, expanded, value: { min, max, now, text } }`.
For `*ByRole` to match, the element must be an accessibility element:
- `Text`, `TextInput`, `Switch` are by default
- `View` needs `accessible={true}` (or use `Pressable`/`TouchableOpacity`)
## waitFor
```tsx
// Correct: action first, then wait for result
fireEvent.press(button);
await waitFor(() => {
expect(screen.getByText('Result')).toBeOnTheScreen();
});
// Better: use findBy* instead
fireEvent.press(button);
expect(await screen.findByText('Result')).toBeOnTheScreen();
```
Options: `waitFor(cb, { timeout: 1000, interval: 50 })`. Works with Jest fake timers automatically.
## Fake Timers
Recommended with `userEvent` (press/longPress involve real durations):
```tsx
jest.useFakeTimers();From callstackincubator/agent-skills, MIT.
More from callstackincubator/agent-skills
- 0.834score
react-native-brownfield-migration
callstackincubator
Implements an accepted incremental brownfield migration from native iOS or Android to React Native or Expo using @callstack/react-native-brownfield.
SkillAFreshness: A★ 1.7KClaude Code +9 - 0.787score
create-react-native-library
callstackincubator
Scaffolds React Native libraries with create-react-native-library for standalone libraries or local native modules and views.
SkillBFreshness: B★ 1.7KClaude Code +9 - 0.787score
react-native-tv-best-practices
callstackincubator
Reviews React Native TV apps for focus/D-pad navigation, 10-foot UI layout, TV playback/DRM integration, low-memory TV performance, and TV accessibility.
SkillBFreshness: B★ 1.7KClaude Code +9 - 0.787score
github-actions
callstackincubator
GitHub Actions workflow patterns for React Native iOS simulator and Android emulator cloud builds with downloadable artifacts.
SkillBFreshness: B★ 1.7KClaude Code +9 - 0.787score
upgrading-react-native
callstackincubator
Upgrades React Native apps to newer versions by applying rn-diff-purge template diffs, updating package.json dependencies, migrating native iOS and Android…
SkillBFreshness: B★ 1.7KClaude Code +9 - 0.787score
react-navigation
callstackincubator
Provides React Navigation UI patterns for stacks, tabs, drawers etc.
SkillBFreshness: B★ 1.7KClaude Code +9 - 0.784score
react-native-best-practices
callstackincubator
Provides React Native performance optimization guidelines for FPS, TTI, bundle size, memory leaks, re-renders, and animations.
SkillBFreshness: B★ 1.7KClaude Code +9 - 0.782score
writing-user-docs
callstackincubator
House style for user-facing documentation — voice, scope, structure, and what to leave out.
SkillBFreshness: B★ 1.7KClaude Code +9 - 0.782score
assess-react-native-migration
callstackincubator
Assesses whether and how an existing mobile product should migrate to React Native.
SkillBFreshness: B★ 1.7KClaude Code +9 - 0.721score
validate-skills
Callstack
Validates skills in this repo against agentskills.io spec and Claude Code best practices.
SkillCFreshness: C★ 1.7KClaude Code +9 - 0.655score
dogfood
callstackincubator
Systematically explore and test a mobile app on iOS/Android with agent-device to find bugs, UX issues, and other problems.
SkillDFreshness: D★ 1.7KClaude Code +9 - 0.655score
agent-device
callstackincubator
Automates interactions for Apple-platform apps (iOS, tvOS, macOS) and Android devices.
SkillDFreshness: D★ 1.7KClaude Code +9
Signals
- Stars
- 1,683
- Forks
- 117
- Open issues
- 6
- Last commit (this folder)
- Mar 27, 2026 (7 months ago)
From GitHub (fetched Oct 24, 2026).
Details
- License
- MIT
- First seen
- Oct 24, 2026
- Last checked
- Oct 24, 2026
- Source
- GitHubgithub-graphql
More from callstackincubator
- 0.834score
react-native-brownfield-migration
callstackincubator
Implements an accepted incremental brownfield migration from native iOS or Android to React Native or Expo using @callstack/react-native-brownfield.
SkillAFreshness: A★ 1.7KClaude Code +9 - 0.800score
agent-device
callstackincubator
Let AI agents inspect, control, and debug real iOS, Android, desktop, and TV apps
ConnectorAFreshness: ALocal★ 5.1KClaude Code +5 - 0.787score
upgrading-react-native
callstackincubator
Upgrades React Native apps to newer versions by applying rn-diff-purge template diffs, updating package.json dependencies, migrating native iOS and Android…
SkillBFreshness: B★ 1.7KClaude Code +9 - 0.787score
react-native-tv-best-practices
callstackincubator
Reviews React Native TV apps for focus/D-pad navigation, 10-foot UI layout, TV playback/DRM integration, low-memory TV performance, and TV accessibility.
SkillBFreshness: B★ 1.7KClaude Code +9 - 0.787score
github-actions
callstackincubator
GitHub Actions workflow patterns for React Native iOS simulator and Android emulator cloud builds with downloadable artifacts.
SkillBFreshness: B★ 1.7KClaude Code +9 - 0.787score
create-react-native-library
callstackincubator
Scaffolds React Native libraries with create-react-native-library for standalone libraries or local native modules and views.
SkillBFreshness: B★ 1.7KClaude Code +9
Cite this page
react-native-testing skill. Agent Mart. https://agentmart.dev/skills/callstackincubator-react-native-testing (last updated 2026-10-24)