test(m79-d): poll for risk options instead of failing a still-populating board

This commit is contained in:
2026-09-15 10:21:29 +08:00
parent 5f9723d2db
commit c7abcb972e
+19 -9
View File
@@ -162,18 +162,28 @@ func _press_first_risk_option(label: String) -> void:
var list := shell.find_child("RiskOptionList", true, false) as Control
var control: Control = null
var used := ""
var parents: Array = [list] if list != null else [shell]
for parent in parents:
if parent == null:
continue
for child in parent.find_children("RiskOption*", "BaseButton", true, false):
var button := child as BaseButton
if button != null and button.is_visible_in_tree() and not button.disabled:
control = button
used = String(button.name)
# The risk board populates its options asynchronously after the screen
# transition; under a loaded suite run the first frame can still show an
# empty list, so poll briefly instead of failing a healthy board.
for _attempt in 30:
control = null
var parents: Array = [list] if list != null else [shell]
for parent in parents:
if parent == null:
continue
for child in parent.find_children("RiskOption*", "BaseButton", true, false):
var button := child as BaseButton
if button != null and button.is_visible_in_tree() and not button.disabled:
control = button
used = String(button.name)
break
if control != null:
break
if control != null:
break
if list == null:
list = shell.find_child("RiskOptionList", true, false) as Control
await _frames(6)
if control == null:
await _step(label, "a selectable risk option", shell.current_screen, "blocked", "no enabled RiskOption node")
_finish(1)