Skip to content

Commit

Permalink
Install Chrome for Testing to fix missing chromedriver version.
Browse files Browse the repository at this point in the history
  • Loading branch information
GUI committed Sep 8, 2023
1 parent 1b5b150 commit 54ff4da
Showing 1 changed file with 18 additions and 10 deletions.
28 changes: 18 additions & 10 deletions tasks/install-system-build-dependencies
Original file line number Diff line number Diff line change
Expand Up @@ -47,19 +47,27 @@ if [ "${INSTALL_TEST_DEPENDENCIES:-}" == "true" ]; then
# Add Chrome for integration tests.
if [ "$TARGETARCH" == "amd64" ]; then
apt-get update
DEBIAN_FRONTEND=noninteractive apt-get -y --no-install-recommends install curl gnupg2 unzip ca-certificates
curl -fsSL https://dl.google.com/linux/linux_signing_key.pub | gpg --dearmor > /usr/share/keyrings/google-chrome.gpg
echo "deb [signed-by=/usr/share/keyrings/google-chrome.gpg] http://dl.google.com/linux/chrome/deb/ stable main" > /etc/apt/sources.list.d/google-chrome.list
apt-get update
DEBIAN_FRONTEND=noninteractive apt-get -y --no-install-recommends install google-chrome-stable
DEBIAN_FRONTEND=noninteractive apt-get -y --no-install-recommends install ca-certificates curl jq unzip
curl -fsSL -o /tmp/chrome.json https://googlechromelabs.github.io/chrome-for-testing/last-known-good-versions-with-downloads.json

# Install Chrome for Testing dependencies:
# https://github.com/puppeteer/puppeteer/blob/main/docs/troubleshooting.md#chrome-doesnt-launch-on-linux
DEBIAN_FRONTEND=noninteractive apt-get -y --no-install-recommends install ca-certificates fonts-liberation libasound2 libatk-bridge2.0-0 libatk1.0-0 libc6 libcairo2 libcups2 libdbus-1-3 libexpat1 libfontconfig1 libgbm1 libgcc1 libglib2.0-0 libgtk-3-0 libnspr4 libnss3 libpango-1.0-0 libpangocairo-1.0-0 libstdc++6 libx11-6 libx11-xcb1 libxcb1 libxcomposite1 libxcursor1 libxdamage1 libxext6 libxfixes3 libxi6 libxrandr2 libxrender1 libxss1 libxtst6 lsb-release wget xdg-utils

# Install Chrome for Testing
chrome_url="$(jq -r '.channels.Stable.downloads.chrome[] | select(.platform == "linux64").url' /tmp/chrome.json)"
curl -fsSL "$chrome_url" -o "/tmp/chrome.zip"
unzip -o -j -d /opt/chrome "/tmp/chrome.zip"
ln -s /opt/chrome/chrome /usr/local/bin/google-chrome
google-chrome --version
rm "/tmp/chrome.zip"

CHROME_VERSION="$(google-chrome --version)"
CHROMEDRIVER_VERSION="${CHROME_VERSION//[^0-9.]/}"
curl -fsSL "https://edgedl.me.gvt1.com/edgedl/chrome/chrome-for-testing/$CHROMEDRIVER_VERSION/linux64/chromedriver-linux64.zip" -o "/tmp/chromedriver-linux64.zip"
unzip -o -j -d /usr/local/bin "/tmp/chromedriver-linux64.zip" "*/chromedriver"
# Install Chromedriver for matching version
chromedriver_url="$(jq -r '.channels.Stable.downloads.chromedriver[] | select(.platform == "linux64").url' /tmp/chrome.json)"
curl -fsSL -o "/tmp/chromedriver.zip" "$chromedriver_url"
unzip -o -j -d /usr/local/bin "/tmp/chromedriver.zip" "*/chromedriver"
chromedriver --version
rm "/tmp/chromedriver-linux64.zip"
rm "/tmp/chromedriver.zip"
else
# For ARM platforms, Chrome stable doesn't exist, so use Chromium
# instead. chromedriver also doesn't exist, so use Electron's ARM builds
Expand Down

0 comments on commit 54ff4da

Please sign in to comment.