mirror of
https://github.com/actions/runner-images-sangeeth.git
synced 2025-12-20 06:29:50 +00:00
Merge pull request #380 from dsame/firefox-driver
Install Firefox(Gecko) webdriver to linux images
This commit is contained in:
@@ -23,3 +23,31 @@ echo "Lastly, documenting what we added to the metadata file"
|
||||
# ($HOME is /home/packer which is owned by packer.)
|
||||
HOME=/root
|
||||
DocumentInstalledItem "Firefox ($(firefox --version))"
|
||||
|
||||
# Download and unpack latest release of geckodriver
|
||||
URL=$(curl -s https://api.github.com/repos/mozilla/geckodriver/releases/latest|grep 'browser_download_url.*linux64.tar.gz'|sed -E 's/^.*(https:.+)".*/\1/g')
|
||||
echo "Downloading geckodriver $URL..."
|
||||
wget "$URL" -O geckodriver.tar.gz
|
||||
tar -xzf geckodriver.tar.gz
|
||||
rm geckodriver.tar.gz
|
||||
|
||||
GECKODRIVER_DIR="/usr/local/share/gecko_driver"
|
||||
GECKODRIVER_BIN="$GECKODRIVER_DIR/geckodriver"
|
||||
|
||||
mkdir -p $GECKODRIVER_DIR
|
||||
mv "geckodriver" $GECKODRIVER_BIN
|
||||
|
||||
chmod +x $GECKODRIVER_BIN
|
||||
ln -s "$GECKODRIVER_BIN" /usr/bin/
|
||||
echo "GECKOWEBDRIVER=$GECKODRIVER_DIR" | tee -a /etc/environment
|
||||
|
||||
# Run tests to determine that the geckodriver installed as expected
|
||||
echo "Testing to make sure that script performed as expected, and basic scenarios work"
|
||||
if ! command -v geckodriver; then
|
||||
echo "geckodriver was not installed"
|
||||
exit 1
|
||||
fi
|
||||
|
||||
echo "Lastly, documenting what we added to the metadata file"
|
||||
ver=`./geckodriver --version|head -1|awk '{print $2}'`
|
||||
DocumentInstalledItem "Geckodriver (${ver}); Gecko Driver is available via GECKOWEBDRIVER environment variable"
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
#!/bin/bash
|
||||
################################################################################
|
||||
## File: google-chrome.sh
|
||||
## Desc: Installs google-chrome, chromedriver and selenium server
|
||||
## Desc: Installs google-chrome and chromedriver
|
||||
################################################################################
|
||||
|
||||
# Source the helpers for use with the script
|
||||
@@ -57,26 +57,3 @@ fi
|
||||
|
||||
echo "Lastly, documenting what we added to the metadata file"
|
||||
DocumentInstalledItem "Chromedriver ($(chromedriver --version)); Chrome Driver is available via CHROMEWEBDRIVER environment variable"
|
||||
|
||||
# Determine latest selenium standalone server version
|
||||
SELENIUM_LATEST_VERSION_URL=https://api.github.com/repos/SeleniumHQ/selenium/releases/latest
|
||||
SELENIUM_VERSION=$(curl $SELENIUM_LATEST_VERSION_URL | jq '.name' | tr -d '"' | cut -d ' ' -f 2)
|
||||
SELENIUM_VERSION_MAJOR_MINOR=$(echo $SELENIUM_VERSION | cut -d '.' -f 1,2)
|
||||
|
||||
# Download selenium standalone server
|
||||
echo "Downloading selenium-server-standalone v$SELENIUM_VERSION..."
|
||||
SELENIUM_JAR_NAME="selenium-server-standalone-$SELENIUM_VERSION.jar"
|
||||
wget https://selenium-release.storage.googleapis.com/$SELENIUM_VERSION_MAJOR_MINOR/$SELENIUM_JAR_NAME
|
||||
|
||||
echo "Testing to make sure that script performed as expected, and basic scenarios work"
|
||||
if [ ! -f "$SELENIUM_JAR_NAME" ]; then
|
||||
echo "Selenium server was not installed"
|
||||
exit 1
|
||||
fi
|
||||
|
||||
SELENIUM_JAR_PATH="/usr/share/java/selenium-server-standalone.jar"
|
||||
mv $SELENIUM_JAR_NAME $SELENIUM_JAR_PATH
|
||||
echo "SELENIUM_JAR_PATH=$SELENIUM_JAR_PATH" | tee -a /etc/environment
|
||||
|
||||
echo "Lastly, documenting what we added to the metadata file"
|
||||
DocumentInstalledItem "Selenium server standalone (available via SELENIUM_JAR_PATH environment variable)"
|
||||
|
||||
31
images/linux/scripts/installers/selenium.sh
Normal file
31
images/linux/scripts/installers/selenium.sh
Normal file
@@ -0,0 +1,31 @@
|
||||
#!/bin/bash
|
||||
################################################################################
|
||||
## File: selenium.sh
|
||||
## Desc: Installs selenium server
|
||||
################################################################################
|
||||
|
||||
# Source the helpers for use with the script
|
||||
source $HELPER_SCRIPTS/document.sh
|
||||
|
||||
# Determine latest selenium standalone server version
|
||||
SELENIUM_LATEST_VERSION_URL=https://api.github.com/repos/SeleniumHQ/selenium/releases/latest
|
||||
SELENIUM_VERSION=$(curl $SELENIUM_LATEST_VERSION_URL | jq '.name' | tr -d '"' | cut -d ' ' -f 2)
|
||||
SELENIUM_VERSION_MAJOR_MINOR=$(echo $SELENIUM_VERSION | cut -d '.' -f 1,2)
|
||||
|
||||
# Download selenium standalone server
|
||||
echo "Downloading selenium-server-standalone v$SELENIUM_VERSION..."
|
||||
SELENIUM_JAR_NAME="selenium-server-standalone-$SELENIUM_VERSION.jar"
|
||||
wget https://selenium-release.storage.googleapis.com/$SELENIUM_VERSION_MAJOR_MINOR/$SELENIUM_JAR_NAME
|
||||
|
||||
echo "Testing to make sure that script performed as expected, and basic scenarios work"
|
||||
if [ ! -f "$SELENIUM_JAR_NAME" ]; then
|
||||
echo "Selenium server was not installed"
|
||||
exit 1
|
||||
fi
|
||||
|
||||
SELENIUM_JAR_PATH="/usr/share/java/selenium-server-standalone.jar"
|
||||
mv $SELENIUM_JAR_NAME $SELENIUM_JAR_PATH
|
||||
echo "SELENIUM_JAR_PATH=$SELENIUM_JAR_PATH" | tee -a /etc/environment
|
||||
|
||||
echo "Lastly, documenting what we added to the metadata file"
|
||||
DocumentInstalledItem "Selenium server standalone (available via SELENIUM_JAR_PATH environment variable)"
|
||||
Reference in New Issue
Block a user