[ Documentation ]
Detox suites

Detox suites

rnx detox runs Detox-style suites against rnx. It shells out to your own Jest, so your Jest version, transforms, and setupFiles keep working; the one thing it forces is that import ... from 'detox' resolves to the rnx driver.

Run an existing suite

terminal
rnx detox

Test discovery checks e2e/, test/e2e/, and detox/ (or set RNX_TEST_DIR). If a rnx-detox.config.cjs, jest.config.cjs, or jest.config.js exists it is used; otherwise the rnx preset is applied directly. Useful flags:

terminal
rnx detox --config e2e/jest.config.js
rnx detox -t "login" # jest --testNamePattern
rnx detox --watch
rnx detox --headed # keep the rnx window visible

If no rnx shell is reachable, the runner warns and tells you how to start one; pass --no-launch when you manage the shell yourself.

Start from scratch

terminal
rnx detox init

scaffolds rnx-detox.config.cjs plus a runnable e2e/example.test.ts using by, device, element, expect, and waitFor from detox.

What the driver supports

Matchers (by.id, by.text, by.label, by.role, by.type), actions (tap, longPress, typeText, replaceText, clearText, scroll, swipe, takeScreenshot), and the assertion set (toBeVisible, toExist, toHaveText, toHaveLabel, toHaveValue, toBeEnabled, and their negations). The full API lives in Detox Driver.

Migrating from native Detox

device.launchApp() and device.reloadReactNative() work as expected. Some device methods depend on native capabilities rnx intentionally handles differently:

Detox featurernx behavior
device.takeScreenshot()captures a canvas screenshot
device.shake()no-op
device.sendToHome()no-op
device.installApp() / uninstallApp()no-op (runs in the browser)
device.setLocation()no-op (use config instead)
device.setURLBlacklist()no-op

Many teams keep both: rnx in CI for fast feedback on every PR, native Detox for a final device pass.

{
"scripts": {
"test:native": "detox test",
"test:rnx": "rnx detox"
}
}

Results in CI and the dashboard

The exit code is Jest’s exit code, so any CI can gate on it with no account. When the suite runs in CI through the Contrast GitHub App (or with an API key), the run also registers in your dashboard with the test counts and the first failure, so a red suite is visible in the dashboard without opening CI logs.

Next