Add end-to-end interaction flow smoke
- Boot the real scene and verify inspection allow/deny, normal vs emergency radio, Help filtering, wand allow/deny and review return-to-menu. - Document the flow coverage and smoke command; mark the 0.9.3 end-to-end audit complete.
This commit is contained in:
1 parent
7315166361
commit
e805a91ad3
6 files changed
+158
-3
No files matched your search
@@ -0,0 +1,131 @@
|
||||
extends SceneTree
|
||||
## End-to-end interaction flows: inspection allow/deny, normal radio vs
|
||||
## emergency hold, Help filtering, wand allow/deny and review return-to-menu.
|
||||
##
|
||||
## Usage:
|
||||
## godot --headless --path . --script res://src/test/smoke_ui_flows.gd
|
||||
## Exit code 0 = pass, 1 = failure.
|
||||
|
||||
const MAX_FRAMES := 1800
|
||||
|
||||
var frame := 0
|
||||
var gm: Node = null
|
||||
var started := false
|
||||
var step := 0
|
||||
var failures: Array[String] = []
|
||||
|
||||
func _initialize() -> void:
|
||||
root.size = Vector2i(1280, 720)
|
||||
root.add_child(load("res://scenes/main.tscn").instantiate())
|
||||
|
||||
func _process(_delta: float) -> bool:
|
||||
frame += 1
|
||||
if gm == null:
|
||||
gm = root.find_child("GameManager", true, false)
|
||||
return false
|
||||
if not started:
|
||||
gm.call("_on_venue_selected", "hollywood_building")
|
||||
started = true
|
||||
return false
|
||||
if frame > MAX_FRAMES:
|
||||
_fail("timeout")
|
||||
return true
|
||||
if frame < 200:
|
||||
return false
|
||||
match step:
|
||||
0:
|
||||
if gm.npcs.is_empty():
|
||||
return false
|
||||
var npc: Node = gm.npcs[0]
|
||||
gm.call("_on_guard_target", npc)
|
||||
gm.call("_toggle_inspection")
|
||||
_check(gm.inspection_open and gm.hud.inspect_panel.visible, "inspection opens")
|
||||
gm.decide_access(true)
|
||||
_check(not gm.inspection_open and not gm.hud.inspect_panel.visible,
|
||||
"inspection allow closes the panel")
|
||||
gm.call("_toggle_inspection")
|
||||
gm.decide_access(false)
|
||||
_check(not gm.inspection_open, "inspection deny closes the panel")
|
||||
|
||||
var battery_before: float = gm.coordinator.radio.battery
|
||||
gm.call("_open_radio", false)
|
||||
_check(gm.radio_panel.visible, "normal radio form opens")
|
||||
gm.radio_panel.action_button.pressed.emit()
|
||||
_check(not gm.radio_panel.visible and gm.coordinator.radio.battery < battery_before,
|
||||
"normal radio sends and spends battery")
|
||||
battery_before = gm.coordinator.radio.battery
|
||||
gm.call("_open_radio", true)
|
||||
_check(gm.radio_panel.visible, "emergency radio form opens")
|
||||
gm.radio_panel.action_button.button_down.emit()
|
||||
gm.radio_panel._process(1.7)
|
||||
_check(not gm.radio_panel.visible
|
||||
and gm.coordinator.radio.battery < battery_before
|
||||
and gm.coordinator.radio.emergency_cooldown_remaining > 0.0,
|
||||
"emergency hold sends once and starts cooldown")
|
||||
|
||||
gm.call("_open_help")
|
||||
_check(gm.help_overlay.visible, "Help opens")
|
||||
gm.help_overlay._refresh("radio")
|
||||
var help_text: String = gm.help_overlay._body.text
|
||||
_check(help_text.to_lower().contains("radio")
|
||||
and not help_text.contains("Movement:"),
|
||||
"Help search filters to radio controls")
|
||||
gm.help_overlay.close_panel()
|
||||
_check(not gm.help_overlay.visible, "Help closes")
|
||||
step = 1
|
||||
frame = 0
|
||||
1:
|
||||
gm.switch_scenario("joke_shop")
|
||||
step = 2
|
||||
frame = 0
|
||||
2:
|
||||
if frame < 200:
|
||||
return false
|
||||
var wand_target: Node = null
|
||||
for node in gm.npcs:
|
||||
var c: Object = node.get_npc_controller() if node.has_method("get_npc_controller") else null
|
||||
if c != null and not c.refuses_screening:
|
||||
wand_target = node
|
||||
break
|
||||
if wand_target == null:
|
||||
return false
|
||||
gm.call("_on_guard_target", wand_target)
|
||||
gm.call("_toggle_wand_screening")
|
||||
_check(gm.wand_open and gm.hud.wand_panel.visible, "wand opens for a guest")
|
||||
gm.decide_wand(true)
|
||||
_check(not gm.wand_open and not gm.hud.wand_panel.visible,
|
||||
"wand allow closes the panel")
|
||||
gm._wand_cooldown = 0.0
|
||||
gm.call("_toggle_wand_screening")
|
||||
gm.decide_wand(false)
|
||||
_check(not gm.wand_open and not gm.hud.wand_panel.visible,
|
||||
"wand deny closes the panel")
|
||||
var review: Dictionary = gm.coordinator.build_review()
|
||||
gm.shift_review_panel.show_review(review, gm.selected_scenario, [],
|
||||
{"complete": false, "next_venue": "tv_studio", "shift_number": 2})
|
||||
_check(gm.shift_review_panel.visible, "review opens")
|
||||
gm.call("_on_review_restart")
|
||||
_check(not gm.shift_review_panel.visible and gm.start_menu.visible,
|
||||
"review return-to-menu restores the venue menu")
|
||||
_finish()
|
||||
return true
|
||||
return false
|
||||
|
||||
func _check(condition: bool, message: String) -> void:
|
||||
if condition:
|
||||
print("ok: " + message)
|
||||
else:
|
||||
_fail(message)
|
||||
|
||||
func _fail(message: String) -> void:
|
||||
failures.append(message)
|
||||
_finish()
|
||||
|
||||
func _finish() -> void:
|
||||
if failures.is_empty():
|
||||
print("SMOKE OK: inspection, radio, Help, wand and review flows")
|
||||
quit(0)
|
||||
else:
|
||||
for message in failures:
|
||||
printerr("SMOKE FAIL: " + message)
|
||||
quit(1)
|
||||
Reference in new issue
Block a user