Add browsers for tests: Playwright, Firefox, geckodriver, headless Chrome (closes #10)
Firefox comes from Mozilla's own apt repo, pinned above Ubuntu's snap-only package. geckodriver is at its latest release, independent of the Firefox version. Playwright installs its Chromium and Firefox; WebKit is skipped because no repository uses it today. Playwright's Chromium is exposed as the headless Chrome. Model: deepseek-v4-pro
This commit is contained in:
@@ -77,7 +77,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.
|
||||
@@ -90,6 +90,42 @@ 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
|
||||
cat > /etc/apt/preferences.d/mozilla <<'EOF'
|
||||
Package: *
|
||||
Pin: origin packages.mozilla.org
|
||||
Pin-Priority: 1000
|
||||
EOF
|
||||
apt-get update
|
||||
apt-get -y install --no-install-recommends -t mozilla firefox
|
||||
|
||||
# geckodriver, at its latest release (independent of the Firefox version).
|
||||
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 is skipped because no repository
|
||||
# uses it today. Playwright's Chromium is also the headless Chrome for
|
||||
# chromedp-style clients, exposed as `chromium` on PATH.
|
||||
playwright install --with-deps chromium firefox
|
||||
chromiums=( "$PLAYWRIGHT_BROWSERS_PATH"/chromium-*/chrome-linux*/chrome )
|
||||
if [ "${#chromiums[@]}" -ne 1 ] || [ ! -x "${chromiums[0]}" ]; then
|
||||
echo "error: expected exactly one chromium binary, found ${#chromiums[@]}" >&2
|
||||
exit 1
|
||||
fi
|
||||
ln -s "${chromiums[0]}" /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"
|
||||
@@ -141,6 +177,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
|
||||
|
||||
Reference in New Issue
Block a user