Files
hermes-agent/tests/pm/test_chromium.py
Teknium 1ac18d2b12 refactor(pm): drop the agent-browser package; Chromium is a default package in its own right
- pm: AgentBrowser class + lock entry gone; Chromium default=True and its env
  exports only PLAYWRIGHT_BROWSERS_PATH (Playwright launches without an
  executable path still need it). A recorded or passed --without agent-browser
  maps to chromium (pm.defaults.RETIRED_DEFAULTS), and pm gc forgets the stale
  agent-browser fact so its store entry is reclaimed.
- install.sh --skip-browser/--no-playwright and install.ps1 -SkipBrowser pass
  --without chromium; undo hint is hermes pm install chromium.
- Docker bakes /etc/hermes/chromium-executable-path; stage2-hook validates it
  and exports nothing; the sandbox-desktop image drops the agent-browser npm
  install and keeps its Playwright Chromium.
2026-10-23 01:41:25 -07:00

43 lines
1.7 KiB
Python

"""One browser payload serves both headed and headless callers."""
from pathlib import Path
import pytest
from pm.lock import Facts
from pm.packages import Chromium
from pm.defaults import default_package_names
from pm.registry import walk
from scripts.bundles.native import _bundle_package_names
def test_browser_default_and_bundle_ship_full_chromium_only():
closure = {package.name for package in walk(["chromium"])}
bundled = set(_bundle_package_names())
assert "chromium" in set(default_package_names()) & bundled
assert "chromium-headless-shell" not in closure | bundled
@pytest.mark.parametrize(("target", "relative"), [
("linux-x64", "chrome-linux64/chrome"),
("linux-arm64", "chrome-linux/chrome"),
("darwin-arm64", "chrome-mac-arm64/Google Chrome for Testing.app/Contents/MacOS/Google Chrome for Testing"),
("win32-x64", "chrome-win64/chrome.exe"),
("win32-arm64", "chrome-win64/chrome.exe"),
])
def test_chromium_binary_and_env_survive_store_relocation(tmp_path, target, relative):
package = Chromium()
store = tmp_path / "store"
entry = store / package.store_entry("1234+145.0.0.0", target)
executable = entry / relative
executable.parent.mkdir(parents=True)
executable.write_bytes(b"browser-fixture")
executable.chmod(0o755)
assert package.binary(entry, target) == executable
facts = Facts(store / "facts.json")
facts.record("chromium", "1234+145.0.0.0", entry.name, package.env(entry, target), store)
moved = tmp_path / "relocated"
store.rename(moved)
env = Facts(moved / "facts.json").env_for("chromium", moved)
assert package.binary(moved / entry.name, target) == moved / entry.name / relative
assert env == {"PLAYWRIGHT_BROWSERS_PATH": str(moved)}