browser-use--browser-harness
fb1a51dd9b
* refactor(tests): reorganize into tests/unit and tests/integration Moves all root-level test_*.py files into a structured tests/ directory: - tests/unit/ — admin, helpers (was test_screenshot), run - tests/integration/ — js expression tests - tests/conftest.py — shared fake_png pytest fixture, eliminating duplication Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com> * refactor: move to src layout, agent-workspace, and fix SKILL.md invocation format - Move package to src/browser_harness/ and domain-skills/interaction-skills to agent-workspace/ - Fix all browser-harness <<'PY' heredoc examples in SKILL.md and run.py HELP string to use the correct -c '...' flag format (heredoc was never supported by the CLI) - Update SKILL.md path references from domain-skills/ to agent-workspace/domain-skills/ Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com> --------- Co-authored-by: Claude Sonnet 4.6 <noreply@anthropic.com>
30 行
993 B
Python
30 行
993 B
Python
from browser_harness import admin
|
|
|
|
|
|
def test_local_chrome_mode_is_false_when_env_provides_remote_cdp():
|
|
assert not admin._is_local_chrome_mode({"BU_CDP_WS": "ws://example.test/devtools/browser/1"})
|
|
|
|
|
|
def test_local_chrome_mode_is_false_when_process_env_provides_remote_cdp(monkeypatch):
|
|
monkeypatch.setenv("BU_CDP_WS", "ws://example.test/devtools/browser/1")
|
|
|
|
assert not admin._is_local_chrome_mode()
|
|
|
|
|
|
def test_handshake_timeout_needs_chrome_remote_debugging_prompt():
|
|
msg = "CDP WS handshake failed: timed out during opening handshake"
|
|
|
|
assert admin._needs_chrome_remote_debugging_prompt(msg)
|
|
|
|
|
|
def test_handshake_403_needs_chrome_remote_debugging_prompt():
|
|
msg = "CDP WS handshake failed: server rejected WebSocket connection: HTTP 403"
|
|
|
|
assert admin._needs_chrome_remote_debugging_prompt(msg)
|
|
|
|
|
|
def test_stale_websocket_does_not_open_chrome_inspect():
|
|
msg = "no close frame received or sent"
|
|
|
|
assert not admin._needs_chrome_remote_debugging_prompt(msg)
|