File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change 309309# shared libraries (libGLESv2.so, libEGL.so, ...) which inherit the
310310# executable bit from Playwright's tarball but are NOT browser binaries.
311311# We only accept files whose basename is chrome / chromium /
312- # chrome-headless-shell / chromium-browser. Compare PR #18635's earlier
313- # ``find | grep -Ei 'chrome|chromium'`` which would match the path
314- # ``.../chrome-headless-shell-linux64/libGLESv2.so`` and pick a .so.
312+ # chrome-headless-shell / headless_shell / chromium-browser. Compare
313+ # PR #18635's earlier ``find | grep -Ei 'chrome|chromium'`` which would
314+ # match the path ``.../chrome-headless-shell-linux64/libGLESv2.so`` and
315+ # pick a .so.
315316# - Quietly skipped when $PLAYWRIGHT_BROWSERS_PATH doesn't exist (e.g.
316317# custom builds that strip Playwright).
317318if [ -z " ${AGENT_BROWSER_EXECUTABLE_PATH:- } " ] && \
318319 [ -n " ${PLAYWRIGHT_BROWSERS_PATH:- } " ] && \
319320 [ -d " $PLAYWRIGHT_BROWSERS_PATH " ]; then
320321 browser_bin=$( find " $PLAYWRIGHT_BROWSERS_PATH " -type f -executable \
321322 \( -name ' chrome' -o -name ' chromium' \
322- -o -name ' chrome-headless-shell' -o -name ' chromium-browser' \) \
323+ -o -name ' chrome-headless-shell' -o -name ' headless_shell' \
324+ -o -name ' chromium-browser' \) \
323325 2> /dev/null | head -n 1)
324326 if [ -n " $browser_bin " ]; then
325327 echo " [stage2] Found agent-browser Chromium binary: $browser_bin "
Original file line number Diff line number Diff line change 1+ """Regression tests for Docker stage2 browser executable discovery."""
2+
3+ from pathlib import Path
4+
5+
6+ def test_stage2_discovers_playwright_arm64_headless_shell () -> None :
7+ """Playwright's --only-shell layout may use a headless_shell basename."""
8+ script = Path ("docker/stage2-hook.sh" ).read_text ()
9+
10+ assert "-name 'headless_shell'" in script
11+
12+
13+ def test_stage2_discovery_stays_filename_matched () -> None :
14+ """Avoid broad path grep that can pick executable shared libraries."""
15+ script = Path ("docker/stage2-hook.sh" ).read_text ()
16+
17+ discovery_block = script .split ("browser_bin=$(" , 1 )[1 ].split (")\n if" , 1 )[0 ]
18+ assert "find \" $PLAYWRIGHT_BROWSERS_PATH\" -type f -executable" in discovery_block
19+ assert "grep" not in discovery_block
You can’t perform that action at this time.
0 commit comments