项目文件夹

文件
Sarath Suresh c390388beb 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>
2026-04-28 15:34:31 +05:30

28 行
813 B
Python

import os
import tempfile
from unittest.mock import patch
from PIL import Image
from browser_harness import helpers
def _run(fake_png, width, height, **kwargs):
fake = lambda method, **_: {"data": fake_png(width, height)}
with patch("browser_harness.helpers.cdp", side_effect=fake), tempfile.TemporaryDirectory() as d:
path = os.path.join(d, "shot.png")
helpers.capture_screenshot(path, **kwargs)
return Image.open(path).size
def test_max_dim_downsizes_oversized_image(fake_png):
assert max(_run(fake_png, 4592, 2286, max_dim=1800)) == 1800
def test_max_dim_skips_when_image_already_small(fake_png):
assert _run(fake_png, 800, 400, max_dim=1800) == (800, 400)
def test_max_dim_default_is_no_resize(fake_png):
assert _run(fake_png, 4592, 2286) == (4592, 2286)