Skip to content
Skills Library
Programming · Testing

detox

/detox

Expert Detox mobile E2E automation for React Native applications on iOS and Android. Use when running gray-box integration tests, simulating device interactions, or debugging mobile flakiness.

Licence
MIT
Last repository change
01.10.2026

Assessment and security

100/ 100Class: good
Format25 / 25
Frontmatter with name and description, valid name, description up to 1,024 characters, name matching the folder.
Discoverability25 / 25
Description explains when to use the skill, has a reasonable length and uses third person.
Content35 / 35
At least 150 words and at most 500 lines, headings, step lists, examples or code.
Hygiene15 / 15
No placeholders such as TODO, no Windows paths, with a licence.
Riskno signals detected in the scan
Files in this package
1
Scripts
0
HTML comments
0
URLs in SKILL.md
1
Deprecation

No signals detected. Repository changed on 01.10.2026, without references to retired models or APIs.

Licence

MIT, open: use and modify while retaining author attribution.

What it does and when to use it

Expert Detox mobile E2E automation for React Native applications on iOS and Android. Use when running gray-box integration tests, simulating device interactions, or debugging mobile flakiness.

Original author description

Expert Detox mobile E2E automation for React Native applications on iOS and Android. Use when running gray-box integration tests, simulating device interactions, or debugging mobile flakiness.

How it works

  1. When to Use
  2. Quick Start
  3. Core Concepts
  4. Common Patterns
  5. Best Practices
  6. Troubleshooting
  7. References
Original SKILL.md headings · 128 lines, 580 words
SKILL.md preview
---
name: detox
description: Expert Detox mobile E2E automation for React Native applications on iOS and Android. Use when running gray-box integration tests, simulating device interactions, or debugging mobile flakiness.
---

# Detox

Detox is designed for React Native. Unlike Appium (Black-box), Detox works "Gray-box" by running _inside_ your app, monitoring the main thread. It _knows_ when the app is busy/idle, eliminating flaky waits.

## When to Use

- **Gray-Box Mobile E2E Automation**: Testing React Native mobile apps with internal synchronization on iOS and Android.
- **Flake-Free Mobile Testing**: Eliminating manual `sleep()` calls by synchronizing automatically with React Native's bridge and event queue.
- **High-Velocity Release Validation**: Validating critical user journeys on simulators and emulators in mobile CI/CD pipelines.
- **Fast Local Feedback**: Running automated mobile UI tests alongside the React Native packager.

## Quick Start

```javascript
describe("Example", () => {
  beforeAll(async () => {
    await device.launchApp();
  });

  it("should show hello screen after tap", async () => {
    await element(by.id("hello_button")).tap();
    await expect(element(by.text("Hello!!!"))).toBeVisible();
  });
});
```

## Core Concepts

### Gray-Box Synchronization Architecture

Detox monitors the app internally (network requests, animations, timers, UI layout passes) and executes actions only when the app is completely idle:

```text
[ Detox Test Runner ] ──(WebSocket)──→ [ Native Detox Agent (Inside App) ]
                                              ├── Monitors React Native Bridge
                                              ├── Tracks Ongoing Network Requests
                                              └── Waits for Zero Pending Animations
```

### Matchers & Actions Hierarchy

Interacts with native elements using accessibility IDs:

```typescript
// e2e/checkout.test.ts
import { by, element, expect } from "detox";

describe("Checkout Flow", () => {
  beforeAll(async () => {
    await device.launchApp({ newInstance: true });
  });

  it("adds item to cart and proceeds to payment", async () => {
    await element(by.id("item_card_101")).tap();
    await element(by.id("add_to_cart_btn")).tap();

    await expect(element(by.id("cart_badge"))).toHaveText("1");
    await element(by.id("cart_icon")).tap();
    await element(by.id("checkout_button")).tap();

    await expect(element(by.text("Payment Options"))).toBeVisible();
  });
});
```

### Device Control & Deep Linking

Controls simulator state, permissions, and URL schemes:

```typescript
it("handles incoming deep links", async () => {
  await device.openURL({ url: "myapp://promo/summer2026" });
  await expect(element(by.id("promo_banner"))).toBeVisible();
});
```

## Common Patterns

### Synchronized User Flow with Test IDs

**Problem**: Test flakiness due to timing differences across mobile platforms.

**Solution**:
Assign `testID` props in React Native and query using `by.id`:

```javascript
describe("Authentication Flow", () => {
  beforeAll(async () => {
    await device.launchApp({ delete: true });
  });

  it("logs in with valid credentials", async () => {
    await element(by.id("email_input")).typeText("user@example.com");
    await element(by.id("password_input")).typeText("secret123");
    await element(by.id("login_button")).tap();
    await expect(element(by.id("welcome_header"))).toBeVisible();
  });
});
```

## Best Practices

**Do**:

- Use `testID` for Element Matching: Assign `testID="my_element"` on React Native components for unambiguous cross-platform matching.
- Disable Infinite Animations during Tests: Infinite loops keep the app permanently busy, preventing Detox from synchronizing.
- Run on Release/Staging Builds in CI: Test release configurations (`configuration: "ios.sim.release"`) for accurate performance metrics.
- Use Mock Servers (MSW or MockServer): Keep external API calls deterministic and isolated from external network outages.

**Don't**:

- Use sleep timeouts: Trust Detox's automatic idle synchronization instead of arbitrary delays.
- Test third-party social auth webviews with Detox: Mock the auth response in the React Native state layer.
- Ignore detox build artifacts: Capture videos and artifacts on failure (`--record-videos failing --take-screenshots failing`).

## Troubleshooting

| Error                                           | Cause                                                             | Solution                                                                            |
| :---------------------------------------------- | :---------------------------------------------------------------- | :---------------------------------------------------------------------------------- |
| `DetoxRuntimeError: App synchronization failed` | Continuous background loops, animations, or timers blocking sync. | Disable indefinite timers in test mode or use `device.disableSynchronization()`.    |
| `Cannot find simulator/emulator`                | Device name in detox configuration does not exist in local SDK.   | Run `xcrun simctl list` or `emulator -list-avds` and update `.detoxrc.js`.          |
| `Test failed: Element not found`                | Native view missing `testID` or collapsed in hierarchy.           | Ensure `testID` is passed to the underlying native component and visible on screen. |

## References

- [Detox Documentation](https://wix.github.io/Detox/)

Versions

RepositoryScoreLicence
This page · G1Joshi/Agent-Skills100MIT
TerminalSkills/skills100Apache-2.0
aks-builds/quality-skills100MIT

Database snapshot: 13.11.2026 · package version 6428a2f85c93 (SHA-256 digest of the entire package)

Downloads in the last 30 days: 0 · ranking

Report a problem with this skill: harmful content, incorrect descriptions or an author’s removal request.

Similar skills

  • 95detox-skill
    Generates Detox E2E tests for React Native apps in JavaScript. Gray-box testing framework with automatic synchronization. Supports local simulators/emulators and TestMu AI cloud. Use when user mentions "Detox", "React Native test", "element(by.id())", "device.launchApp".…
  • 100mobile-test
    Writes, runs and reviews mobile tests across Flutter, native Android, native iOS, React Native and Kotlin Multiplatform. Covers Dart widget/integration tests, JUnit/Compose/Espresso, XCTest/XCUITest, Jest/Detox, and KMP common/target tests. Use to add, fix, run or audit tests,…
  • 80role-aqa:mobile-testing
    Mobile test automation with Appium (cross-platform), Detox (React Native gray-box), XCUITest (iOS native), Espresso (Android native), device farms (BrowserStack, Sauce Labs, AWS Device Farm), screenshot testing, gesture testing, and deep link testing. Use when automating mobile…
  • 100detox-testing
    Authors React Native E2E tests with Detox (Wix) - gray-box architecture (runs in-process with the app), `element(by.id|by.text|by.label)` matchers, `waitFor()` for explicit sync beyond Detox's automatic async tracking, Jest runner. Use when the app is React Native and speed…
  • 90audit-mobile-qa
    Mobile QA auditor for Android, iOS, Flutter and React Native. Reviews unit/UI/E2E test setup and quality (Compose, Espresso, UiAutomator, JUnit/MockK/Turbine/coroutines-test, XCTest, XCUITest, Swift Testing, flutter_test, Detox, Maestro, Appium), flakiness (sleeps, text…
  • 100limrun-detox-testing
    在 Limrun iOS 模拟器上配置、运行或调试 Detox。当需要将 Limrun Detox 运行时接入应用、打通 Detox 中介连接,或经目标隧道校验应用/测试者连接时使用。

Feedback and reports

Your message goes to Bartosz Sokoliński. An email address is needed only for a reply. See the privacy policy.