fix: guard transient controls and verify timeline endpoints
This commit is contained in:
1 parent
479a185192
commit
00e62a663a
29 files changed
+1150
-90
No files matched your search
@@ -134,7 +134,9 @@ async def test_fallback_observation_renders_the_indexed_ui_list(mock_context, tm
|
||||
|
||||
assert post == _POST_IMG
|
||||
assert isinstance(exec_result.ui_elements_text, str)
|
||||
assert exec_result.ui_elements_text == "[1] Text: 'Settings' | Bounds: [37,50][962,112]"
|
||||
assert exec_result.ui_elements_text == (
|
||||
"[1] Text: 'Settings' | Bounds: [37,50][962,112] | resource_id: 'android:id/title'"
|
||||
)
|
||||
assert "{'text'" not in exec_result.ui_elements_text
|
||||
# State refreshed exactly as the executor's success path does.
|
||||
assert state.indexed_elements[0]["index"] == 1
|
||||
|
||||
@@ -23,6 +23,7 @@ feeds the safety-net XML validation.
|
||||
|
||||
import json
|
||||
from unittest.mock import AsyncMock, MagicMock, Mock, patch
|
||||
from uuid import uuid4
|
||||
|
||||
from langchain_core.messages import AIMessage
|
||||
import pytest
|
||||
@@ -309,6 +310,48 @@ async def test_validator_burst_success_executes_every_member(
|
||||
assert len(mock_mcp.calls_for("click")) == 2
|
||||
|
||||
|
||||
@pytest.mark.asyncio
|
||||
@pytest.mark.parametrize("post_image", ["screenshot", "new-sequence-image"])
|
||||
async def test_sequence_captures_once_after_whole_burst_and_retains_equal_hash(
|
||||
mock_mcp, mock_context, temp_screenshot, post_image
|
||||
):
|
||||
events = []
|
||||
|
||||
def action(name, args):
|
||||
events.append(name)
|
||||
return True, ""
|
||||
|
||||
def screenshot():
|
||||
events.append("capture")
|
||||
return "ZHVtbXlfZGF0YQ=="
|
||||
|
||||
mock_mcp.action_handler = action
|
||||
mock_mcp.screenshot = screenshot
|
||||
mock_context.data_engine.get_or_create_image.return_value = post_image
|
||||
mock_context.data_engine.get_image_path.return_value = temp_screenshot
|
||||
state = DummyState(
|
||||
structured_decisions=json.dumps(
|
||||
[
|
||||
{
|
||||
"action": "action_sequence",
|
||||
"args": {"steps": [{"action": "wait", "time_in_ms": 1}]},
|
||||
},
|
||||
{"action": "tap", "coordinates": [105, 205]},
|
||||
]
|
||||
),
|
||||
latest_screenshot=temp_screenshot,
|
||||
current_step_id=str(uuid4()),
|
||||
)
|
||||
|
||||
result = await ValidatorNode(mock_context)(state)
|
||||
|
||||
assert result["last_execution_result"]["status"] == "dispatched"
|
||||
assert events == ["action_sequence", "click", "capture"]
|
||||
assert mock_context.data_engine.update_step_execution_result.call_args.kwargs == {
|
||||
"post_image_name": post_image
|
||||
}
|
||||
|
||||
|
||||
@pytest.mark.asyncio
|
||||
async def test_validator_success_closes_open_incident(mock_mcp, mock_context, temp_screenshot):
|
||||
"""A successful turn closes whatever incident was still open."""
|
||||
|
||||
Reference in new issue
Block a user