You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
Commit d9cbd17
Browse filesBrowse the repository at this point in the historyBrowse files
let said = tool_said(&fake,&chat,&c,"run: cd /tmp/pw && python pw.py && node pw.js && python -c 'import sys; [print(f, open(f, \"rb\").read(5)) for f in sys.argv[1:]]' py.png py.pdf js.png js.pdf").await;
5006
+
for seen in[format!("python-chromium {version}"),format!("node-chromium {version}"),"videos 1".into(),r"py.png b'\\x89PNG\\r'".into(),"py.pdf b'%PDF-'".into(),r"js.png b'\\x89PNG\\r'".into(),"js.pdf b'%PDF-'".into()]{
5007
+
assert!(said.contains(&seen),"{seen:?} in what the terminal said: {said}");
5008
+
}
5009
+
let said = tool_said(&fake,&chat,&c,"run: cd /tmp/pw && zip -q t.zip pw.py && unzip -l t.zip | grep -c pw.py && echo '{\"n\": 42}' | jq .n && sqlite3 :memory: 'select 6 * 7' && playwright --version").await;
5010
+
let lines:Vec<&str> = said.split("\\n").map(str::trim).collect();
5011
+
let pinned = include_str!("../../hermes/playwright-requirements.txt").lines().find_map(|l| l.strip_prefix("playwright==")).and_then(|v| v.split_whitespace().next()).expect("the lock pins playwright");
5012
+
let release = format!("Version {pinned}");
5013
+
for seen in["1","42", release.as_str()]{
5014
+
assert!(lines.iter().any(|l| l.contains(seen)),"{seen:?} in what the terminal said: {said}");
assert_eq!(said.matches("Playwright's Chromium is installed already").count(),3,"each install of Chromium says so: {said}");
5023
+
assert!(said.contains("firefox=1") && said.contains("firefox can only be installed as root here (sudo playwright install firefox)"),"another browser is root's: {said}");
5024
+
let took:u64 = said.split("took=").nth(1).and_then(|r| r.split(|ch:char| !ch.is_ascii_digit()).next()).and_then(|n| n.parse().ok()).unwrap_or_else(|| panic!("how long: {said}"));
5025
+
assert!(took < 10,"at once, not after Playwright's lock: {took} s");
5026
+
// what it suggests (Codex on #991): `sudo playwright install chromium`
5027
+
// fetches nothing, and a browser `sudo` installs goes where the agent's
5028
+
// own launch looks (sudo keeps PLAYWRIGHT_BROWSERS_PATH): its dry run's
5029
+
// place is the one the agent's Playwright resolves
5030
+
let said = tool_said(&fake,&chat,&c,"run: cd /tmp/pw && sudo playwright install chromium && echo \"sudo-chromium=$?\" && at=$(sudo playwright install --dry-run firefox | sed -n 's|^ *Install location: *\\(.*/firefox-[0-9]*\\)$|\\1|p') && mine=$(python -c 'from playwright.sync_api import sync_playwright; p = sync_playwright().start(); print(p.firefox.executable_path); p.stop()') && case \"$mine\" in \"$at\"/*) echo \"firefox-where-$((6 * 7))\" ;; *) echo \"sudo $at, the agent $mine\" ;; esac").await;
5031
+
assert!(said.contains("sudo-chromium=0") && !said.contains("MiB") && !said.contains("downloaded to"),"sudo installs no Chromium, nor its FFmpeg: {said}");
assert!(said.contains("firefox-where-42"),"a browser sudo installs is where the agent looks: {said}");
5034
+
// `uninstall`, which collects regardless, is refused in Hermes' store
5035
+
let said = tool_said(&fake,&chat,&c,"run: cd /tmp/pw && { sudo playwright uninstall --all; echo \"uninstall=$?\"; } && { timeout 60 playwright uninstall; echo \"mine=$?\"; }").await;
5036
+
assert!(said.contains("uninstall=1") && said.contains("mine=1") && said.contains("would remove Hermes' own tools"),"{said}");
5037
+
let store = c.exec_out(&["ls","/opt/hermes/tools"]);
5038
+
assert!(store.lines().any(|l| l == "chromium-1208") && store.lines().any(|l| l.starts_with("ffmpeg-9")),"Hermes' Chrome for Testing and FFmpeg are kept: {store}");
5039
+
let browsers = c.exec_out(&["sh","-c","ls /opt/hermes/tools | grep chromium"]);
5040
+
assert_eq!(browsers.lines().count(),3,"Chrome for Testing's, and Playwright's two names for the system Chromium; none downloaded: {browsers}");
0 commit comments