Skip to content

Instantly share code, notes, and snippets.

@mrself
Last active March 26, 2018 09:51
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save mrself/a28545a7b29c18b063615ef02dd6cf9e to your computer and use it in GitHub Desktop.
Save mrself/a28545a7b29c18b063615ef02dd6cf9e to your computer and use it in GitHub Desktop.
Run nightwatch tests with manually started selenium server
#!/bin/bash
# It supposes you have bin directory in root project dir with `geckodriver` and `selenium-server-standalone-3.9.1.jar` files
# Create a log file for selenium
logfile="logs/selenium.log"
# Ensure a log file exists
if [ ! -e "$logfile" ] ; then
touch "$logfile"
fi
# Ensure a log file is empty
> $logfile
export DISPLAY=:99
pkill Xvfb
Xvfb :99 &
pkill java
basedir=$(pwd)
nohup java -jar -Dwebdriver.gecko.driver="$basedir/bin/geckodriver" "$basedir/bin/selenium-server-standalone-3.9.1.jar" > $logfile &
# Sleep while selenium is not started
while ! grep "Selenium Server is up and running" $logfile
do
sleep 1
done
./node_modules/.bin/nightwatch
#!/usr/bin/env bash
apt-get update
# install nvm
sudo apt-get install -y build-essential libssl-dev
curl -sL https://raw.githubusercontent.com/creationix/nvm/v0.31.0/install.sh -o install_nvm.sh
bash install_nvm.sh
source ~/.profile
sudo apt-get install -y npm
nvm install 7.5.0
nvm use 7.5.0
# install java
sudo apt-get install -y default-jre
sudo apt-get install -y default-jdk
sudo add-apt-repository -y ppa:webupd8team/java
sudo apt-get update
sudo apt-get install -y oracle-java9-installer
# install x virtual frame buffer for selenium display
sudo apt-get install -y xvfb
# install npm modules
cd /vagrant
npm i
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment