How to install Chrome for Testing from zip file on Debian?
Asked Answered
R

1

13

Using:

Distributor ID: Debian
Description:    Debian GNU/Linux 10 (buster)
Release:    10
Codename:   buster

Google is now recommending that people use Chrome for Testing for their test automation instead of commercial version of Chrome and I can't find a way to make it work. This is originally how we did it in our pipeline:

curl -sS -o - https://dl-ssl.google.com/linux/linux_signing_key.pub | apt-key add
echo "deb http://dl.google.com/linux/chrome/deb/ stable main" >> /etc/apt/sources.list.d/google-chrome.list
apt-get -y update
apt-get -y install google-chrome-stable

But now using the new api for Chrome for Testing this is what I'm using in our shell script:

LATEST_CHROME_JSON=$(curl -s https://googlechromelabs.github.io/chrome-for-testing/last-known-good-versions-with-downloads.json | jq '.channels.Stable')
LATEST_CHROME_URL=$(echo "$LATEST_CHROME_JSON" | jq -r '.downloads.chrome[] | select(.platform == "linux64") | .url')
wget -N "$LATEST_CHROME_URL" -P ~/
unzip ~/chrome-linux64.zip -d ~/
rm ~/chrome-linux64.zip
mkdir -p /opt/chrome
mv ~/chrome-linux64/* /opt/chrome/
rm -r ~/chrome-linux64
ln -s /opt/chrome/chrome /usr/local/bin/chrome
chmod +x /opt/chrome/chrome
chrome --version

Everytime I use chrome --version the pipeline fails because some dependency or another is missing. How come I didn't need any of these dependencies before? And how do I have it print out all the required dependencies instead of erroring out one by one? Right now I keep adding a new dependency to install, commit and push, run my pipeline, only to see a brand new error and a brand new dependency is needed.

The dependencies I'm installing:

apt-get update
apt-get install -y unzip openjdk-8-jre-headless
apt-get install -y xvfb libxi6 libgconf-2-4 jq libjq1 libonig5 #xorg apt-get install -y jq libjq1 libonig5
apt-get install -y libnss3
apt-get install -y libatk1.0-0
apt-get install -y libatk-bridge2.0-0

I had to separate them because openjdk-8-jre-headless kept failing because for some reason it's missing or something. I remember getting this from this tutorial on installing chrome: https://gist.github.com/buttreygoodness/09e26d7f21eb5b95a4229658a7a9b321

As I post this, my pipeline just failed again this time with error

chrome: error while loading shared libraries: libcups.so.2: cannot open shared object file: No such file or directory

This is getting frustrating. There has to be a better way to install chrome from a zip file like this. I don't understand why they couldn't just make a .deb file like they normally do

Rothermere answered 20/7, 2023 at 13:8 Comment(2)
I installed it with reference to this blog. How can I get Chrome for Testing binaries?Aborigine
we're not using node/npm. We would need to download and install node on our testing machines purely for chrome for testing and nothing else.Rothermere
R
12

Finally worked by using these dependencies

apt-get install -y unzip xvfb libxi6 libgconf-2-4 jq libjq1 libonig5 libxkbcommon0 libxss1 libglib2.0-0 libnss3 \
  libfontconfig1 libatk-bridge2.0-0 libatspi2.0-0 libgtk-3-0 libpango-1.0-0 libgdk-pixbuf2.0-0 libxcomposite1 \
  libxcursor1 libxdamage1 libxtst6 libappindicator3-1 libasound2 libatk1.0-0 libc6 libcairo2 libcups2 libxfixes3 \
  libdbus-1-3 libexpat1 libgcc1 libnspr4 libgbm1 libpangocairo-1.0-0 libstdc++6 libx11-6 libx11-xcb1 libxcb1 libxext6 \
  libxrandr2 libxrender1 gconf-service ca-certificates fonts-liberation libappindicator1 lsb-release xdg-utils

LATEST_CHROME_RELEASE=$(curl -s https://googlechromelabs.github.io/chrome-for-testing/last-known-good-versions-with-downloads.json | jq '.channels.Stable')
LATEST_CHROME_URL=$(echo "$LATEST_CHROME_RELEASE" | jq -r '.downloads.chrome[] | select(.platform == "linux64") | .url')
wget -N "$LATEST_CHROME_URL" -P ~/
unzip ~/chrome-linux64.zip -d ~/
mv ~/chrome-linux64 ~/chrome
ln -s ~/chrome/chrome /usr/local/bin/chrome
chmod +x ~/chrome
rm ~/chrome-linux64.zip
Rothermere answered 21/7, 2023 at 2:20 Comment(6)
You can use apt show google-chrome to list all dependencies of the Google Chrome .deb package. The dependencies for CfT should be mostly the same as those for Google Chrome.Plautus
I feel this is not sustainable model. Manually installing os packages feels like 2002 to me. Ideally there should be beeter way (package manager way) to install CFT from Google.Isiahisiahi
Agree with Amar that there should be a package manager way of doing this, its nice we can always install the latest chrome(driver) versions but the dependencies not being included (or referenced) feels like a step backBeutler
Thank you, thank you, thank you! I've been pulling my hair out over this! Def needs a better installation method for sure.Oared
I am also facing the same issue. I am currently installing the google-chrome-stable package and then removing it. The dependencies are now installed so I can just unzip the zip file from last-known-good-versions.json and then start using it. I agree this is a little hacky and works as a temporary solution only. The right way would be if CFT publishes a list of dependencies themselves and we could install them using apt.Repertoire
There's a feature request for this in the Chrome for Testing bug tracker.Plautus

© 2022 - 2024 — McMap. All rights reserved.