feat(gui): Add auto-scroll, blinking history, and reactive API events
This commit is contained in:
@@ -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
|
||||
|
||||
29
tests/temp_liveaisettingssim.toml
Normal file
29
tests/temp_liveaisettingssim.toml
Normal file
@@ -0,0 +1,29 @@
|
||||
[project]
|
||||
name = "temp_liveaisettingssim"
|
||||
git_dir = "C:\\projects\\manual_slop"
|
||||
system_prompt = ""
|
||||
main_context = ""
|
||||
word_wrap = true
|
||||
summary_only = false
|
||||
auto_scroll_comms = true
|
||||
auto_scroll_tool_calls = true
|
||||
|
||||
[output]
|
||||
output_dir = "./md_gen"
|
||||
|
||||
[files]
|
||||
base_dir = "."
|
||||
paths = []
|
||||
|
||||
[screenshots]
|
||||
base_dir = "."
|
||||
paths = []
|
||||
|
||||
[agent.tools]
|
||||
run_powershell = true
|
||||
read_file = true
|
||||
list_directory = true
|
||||
search_files = true
|
||||
get_file_summary = true
|
||||
web_search = true
|
||||
fetch_url = true
|
||||
13
tests/temp_liveaisettingssim_history.toml
Normal file
13
tests/temp_liveaisettingssim_history.toml
Normal file
@@ -0,0 +1,13 @@
|
||||
roles = [
|
||||
"User",
|
||||
"AI",
|
||||
"Vendor API",
|
||||
"System",
|
||||
]
|
||||
active = "main"
|
||||
auto_add = true
|
||||
|
||||
[discussions.main]
|
||||
git_commit = ""
|
||||
last_updated = "2026-02-25T00:40:10"
|
||||
history = []
|
||||
29
tests/temp_livecontextsim.toml
Normal file
29
tests/temp_livecontextsim.toml
Normal file
@@ -0,0 +1,29 @@
|
||||
[project]
|
||||
name = "temp_livecontextsim"
|
||||
git_dir = "C:\\projects\\manual_slop"
|
||||
system_prompt = ""
|
||||
main_context = ""
|
||||
word_wrap = true
|
||||
summary_only = false
|
||||
auto_scroll_comms = true
|
||||
auto_scroll_tool_calls = true
|
||||
|
||||
[output]
|
||||
output_dir = "./md_gen"
|
||||
|
||||
[files]
|
||||
base_dir = "."
|
||||
paths = []
|
||||
|
||||
[screenshots]
|
||||
base_dir = "."
|
||||
paths = []
|
||||
|
||||
[agent.tools]
|
||||
run_powershell = true
|
||||
read_file = true
|
||||
list_directory = true
|
||||
search_files = true
|
||||
get_file_summary = true
|
||||
web_search = true
|
||||
fetch_url = true
|
||||
14
tests/temp_livecontextsim_history.toml
Normal file
14
tests/temp_livecontextsim_history.toml
Normal file
@@ -0,0 +1,14 @@
|
||||
roles = [
|
||||
"User",
|
||||
"AI",
|
||||
"Vendor API",
|
||||
"System",
|
||||
]
|
||||
history = []
|
||||
active = "TestDisc_1771997990"
|
||||
auto_add = true
|
||||
|
||||
[discussions.TestDisc_1771997990]
|
||||
git_commit = ""
|
||||
last_updated = "2026-02-25T00:40:04"
|
||||
history = []
|
||||
29
tests/temp_liveexecutionsim.toml
Normal file
29
tests/temp_liveexecutionsim.toml
Normal file
@@ -0,0 +1,29 @@
|
||||
[project]
|
||||
name = "temp_liveexecutionsim"
|
||||
git_dir = "C:\\projects\\manual_slop"
|
||||
system_prompt = ""
|
||||
main_context = ""
|
||||
word_wrap = true
|
||||
summary_only = false
|
||||
auto_scroll_comms = true
|
||||
auto_scroll_tool_calls = true
|
||||
|
||||
[output]
|
||||
output_dir = "./md_gen"
|
||||
|
||||
[files]
|
||||
base_dir = "."
|
||||
paths = []
|
||||
|
||||
[screenshots]
|
||||
base_dir = "."
|
||||
paths = []
|
||||
|
||||
[agent.tools]
|
||||
run_powershell = true
|
||||
read_file = true
|
||||
list_directory = true
|
||||
search_files = true
|
||||
get_file_summary = true
|
||||
web_search = true
|
||||
fetch_url = true
|
||||
15
tests/temp_liveexecutionsim_history.toml
Normal file
15
tests/temp_liveexecutionsim_history.toml
Normal file
@@ -0,0 +1,15 @@
|
||||
roles = [
|
||||
"User",
|
||||
"AI",
|
||||
"Vendor API",
|
||||
"System",
|
||||
]
|
||||
active = "main"
|
||||
auto_add = true
|
||||
|
||||
[discussions.main]
|
||||
git_commit = ""
|
||||
last_updated = "2026-02-25T00:40:46"
|
||||
history = [
|
||||
"@2026-02-25T00:40:30\nUser:\nCreate a hello.ps1 script that prints 'Simulation Test' and execute it.",
|
||||
]
|
||||
29
tests/temp_livetoolssim.toml
Normal file
29
tests/temp_livetoolssim.toml
Normal file
@@ -0,0 +1,29 @@
|
||||
[project]
|
||||
name = "temp_livetoolssim"
|
||||
git_dir = "C:\\projects\\manual_slop"
|
||||
system_prompt = ""
|
||||
main_context = ""
|
||||
word_wrap = true
|
||||
summary_only = false
|
||||
auto_scroll_comms = true
|
||||
auto_scroll_tool_calls = true
|
||||
|
||||
[output]
|
||||
output_dir = "./md_gen"
|
||||
|
||||
[files]
|
||||
base_dir = "."
|
||||
paths = []
|
||||
|
||||
[screenshots]
|
||||
base_dir = "."
|
||||
paths = []
|
||||
|
||||
[agent.tools]
|
||||
run_powershell = true
|
||||
read_file = true
|
||||
list_directory = true
|
||||
search_files = true
|
||||
get_file_summary = true
|
||||
web_search = true
|
||||
fetch_url = true
|
||||
13
tests/temp_livetoolssim_history.toml
Normal file
13
tests/temp_livetoolssim_history.toml
Normal file
@@ -0,0 +1,13 @@
|
||||
roles = [
|
||||
"User",
|
||||
"AI",
|
||||
"Vendor API",
|
||||
"System",
|
||||
]
|
||||
active = "main"
|
||||
auto_add = true
|
||||
|
||||
[discussions.main]
|
||||
git_commit = ""
|
||||
last_updated = "2026-02-25T00:40:27"
|
||||
history = []
|
||||
@@ -9,5 +9,5 @@ auto_add = true
|
||||
|
||||
[discussions.main]
|
||||
git_commit = ""
|
||||
last_updated = "2026-02-24T22:36:27"
|
||||
last_updated = "2026-02-25T00:02:11"
|
||||
history = []
|
||||
|
||||
57
tests/test_extended_sims.py
Normal file
57
tests/test_extended_sims.py
Normal file
@@ -0,0 +1,57 @@
|
||||
import pytest
|
||||
import time
|
||||
import sys
|
||||
import os
|
||||
|
||||
# Ensure project root is in path
|
||||
sys.path.append(os.path.abspath(os.path.join(os.path.dirname(__file__), "..")))
|
||||
|
||||
from api_hook_client import ApiHookClient
|
||||
from simulation.sim_context import ContextSimulation
|
||||
from simulation.sim_ai_settings import AISettingsSimulation
|
||||
from simulation.sim_tools import ToolsSimulation
|
||||
from simulation.sim_execution import ExecutionSimulation
|
||||
|
||||
@pytest.mark.integration
|
||||
def test_context_sim_live(live_gui):
|
||||
"""Run the Context & Chat simulation against a live GUI."""
|
||||
client = ApiHookClient()
|
||||
assert client.wait_for_server(timeout=10)
|
||||
|
||||
sim = ContextSimulation(client)
|
||||
sim.setup("LiveContextSim")
|
||||
sim.run()
|
||||
sim.teardown()
|
||||
|
||||
@pytest.mark.integration
|
||||
def test_ai_settings_sim_live(live_gui):
|
||||
"""Run the AI Settings simulation against a live GUI."""
|
||||
client = ApiHookClient()
|
||||
assert client.wait_for_server(timeout=10)
|
||||
|
||||
sim = AISettingsSimulation(client)
|
||||
sim.setup("LiveAISettingsSim")
|
||||
sim.run()
|
||||
sim.teardown()
|
||||
|
||||
@pytest.mark.integration
|
||||
def test_tools_sim_live(live_gui):
|
||||
"""Run the Tools & Search simulation against a live GUI."""
|
||||
client = ApiHookClient()
|
||||
assert client.wait_for_server(timeout=10)
|
||||
|
||||
sim = ToolsSimulation(client)
|
||||
sim.setup("LiveToolsSim")
|
||||
sim.run()
|
||||
sim.teardown()
|
||||
|
||||
@pytest.mark.integration
|
||||
def test_execution_sim_live(live_gui):
|
||||
"""Run the Execution & Modals simulation against a live GUI."""
|
||||
client = ApiHookClient()
|
||||
assert client.wait_for_server(timeout=10)
|
||||
|
||||
sim = ExecutionSimulation(client)
|
||||
sim.setup("LiveExecutionSim")
|
||||
sim.run()
|
||||
sim.teardown()
|
||||
@@ -14,7 +14,7 @@ def test_ai_settings_simulation_run():
|
||||
|
||||
mock_client.get_value.side_effect = lambda key: {
|
||||
"current_provider": "gemini",
|
||||
"current_model": "gemini-2.0-flash"
|
||||
"current_model": "gemini-2.5-flash-lite"
|
||||
}.get(key)
|
||||
|
||||
with patch('simulation.sim_base.WorkflowSimulator') as mock_sim_class:
|
||||
@@ -25,7 +25,7 @@ def test_ai_settings_simulation_run():
|
||||
|
||||
# Override the side effect after initial setup if needed or just let it return the same for simplicity
|
||||
# Actually, let's use a side effect that updates
|
||||
vals = {"current_provider": "gemini", "current_model": "gemini-2.0-flash"}
|
||||
vals = {"current_provider": "gemini", "current_model": "gemini-2.5-flash-lite"}
|
||||
def side_effect(key):
|
||||
return vals.get(key)
|
||||
def set_side_effect(key, val):
|
||||
|
||||
Reference in New Issue
Block a user