feat(gui): Add auto-scroll, blinking history, and reactive API events

This commit is contained in:
2026-02-25 00:41:45 -05:00
parent 3113e3c103
commit fb80ce8c5a
24 changed files with 575 additions and 172 deletions

View File

@@ -31,27 +31,26 @@ def kill_process_tree(pid):
except Exception as e:
print(f"[Fixture] Error killing process tree {pid}: {e}")
@pytest.fixture(scope="session", params=["gui_legacy.py", "gui_2.py"])
def live_gui(request):
@pytest.fixture(scope="session")
def live_gui():
"""
Session-scoped fixture that starts a GUI script with --enable-test-hooks.
Parameterized to run either gui.py or gui_2.py.
Session-scoped fixture that starts gui_2.py with --enable-test-hooks.
"""
gui_script = request.param
gui_script = "gui_2.py"
print(f"\n[Fixture] Starting {gui_script} --enable-test-hooks...")
os.makedirs("logs", exist_ok=True)
log_file = open(f"logs/{gui_script.replace('.', '_')}_test.log", "w", encoding="utf-8")
process = subprocess.Popen(
["uv", "run", "python", gui_script, "--enable-test-hooks"],
["uv", "run", "python", "-u", gui_script, "--enable-test-hooks"],
stdout=log_file,
stderr=log_file,
text=True,
creationflags=subprocess.CREATE_NEW_PROCESS_GROUP if os.name == 'nt' else 0
)
max_retries = 10 # Increased for potentially slower startup of gui_2
max_retries = 10 # Reduced as recommended
ready = False
print(f"[Fixture] Waiting up to {max_retries}s for Hook Server on port 8999...")
@@ -74,7 +73,6 @@ def live_gui(request):
kill_process_tree(process.pid)
pytest.fail(f"Failed to start {gui_script} with test hooks.")
client = ApiHookClient() # Initialize client here
try:
yield process, gui_script
finally:
@@ -82,19 +80,7 @@ def live_gui(request):
# Reset the GUI state before shutting down
try:
client.reset_session()
time.sleep(1) # Give GUI time to process reset
except Exception as e:
print(f"[Fixture] Error resetting GUI session: {e}")
time.sleep(0.5)
except: pass
kill_process_tree(process.pid)
log_file.close()
@pytest.fixture(scope="session")
def live_gui_2(live_gui):
"""
A specific instance of the live_gui fixture that only runs for gui_2.py.
This simplifies tests that are specific to gui_2.py.
"""
process, gui_script = live_gui
if gui_script != "gui_2.py":
pytest.skip("This test is only for gui_2.py")
return process