detox
安装方式
先用 Prompt 核对来源与依赖。也可下载安装包。
用 AI 助手安装
复制提示词,让助手先核对固定版本和依赖。
查看 Prompt收起 Prompt
先检查当前 Agent 是否已安装 SkillPI Skill Finder。如果尚未安装,请按官方仓库的说明安装并启用:https://github.com/Findskills/skillpi。然后使用 Skill Finder 打开此 SkillPI 详情页并定位 "detox":https://skillpi.com/zh/skills/deepskill-9870dbe8f13c0348eb9e8a40b569c97857f1829fa5bd9b99ee1e9e97f3cb1472。安装前核对上游来源和版本:https://github.com/TerminalSkills/skills。来源不一致时停止并说明差异。核对通过后,用 Skill Finder 安装目标 Skill,并报告安装路径和来源版本。
来源与配置
github.com
配置方式待核实
请查看原始来源中的适用工具、依赖和权限要求。
安装实测待补充
在为 React Native 应用编写端到端测试时使用 Detox 的灰盒测试方法。适用于提到“detox”“React Native 测试”“React Native E2E”“灰盒测试”或“Wix Detox”的场景。对于一般移动应用测试请参考 appium,对于更简单的移动 UI 流程请参考 maestro。
介绍来源: third_party · TerminalSkills · 1.0.0 参考来源
SkillPi 解读
- 能完成的任务
- 翻译待完成,请参阅来源文档。
- 软件、账号及付费要求
- 贝什
- 实测状态
- 未测试
文件浏览
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-boxDetox
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
- Platform — iOS, Android, or both?
- React Native version — Expo or bare workflow?
- CI — Which CI provider? (GitHub Actions, CircleCI, Bitrise)
- 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当前收录版本
1.0.0
质量评测
满分100 · 来自 SkillPi LAB 实验室的评测报告。
亮点
- 提供 Detox 框架的完整端到端测试解决方案
- 覆盖 React Native 开发者高频刚需场景
- 包含实际项目配置与 CI 集成示例
亮点
- 触发词覆盖全面且边界清晰
- 明确区分与其他测试工具(appium/maestro)的适用场景
待提升项
-
文档长度略长 原报告严重程度:轻微
SKILL.md 约 450 行,建议增加目录导航或拆分章节
改进建议:可考虑添加 TOC 或拆分为多个子文档提升可读性
亮点
- 结构清晰,分阶段引导用户完成全流程
- 包含完整代码示例和配置文件
- frontmatter 信息完整规范
亮点
- 命令与配置可直接执行
- 覆盖构建、测试、CI 全流程
- 提供重试机制提升稳定性
取前四项原始分值的算术平均,四舍五入取整。可通过收录报告核对各项评分与说明,运行记录需单独查证。
正文静态检测
100 / 100 · skillpi-20261123-no-r3-v1
正文未命中当前规则。
分数仅反映正文中的规则命中,供使用前参考。附件与运行行为不在此评分范围内。
权限与使用前检查
根据当前主文档自动整理,命中内容可能是示例或防护说明;不是实际权限声明,也未覆盖附件、外部依赖或运行行为。
-
安装或获取外部依赖
使用官方来源并锁定版本,在隔离环境检查安装脚本。当前文档检查不覆盖后续下载的代码。
主文档提及 · 第 37, 38, 42, 219 行 -
账号、密钥或授权
使用专用、最小权限账号,不把密钥粘贴到公开内容或命令日志;核对接收数据的服务与租户。
主文档提及 · 第 136, 145, 151 行
安全评级与访问范围
safe · 静态证据核验,不代表运行安全保证。
贝什
使用前请由宿主核对并授权实际文件读写、外部服务和联网目的地;本站的核验不会授予任何运行权限。
用户讨论
还没有已核实的点评。