Skip to content

Instantly share code, notes, and snippets.

@DMeechan
Last active June 19, 2018 13:40
Show Gist options
  • Save DMeechan/8f1ae1ae4943a6734d29d6c744498d5b to your computer and use it in GitHub Desktop.
Save DMeechan/8f1ae1ae4943a6734d29d6c744498d5b to your computer and use it in GitHub Desktop.
DevOps Course Chapter 9 - integrating our automated tests into our delivery pipeline
#!/bin/bash
# This script is run on IBM Cloud in the delivery pipeline
# It enables a Test stage to run automated Selenium tests
# In Firefox using a virtual display
echo "==> Updating all dependencies"
sudo apt-get -y --force-yes update
echo "==> Installing Firefox"
sudo apt-get -y --force-yes install firefox
firefox -v
echo "==> Installing virtual display buffer"
sudo apt-get -y --force-yes install xvfb xfonts-base xfonts-scalable xfonts-100dpi xfonts-75dpi xfonts-cyrillic xorg dbus-x11
sudo apt-get -y --force-yes install dialog apt-utils
echo "==> Installing Firefox Geckodriver"
wget https://github.com/mozilla/geckodriver/releases/download/v0.17.0/geckodriver-v0.17.0-linux64.tar.gz
mkdir -p bin
tar xvzf geckodriver-v0.17.0-linux64.tar.gz -C bin
export PATH=$(pwd)/bin:$PATH
echo "==> Installing Selenium"
sudo pip install -U Selenium
echo "==> Running Xvfb"
Xvfb :10 -ac &
export DISPLAY=:10vfb :10 -ac & export DISPLAY=:10
echo "==> Installing NVM"
npm config delete prefix
sudo apt-get -y --force-yes update
sudo apt-get -y --force-yes install build-essential libssl-dev
curl https://raw.githubusercontent.com/creationix/nvm/v0.33.11/install.sh | sh
source ~/.profile
echo "==> Updating Node"
nvm install 10.2.1
node -v
npm -v
echo "==> Finished installing everything"
npm test
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment