refactor(phase5): Comprehensive stabilisation pass. De-duplicated App/Controller state, hardened session reset, and updated integration tests with deterministic polling.

This commit is contained in:
2026-05-09 16:55:45 -04:00
parent d1cc019640
commit b958fa2819
16 changed files with 351 additions and 383 deletions
+14 -4
View File
@@ -8,6 +8,9 @@ def test_text_viewer_state_update(live_gui) -> None:
Verifies that we can set text viewer state and it is reflected in GUI state.
"""
client = ApiHookClient()
client.click("btn_reset")
time.sleep(2)
label = "Test Viewer Label"
content = "This is test content for the viewer."
text_type = "markdown"
@@ -16,10 +19,17 @@ def test_text_viewer_state_update(live_gui) -> None:
client.push_event("custom_callback", {"callback": "_set_attr", "args": ["text_viewer_title", label]})
client.push_event("custom_callback", {"callback": "_set_attr", "args": ["text_viewer_content", content]})
client.push_event("custom_callback", {"callback": "_set_attr", "args": ["text_viewer_type", text_type]})
time.sleep(0.5)
state = client.get_gui_state()
# Poll for state change (up to 5s)
state = None
start_time = time.time()
while time.time() - start_time < 5:
state = client.get_gui_state()
if state and state.get('text_viewer_type') == text_type:
break
time.sleep(0.1)
assert state is not None
assert state.get('show_text_viewer') == True
assert state.get('text_viewer_title') == label
assert state.get('text_viewer_type') == text_type
assert state.get('text_viewer_type') == text_type