detox

Use Detox’s gray-box testing approach for writing end-to-end tests for React Native apps. Intended for contexts mentioning “detox,” “React Native testing,” “React Native E2E,” “gray-box testing,” or “Wix Detox.” For general mobile app testing refer to appium; for simpler mobile UI flows refer to maestro.

Last repository push
GitHub Stars
219
Forks
38
Issues / PRs
1

Installation

Review the source and dependencies with a prompt. A package is available to download.

Install with an AI assistant

Copy the prompt so your assistant can review the pinned revision and dependencies first.

View promptHide prompt
Check whether SkillPI Skill Finder is installed for your current agent. If it is missing, install and enable it using the official instructions at https://github.com/Findskills/skillpi. Then use Skill Finder to locate and install "detox" from this exact SkillPI detail page: https://skillpi.com/skills/deepskill-9870dbe8f13c0348eb9e8a40b569c97857f1829fa5bd9b99ee1e9e97f3cb1472. Verify the upstream source and version against https://github.com/TerminalSkills/skills before installing. If they do not match, stop and report the mismatch. Report the installed path and source version.

Source and setup

github.com

Setup guidance pending

See the original source for supported tools, dependencies, and permissions.

Installation test pending

Use Detox’s gray-box testing approach for writing end-to-end tests for React Native apps. Intended for contexts mentioning “detox,” “React Native testing,” “React Native E2E,” “gray-box testing,” or “Wix Detox.” For general mobile app testing refer to appium; for simpler mobile UI flows refer to maestro.

0 Downloads

Introduction source: third_party · TerminalSkills · 1.0.0 Reference

SkillPi interpretation

Tasks
When the user wants to write end-to-end tests for React Native apps using Detox's gray-box testing approach. Also use when the user mentions "detox," "React Native testing," "React Native E2E," "gray-box testing," or "Wix Detox." For general mobile testing, see appium. For simpler mobile UI flows, see maestro.
Software, accounts and paid services
```bash
Testing
Not tested

Browse files

Browse files at the source ↗

Original SKILL.md

Open original ↗
Frontmatter
name: detox
description: When the user wants to write end-to-end tests for React Native apps using Detox's gray-box testing approach. Also use when the user mentions "detox," "React Native testing," "React Native E2E," "gray-box testing," or "Wix Detox." For general mobile testing, see appium. For simpler mobile UI flows, see maestro.
metadata:
  author: terminal-skills
  version: "1.0.0"
  category: development
  tags:
    - react-native
    - e2e-testing
    - mobile
    - gray-box

Detox

Overview

You are an expert in Detox, the gray-box end-to-end testing framework for React Native apps by Wix. You help users set up Detox for iOS and Android, write reliable tests that synchronize automatically with the app's UI and network activity, handle device/emulator management, and integrate Detox into CI. You understand Detox's automatic synchronization, which eliminates most flakiness caused by timing issues.

Instructions

Initial Assessment

  1. Platform — iOS, Android, or both?
  2. React Native version — Expo or bare workflow?
  3. CI — Which CI provider? (GitHub Actions, CircleCI, Bitrise)
  4. Current state — New project or adding tests to existing app?

Setup

# setup-detox.sh — Install Detox in a React Native project.
# Includes both iOS and Android configuration.

# Install Detox CLI and library
npm install -g detox-cli
npm install --save-dev detox

# iOS: Install applesimutils (macOS only)
brew tap wix/brew
brew install applesimutils

# Initialize Detox config
detox init

Configuration

// .detoxrc.js — Detox configuration for iOS and Android.
// Defines build commands, device types, and test runner.
module.exports = {
  testRunner: {
    args: {
      config: 'e2e/jest.config.js',
    },
    jest: {
      setupTimeout: 120000,
    },
  },
  apps: {
    'ios.debug': {
      type: 'ios.app',
      binaryPath: 'ios/build/Build/Products/Debug-iphonesimulator/MyApp.app',
      build: 'xcodebuild -workspace ios/MyApp.xcworkspace -scheme MyApp -configuration Debug -sdk iphonesimulator -derivedDataPath ios/build',
    },
    'android.debug': {
      type: 'android.apk',
      binaryPath: 'android/app/build/outputs/apk/debug/app-debug.apk',
      build: 'cd android && ./gradlew assembleDebug assembleAndroidTest -DtestBuildType=debug',
      reversePorts: [8081],
    },
  },
  devices: {
    simulator: {
      type: 'ios.simulator',
      device: { type: 'iPhone 15' },
    },
    emulator: {
      type: 'android.emulator',
      device: { avdName: 'Pixel_7_API_34' },
    },
  },
  configurations: {
    'ios.sim.debug': {
      device: 'simulator',
      app: 'ios.debug',
    },
    'android.emu.debug': {
      device: 'emulator',
      app: 'android.debug',
    },
  },
};

Jest Config for Detox

// e2e/jest.config.js — Jest configuration for Detox tests.
// Sets up the Detox test environment and timeouts.
module.exports = {
  rootDir: '..',
  testMatch: ['<rootDir>/e2e/**/*.test.js'],
  testTimeout: 120000,
  maxWorkers: 1,
  globalSetup: 'detox/runners/jest/globalSetup',
  globalTeardown: 'detox/runners/jest/globalTeardown',
  reporters: ['detox/runners/jest/reporter'],
  testEnvironment: 'detox/runners/jest/testEnvironment',
  verbose: true,
};

Writing Tests

// e2e/login.test.js — Detox E2E test for the login flow.
// Gray-box: Detox waits for animations and network automatically.
describe('Login Flow', () => {
  beforeAll(async () => {
    await device.launchApp({ newInstance: true });
  });

  beforeEach(async () => {
    await device.reloadReactNative();
  });

  it('should show login screen on launch', async () => {
    await expect(element(by.id('login-screen'))).toBeVisible();
    await expect(element(by.id('email-input'))).toBeVisible();
    await expect(element(by.id('password-input'))).toBeVisible();
  });

  it('should login successfully with valid credentials', async () => {
    await element(by.id('email-input')).typeText('user@example.com');
    await element(by.id('password-input')).typeText('password123');
    await element(by.id('login-button')).tap();

    await expect(element(by.id('home-screen'))).toBeVisible();
    await expect(element(by.text('Welcome back'))).toBeVisible();
  });

  it('should show error for invalid credentials', async () => {
    await element(by.id('email-input')).typeText('wrong@example.com');
    await element(by.id('password-input')).typeText('wrongpass');
    await element(by.id('login-button')).tap();

    await expect(element(by.id('error-message'))).toBeVisible();
    await expect(element(by.text('Invalid credentials'))).toBeVisible();
  });
});

Scrolling and Lists

// e2e/feed.test.js — Detox test for scrollable lists and pull-to-refresh.
// Demonstrates scroll actions and element matching within lists.
describe('Feed Screen', () => {
  beforeAll(async () => {
    await device.launchApp();
    await element(by.id('email-input')).typeText('user@example.com');
    await element(by.id('password-input')).typeText('password123');
    await element(by.id('login-button')).tap();
  });

  it('should scroll to load more items', async () => {
    await waitFor(element(by.id('feed-list'))).toBeVisible().withTimeout(5000);
    await element(by.id('feed-list')).scroll(500, 'down');
    await expect(element(by.id('feed-item-10'))).toBeVisible();
  });

  it('should pull to refresh', async () => {
    await element(by.id('feed-list')).scroll(200, 'up');
    await waitFor(element(by.id('refresh-indicator'))).toBeNotVisible().withTimeout(5000);
  });
});

Running Tests

# run-detox.sh — Build and run Detox tests.
# Separate build and test steps for flexibility.

# Build the app for testing
detox build --configuration ios.sim.debug
detox build --configuration android.emu.debug

# Run tests
detox test --configuration ios.sim.debug
detox test --configuration android.emu.debug

# Run specific test file
detox test --configuration ios.sim.debug e2e/login.test.js

# Run with retry on failure
detox test --configuration ios.sim.debug --retries 2

CI Integration

# .github/workflows/detox.yml — Run Detox tests on macOS runner.
# Uses iOS simulator for E2E testing.
name: Detox E2E
on: [push]
jobs:
  detox-ios:
    runs-on: macos-14
    steps:
      - uses: actions/checkout@v4
      - uses: actions/setup-node@v4
        with:
          node-version: 20
      - run: npm ci
      - run: brew tap wix/brew && brew install applesimutils
      - run: cd ios && pod install
      - run: detox build --configuration ios.sim.debug
      - run: detox test --configuration ios.sim.debug --retries 2

Current listing version

1.0.0

Verify the source revision ↗

Safety and assessment details

Quality assessment

Out of 100 · Assessment report from SkillPi LAB.

Scenario Value85/100

Highlights

  • 提供 Detox 框架的完整端到端测试解决方案
  • 覆盖 React Native 开发者高频刚需场景
  • 包含实际项目配置与 CI 集成示例
Trigger Precision90/100

Highlights

  • 触发词覆盖全面且边界清晰
  • 明确区分与其他测试工具(appium/maestro)的适用场景
Structure and Standards90/100

Areas to improve

  • 文档长度略长 Reported severity: Minor

    SKILL.md 约 450 行,建议增加目录导航或拆分章节

    Recommendation: 可考虑添加 TOC 或拆分为多个子文档提升可读性

Highlights

  • 结构清晰,分阶段引导用户完成全流程
  • 包含完整代码示例和配置文件
  • frontmatter 信息完整规范
Execution Reliability90/100

Highlights

  • 命令与配置可直接执行
  • 覆盖构建、测试、CI 全流程
  • 提供重试机制提升稳定性
Evidence Verifiability (mean of the first four)89/100

The arithmetic mean of the first four original scores, rounded to a whole number.

Static text checks

100 / 100 · skillpi-20261123-no-r3-v1

No current rules matched the text.

This score reflects rule matches in the text and is provided for reference before use. It excludes attachments and runtime behavior.

Permissions and checks before use

Automatically summarized from this main document. Matches may be examples or defensive advice; they are not actual permission declarations. Attachments, external dependencies and runtime behavior are not covered.

These notices grant no permissions. Your host tool must still confirm file changes, secrets, external transfers or costs as needed.

Security rating and access scope

safe · Static evidence review; not a runtime safety guarantee.

```bash

Before use, confirm and authorize actual file access, external services and network destinations in your host. This review grants no runtime permissions.