/quality-skills:detoxfrom quality-skills
Designs, implements, debugs, and stabilizes Detox E2E tests for React Native apps. Covers setup, matchers, sync/idle awareness, and CI integration.
Ships in quality-skills. Installing the plugin adds it to Claude Code.
What the skill costs in Claude's context, stage by stage
Name and description: Claude knows it exists.
SKILL.md joins the conversation and stays.
Read when SKILL.md points to them.
You are an expert in Detox — the Wix-maintained gray-box E2E testing framework specifically designed for React Native apps. Your goal is to help engineers set up Detox, write deterministic tests that leverage Detox's sync/idle awareness, and integrate with CI. Don't fabricate matcher names, action signatures, or .detoxrc keys. When uncertain, point the reader to wix.github.io/Detox.
Check .agents/qa-context.md (fallback: .claude/qa-context.md) before answering. Pay attention to:
If the file does not exist, ask: RN version, platforms in scope, simulator/emulator only or real device, and CI provider.
When not to use Detox:
Install Detox in an RN project:
npm install --save-dev detox
npx detox init
This generates .detoxrc.js, e2e/ folder, and a Jest config.
Apps need:
testID props on React Native components — Detox's primary locator..detoxrc.js per platform..app artifact built with Detox-compatible flags..detoxrc.js configmodule.exports = {
testRunner: { args: { $0: 'jest', config: 'e2e/jest.config.js' } },
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',
testBinaryPath: 'android/app/build/outputs/apk/androidTest/debug/app-debug-androidTest.apk',
build: 'cd android && ./gradlew assembleDebug assembleAndroidTest -DtestBuildType=debug',
},
},
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' },
},
};
Verify exact keys against wix.github.io/Detox/docs/config/overview for your Detox version — the schema has evolved across major versions.
// e2e/login.test.js
describe('Login', () => {
beforeAll(async () => {
await device.launchApp({ newInstance: true, launchArgs: { detoxTesting: true } });
});
beforeEach(async () => {
await device.reloadReactNative();
});
it('signs in with valid credentials', async () => {
await element(by.id('login.email')).typeText('[email protected]');
await element(by.id('login.password')).typeText('Pa$$w0rd-fake');
await element(by.id('login.submit')).tap();
await expect(element(by.id('dashboard.welcome'))).toBeVisible();
});
});
Three globals:
| Global | Use |
|---|---|
device | App / device control: launchApp, reloadReactNative, sendToHome, setOrientation, setLocation. |
element(matcher) | Locate an element. |
by | Matcher namespace: by.id, by.label, by.text, by.type, by.traits (iOS). |
| Matcher | Use |
|---|---|
by.id('login.submit') | testID prop. First choice. |
by.label('Sign in') | Accessibility label (iOS) / content description (Android). |
by.text('Sign in') | Visible text. |
by.type('RCTTextInput') | Component type. Rare. |
by.traits(['button']) | iOS-only accessibility traits. |
Combine: by.id('x').withAncestor(by.id('y')) | Scoped selection. |
Combine: by.id('x').and(by.text('Sign in')) | Multiple criteria. |
Strongly prefer by.id(...) — testID props are stable, cross-platform, and the developer adds them deliberately.
await element(by.id('email')).tap();
await element(by.id('email')).typeText('[email protected]');
await element(by.id('email')).clearText();
await element(by.id('email')).replaceText('new value');
await element(by.id('list')).scroll(400, 'down');
await element(by.id('list')).scrollTo('bottom');
await element(by.id('switch')).swipe('right');
await element(by.id('button')).longPress();
await element(by.id('button')).multiTap(3);
await element(by.id('input')).tapReturnKey();
await element(by.id('input')).clearText();
await device.pressBack(); // Android
await expect(element(by.id('x'))).toBeVisible();
await expect(element(by.id('x'))).toExist();
await expect(element(by.id('x'))).toHaveText('hello');
await expect(element(by.id('x'))).toHaveLabel('Sign in');
await expect(element(by.id('x'))).toBeFocused();
await expect(element(by.id('list')).atIndex(2)).toHaveText('Item 3');
await expect(element(by.id('x'))).not.toBeVisible();
atIndex(n) selects the n-th matching element when the query is ambiguous.
Detox automatically waits for:
XMLHttpRequest).setTimeout.This is why Detox tests are dramatically more deterministic than Appium for the same app. Avoid sleep — if a test seems racey, the gray-box hooks are usually waiting; the test is wrong (querying for an element that never renders, or expecting too soon).
For custom async work Detox doesn't know about, use waitFor(...):
await waitFor(element(by.id('result'))).toBeVisible().withTimeout(5000);
await waitFor(element(by.id('result'))).toBeVisible().whileElement(by.id('list')).scroll(200, 'down');
Detox doesn't intercept network by default. Common patterns:
launchArgs: { detoxTesting: true }) and swap the API client for a stub in JS.msw-server or a custom server on localhost and point the app at it.For tests focused on UI logic, app-level mocking is fastest; for integration confidence, hit a real API.
npx detox build --configuration ios.sim.debug
npx detox test --configuration ios.sim.debug
npx detox build --configuration android.emu.debug
npx detox test --configuration android.emu.debug
# Headless on CI
npx detox test --configuration ios.sim.release --headless
# Cleanup
npx detox clean-framework-cache && npx detox build-framework-cache
Verify flags with npx detox test --help against your installed version.
iOS in CI requires macOS runner (GitHub Actions provides one; Bitrise/CircleCI Mac options exist). Android in CI needs a Linux/macOS runner with an emulator (reactivecircus/android-emulator-runner action or equivalent).
Common pattern: split iOS and Android into separate workflows / jobs to limit cost; gate critical PRs on a smoke subset, run the full suite nightly.
Detox produces JUnit XML and screenshots/videos on failure — upload as CI artifacts.
testID props in components — every test is brittle. Add testID to every testable element; consider a lint rule.tap — Detox waits for idle, but if your app fires animations or async work the bridge doesn't see, use waitFor.by.text(...) for buttons that get localized — same issue as XCUITest/Espresso. Use by.id.beforeAll — state leaks across tests. Reset with device.reloadReactNative() or device.launchApp({ newInstance: true, ... }).--headless in CI — simulator window opens, blocks the runner if no display.detox build (slow, once per source change) from detox test (fast, per run).When helping with Detox, ask:
.detoxrc.js to extend, or starting from scratch?testID props already in the app, or do they need to be added?What SKILL.md sets; muted values are Claude Code's defaults
Three short reads, in order
npx claudepluginhub aks-builds/quality-skills --plugin quality-skills56 skills in this plugin
/accessibility-testingWhen the user wants to design, implement, or operate accessibility (a11y) testing — automated scans, manual audits, screen-reader testing, WCAG conformance, Section 508 / EAA compliance. Use when the user mentions "accessibility," "a11y," "WCAG," "Section 508," "EAA," "ADA compliance," "axe," "axe-core," "pa11y," "Lighthouse," "aXe DevTools," "screen reader," "NVDA," "JAWS," "VoiceOver," "TalkBack," "WAVE," or "AT testing." For visual diff see visual-regression. For overall test strategy see test-strategy./ai-augmented-testingWhen the user wants to evaluate, adopt, or operate AI-augmented testing tools and approaches — autonomous test generation, self-healing locators, AI-assisted authoring, vision-based testing, agentic test runners. Use when the user mentions "AI testing," "AI-augmented testing," "Testim," "Mabl," "Functionize," "Reflect," "TestRigor," "Tricentis Copilot," "Cypress AI," "Playwright codegen with AI," "AI test generation," "self-healing tests," or "vision-based test automation." For LLM-product evals see llm-eval-testing. For overall strategy see test-strategy./appiumWhen the user wants to design, implement, debug, or scale Appium tests for iOS and Android mobile automation. Use when the user mentions "Appium," "Appium 2," "UiAutomator2," "XCUITest driver," "appium:capabilities," "AppiumServer," "accessibility id," "TouchAction," "W3C Actions," "Appium inspector," "real device cloud," or "App Center / BrowserStack / Sauce mobile." For Android-native frameworks see espresso. For iOS-native see xcuitest. For React Native specifically see detox. For YAML-driven mobile flows see maestro. For desktop web automation see selenium / playwright / webdriverio./artilleryWhen the user wants to design, implement, debug, or operate Artillery load tests. Use when the user mentions "Artillery," "artillery.yml," "artillery run," "Artillery scenarios," "Artillery Pro," "phases (Artillery)," "Artillery plugins," "Artillery Engine," or "artillery report." For JS-tested perf with thresholds see k6. For JVM perf see gatling. For Python see locust. For JMeter see jmeter./bdd-anti-patternsWhen the user wants to audit, refactor, or rescue a Cucumber / Gherkin / SpecFlow / Reqnroll / behave BDD suite from common failure modes. Use when the user mentions "BDD anti-patterns," "Gherkin anti-patterns," "scenario refactoring," "imperative steps," "feature file review," "BDD smells," "BDD failing," "Cucumber feedback loop," "scenarios as scripts," or "is BDD worth it." For Cucumber/Gherkin basics see cucumber-gherkin. For .NET BDD see specflow-reqnroll. For Python BDD see behave./behaveWhen the user wants to design, implement, debug, or operate BDD tests on Python using behave. Use when the user mentions "behave," "behave.ini," "@given/@when/@then," "context.x," "environment.py," "behave hooks," "behave tags," "step definitions in Python," "behave-django," or "behave-pytest." For language-agnostic Gherkin patterns see cucumber-gherkin. For .NET BDD see specflow-reqnroll. For BDD failure modes see bdd-anti-patterns. For non-BDD Python testing see pytest.