home / skills / partme-ai / full-stack-skills / detox

detox skill

/skills/detox

This skill guides you through Detox mobile testing for React Native, enabling efficient E2E tests, synchronization, and setup.

npx playbooks add skill partme-ai/full-stack-skills --skill detox

Review the files below or copy the command above to add this skill to your agents.

Files (2)
SKILL.md
675 B
---
name: detox
description: Provides comprehensive guidance for Detox mobile testing framework including React Native testing, E2E testing, and test synchronization. Use when the user asks about Detox, needs to test React Native applications, write E2E tests for mobile apps, or configure Detox.
license: Complete terms in LICENSE.txt
---

## When to use this skill

Use this skill whenever the user wants to:
- [待完善:根据具体工具添加使用场景]

## How to use this skill

[待完善:根据具体工具添加使用指南]

## Best Practices

[待完善:根据具体工具添加最佳实践]

## Keywords

[待完善:根据具体工具添加关键词]

Overview

This skill provides practical, hands-on guidance for using the Detox end-to-end testing framework for mobile apps, with a focus on React Native. It covers setup, test writing, synchronization strategies, CI integration, and common troubleshooting tips to get reliable E2E tests running quickly. The goal is to help teams build stable, maintainable mobile E2E suites that accurately verify app behavior on real devices and simulators.

How this skill works

The skill explains how Detox drives your app by launching it on simulators or real devices, interacting with UI elements, and asserting outcomes while leveraging built-in synchronization to wait for the app to be idle. It walks through installing Detox, configuring test runners (Jest/Mocha), defining device and build configurations, writing element queries and actions, and interpreting logs. It also covers strategies to resolve flakiness, integrate with CI pipelines, and test platform-specific behaviors.

When to use it

  • You need reliable end-to-end tests for a React Native mobile app before release.
  • You want deterministic UI tests that run on emulators/simulators and real devices.
  • You must validate navigation flows, network interactions, and native module behavior.
  • You need to integrate mobile E2E tests into CI/CD pipelines for regression prevention.
  • You are debugging test flakiness and need synchronization techniques specific to Detox.

Best practices

  • Keep tests small and focused: test single flows or user stories per spec file.
  • Use clear and stable element identifiers (testIDs) rather than fragile selectors.
  • Leverage Detox synchronization and avoid arbitrary sleeps; use waitFor and matchers.
  • Mock network calls and native modules where possible to reduce nondeterminism.
  • Run tests on both simulators and at least one real device to catch platform-specific issues.

Example use cases

  • Set up Detox with Jest for a React Native app and run an initial smoke test on iOS and Android.
  • Write E2E tests that validate login, onboarding, and in-app purchases with mocked backend responses.
  • Resolve intermittent test failures by inspecting Detox logs and applying explicit waitFor conditions.
  • Automate Detox runs in CI (GitHub Actions, CircleCI) to prevent regressions on pull requests.
  • Test deep links and push notification flows using device launch arguments and push simulators.

FAQ

Does Detox work with React Native and native apps?

Yes. Detox supports React Native apps and native iOS/Android apps by interacting with UI elements exposed to the testing runtime.

How do I reduce flakiness in Detox tests?

Prefer synchronization and waitFor constructs, mock external services, stabilize testIDs, and avoid random data or timing-based assertions.

Can I run Detox in CI on both iOS and Android?

Yes. CI integration requires configuring device/emulator setup, appropriate build artifacts, and often headless or emulated device environments.