The broader Detox suite contains more than 150 E2E scenarios and runs nightly. The current migration scope is narrower: 107 active Detox regression tests. These are different counts, not competing estimates of the same set. The team spent months making the existing CI pipeline practical for pull requests. Parallel execution reduced the full-suite runtime from 50–60 minutes per platform to about 20 minutes. Nx-based impact analysis, module tags and a custom Jest runner brought the average PR run to around 12 minutes. A replacement must be evaluated against that pipeline, not merely against the syntax of individual Detox files.
Detox tests are JavaScript run via Jest with full programmatic control over the setup, helpers and assertions. Detox can also synchronize with app activity. Maestro expresses mobile interactions as YAML commands and uses its own execution model for handling waits. A direct translation might preserve the apparent sequence of taps but could change when those taps occur, how the state is initialized or what is actually checked. Helper functions are another pitfall: A method called completeOnboarding() might in fact hide several screens and assertions. The agent will need to review that method’s implementation before attempting any translation.
Building an Agent-Assisted Workflow
The migration is being organized in waves, beginning with simpler tests from each Detox suite. So far, 33 of the 107 active Detox tests in scope have been migrated to Maestro, approximately 31%. That figure tracks conversion progress; it does not mean that 33 flows are stable in CI or that the migration has saved engineering time.
The purpose of the initial wave is to expose shared dependencies rather than increase coverage: API mocks, fixtures, feature flags, permissions, screenshots, deep links, retries, parallel execution and CI. The workflow calls for Claude Code to inspect the tests and helpers, identify Detox-specific mechanisms, map possible Maestro equivalents and flag gaps. Porting fixtures and mocks and drafting runner or CI scripts are further tasks the agent can assist with; they should not be treated as complete merely because a test has been converted. Engineers still need to approve the shared architecture and acceptance criteria, since an error there can affect every subsequent flow.
With the fundamentals in place, Claude Code will take the individual test and turn it into a Maestro flow, use Maestro MCP to run the pilot flow on a simulator, check the accessibility hierarchy and verify that the fixtures, mocks and permissions all took effect. That’s far more useful than just generating the YAML, but a successful run is only one of the checks. The reviewer still has to compare the flow against the original test’s assertions and side effects.
One issue is that Detox and Maestro don’t always see the same UI. Detox works with the app’s view tree, whereas Maestro interrogates the OS’s accessibility hierarchy.
Android selectors tend to map over much more easily than on iOS selectors do, where a tappable container may have a combined label and the child IDs of that container may not be available at all. A Detox assertion on an icon within a card may therefore have no direct Maestro equivalent. Where we can, we’ll target a stable container ID, then match the text of that container against a regex. That’s a change in selector strategy, not a reason to just quietly drop the check.
Two Failure Modes That a Passing Flow Can Hide
The first failure mode was a loss of visual verification. Claude Code substituted the Detox screenshot comparisons (takeScreenshot with jest-image-snapshot) with a list of element assertions. The flow would pass, but it was no longer actually verifying the screen. Maestro has an assertScreenshot command, so it wasn’t just a matter of not having the equivalent, it was a translation that had broken the contract of the test.
Detox Test
// e2e/tests/achievements.spec.js
describe(‘Achievements’, () => {
it(‘[Achievements]: Badges categories’, async () => {
await openAwardsScreenByDeeplink()
await waitForElementWithId(achievements.awardsScreenScrollView, 500, 10)
await scrollById(category, achievements.awardsScreenScrollView, directions.down, 100, 100)
await waitForElementWithId(achievements.tenKStepsBadgeIcon, 500)
await checkSnapshot(achievements.stepsCategory, `badgeCategory-steps}`)
})
})
Maestro (First Run)
# achievements/badges-categories.yaml
# Notes:
# (both platforms) and badge icon (Android).
appId: ${APP_ID}
—
– runFlow: ../../setupApp.yaml
– runFlow:
file: ../../subflows/openDeeplink.yaml
env:
DEEPLINK: “/achievements/awards”
– extendedWaitUntil:
visible:
id: “awardsScreenScrollView”
timeout: 10000
– extendedWaitUntil:
visible: “Influencer Badge”
timeout: 10000
– assertVisible: “10K steps”
– assertVisible: “7-Day Streak”
– extendedWaitUntil:
visible:
id: “awardsScreenScrollView”
timeout: 10000
– scrollUntilVisible:
element:
id: “badgeCategory-steps”
direction: DOWN
timeout: 10000
visibilityPercentage: 100
– assertVisible:
text: “10K steps”
childOf:
id: “badgeCategory-steps”
Maestro (Fixed Version)
# Same as Detox `checkAwardsCategory`, including checkSnapshot of the category card
appId: ${APP_ID}
—
– runFlow: ../../setupApp.yaml
– runFlow:
file: ../../subflows/openDeeplink.yaml
env:
CATEGORY: steps
DEEPLINK: “/achievements/awards”
– extendedWaitUntil:
visible:
id: “awardsScreenScrollView”
timeout: 10000
– extendedWaitUntil:
visible: “Influencer Badge”
timeout: 10000
– extendedWaitUntil:
visible:
id: “awardsScreenScrollView”
timeout: 10000
– scrollUntilVisible:
element:
id: “badgeCategory-steps”
direction: DOWN
timeout: 10000
visibilityPercentage: 100
# Detox waits for the badge image before the snapshot
– runFlow:
when:
platform: Android
commands:
– extendedWaitUntil:
visible:
id: “badgeStyledIcon-stepsIcon”
childOf:
id: “badgeCategory-steps”
timeout: 5000
– runFlow:
when:
platform: iOS
commands:
– extendedWaitUntil:
visible:
text: “10K steps”
childOf:
id: “badgeCategory-steps”
timeout: 5000
– runFlow:
file: checkSnapshot.yaml
env:
SUITE: “achievements”
NAME: “badgeCategory-${CATEGORY}”
CROP_ID: “badgeCategory-${CATEGORY}”
# subflows/checkSnapshot.yaml (element branch)
# record (default): takeScreenshot, runner copies PNG to snapshots/<platform>/<suite>/
# assert: compare with the reviewed reference
– runFlow:
when:
true: ${typeof SNAPSHOT_MODE !== ‘undefined’ && SNAPSHOT_MODE == ‘assert’}
commands:
– assertScreenshot:
path: {maestro.platform}/{NAME}.png
thresholdPercentage: “${typeof THRESHOLD === ‘undefined’ ? 99 : THRESHOLD}”
cropOn:
id: ${CROP_ID}
The second failure mode was timing. A Super Draw flow would intermittently fail after tapping the Past Super Draws button. The agent inserted a waitForAnimationToEnd with a 3,000 ms timeout. Three local runs all passed, but CI failed on a slower emulator.
The flow needed to wait for the Past Super Draws screen to appear, not just for the animation to finish. Replacing the wait for animation end with two extendedWaitUntil steps — one for the button to disappear and the other for the screen title to appear (the screen has no testID, and its title matches the button text) — and using 5,000 ms as the timeout solved the observed issue. The general principle is to wait for an observable app state rather than assume that animation completion is proof that the underlying transition has completed.
Maestro Code (First Version)
# superDraw/past-super-draws.yaml (fragment)
# scrollToSuperDraw(pastSuperDrawsButton) + openPastSuperDraws
– scrollUntilVisible:
element:
id: “pastSuperDrawsButton”
direction: DOWN
timeout: 20000
– tapOn:
id: “pastSuperDrawsButton”
– waitForAnimationToEnd:
timeout: 3000
– runFlow:
file: ../../subflows/checkSnapshot.yaml
env:
SUITE: “super_draw”
NAME: “past_super_draws”
Maestro Code (Fixed)
# superDraw/past-super-draws.yaml (fragment)
# scrollToSuperDraw(pastSuperDrawsButton) + openPastSuperDraws
– scrollUntilVisible:
element:
id: “pastSuperDrawsButton”
direction: DOWN
timeout: 20000
– tapOn:
id: “pastSuperDrawsButton”
# The screen has no testID, and its title has the same text as the button
# (“Past Super Draws”): wait until the button is gone and the title is shown.
– extendedWaitUntil:
notVisible:
id: “pastSuperDrawsButton”
timeout: 5000
– extendedWaitUntil:
visible:
text: “Past Super Draws”
timeout: 5000
– runFlow:
file: ../../subflows/checkSnapshot.yaml
env:
SUITE: “super_draw”
NAME: “past_super_draws”
Timeouts also need to be enforced at three levels. Individual waits should have explicit UI, network and third-party content limits and should name the state that they are waiting for. There should be a runner-level watchdog to bound each flow, take screenshots and device logs on timeout, record the result and deal with retries.
The runner itself will need an overall CI deadline and will need to report flows that couldn’t finish as skipped before it terminates the build. Maestro command-level waits on their own don’t provide the same per-test and per-run guarantees as the current setup.
Platform-specific logic is another maintenance cost. A short device.getPlatform() branch in Detox becomes a much larger set of conditional runFlow blocks in Maestro, and iOS accessibility differences can blow that out. My preference is to tag the single-platform flows, put the common platform actions (Back, sharing, relaunch, etc.) into shared subflows and pass the platform-specific values through the config. That way, differences don’t proliferate through every test, and the flows are much easier for QA engineers who don’t specialize in automation to read and contribute to.
Why a Hybrid Approach Makes Sense
I don’t plan to replace Detox all at once. The initial approach is to retain the existing quality gates and introduce Maestro for a subset of journeys that are difficult to cover with our current Detox setup, including some cross-app and native interactions. The precise limitations depend on the project and should not be mistaken for a blanket claim about Detox. This lets us compare frameworks without discarding working infrastructure. It also separates two different outcomes: Porting a test changes the framework; adding a test expands coverage.
A full replacement would have to justify its cost across the whole pipeline. Maestro flows may be compact, but the comparison must include CI startup, parallelization, retries, test selection, debugging and maintenance. My current 12-minute average PR run is a solid baseline. If a new system makes authoring easier but at the expense of slower feedback or more difficult-to-debug failures, then that trade-off has to be clear. Complex Detox scenarios may also end up being cheaper to maintain in the long run where the JS helpers provide some real value.
Evaluating Migration Quality and Cost
Migration cost has two components. The first is the one-off work of rebuilding the mocks, fixtures, permissions, the runner and the CI. Claude Code can help with the dependency inventory, porting the underlying logic and drafting the supporting scripts. Maestro MCP can then validate those mechanisms on a simulator. The engineer still owns the architecture and will review the results, since every subsequent flow will depend on it. In practice, the most demanding work has involved setting up the build and test utilities, preserving mock behavior and restoring screenshot assertions. Differences between the accessibility trees exposed by iOS and Android have added further complexity, as has replacing generic waits for the interface to settle with checks for specific, observable UI states.
The second is the cost per accepted flow in the later waves (source prep, agent execution and retries, human review, corrections and CI stabilization). Generation time on its own is not a useful metric. A fair comparison would be against manually migrated tests of a similar complexity (from simple journeys through to the more complex ones involving gestures, fixtures and conditional navigation).
Quality has its own set of metrics: Retention of original verification conditions, repeated-run stability and failure modes. Those are the criteria by which we evaluate; they are not the results that I can report at this stage. I don’t have the validated data on time saved, so any percentage claim would be premature.
The current results also show why conversion progress and execution reliability need separate denominators. The 33 migrated Detox tests count source tests converted so far; the reported Android emulator run covered 32 Maestro flows (two Detox tests were merged into a single flow), of which 12 passed (37.5%). The 12/32 result is a single execution snapshot, not a migration success rate, a time-savings estimate or evidence that the other flows cannot be made reliable.
Conclusion
The practical acceptance rule is to treat conversion, execution and fidelity as separate gates. First, inventory the original test’s assertions, helper behavior and setup. Next, compare the generated flow against that inventory, including visual checks and platform-specific conditions. Then run the flow repeatedly in the target CI environment, waiting for observable UI states rather than animation completion alone. Finally, record the time spent reviewing, repairing and stabilizing it; YAML generation time is not the full migration cost.
The current evidence supports a hybrid approach, not a full replacement decision. With 33 source tests converted and 12 of 32 flows passing in one Android emulator run, there is still work to do on reliability and verification. Keep the established Detox quality gates until migrated flows demonstrate equivalent checks, stable CI behavior and an acceptable maintenance cost.

