brad-did-something / tests /probe_sprites.py
qFelix's picture
Brad Did Something - Gradio/FastAPI Space on HF
78c0f6e
Raw
History Blame Contribute Delete
892 Bytes
"""Zoomed screenshot of the office cast to eyeball the per-NPC floor faces +
walk wiring. Server must be running. Usage: python tests/probe_sprites.py [url]
"""
import sys
import time
from playwright.sync_api import sync_playwright
BASE = sys.argv[1] if len(sys.argv) > 1 else "http://localhost:7871"
with sync_playwright() as pw:
b = pw.chromium.launch()
pg = b.new_page(viewport={"width": 1100, "height": 850})
pg.goto(f"{BASE}/game", wait_until="networkidle")
pg.click("#btn-start")
pg.wait_for_selector("#hud", state="visible", timeout=5000)
time.sleep(1.0)
# nudge the player so it's mid-stride for the shot
for _ in range(8):
pg.keyboard.down("d"); time.sleep(0.03); pg.keyboard.up("d")
time.sleep(0.2)
pg.locator("#stage").screenshot(path="tests/shots/sprites_zoom.png")
print("saved tests/shots/sprites_zoom.png")
b.close()