feat(testing): stabilize simulation suite and fix gemini caching
This commit is contained in:
@@ -22,53 +22,49 @@ def cleanup_callback_file():
|
||||
if TEST_CALLBACK_FILE.exists():
|
||||
TEST_CALLBACK_FILE.unlink()
|
||||
|
||||
def test_gui2_set_value_hook_works(live_gui_2):
|
||||
def test_gui2_set_value_hook_works(live_gui):
|
||||
"""
|
||||
Tests that the 'set_value' GUI hook is correctly implemented.
|
||||
This requires a way to read the value back, which we don't have yet.
|
||||
For now, this test just sends the command and assumes it works.
|
||||
"""
|
||||
client = ApiHookClient()
|
||||
assert client.wait_for_server(timeout=10)
|
||||
test_value = f"New value set by test: {uuid.uuid4()}"
|
||||
gui_data = {'action': 'set_value', 'item': 'ai_input', 'value': test_value}
|
||||
|
||||
response = client.post_gui(gui_data)
|
||||
assert response == {'status': 'queued'}
|
||||
|
||||
# In a future test, we would add:
|
||||
# time.sleep(0.2)
|
||||
# current_value = client.get_value('ai_input') # This hook doesn't exist yet
|
||||
# assert current_value == test_value
|
||||
# Verify the value was actually set using the new get_value hook
|
||||
time.sleep(0.5)
|
||||
current_value = client.get_value('ai_input')
|
||||
assert current_value == test_value
|
||||
|
||||
def test_gui2_click_hook_works(live_gui_2):
|
||||
def test_gui2_click_hook_works(live_gui):
|
||||
"""
|
||||
Tests that the 'click' GUI hook for the 'Reset' button is implemented.
|
||||
This will be verified by checking for a side effect (e.g., session is reset,
|
||||
which can be checked via another hook).
|
||||
"""
|
||||
client = ApiHookClient()
|
||||
assert client.wait_for_server(timeout=10)
|
||||
|
||||
# First, set some state that 'Reset' would clear.
|
||||
# We use the 'set_value' hook for this.
|
||||
test_value = "This text should be cleared by the reset button."
|
||||
client.post_gui({'action': 'set_value', 'item': 'ai_input', 'value': test_value})
|
||||
time.sleep(0.2)
|
||||
client.set_value('ai_input', test_value)
|
||||
time.sleep(0.5)
|
||||
assert client.get_value('ai_input') == test_value
|
||||
|
||||
# Now, trigger the click
|
||||
gui_data = {'action': 'click', 'item': 'btn_reset'}
|
||||
response = client.post_gui(gui_data)
|
||||
assert response == {'status': 'queued'}
|
||||
client.click('btn_reset')
|
||||
time.sleep(0.5)
|
||||
|
||||
# We need a way to verify the state was reset.
|
||||
# We can't read the ai_input value back yet.
|
||||
# So this test remains conceptual for now, but demonstrates the intent.
|
||||
# Verify it was reset
|
||||
assert client.get_value('ai_input') == ""
|
||||
|
||||
def test_gui2_custom_callback_hook_works(live_gui_2):
|
||||
def test_gui2_custom_callback_hook_works(live_gui):
|
||||
"""
|
||||
Tests that the 'custom_callback' GUI hook is correctly implemented.
|
||||
This test will PASS if the hook is correctly processed by gui_2.py.
|
||||
"""
|
||||
client = ApiHookClient()
|
||||
assert client.wait_for_server(timeout=10)
|
||||
test_data = f"Callback executed: {uuid.uuid4()}"
|
||||
|
||||
gui_data = {
|
||||
|
||||
Reference in New Issue
Block a user