diff --git a/src/commands/install_chrome_for_testing.yml b/src/commands/install_chrome_for_testing.yml index 156a9d4..48969d9 100644 --- a/src/commands/install_chrome_for_testing.yml +++ b/src/commands/install_chrome_for_testing.yml @@ -4,21 +4,27 @@ description: > https://developer.chrome.com/blog/chrome-for-testing/ parameters: + version: + type: string + description: > + Which version to install. No default version provided, you must specify the one you want. + install_dir: type: string default: /usr/local/bin description: > Directory in which to download chrome and the driver. - version: - type: string - default: "" + install_chromedriver: + type: boolean + default: true description: > - Which version to install. No default version provided, you must specify the one you want. + Whether or not to install Chrome for Testing chromedriver alongside Chrome for Testing steps: - run: name: Install Chrome for testing environment: ORB_PARAM_DIR: <> ORB_PARAM_VERSION: <> + ORB_PARAM_INSTALL_CHROMEDRIVER: <> command: <> diff --git a/src/scripts/install_chrome_for_testing.sh b/src/scripts/install_chrome_for_testing.sh index 9b7233e..a26fb4f 100644 --- a/src/scripts/install_chrome_for_testing.sh +++ b/src/scripts/install_chrome_for_testing.sh @@ -1,21 +1,29 @@ #!/bin/bash if [[ $EUID == 0 ]]; then export SUDO=""; else export SUDO="sudo"; fi -cd "$ORB_PARAM_DIR" || exit 1 +cd "$ORB_PARAM_DIR" || { echo "$ORB_PARAM_DIR does not exist. Exiting"; exit 1; } + +if [ -z "$ORB_PARAM_VERSION" ]; then + echo "ORB_PARAM_VERSION is not set. Exiting." + exit 1 +fi if uname -a | grep Darwin >/dev/null 2>&1; then - $SUDO wget -q -O chrome-for-testing.zip "https://storage.googleapis.com/chrome-for-testing-public/$ORB_PARAM_VERSION/mac-arm64/chrome-mac-arm64.zip" + $SUDO curl -s -o chrome-for-testing.zip "https://storage.googleapis.com/chrome-for-testing-public/$ORB_PARAM_VERSION/mac-arm64/chrome-mac-arm64.zip" if [ -s "chrome-for-testing.zip" ]; then $SUDO unzip chrome-for-testing.zip >/dev/null 2>&1 else echo "Version $ORB_PARAM_VERSION doesn't exist" exit 1 fi - $SUDO wget -q -O chrome-for-testing-driver.zip "https://storage.googleapis.com/chrome-for-testing-public/$ORB_PARAM_VERSION/mac-arm64/chromedriver-mac-arm64.zip" - $SUDO unzip chrome-for-testing-driver.zip >/dev/null 2>&1 - $SUDO mv chromedriver-mac-arm64/chromedriver chromedriver + + if [ "$ORB_PARAM_INSTALL_CHROMEDRIVER" = true ] ; then + $SUDO curl -s -o chrome-for-testing-driver.zip "https://storage.googleapis.com/chrome-for-testing-public/$ORB_PARAM_VERSION/mac-arm64/chromedriver-mac-arm64.zip" + $SUDO unzip chrome-for-testing-driver.zip >/dev/null 2>&1 + $SUDO mv chromedriver-mac-arm64/chromedriver chromedriver + fi elif command -v apt >/dev/null 2>&1; then - $SUDO wget -q -O chrome-for-testing.zip "https://storage.googleapis.com/chrome-for-testing-public/$ORB_PARAM_VERSION/linux64/chrome-linux64.zip" + $SUDO curl -s -o chrome-for-testing.zip "https://storage.googleapis.com/chrome-for-testing-public/$ORB_PARAM_VERSION/linux64/chrome-linux64.zip" if [ -s "chrome-for-testing.zip" ]; then $SUDO unzip chrome-for-testing.zip >/dev/null 2>&1 else @@ -27,15 +35,22 @@ elif command -v apt >/dev/null 2>&1; then $SUDO apt-get satisfy -y --no-install-recommends "${pkg}"; done < chrome-linux64/deb.deps; - $SUDO wget -q -O chrome-for-testing-driver.zip "https://storage.googleapis.com/chrome-for-testing-public/$ORB_PARAM_VERSION/linux64/chromedriver-linux64.zip" - $SUDO unzip chrome-for-testing-driver.zip >/dev/null 2>&1 - $SUDO mv chromedriver-linux64/chromedriver chromedriver + if [ "$ORB_PARAM_INSTALL_CHROMEDRIVER" = true ] ; then + $SUDO curl -s -o chrome-for-testing-driver.zip "https://storage.googleapis.com/chrome-for-testing-public/$ORB_PARAM_VERSION/linux64/chromedriver-linux64.zip" + $SUDO unzip chrome-for-testing-driver.zip >/dev/null 2>&1 + $SUDO mv chromedriver-linux64/chromedriver chromedriver + fi fi -$SUDO chmod +x chromedriver -if chromedriver --version | grep "$ORB_PARAM_VERSION" >/dev/null 2>&1; then - echo "Chrome for testing installed correctly" -else - echo "Error installing Chrome for testing" - exit 1 +if [ "$ORB_PARAM_INSTALL_CHROMEDRIVER" = true ] ; then + $SUDO chmod +x chromedriver fi + +if [ "$ORB_PARAM_INSTALL_CHROMEDRIVER" = true ] ; then + if chromedriver --version | grep "$ORB_PARAM_VERSION" >/dev/null 2>&1; then + echo "chromedriver for Chrome for testing installed correctly" + else + echo "Error installing Chrome for testing" + exit 1 + fi +fi \ No newline at end of file