silverstripe / gha-ci

GitHub Actions Workflow - CI for Silverstripe modules
BSD 3-Clause "New" or "Revised" License
0 stars 11 forks source link

Update method of downloading chrome + chromedriver #82

Closed emteknetnz closed 1 year ago

emteknetnz commented 1 year ago

There's a recent way to install chrome for behat

https://developer.chrome.com/blog/chrome-for-testing/

I discovered this after my own script for getting behat to run in my docker environment suddenly stopped working as the version of chromedriver was lagging the stable release of google chrome. Fortunately the new method seems much better once it is working.

I finally got it to work within docker with the following, we'll very likely need to update gha-ci to use this installation method shortly

# Need to fix error when trying to running chrome
# "Error while loading shared libraries: libnss3.so" and "error while loading shared libraries: libasound.so.2"
RUN apt-get install -y libnss3-dev libgdk-pixbuf2.0-dev libgtk-3-dev libxss-dev libasound2

# Get latest versions of chrome + chromedriver from json endpoint
RUN curl https://googlechromelabs.github.io/chrome-for-testing/last-known-good-versions-with-downloads.json > chrome.json

# Install chrome
RUN wget $(cat chrome.json | jq -r '.channels.Stable.downloads.chrome[] | select(.platform == "linux64").url')
RUN unzip chrome-linux64.zip
RUN ln -s $(pwd)/chrome-linux64/chrome /usr/bin/chrome

# Install chromedriver
RUN wget $(cat chrome.json | jq -r '.channels.Stable.downloads.chromedriver[] | select(.platform == "linux64").url')
RUN unzip chromedriver-linux64.zip
RUN ln -s $(pwd)/chromedriver-linux64/chromedriver /usr/bin/chromedriver

PRs

GuySartorelli commented 1 year ago

@emteknetnz Please link any related PRs in the issue description.

emteknetnz commented 1 year ago

Added

GuySartorelli commented 1 year ago

PR merged