jpskill.com
💬 コミュニケーション コミュニティ

detox

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.

⚡ おすすめ: コマンド1行でインストール(60秒)

下記のコマンドをコピーしてターミナル(Mac/Linux)または PowerShell(Windows)に貼り付けてください。 ダウンロード → 解凍 → 配置まで全自動。

🍎 Mac / 🐧 Linux
mkdir -p ~/.claude/skills && cd ~/.claude/skills && curl -L -o detox.zip https://jpskill.com/download/14832.zip && unzip -o detox.zip && rm detox.zip
🪟 Windows (PowerShell)
$d = "$env:USERPROFILE\.claude\skills"; ni -Force -ItemType Directory $d | Out-Null; iwr https://jpskill.com/download/14832.zip -OutFile "$d\detox.zip"; Expand-Archive "$d\detox.zip" -DestinationPath $d -Force; ri "$d\detox.zip"

完了後、Claude Code を再起動 → 普通に「動画プロンプト作って」のように話しかけるだけで自動発動します。

💾 手動でダウンロードしたい(コマンドが難しい人向け)
  1. 1. 下の青いボタンを押して detox.zip をダウンロード
  2. 2. ZIPファイルをダブルクリックで解凍 → detox フォルダができる
  3. 3. そのフォルダを C:\Users\あなたの名前\.claude\skills\(Win)または ~/.claude/skills/(Mac)へ移動
  4. 4. Claude Code を再起動

⚠️ ダウンロード・利用は自己責任でお願いします。当サイトは内容・動作・安全性について責任を負いません。

🎯 このSkillでできること

下記の説明文を読むと、このSkillがあなたに何をしてくれるかが分かります。Claudeにこの分野の依頼をすると、自動で発動します。

📦 インストール方法 (3ステップ)

  1. 1. 上の「ダウンロード」ボタンを押して .skill ファイルを取得
  2. 2. ファイル名の拡張子を .skill から .zip に変えて展開(macは自動展開可)
  3. 3. 展開してできたフォルダを、ホームフォルダの .claude/skills/ に置く
    • · macOS / Linux: ~/.claude/skills/
    • · Windows: %USERPROFILE%\.claude\skills\

Claude Code を再起動すれば完了。「このSkillを使って…」と話しかけなくても、関連する依頼で自動的に呼び出されます。

詳しい使い方ガイドを見る →
最終更新
2026-05-18
取得日時
2026-05-18
同梱ファイル
1
📖 Claude が読む原文 SKILL.md(中身を展開)

この本文は AI(Claude)が読むための原文(英語または中国語)です。日本語訳は順次追加中。

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