Chessistics/tools/automation/test_collision.py

36 lines
1.1 KiB
Python
Raw Normal View History

"""Smoke test for collision camera pan + notification toast."""
import sys, time
from pathlib import Path
sys.path.insert(0, str(Path(__file__).resolve().parents[2]))
from tools.automation.harness import Harness
def main():
with Harness.launch(run_name="collision") as h:
h.load_mission("campaign_01", 0)
# Two Pawns that will collide on (1,0) at turn 1 — mutual destruction
h.place("Pawn", (0, 0), (1, 0))
h.place("Pawn", (2, 0), (1, 0))
h.screenshot("01_before_collision")
h.set_speed(0.2)
h.play()
time.sleep(1.5)
h.screenshot("02_during_pan_zoom")
time.sleep(1.0)
h.screenshot("03_toast_visible")
s = h.state()
print(f"[after] phase={s['phase']} pieces={len(s['pieces'])} stock={s['remainingStock']}")
assert s['phase'] == 'Paused', f"Expected auto-pause after collision, got {s['phase']}"
assert len(s['pieces']) == 0, "Both pawns should have been returned to stock"
print("OK — collision auto-pause, pieces returned to stock")
if __name__ == "__main__":
main()