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
import type { E2EConfig } from 'e2e';
import { mobile } from '@e2e-dev/mobile';
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();
});
});import { test } from '@e2e-dev/mobile';
import { expect, credentials } from 'e2e';
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.
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.
