[ agent view ]
Documentation Index
Fetch the complete documentation index at: https://e2e.com/docs/llms.txt Use this file to discover all available pages before exploring further.
From Detox
Use your existing app build and testIDs with screen, expect, and agent goals.
e2e tests a React Native app on a simulator or emulator with your normal
debug or release build, with no Detox framework in the app. Your testID
props work with getByTestId on both platforms.
For a migration that spans several sessions, the migrate-to-e2e skill records what moved in a progress file and keeps the old suite running until you retire each test.
Port the config
<Note>Set up a target with the mobile guide and a model with the quickstart. Both runners can use the same simulator while you move one spec at a time.</Note>
Detox (.detoxrc.js) | e2e |
|---|---|
apps.<name>.binaryPath | app: { appPath } on the target plus one device.installApp() per device in a fixture; the engine installs nothing on its own |
apps.<name>.bundleId | app: { bundleId: 'com.example.app' } on the target, the app app.open() launches |
devices.<name>.device.type | mobile({ device: 'iPhone 17' }) |
configurations | targets, one engine per platform |
Jest config, maxWorkers | workers, one per device |
detox build | Your normal build |
device.launchApp({ permissions }) | app.permissions on the target, set before every fresh launch, or device.openApp(app, { relaunch: true, permissions }) for one; grant, deny, reset for YES, NO, unset |
device.launchApp({ launchArgs }) | app.launchArguments on the target, or device.openApp(app, { relaunch: true, launchArguments }) for one; a list of strings the platform launch command takes, not a map |
device.launchApp({ languageAndLocale }) | app.launchArguments: ['-AppleLanguages', '(fr)', '-AppleLocale', 'fr_FR'] on an iOS target; see Run the app in another language |
export default {
targets: [
{
name: 'ios',
engine: mobile({ platform: 'ios' }),
app: { bundleId: 'com.example.app', appPath: 'ios/build/MyApp.app' },
},
{
name: 'android',
engine: mobile({ platform: 'android' }),
app: { bundleId: 'com.example.app', appPath: 'android/app/build/outputs/apk/debug/app-debug.apk' },
},
],
workers: 1,
} satisfies E2EConfig;
Rewrite one spec
Start with a flow that needs frequent maintenance. If its screens take time
to settle after agent actions, raise the engine's
settle option; for deterministic test steps, raise
its transition option when a control is still
arriving.
describe('login', () => {
beforeAll(async () => { await device.launchApp({ newInstance: true }); });
it('shows the home screen', async () => {
await element(by.id('email')).typeText('ada@example.test');
await element(by.id('password')).typeText('hunter2');
await element(by.text('Sign in')).tap();
await waitFor(element(by.id('home'))).toBeVisible().withTimeout(10000);
await expect(element(by.text('Welcome, Ada'))).toBeVisible();
});
});
test('shows the home screen', async ({ agent, app, screen }) => {
await app.open();
const ada = credentials.user('ada');
await agent.act('sign in as {username}', { params: { username: ada.username, password: ada.password } });
await expect(screen.getByTestId('home')).toBeVisible({ timeout: 10_000 });
await expect(screen.getByText('Welcome, Ada')).toBeVisible();
});
Nothing launches on its own, so the test starts with app.open(). The
password comes from configured credentials.
Map each Detox call
"Not yet" marks a call e2e doesn't have today, and "No equivalent" one it leaves out on purpose.
| Detox | e2e |
|---|---|
by.id('x') | screen.getByTestId('x') |
by.text('t') | screen.getByText('t'); both match the exact text |
by.label('l') | screen.getByLabel('l') |
by.type('RCTImageView') | device.locator('role=image'), agent-device's selector syntax |
by.id('x').withAncestor(by.id('row')) | screen.getByTestId('row').getByTestId('x') |
.atIndex(n) | .nth(n) |
.tap(), .multiTap(2), .longPress() | .tap(), .doubleTap(), .longPress() |
.tap({ x, y }) | .tap({ position: { x, y } }) |
.typeText(t), .replaceText(t) | .fill(t) replaces the content |
.clearText() | .clear() |
.tapReturnKey() | .press('Enter') |
.tapBackspaceKey() | Not yet. .fill(t) with the shorter text |
.swipe('up', 'fast') | .swipe({ direction: 'down', momentum: 'fast' }): Detox names the finger's direction, e2e the content's |
.scroll(200, 'down') | screen.swipe({ direction: 'down' }) |
waitFor(el).toBeVisible().whileElement(list).scroll(...) | list.scrollUntilVisible(el), with { direction: 'up' } when Detox scrolls up |
list.scrollTo('bottom') | list.scrollUntilVisible(lastRow); for 'top', list.scrollUntilVisible(firstRow, { direction: 'up' }) |
.adjustSliderToPosition() | Not yet. Drag with screen.swipe({ from, to }), the points taken from the slider's .boundingBox(); on Android, .tap({ position }) on the track also works |
.setDatePickerDate() | Not yet |
.getAttributes() | One call per field: .textContent(), .inputValue(), .isEnabled(), .isVisible(), .isChecked(), .boundingBox(), and .getAttribute('placeholder'), the only attribute a device node has |
waitFor(el).toBeVisible().withTimeout(ms) | await expect(el).toBeVisible({ timeout: ms }) |
expect(el).toBeVisible(), .toExist() | .toBeVisible() for visibility; .toHaveCount(1) for existence |
expect(el).not.toBeVisible() | .toBeHidden() |
expect(el).toHaveText(t) | .toHaveText(t) |
expect(el).toHaveToggleValue(true) | .toBeChecked() |
expect(el).toHaveValue(v) | .toHaveValue(v) |
expect(el).toHaveLabel(l) | .toHaveAccessibleName(l) |
device.launchApp({ newInstance: true }) | app.restart() |
device.launchApp({ delete: true }) | app.clearState() |
device.launchApp({ newInstance: false }) | device.openApp(id) without relaunch |
device.launchApp({ url }), device.openURL({ url }) | device.openLink(url) |
device.terminateApp() | device.closeApp() |
device.uninstallApp() | Not yet. device.unstable_raw.client.apps.uninstall({ ...device.unstable_raw.selection, app: 'com.example.app' }) removes it, see unstable_raw; device.installApp(path, { reinstall: true }) installs with no data |
device.resetContentAndSettings() | Not yet. app.clearState() resets the app; on iOS, device.clearKeychain() clears the simulator keychain for every app |
device.reloadReactNative() | No equivalent. app.restart() is the nearest |
device.sendToHome(), device.pressBack() | device.home(), device.back() |
device.setLocation(lat, lon) | device.setLocation({ latitude, longitude }) |
device.setOrientation('landscape') | device.setOrientation('landscape-left') |
device.setBiometricEnrollment(true) | device.enrollBiometrics('faceid', true) |
device.matchFace(), device.unmatchFace() | device.setBiometrics('faceid', 'match' | 'nonmatch') |
device.setStatusBar | No equivalent. toHaveScreenshot holds the status bar fixed |
device.setURLBlacklist | No equivalent |
device.shake(), device.sendUserNotification() | Not yet |
device.disableSynchronization() | No equivalent. Actions wait and assertions retry |
device.takeScreenshot() | app.screenshot('label'), secure fields masked |
device.takeScreenshot() compared with an image snapshot library | await expect(screen).toHaveScreenshot('name.png'), see Visual comparison |
:ios: / :android: in a test name | { platforms: ['ios'] } on the test |
device.getPlatform() | the platform fixture: async ({ platform }) => ... |
Two things differ from Detox:
- Actions and single-node reads and assertions need one match. Several fail
with
LOCATOR_AMBIGUOUS. Narrow with.filter(),.first(), or.nth(). See screen. - A device has no
test.setupor{ session }. See what differs from the web.
Next
Configure your app and devices.
Every option, the device fixture, and the tool pack.
