Repository navigation
Conversation
spydon
added this pull request to stack #4135
October 24, 2026 09:30
spydon
removed this pull request from stack #4135
October 24, 2026 10:30
spydon
added this pull request to stack #4140
October 24, 2026 10:30
This branch has not been deployed
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Description
Adds a
flame waitcommand toflame_clithat blocks until a condition holds in the running game, or until a timeout is reached, so that scripts and AI agents don't need sleep loops and guessed timings. For example, tap a button and then wait until the game over overlay is shown:flame input tap 400,300 flame wait overlay GameOverThe conditions are subcommands, like
overlay showandinput tap:wait component <type pattern>: a component whose type matches the regular expression exists, matched case insensitively liketree --filter.--idmatches a single component,--countwaits for an exact number of matches,--at-leastfor a minimum number, and--goneuntil nothing matches, which covers waiting until a component is removed (flame wait component --id 123 --gone).--where "position.x > 100"compares a numeric attribute from the same data thattreeandinspectreturn (position.x,position.y,size.x,size.y,scale.x,scale.y,angleandpriority), and can be given several times.wait overlay <name>: the overlay is shown, or hidden with--hidden. An unregistered overlay fails right away with65.wait pausedandwait resumed: the game loop is paused or running.All of them take
--timeout(10 seconds by default,0checks once and works as an assertion),--interval(0.2 seconds by default) and--json. When the condition holds, the command prints what matched, for example the matching components with their ids and attributes, and exits with0. When the timeout is reached first it says what it found instead, for exampleTimed out after 10 seconds waiting for a component with a type matching enemy, found 0., and exits with75(ExitCode.tempFail), which is added to the documented exit codes. A game that doesn't answer a check in time, for example because it is stopped at a breakpoint, also fails with75instead of blocking the command past its timeout.The command polls the existing
getComponentTree,getOverlaysandgetPausedservice extensions over one connection, so nothing changes on the game side. The clock is injectable through aWaitClockpassed toFlameCommandRunner, so the tests are fast and deterministic.To support this:
FlameCommandtakes an optionalconnect, and the runner passes its connector to the wait command, so that commands talking to a game can be tested with a fake connection.FlameConnection.callnow reports a closed connection, which is what happens when the game stops while a command is waiting, asThe game is no longer runningwith exit code69, instead of the generic70error.FlameConnection.withServicecreates a connection from an existingVmService, which the tests use.findComponentNodesincomponent_tree.dartreturns the matching nodes of the tree.The command is documented in the CLI docs and the readme.
Checklist
docsand added dartdoc comments with///.examplesordocs.Breaking Change?
Related Issues
Part of #4131