Add browsers for tests: Playwright, Firefox, geckodriver, headless Chrome (closes #10)

Firefox comes from Mozilla's own apt repo since Ubuntu's is a snap that
does not run in a container. geckodriver is matched to it at build time.
Playwright installs its Chromium and Firefox, skipping WebKit which has
no linux-arm64 build; Playwright's Chromium is exposed as the headless
Chrome.

Model: deepseek-v4-pro
This commit is contained in:
2026-11-05 14:13:30 +00:00
parent 2633ae263c
commit b66ddc7a63
4 changed files with 45 additions and 3 deletions
+32 -1
View File
@@ -68,7 +68,7 @@ nvm install --lts
nvm alias default "lts/*"
nvm use default
set -ux
npm install -g npm@latest corepack wrangler prettier
npm install -g npm@latest corepack wrangler prettier playwright
corepack enable
# Pre-populate the corepack cache so projects that pin a package manager
# do not download at run time. The last yarn installed becomes the default.
@@ -81,6 +81,33 @@ pnpm --version
yarn --version
nvm cache clear
# --- browsers for tests: Firefox, geckodriver, Playwright --------------------
# Ubuntu's firefox is a snap that does not run in a container, so use
# Mozilla's own apt repository for the real binary.
install -d -m 0755 /etc/apt/keyrings
curl -fsSL https://packages.mozilla.org/apt/repo-signing-key.gpg \
-o /etc/apt/keyrings/packages.mozilla.org.asc
echo "deb [signed-by=/etc/apt/keyrings/packages.mozilla.org.asc] https://packages.mozilla.org/apt mozilla main" \
> /etc/apt/sources.list.d/mozilla.list
apt-get update
apt-get -y install --no-install-recommends -t mozilla firefox
# geckodriver, matched to Firefox at its current release.
gd="$(latest_tag mozilla/geckodriver)"
case "$arch" in
arm64) gd_arch=linux-aarch64 ;;
*) gd_arch=linux64 ;;
esac
curl -fsSL "https://github.com/mozilla/geckodriver/releases/download/${gd}/geckodriver-${gd}-${gd_arch}.tar.gz" |
tar -C /usr/local/bin -xz geckodriver
# Playwright's Chromium and Firefox. WebKit has no linux-arm64 build, so it
# is skipped. Playwright's Chromium is also the headless Chrome for
# chromedp-style clients, exposed as `chromium` on PATH.
playwright install --with-deps chromium firefox
ln -s "$(ls -d "$PLAYWRIGHT_BROWSERS_PATH"/chromium-*/chrome-linux*/chrome | head -n1)" \
/usr/local/bin/chromium
# --- pyenv, Python (latest), pip, virtualenv ---------------------------------
git clone -q --depth 1 --branch "$PYENV_GIT_TAG" https://github.com/pyenv/pyenv.git "$PYENV_ROOT"
rm -rf "$PYENV_ROOT/.git"
@@ -129,6 +156,10 @@ COREPACK_ENABLE_NETWORK=0 yarn --version
COREPACK_ENABLE_NETWORK=0 pnpm --version
wrangler --version
prettier --version
playwright --version
firefox --version
geckodriver --version
chromium --version
python3 --version
pip --version
virtualenv --version