forked from qmk/qmk_firmware
-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
* Add a couple of nightwatch targets to npm - `npm run init_nightwatch` to bootstrap the headless selenium stuff - `npm run nightwatch` to run the task Only tested on OSX. - fix up version number in nightwatch.conf file - remove binary commits * Fix up security warnings from github - everything but one thing is fixed up - the final thing is an HTML report writer we don't use it so I think it's ok for now. Hopefully someone will patch it. * Remove unused vars * Ignore temp files * Update docs * Fix warnings from shellcheck * Simplify script - refactor variable assignments - assign variables for re-use to avoid building strings - avoid creating temporary artifacts while unpacking - remove a branch * Remove a redundant rm * Update README.md to use nvm - to avoid issues with outdated npm * numbering * markdown formatting * Add instructions to install headless chrome
- Loading branch information
1 parent
829c2b3
commit c7482c7
Showing
8 changed files
with
229 additions
and
375 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Binary file not shown.
Binary file not shown.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,88 +1,82 @@ | ||
#!/bin/bash | ||
#!/bin/bash -e | ||
set -x | ||
|
||
# This script is intended to be run from the qmk_configurator/functional_tests directory | ||
# Installs Chrome Web Driver | ||
# Installs Selenium Standalone Server | ||
|
||
if [ "$EUID" -ne 0 ]; then | ||
exec sudo "$0" "$@"; | ||
fi | ||
|
||
# Determine which OS | ||
OS="$(uname -s)" | ||
|
||
# Set Versions | ||
SELENIUM_VERSION="3.13.0" | ||
CHR_DRIVER_VER="2.40" | ||
GKO_DRIVER_VER="0.21.0" | ||
CHR_DRIVER_URL="https://chromedriver.storage.googleapis.com/${CHR_DRIVER_VER}" | ||
GKO_DRIVER_URL="https://github.com/mozilla/geckodriver/releases/download/v${GKO_DRIVER_VER}" | ||
|
||
# Get Paths | ||
PWD="$(pwd)" # should be qmk_configurator/functional_tests | ||
ROOTPWD=$(pwd) # should be qmk_configurator/functional_tests | ||
|
||
rm -fr ./bin ./tmp | ||
mkdir -p ./bin ./tmp | ||
|
||
# Determine which Chrome Web Driver to download based on system | ||
if [ "${OS}" == "Darwin" ]; then | ||
CHR_DRIVER="https://chromedriver.storage.googleapis.com/${CHR_DRIVER_VER}/chromedriver_mac64.zip" | ||
GKO_DRIVER="https://github.com/mozilla/geckodriver/releases/download/v${GKO_DRIVER_VER}/geckodriver-v${GKO_DRIVER_VER}-macos.tar.gz" | ||
DRIVER="mac64" | ||
DRIVER="macos" | ||
GKO_ARCHIVE="geckodriver-v${GKO_DRIVER_VER}-${DRIVER}.tar.gz" | ||
CHR_ARCHIVE="chromedriver_mac64.zip" | ||
else | ||
VERSION="$(uname -m)" | ||
if [ "${VERSION}" == "x86_64:" ]; then | ||
CHR_DRIVER="https://chromedriver.storage.googleapis.com/${CHR_DRIVER_VER}/chromedriver_linux32.zip" | ||
GKO_DRIVER="https://github.com/mozilla/geckodriver/releases/download/v${GKO_DRIVER_VER}/geckodriver-v${GKO_DRIVER_VER}-linux32.tar.gz" | ||
DRIVER="linux32" | ||
DRIVER="linux32" | ||
else | ||
CHR_DRIVER="https://chromedriver.storage.googleapis.com/${CHR_DRIVER_VER}/chromedriver_linux64.zip" | ||
GKO_DRIVER="https://github.com/mozilla/geckodriver/releases/download/v${GKO_DRIVER_VER}/geckodriver-v${GKO_DRIVER_VER}-linux64.tar.gz" | ||
DRIVER="linux64" | ||
DRIVER="linux64" | ||
fi | ||
GKO_ARCHIVE="geckodriver-v${GKO_DRIVER_VER}-${DRIVER}.tar.gz" | ||
CHR_ARCHIVE="chromedriver_${DRIVER}.zip" | ||
fi | ||
CHR_DRIVER="${CHR_DRIVER_URL}/${CHR_ARCHIVE}" | ||
GKO_DRIVER="${GKO_DRIVER_URL}/${GKO_ARCHIVE}" | ||
|
||
# Download Chrome Web Driver .zip file to temporary location | ||
TEMP_PATH=${PWD}"/tmp/chromedriver" | ||
mkdir "$TEMP_PATH" && pushd "$TEMP_PATH" | ||
TEMP_PATH="${ROOTPWD}/tmp/chromedriver" | ||
mkdir -p "$TEMP_PATH" && cd "$TEMP_PATH" | ||
wget $CHR_DRIVER -P "$TEMP_PATH" | ||
printf "Chrome Driver zip file downloaded to %s.\\n" "${TEMP_PATH}" | ||
|
||
# Unzip Chrome Driver zip file to qmk_configurator/functional_tests/bin directory | ||
DEST_PATH=${PWD}"/bin" | ||
unzip "${TEMP_PATH}"/chromedriver_$DRIVER.zip | ||
sudo mv -f ./chromedriver "$DEST_PATH" | ||
sudo chown root:root "$DEST_PATH" | ||
sudo chmod 0755 "$DEST_PATH" | ||
DEST_PATH=${ROOTPWD}"/bin" | ||
unzip "${TEMP_PATH}/${CHR_ARCHIVE}" | ||
mv -f ./chromedriver "$DEST_PATH" | ||
chmod 0755 "$DEST_PATH" | ||
|
||
printf "Installed Chrome Web Driver for %s to %s.\\n" "${DRIVER}" "${DEST_PATH}" | ||
|
||
# Download geckodriver to temporary location | ||
TEMP_PATH=${PWD}"/tmp/geckodriver" | ||
mkdir "$TEMP_PATH" && pushd "$TEMP_PATH" | ||
TEMP_PATH=${ROOTPWD}"/tmp/geckodriver" | ||
mkdir -p "$TEMP_PATH" && cd "$TEMP_PATH" | ||
wget $GKO_DRIVER -P "$TEMP_PATH" | ||
printf "geckodriver downloaded to %s.\\n" "${TEMP_PATH}" | ||
|
||
# gunzip/tar geckodriver to qmk_configurator/functional_tests/bin directory | ||
DEST_PATH=${PWD}"/bin" | ||
if [ "${OS}" == "Darwin" ]; then | ||
DRIVER="macos" | ||
fi | ||
|
||
gunzip "${TEMP_PATH}"/geckodriver-v$GKO_DRIVER_VER-$DRIVER.tar.gz | ||
tar xvf "${TEMP_PATH}"/geckodriver-v$GKO_DRIVER_VER-$DRIVER.tar | ||
DEST_PATH=${ROOTPWD}"/bin" | ||
gunzip < "${TEMP_PATH}/${GKO_ARCHIVE}" | tar xvf - | ||
|
||
sudo mv -f ./geckodriver "$DEST_PATH" | ||
sudo chown root:root "$DEST_PATH" | ||
sudo chmod 0755 "$DEST_PATH" | ||
mv -f ./geckodriver "$DEST_PATH" | ||
chmod 0755 "${DEST_PATH}" | ||
|
||
printf "Installed geckodriver for %s to %s.\\n" "${DRIVER}" "${DEST_PATH}" | ||
|
||
#Download and install Standalone Selenium Server | ||
SELENIUM_JAR_FILE=selenium-server-standalone-$SELENIUM_VERSION.jar | ||
wget http://selenium-release.storage.googleapis.com/$(echo "$SELENIUM_VERSION" | cut -d'.' -f-2)/$SELENIUM_JAR_FILE -P "$TEMP_PATH" | ||
mv -f "$TEMP_PATH/$SELENIUM_JAR_FILE" "$DEST_PATH" | ||
chown root:root "$DEST_PATH$SELENIUM_JAR_FILE" | ||
chmod 755 "$DEST_PATH$SELENIUM_JAR_FILE" | ||
wget "http://selenium-release.storage.googleapis.com/$(echo "$SELENIUM_VERSION" | cut -d'.' -f-2)/$SELENIUM_JAR_FILE" -P "$TEMP_PATH" | ||
mv -f "${TEMP_PATH}/${SELENIUM_JAR_FILE}" "${DEST_PATH}" | ||
chmod 755 "${DEST_PATH}/${SELENIUM_JAR_FILE}" | ||
|
||
printf "Installed Selenium Standalone Server %s. \\n" "${SELENIUM_VERSION}" | ||
|
||
printf "Deleting directory qmk_configurator/functional_tests/tmp \\n" | ||
sudo rm -rf tmp/ | ||
rm -rf ./tmp/ | ||
|
||
printf "Installation is successful. \\n" | ||
printf "Installation is successful. \\n" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.