Command Palette

Search for a command to run...

UnylyUnyly
Назад к скиллам

detox

БесплатноБез исполняемых скриптовНе проверен

Detox is a gray-box end-to-end testing framework for React Native apps: it runs Jest tests against the app on an iOS simulator or Android emulator and waits…

TerminalSkillsот TerminalSkills★ 221 звезда на GitHub

Об этом скилле

Detox

Overview

Detox is the gray-box end-to-end testing framework for React Native apps by Wix. Tests are written in JavaScript, run by Jest on your machine, and drive the real app on an iOS simulator or Android emulator. Because Detox runs inside the app as well, it knows when animations, timers and network requests are in flight and waits for the app to become idle before every action and assertion, which removes most timing flakiness without sleep calls. The price is setup: Detox needs a test build of the app per platform and a few native changes on Android.

Instructions

Initial Assessment

  1. Platform — iOS, Android, or both? iOS tests only run on macOS.
  2. React Native version — bare React Native or Expo? Detox has no Expo-specific support, and the Expo guide that the Detox docs link to now covers Maestro; treat Detox on Expo as community-maintained.
  3. CI — Which CI provider? (GitHub Actions, CircleCI, Bitrise)
  4. Current state — New project or adding tests to existing app?

Setup

# Run in the React Native project root
npm install "jest@^29" --save-dev      # pin the major so an old lockfile cannot pull Jest 26
npm install detox --save-dev

# iOS only (macOS): simulator control tool required by Detox
brew tap wix/brew
brew install applesimutils

# Creates .detoxrc.js, e2e/jest.config.js and e2e/starter.test.js
npx detox init

npm install -g detox-cli is optional: it only lets you type detox instead of npx detox.

Configuration

// .detoxrc.js — apps (how to build, where the binary is), devices, and their combinations
/** @type {Detox.DetoxConfig} */
module.exports = {
  testRunner: {
    args: { $0: 'jest', config: 'e2e/jest.config.js' },
    jest: { setupTimeout: 120000 },
  },
  apps: {
    'ios.debug': {
      type: 'ios.app',
      binaryPath: 'ios/build/Build/Products/Debug-iphonesimulator/FieldNotes.app',
      build: 'xcodebuild -workspace ios/FieldNotes.xcworkspace -scheme FieldNotes -configuration Debug -sdk iphonesimulator -derivedDataPath ios/build',
    },
    'ios.release': {
      type: 'ios.app',
      binaryPath: 'ios/build/Build/Products/Release-iphonesimulator/FieldNotes.app',
      build: 'xcodebuild -workspace ios/FieldNotes.xcworkspace -scheme FieldNotes -configuration Release -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 16' } },
    emulator: { type: 'android.emulator', device: { avdName: 'Pixel_7_API_34' } },
  },
  configurations: {
    'ios.sim.debug': { device: 'simulator', app: 'ios.debug' },
    'ios.sim.release': { device: 'simulator', app: 'ios.release' },
    'android.emu.debug': { device: 'emulator', app: 'android.debug' },
  },
};

A simulator of that type must already exist (applesimutils --list): Detox clones an existing one and fails with Failed to find a device when there is none. detox init writes iPhone 15, which the GitHub macos-15 image does not have. avdName must be one that emulator -list-avds prints. detox build only runs the build string of the chosen configuration; if it fails, the fix is in the Xcode or Gradle command, not in Detox.

Jest Config for Detox

// e2e/jest.config.js — generated by `detox init`
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,
};

Android native setup

iOS needs no project changes. A bare Android project needs these build-script changes and three more below:

 // android/build.gradle
 allprojects {
   repositories {
     google()
+    maven { url("$rootDir/../node_modules/detox/Detox-android") }
   }
 }

 // android/app/build.gradle
   defaultConfig {
+    testBuildType System.getProperty('testBuildType', 'debug')
+    testInstrumentationRunner 'androidx.test.runner.AndroidJUnitRunner'
   }
   dependencies {
+    androidTestImplementation('com.wix:detox:+')
   }

Also: the Kotlin Gradle plugin on the buildscript classpath; a DetoxTest.java instrumentation test under android/app/src/androidTest/java/ in your app's package (copy it from the Detox "Project Setup" page and change the package line); and a network_security_config.xml that permits cleartext traffic to 10.0.2.2 and localhost, registered with android:networkSecurityConfig in AndroidManifest.xml. Release builds must add Detox's ProGuard file (`node_modules/detox/android/detox/proguard-rules-app

Полный SKILL.md на GitHub

Установить detox в Claude Code и Claude Desktop

Зарегайся, чтобы установить скилл

Создай бесплатный аккаунт, чтобы открыть команду установки и сохранить скилл в библиотеку.

  • Открой команду установки в одну строку
  • Сохраняй скиллы в синхронизируемую библиотеку
  • Уведомления, когда скиллы обновляются
Зарегаться бесплатноУ меня уже есть аккаунт

Разрешённые инструменты

Инструменты, которые скиллу разрешено вызывать.

Без ограничений — скилл может использовать любой инструмент.

Вложенные файлы

_scores.json

FAQ

Что делает скилл detox?

Detox is a gray-box end-to-end testing framework for React Native apps: it runs Jest tests against the app on an iOS simulator or Android emulator and waits for the app to go idle before each step. Use when the user wants to set up Detox, write or fix React Native E2E tests, debug a test that hangs or cannot find an element, or run Detox in CI. Also use when the user mentions "detox," "React Native E2E," "gray-box testing," "detox build," or "Wix Detox." For black-box testing of any mobile app, see appium; for simple YAML UI flows, see maestro.

Как установить скилл detox?

Скопируй папку скилла в ~/.claude/skills (вкладка Claude Code выше делает это одной командой), либо поставь как плагин.

Скилл detox запускает скрипты?

Нет, скилл состоит только из инструкций (SKILL.md), без исполняемых скриптов.

Похожие скиллы

Сравнить detox с