This commit is contained in:
@@ -1,6 +1,7 @@
|
||||
from __future__ import annotations
|
||||
|
||||
from api.mcp import tool_handlers
|
||||
from core.models import ActiveApp
|
||||
from device.manager import DeviceManager
|
||||
from tests.fakes import FakeDriver
|
||||
|
||||
@@ -36,3 +37,30 @@ def test_mcp_handlers_are_semantic_and_hide_driver_terms() -> None:
|
||||
assert "Appium" not in serialized
|
||||
assert "XCUI" not in serialized
|
||||
assert all(response is not None for response in responses)
|
||||
|
||||
|
||||
def test_mcp_ui_tree_can_include_active_app_info() -> None:
|
||||
manager = DeviceManager()
|
||||
manager.register_device(
|
||||
"android-1",
|
||||
lambda: FakeDriver(
|
||||
active_app=ActiveApp(
|
||||
platform="android",
|
||||
package="com.example.mobile",
|
||||
activity=".MainActivity",
|
||||
)
|
||||
),
|
||||
)
|
||||
manager.connect("android-1", max_retries=1)
|
||||
|
||||
response = tool_handlers(manager=manager)["get_ui_tree"](
|
||||
device_id="android-1",
|
||||
include_app_info=True,
|
||||
)
|
||||
|
||||
assert response["app"] == {
|
||||
"platform": "android",
|
||||
"package": "com.example.mobile",
|
||||
"activity": ".MainActivity",
|
||||
}
|
||||
assert isinstance(response["nodes"], list)
|
||||
|
||||
Reference in New Issue
Block a user