@@ -131,6 +131,9 @@ def test_execute_cached_execution_executes_trajectory() -> None:
131131 # Execute the trajectory
132132 tool = ExecuteCachedTrajectory ()
133133 mock_toolbox = MagicMock (spec = ToolCollection )
134+ # Mock successful tool execution (return result without is_error attribute)
135+ mock_result = MagicMock (spec = []) # Empty spec means no attributes
136+ mock_toolbox .run .return_value = [mock_result ]
134137 tool .set_toolbox (mock_toolbox )
135138
136139 result = tool (trajectory_file = str (cache_file ))
@@ -174,6 +177,9 @@ def test_execute_cached_execution_skips_screenshot_tools() -> None:
174177 # Execute the trajectory
175178 tool = ExecuteCachedTrajectory ()
176179 mock_toolbox = MagicMock (spec = ToolCollection )
180+ # Mock successful tool execution (return result without is_error attribute)
181+ mock_result = MagicMock (spec = []) # Empty spec means no attributes
182+ mock_toolbox .run .return_value = [mock_result ]
177183 tool .set_toolbox (mock_toolbox )
178184
179185 result = tool (trajectory_file = str (cache_file ))
@@ -210,7 +216,7 @@ def test_execute_cached_execution_handles_errors_gracefully() -> None:
210216 result = tool (trajectory_file = str (cache_file ))
211217
212218 # Verify error message
213- assert "error occured " in result .lower ()
219+ assert "error occurred " in result .lower ()
214220 assert "verify the UI state" in result
215221
216222
@@ -277,6 +283,9 @@ def test_execute_cached_execution_uses_delay_time_between_actions() -> None:
277283 custom_settings = CacheExecutionSettings (delay_time_between_action = 0.1 )
278284 tool = ExecuteCachedTrajectory (settings = custom_settings )
279285 mock_toolbox = MagicMock (spec = ToolCollection )
286+ # Mock successful tool execution (return result without is_error attribute)
287+ mock_result = MagicMock (spec = []) # Empty spec means no attributes
288+ mock_toolbox .run .return_value = [mock_result ]
280289 tool .set_toolbox (mock_toolbox )
281290
282291 # Mock time.sleep to verify it's called with correct delay
@@ -319,6 +328,9 @@ def test_execute_cached_execution_default_delay_time() -> None:
319328 # Execute with default settings
320329 tool = ExecuteCachedTrajectory ()
321330 mock_toolbox = MagicMock (spec = ToolCollection )
331+ # Mock successful tool execution (return result without is_error attribute)
332+ mock_result = MagicMock (spec = []) # Empty spec means no attributes
333+ mock_toolbox .run .return_value = [mock_result ]
322334 tool .set_toolbox (mock_toolbox )
323335
324336 # Mock time.sleep to verify default delay is used
0 commit comments