Skip to content
Draft
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
11 changes: 8 additions & 3 deletions lib/crewai-tools/tests/tools/stagehand_tool_test.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
from unittest.mock import MagicMock, patch

import pytest

from urllib.parse import urlparse

# Create mock classes that will be used by our fixture
class MockStagehandModule:
Expand Down Expand Up @@ -171,8 +171,13 @@ def test_navigate_command(mock_run, stagehand_tool):
)

# Assertions
assert "https://example.com" in result

# Extract URL from result string and check its host
# Example result: "Successfully navigated to https://example.com"
import re
url_match = re.search(r'https?://[^\s]+', result)
assert url_match is not None
parsed = urlparse(url_match.group(0))
assert parsed.hostname == "example.com"

@patch(
"crewai_tools.tools.stagehand_tool.stagehand_tool.StagehandTool._run", autospec=True
Expand Down
Loading