Merge pull request #1100 from ludovic111/fix/agent-e2e-wait-loaded

🤖 Agent: merged. Test-only fix (agent_control_e2e waits for the world to load); verify and CI parity pass.
This commit is contained in:
Ludovic Marie
2026-10-21 22:02:46 +02:00
committed by GitHub
+27 -9
View File
@@ -187,26 +187,44 @@ def scenario(d, out):
d('click_button', label='Create New World')
d('type', field='name', replace=True, text='Agent World')
d('type', field='seed', text='5') # spawn near a walkable oak
created = d('click_button', label='Create New World')
assert created['screen'] == 'playing', created
d('click_button', label='Create New World')
# The world opens a few frames later: in the frame it is prepared off the UI thread behind the
# title screen (world_loading.rs), on the server thread once the server has it.
d('wait_for', condition='loaded', timeout=400)
d('wait_ready', seconds=400)
state = d('state')
assert state['gamemode'] == 'survival' and state['player']['health'] > 0, state
d('command', command='time set day')
# The spawn is random within the spawn radius, on the first full top face below the
# MOTION_BLOCKING height (PlayerSpawnFinder.getLevelRespawnPos): a tree's leaves too, too high
# for goto's drops.
x, y, z = state['player']['block_pos']
ground = y - 1
while ground > y - 16 and d('block', x=x, y=ground, z=z)['block'].endswith(('_leaves', 'air')):
ground -= 1
if ground < y - 1:
d('command', command=f'tp @s {x + 0.5} {ground + 1} {z + 0.5}')
d('wait', ticks=5)
# 2. Walk to a tree: the nearest trunk the path finder can reach.
# 2. Walk to a tree, the nearest trunk the path finder can reach, and 3. break the log at the
# bottom of the trunk (it must end up in the inventory). Low leaves can hide every face of that
# log from where the walk stops: then the next tree.
for _, base, log_id in trunk_bases(d)[:8]:
x, y, z = base
try:
d('goto', x=x + 0.5, y=y, z=z + 0.5, near=2.5, timeout=60)
break
except Failed as e:
print(f' cannot reach {log_id} at {base}: {e}')
continue
try:
broke = d('break', x=x, y=y, z=z)
break
except Failed as e:
if 'no face' not in str(e):
raise
print(f' {log_id} at {base} is hidden: {e}')
else:
raise Failed('no reachable tree near spawn')
# 3. Break the log at the bottom of the trunk; it must end up in the inventory.
broke = d('break', x=x, y=y, z=z)
assert broke['block_before'].startswith(log_id), broke
assert broke['drops'].get(log_id, 0) >= 1, broke
if broke['picked_up'].get(log_id, 0) < 1:
@@ -276,8 +294,8 @@ def ui_scenario(d, out):
tree = widgets(d)
assert tree['game']['kind'] == 'button' and any(w['kind'] == 'field' for w in tree.values()), tree
d('type', field='name', replace=True, text='UI World')
created = d('click', id='create-new-world')
assert created['screen'] == 'playing', created
d('click', id='create-new-world')
d('wait_for', condition='loaded', timeout=400) # a few frames later, as in the survival scenario
d('wait_ready', seconds=400)
# 2. Options from the pause menu: a slider set by id moves its value and label.