2020-10-23 17:59:08 +03:00
|
|
|
#!/bin/bash -e -o pipefail
|
2023-11-28 02:25:03 +01:00
|
|
|
################################################################################
|
|
|
|
|
## File: install-chrome.sh
|
|
|
|
|
## Desc: Install chrome and chrome for testing browsers
|
|
|
|
|
################################################################################
|
|
|
|
|
|
2020-10-20 13:47:33 +03:00
|
|
|
source ~/utils/utils.sh
|
2023-07-28 21:09:52 +02:00
|
|
|
arch=$(get_arch)
|
2020-10-20 13:47:33 +03:00
|
|
|
|
2023-07-28 21:09:52 +02:00
|
|
|
echo "Installing Google Chrome..."
|
2023-08-11 11:47:08 +02:00
|
|
|
brew install --cask google-chrome
|
2020-09-10 14:34:08 +03:00
|
|
|
|
2023-07-28 21:09:52 +02:00
|
|
|
# Parse Google Chrome version
|
2023-12-21 14:48:28 +01:00
|
|
|
full_chrome_version=$("/Applications/Google Chrome.app/Contents/MacOS/Google Chrome" --version)
|
|
|
|
|
full_chrome_version=${full_chrome_version#Google Chrome }
|
|
|
|
|
chrome_version=${full_chrome_version%.*}
|
|
|
|
|
echo "Google Chrome version is $full_chrome_version"
|
2023-07-28 21:09:52 +02:00
|
|
|
|
|
|
|
|
# Get Google Chrome versions information
|
2023-12-21 14:48:28 +01:00
|
|
|
chrome_platform="mac-$arch"
|
2023-07-28 21:09:52 +02:00
|
|
|
CHROME_VERSIONS_URL="https://googlechromelabs.github.io/chrome-for-testing/latest-patch-versions-per-build-with-downloads.json"
|
2024-01-09 14:47:31 +01:00
|
|
|
chrome_versions_json="$(cat $(download_with_retry "$CHROME_VERSIONS_URL"))"
|
2023-07-28 21:09:52 +02:00
|
|
|
|
|
|
|
|
# Download and unpack the latest release of Chrome Driver
|
2024-01-09 14:47:31 +01:00
|
|
|
chromedriver_version=$(echo $chrome_versions_json | jq -r '.builds["'"$chrome_version"'"].version')
|
2023-12-21 14:48:28 +01:00
|
|
|
echo "Installing Chrome Driver version $chromedriver_version"
|
2023-07-28 21:09:52 +02:00
|
|
|
|
2024-01-09 14:47:31 +01:00
|
|
|
chromedriver_url=$(echo $chrome_versions_json | jq -r '.builds["'"$chrome_version"'"].downloads.chromedriver[] | select(.platform=="'"${chrome_platform}"'").url')
|
|
|
|
|
chromedriver_dir="/usr/local/share/chromedriver-$chrome_platform"
|
2023-12-21 14:48:28 +01:00
|
|
|
chromedriver_bin="$chromedriver_dir/chromedriver"
|
2023-07-28 21:09:52 +02:00
|
|
|
|
2024-01-09 14:47:31 +01:00
|
|
|
chromedriver_archive_path=$(download_with_retry $chromedriver_url)
|
|
|
|
|
unzip -qq $chromedriver_archive_path -d /tmp/
|
|
|
|
|
sudo mv /tmp/chromedriver-$chrome_platform $chromedriver_dir
|
|
|
|
|
ln -s $chromedriver_bin /usr/local/bin/chromedriver
|
|
|
|
|
echo "export CHROMEWEBDRIVER=$chromedriver_dir" >> ${HOME}/.bashrc
|
2023-07-28 21:09:52 +02:00
|
|
|
|
|
|
|
|
# Download and unpack the latest release of Google Chrome for Testing
|
2024-01-09 14:47:31 +01:00
|
|
|
chrome_for_testing_version=$(echo $chrome_versions_json | jq -r '.builds["'"$chrome_version"'"].version')
|
2023-12-21 14:48:28 +01:00
|
|
|
echo "Installing Google Chrome for Testing version $chrome_for_testing_version"
|
2023-07-28 21:09:52 +02:00
|
|
|
|
2024-01-09 14:47:31 +01:00
|
|
|
chrome_for_testing_url=$(echo $chrome_versions_json | jq -r '.builds["'"$chrome_version"'"].downloads.chrome[] | select(.platform=="'"${chrome_platform}"'").url')
|
2023-12-21 14:48:28 +01:00
|
|
|
chrome_for_testing_app="Google Chrome for Testing.app"
|
2023-07-28 21:09:52 +02:00
|
|
|
|
2024-01-09 14:47:31 +01:00
|
|
|
chrome_for_testing_archive_path=$(download_with_retry $chrome_for_testing_url)
|
|
|
|
|
unzip -qq $chrome_for_testing_archive_path -d /tmp/
|
|
|
|
|
mv "/tmp/chrome-$chrome_platform/$chrome_for_testing_app" "/Applications/$chrome_for_testing_app"
|
2020-09-10 14:34:08 +03:00
|
|
|
|
|
|
|
|
echo "Installing Selenium"
|
2021-11-11 14:57:18 +03:00
|
|
|
brew_smart_install "selenium-server"
|
2020-09-10 14:34:08 +03:00
|
|
|
|
2021-01-22 09:26:28 +03:00
|
|
|
invoke_tests "Browsers" "Chrome"
|