Feat/maestro repeat while
Merged
AH
2mo ago+842+842+012345678901234567890123456789-109-109-012345678901234567890123456789
Summary
Maestro flows that used repeat.while were rejected with "repeat.while is not supported; use repeat.times". This adds support that follows the Maestro repeat reference:
- repeat:
while:
notVisible: "ValueX"
commands:
- tapOn: Button
- evalScript: ${output.counter = 0}
- repeat:
times: 4 # optional upper bound
while:
true: ${output.counter < 3}
commands:
- evalScript: ${output.counter++}
- Parser:
repeatnow needstimes,while, or both.whileacceptsplatform,visible,notVisible, andtrue. - Execution: the condition is checked before each iteration. The loop stops when the condition is false or when
timesis reached, whichever comes first.- Visibility checks use the same lookup timeout as
runFlow.when. trueexpressions run JavaScript through the same evaluator asevalScript. Results count as false using the same rule asassertTrue. So"false","0","","null", and"undefined"from string output values are false.- Changes the expression makes to
output.*carry into later steps.
- Visibility checks use the same lookup timeout as
- Security:
while.trueis refused for flows received over the remote daemon connection, the same asevalScript. - Conformance and docs: added an authored
repeat-whileflow and regenerated the layer-1 fixtures. Updated the support matrix andreplay-e2e.md.
19 files changed. No scope expansion.
Test plan
- Ran
pnpm check:affected --runone4dc41a24and it passed.- The first run had two unrelated timeouts (
interaction-response-shape,apple-platform-output-guard). Both passed when run alone and on the rerun.
- The first run had two unrelated timeouts (
- New unit tests cover:
- parsing, including the errors for a missing or empty
while - a JavaScript loop
- a visibility loop
- stopping at the
timesbound - refusal for untrusted remote flows
- true/false handling of script results
- parsing, including the errors for a missing or empty
pnpm maestro:conformancepasses.- Not tested on a device yet. To check manually, run the YAML above with
agent-device replayon an iOS simulator or Android emulator.