limrun-maestro-testing
Compare original and translation side by side
🇺🇸
Original
English🇨🇳
Translation
ChineseMaestro on Limrun iOS
在Limrun iOS上运行Maestro
Run the stock upstream Maestro CLI against a remote Limrun iOS simulator.
wires to the instance transparently: it
installs and launches the Maestro XCTest runner on the simulator when needed,
then routes the driver traffic to it. No fork of Maestro, no local simulator,
no local Xcode.
lim ios maestromaestro test直接使用官方原生Maestro CLI对接远程Limrun iOS模拟器。
会自动将与模拟器实例关联:在需要时,它会在模拟器上安装并启动Maestro XCTest runner,然后将驱动流量路由至该runner。无需fork Maestro,无需本地模拟器,也无需本地Xcode。
lim ios maestromaestro testPrerequisites
前提条件
- CLI 0.22.0 or newer:
lim. Auth isnpm install --global limorlim login(it may be set outside the project, so don't ask for it just because it's missing fromLIM_API_KEYor the shell)..env - Maestro CLI on PATH: . Maestro needs Java 17+ (
curl -fsSL https://get.maestro.mobile.dev | bashto check). Both Maestro 2.5.x and 2.6+ work;java -versionadapts to the installed version automatically.lim
The CLI is the source of truth: if a flag errors or you need one not shown
here, check instead of guessing.
lim ios <subcommand> --help- CLI 0.22.0或更高版本:执行
lim安装。认证方式为npm install --global lim或设置lim login(该密钥可在项目外配置,因此不要仅因LIM_API_KEY或Shell中未配置就索要)。.env - 系统PATH中需配置Maestro CLI:执行安装。Maestro需要Java 17+版本(可通过
curl -fsSL https://get.maestro.mobile.dev | bash检查)。Maestro 2.5.x和2.6+版本均兼容;java -version会自动适配已安装的版本。lim
CLI是权威参考:若某个标记报错或需要此处未展示的标记,请查看,不要自行猜测。
lim ios <subcommand> --helpVerify the setup
验证环境配置
Before touching the user's app, prove the whole pipeline with a flow against
the built-in Settings app; it needs no app install, tunnel, or build:
bash
ID=$(lim ios create --install-asset appstore/maestro-ios-runner-2.5.1.tar.gz \
--no-open --quiet --json | jq -r .metadata.id)
cat > hello-flow.yaml <<'EOF'
appId: com.apple.Preferences
---
- launchApp
- assertVisible: General
- takeScreenshot: settings-check
EOF
lim ios maestro --id "$ID" test hello-flow.yamlAll three steps reporting means Maestro, the runner, and the
remote wiring all work; anything failing after this point is about the app or
the flow, not the setup.
COMPLETED在操作用户的应用之前,先通过内置“设置”应用的流程验证整个链路是否正常;该流程无需安装应用、配置隧道或构建:
bash
ID=$(lim ios create --install-asset appstore/maestro-ios-runner-2.5.1.tar.gz \
--no-open --quiet --json | jq -r .metadata.id)
cat > hello-flow.yaml <<'EOF'
appId: com.apple.Preferences
---
- launchApp
- assertVisible: General
- takeScreenshot: settings-check
EOF
lim ios maestro --id "$ID" test hello-flow.yaml若三个步骤均显示,则说明Maestro、runner和远程连接均正常工作;此后出现的任何问题都与应用或流程本身有关,而非环境配置问题。
COMPLETEDRun a flow
运行流程
bash
lim ios maestro test flow.yaml
lim ios maestro test flows/
lim ios maestro --id <ios-id> test flow.yamlWithout this targets the most recently created iOS instance in the
current workspace (workspaces follow the git repo or worktree you run from);
pass (before ) in scripts, agents, or when running from
a different directory. The first run on an instance takes a few extra seconds
to launch the runner (plus the install when it wasn't preinstalled); later
runs skip that. Extra Maestro flags go after
:
--id--id <ios-id>test--bash
lim ios maestro -- test flow.yaml --include-tags smoke --test-output-dir artifactsDo not pass , , , , or
; sets those itself and rejects duplicates.
Real Maestro exit codes and reports are preserved, so CI wiring works as with
local Maestro.
--platform--device--udid--no-reinstall-driver--driver-host-portlimbash
lim ios maestro test flow.yaml
lim ios maestro test flows/
lim ios maestro --id <ios-id> test flow.yaml若未指定,则会针对当前工作区中最近创建的iOS实例(工作区与您运行命令所在的Git仓库或工作树关联);在脚本、Agent或从其他目录运行时,请在之前传入。首次在实例上运行时,需要额外几秒时间启动runner(若未预安装runner,还需额外安装时间);后续运行则会跳过该步骤。额外的Maestro标记需放在之后:
--idtest--id <ios-id>--bash
lim ios maestro -- test flow.yaml --include-tags smoke --test-output-dir artifacts请勿传入、、、或;会自行设置这些标记,且会拒绝重复传入。Maestro的真实退出码和报告将被保留,因此CI集成方式与本地Maestro完全一致。
--platform--device--udid--no-reinstall-driver--driver-host-portlimInstance setup
实例配置
Any running iOS instance works; the runner is installed on first use. Creating
the instance with the runner preinstalled skips that step:
bash
lim ios create --install-asset appstore/maestro-ios-runner-2.5.1.tar.gz --no-open--no-openInstall the app under test as usual (,
, or a build skill), then reference its bundle id via
in the flow. For Expo Go testing, also preinstall
and open the project URL with
(env vars must be prefixed to be visible in flows):
lim ios create --install app.ipalim ios install-appappId:appstore/Expo-Go-54.0.6.tar.gzopenLinkMAESTRO_bash
MAESTRO_EXPO_URL='exp://<tunnel-host>' lim ios maestro test flow.yaml任何运行中的iOS实例均可使用;runner会在首次使用时自动安装。创建实例时预安装runner可跳过安装步骤:
bash
lim ios create --install-asset appstore/maestro-ios-runner-2.5.1.tar.gz --no-open--no-open按照常规方式安装待测试应用(、或使用构建skill),然后在流程中通过引用其Bundle ID。若要测试Expo Go,还需预安装,并使用打开项目URL(环境变量必须以为前缀才能在流程中可见):
lim ios create --install app.ipalim ios install-appappId:appstore/Expo-Go-54.0.6.tar.gzopenLinkMAESTRO_bash
MAESTRO_EXPO_URL='exp://<tunnel-host>' lim ios maestro test flow.yamlExpo dev-client builds
Expo开发客户端构建
Expo Go is the quickest path, but a dev-client build works too.
lands on the dev launcher rather than your app, so open the dev-client URL
instead: followed by
.
Use for building the dev client, starting Metro, and
deriving that URL.
launchApp- stopApp- openLink: <scheme>://expo-development-client/?url=<url-encoded-metro-url>limrun-expo-developmentExpo Go是最快的测试路径,但开发客户端构建也可正常使用。会直接进入开发启动器而非您的应用,因此需改为打开开发客户端URL:先执行,再执行。可使用构建开发客户端、启动Metro并生成该URL。
launchApp- stopApp- openLink: <scheme>://expo-development-client/?url=<url-encoded-metro-url>limrun-expo-developmentFlow gotchas on Limrun
Limrun上的流程注意事项
- /
startRecordingYAML commands are not supported (the simulator is remote). Record around the run instead:stopRecordingreturns immediately (recording happens on the instance), and after the flowlim ios record start --id <ios-id>downloads the video to the local path.lim ios record stop --id <ios-id> -o video.mp4 - works and saves the PNG locally into the working directory (or
takeScreenshot), like stock Maestro.--test-output-dir - and flow commands that reference local simulator file paths are not supported.
addMedia - HTTP calls from /
runScriptmust useevalScriptURLs. Plainhttps://calls are refused (except to the driver itself), because Maestro's plain-HTTP traffic is routed through a local bridge that only forwards to the remote simulator.http:// - When a flow re-runs against an app that is already open (for example Expo
Go), start it with before
- stopApp/openLink; deep links can be dropped by an app that is mid-foreground, and stale screens fail early assertions.launchApp - Fleet variance: anchor assertions on stable accessibility identifiers and
text, not on timing. Use with a generous timeout for first app load.
extendedWaitUntil - Text selectors match the element's accessibility label, and on iOS a label
often folds in sibling content (icon names, adjacent text) or non-breaking
spaces. Read the exact label with before writing the selector instead of guessing from what the screen shows.
lim ios element-tree
- 不支持/
startRecordingYAML命令(因为模拟器是远程的)。可在运行流程前后进行录制:stopRecording会立即返回(录制在实例上进行),流程结束后执行lim ios record start --id <ios-id>即可将视频下载到本地路径。lim ios record stop --id <ios-id> -o video.mp4 - 功能正常,会将PNG图片保存到本地工作目录(或
takeScreenshot指定的目录),与原生Maestro一致。--test-output-dir - 不支持及引用本地模拟器文件路径的流程命令。
addMedia - /
runScript中的HTTP调用必须使用evalScriptURL。纯https://调用会被拒绝(除了对驱动本身的调用),因为Maestro的纯HTTP流量会通过本地桥接路由,而该桥接仅转发至远程模拟器。http:// - 当流程针对已打开的应用(例如Expo Go)重新运行时,需在/
openLink之前先执行launchApp;处于前台的应用可能会丢弃深度链接,且陈旧的界面会导致早期断言失败。- stopApp - 设备差异:断言需基于稳定的可访问性标识符和文本,而非时间。首次加载应用时,使用并设置充足的超时时间。
extendedWaitUntil - 文本选择器匹配元素的可访问性标签,而在iOS上,标签通常会包含兄弟内容(图标名称、相邻文本)或不间断空格。编写选择器前,请使用查看确切的标签,不要仅凭屏幕显示内容猜测。
lim ios element-tree
Validation signals
验证信号
- then
Running maestro <version> against <ios-id>...: the driver is connected end to end.Running on Limrun iPhone - iOS ... - : first use on this instance.
Launching the Maestro runner...additionally appears only when the instance was created without the runner asset. Subsequent runs skip both.Installing the Maestro runner... - Maestro itself prints several JDK lines (reflection, native access) on every run; they are benign upstream noise, not Limrun errors.
WARNING - Flow failures print Maestro's own debug output directory with screenshots
and the UI hierarchy; shows the live screen when debugging selectors.
lim ios element-tree --id <ios-id>
- 显示,随后显示
Running maestro <version> against <ios-id>...:说明驱动已完成端到端连接。Running on Limrun iPhone - iOS ... - 显示:这是该实例的首次使用。若实例创建时未预安装runner资产,还会额外显示
Launching the Maestro runner...。后续运行会跳过这两步。Installing the Maestro runner... - Maestro每次运行时都会打印多条JDK警告信息(反射、原生访问);这些是上游的良性输出,并非Limrun的错误。
- 流程失败时,Maestro会打印自身的调试输出目录,其中包含截图和UI层级;调试选择器时,可显示当前屏幕的实时内容。
lim ios element-tree --id <ios-id>
Cleanup
清理
Delete the instance when done: ( is not valid
for delete). The wiring starts is torn down when the command
exits.
lim ios delete <ios-id>--idlim ios maestro使用完毕后删除实例:(命令不支持标记)。启动的连接会在命令退出时自动断开。
lim ios delete <ios-id>delete--idlim ios maestro