This commit is contained in:
@@ -5,7 +5,12 @@ from unittest.mock import MagicMock, patch
|
||||
|
||||
from agents.collab_runner import CollaborativeTaskRunner, CollaborativeTaskRunnerConfig
|
||||
from agents.config import CollaborationConfig
|
||||
from agents.models import Observation, ReflectionAction, ReflectionOutcome, VerificationVerdict
|
||||
from agents.models import (
|
||||
Observation,
|
||||
ReflectionAction,
|
||||
ReflectionOutcome,
|
||||
VerificationVerdict,
|
||||
)
|
||||
from core.models import Bounds, Scene, SceneElement, Task
|
||||
from runtime.executor import StepResult
|
||||
from runtime.planner import PlannedStep
|
||||
@@ -13,6 +18,7 @@ from runtime.task import TaskRunner, TaskRunnerConfig
|
||||
from storage.artifact_store import ArtifactStore
|
||||
from storage.task_metadata import TaskMetadataStore
|
||||
from storage.timeline import Timeline
|
||||
from tests.fakes import PNG_10X20
|
||||
from world.config import WorldConfig
|
||||
|
||||
|
||||
@@ -20,7 +26,11 @@ def _scene() -> Scene:
|
||||
return Scene(
|
||||
width=1080,
|
||||
height=1920,
|
||||
elements=[SceneElement(id="btn1", type="button", bounds=Bounds(10, 20, 100, 50), text="OK")],
|
||||
elements=[
|
||||
SceneElement(
|
||||
id="btn1", type="button", bounds=Bounds(10, 20, 100, 50), text="OK"
|
||||
)
|
||||
],
|
||||
)
|
||||
|
||||
|
||||
@@ -55,7 +65,9 @@ def _replan_outcome() -> ReflectionOutcome:
|
||||
def _recovery_outcome() -> ReflectionOutcome:
|
||||
return ReflectionOutcome(
|
||||
replan=False,
|
||||
action=ReflectionAction(action="swipe", description="Scroll", args={"direction": "up"}),
|
||||
action=ReflectionAction(
|
||||
action="swipe", description="Scroll", args={"direction": "up"}
|
||||
),
|
||||
reasoning="Try scrolling.",
|
||||
)
|
||||
|
||||
@@ -204,6 +216,7 @@ def test_collaborative_run_shares_bookkeeping_with_task_runner(tmp_path) -> None
|
||||
on_task_succeeded=on_task_succeeded,
|
||||
world_config=WorldConfig(enabled=True),
|
||||
config=TaskRunnerConfig(max_steps=5),
|
||||
screenshot_provider=lambda device_id: PNG_10X20,
|
||||
)
|
||||
|
||||
runner = CollaborativeTaskRunner(
|
||||
@@ -225,6 +238,9 @@ def test_collaborative_run_shares_bookkeeping_with_task_runner(tmp_path) -> None
|
||||
|
||||
assert result.status == "completed"
|
||||
assert len(timeline.read(task.id)) == 1
|
||||
record = timeline.read(task.id)[0]
|
||||
assert record["before_screenshot_path"]
|
||||
assert record["after_screenshot_path"]
|
||||
assert metadata.get_task(task.id)["status"] == "completed"
|
||||
on_task_succeeded.assert_called_once_with(task.id, task.goal, timeline)
|
||||
|
||||
|
||||
Reference in New Issue
Block a user