From Maestro
Move Maestro flows to TypeScript with locators, assertions, and agent goals.
e2e replaces Maestro’s YAML flows with TypeScript tests. Each command becomes an awaited call, usually on a locator, or one agent goal covers several. Both runners can use the same simulator or emulator while you move one flow at a time.
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
The reference pages hold the details: screen, expect, test, and the mobile engine.
Rewrite one flow
Start with a flow whose optional steps and runFlow: { when } branches
often need updating.
appId: com.example.app
---
- launchApp:
clearState: true
- tapOn: "Get started"
- tapOn:
id: "email"
- inputText: "ada@example.test"
- tapOn: "Continue"
- assertVisible: "Check your inbox"
- scrollUntilVisible:
element: "Resend"
- assertVisible:
id: "resend"import { test } from '@e2e-dev/mobile';
import { expect } from 'e2e';
test('asks for the email', async ({ app, agent, screen }) => {
await app.clearState();
await agent.act('get started with the email {email}', { params: { email: 'ada@example.test' } });
await expect(screen.getByText('Check your inbox')).toBeVisible();
await screen.scrollUntilVisible(screen.getByTestId('resend'));
await expect(screen.getByTestId('resend')).toBeVisible();
});Map each command
Calls on device run only on a device, so a test that uses it declares
requires: ['device'] and other targets skip it. Calls on screen, app,
agent, and expect(locator) run on every target. “Not yet” marks a
command e2e doesn’t have today, and “No equivalent” one it leaves out on
purpose.
App lifecycle
Taps and input
Gestures
Assertions and waits
Device
AI commands and flow control
Rewrite selectors
Four differences from Maestro’s selectors cause most edits.
- Maestro reads text and id as case-insensitive regular expressions, so
tapOn: ".*Save.*"matches any text with Save in it, and"Mute Account"matchesMute account.getByTextandgetByTestIdmatch the whole string, case included. WritegetByText(/^mute account$/i)orgetByTestId(/^row-/)for a pattern, or{ exact: false }for a case-insensitive substring of text. - Maestro taps the first of several matches. e2e fails with
LOCATOR_AMBIGUOUS, so write.first()when the first match is what you mean. isVisible(), the check that replacesoptionalandrunFlow: { when }, isfalseon zero matches andLOCATOR_AMBIGUOUSon several. Add{ visible: true }to the query or.first()when a hidden twin may exist.below,above,leftOf,rightOf, andcontainsDescendantshave no port. e2e hasfilter({ has, hasText })and chaining for structure, and nothing spatial. UsegetByLabel, a test id, or a goal:agent.act('enter {email} in the email field', { params })finds the field.
What differs on purpose
- e2e records and redacts the calls on
screen,app,device, and the agent.device.unstable_rawhands a test agent-device’s client for what those don’t cover. Its calls aren’t steps: the report and trace leave them out, the agent cache doesn’t replay them, nothing redacts their arguments, and nothing waits for the screen to settle after one. - A device has no
test.setupor{ session }, see what differs from the web.
