extends SceneTree func _initialize() -> void: call_deferred("_run") func _find_by_text(node: Node, expected: String) -> Control: if node is Label and node.text == expected: return node if node is Button and node.text == expected: return node for child in node.get_children(): var found := _find_by_text(child, expected) if found != null: return found return null func _run() -> void: await process_frame var app := root.get_node_or_null("App") if app == null: printerr("TEST_FAIL autoload App missing") quit(1) return var half_label := _find_by_text(app, "Parte: 1") var actions_label := _find_by_text(app, "Acciones: 10") var pass_button := _find_by_text(app, "Pase (1)") as Button var shoot_button := _find_by_text(app, "Tiro (3)") as Button if half_label == null or actions_label == null or pass_button == null or shoot_button == null: printerr("TEST_FAIL initial UI state incomplete") quit(2) return if pass_button.disabled or not shoot_button.disabled: printerr("TEST_FAIL initial action availability incorrect") quit(3) return pass_button.pressed.emit() await process_frame if _find_by_text(app, "Acciones: 9") == null: printerr("TEST_FAIL pass did not consume one action") quit(4) return print("TEST_PASS initial_state_and_pass_action") quit(0)