-
Notifications
You must be signed in to change notification settings - Fork 8
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Browser testing via Selenium now supported
- Loading branch information
1 parent
f4f51c1
commit 01a61f9
Showing
6 changed files
with
130 additions
and
3 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
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -3,5 +3,7 @@ ip: "192.168.10.10" | |
site: site.test | ||
root: /vagrant | ||
|
||
databases: | ||
- dbname | ||
#selenium: true | ||
|
||
#databases: | ||
# - dbname |
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 |
---|---|---|
@@ -0,0 +1,26 @@ | ||
#!/usr/bin/env bash | ||
|
||
profile_file='/home/vagrant/.profile' | ||
|
||
source="\n\n# Run Chrome via Selenium Server | ||
start-chrome() { | ||
xvfb-run java -Dwebdriver.chrome.driver=/usr/local/bin/chromedriver -jar /usr/local/bin/selenium-server-standalone.jar | ||
} | ||
start-chrome-debug() { | ||
xvfb-run java -Dwebdriver.chrome.driver=/usr/local/bin/chromedriver -jar /usr/local/bin/selenium-server-standalone.jar -debug | ||
} | ||
# Run Chrome Headless | ||
start-chrome-headless() { | ||
chromedriver --url-base=/wd/hub | ||
}" | ||
|
||
# Append Selenium Server commands to ~/.profile | ||
if ! grep -cqs 'chromedriver' ${profile_file} | ||
then | ||
printf "$source" >> "$profile_file" | ||
fi | ||
|
||
# Re-source user profiles | ||
source ${profile_file} |
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 |
---|---|---|
@@ -0,0 +1,45 @@ | ||
#!/usr/bin/env bash | ||
|
||
[[ -n "$1" ]] && chromedriver_ver=$1 || chromedriver_ver=`curl -sS chromedriver.storage.googleapis.com/LATEST_RELEASE` | ||
is_updated=0 | ||
|
||
# Install Google Chrome. | ||
if [[ -f "/usr/bin/google-chrome-stable" ]] | ||
then | ||
echo 'Google Chrome already installed' | ||
else | ||
curl -sS -o - https://dl-ssl.google.com/linux/linux_signing_key.pub | apt-key add > /dev/null 2>&1 | ||
echo "deb http://dl.google.com/linux/chrome/deb/ stable main" >> /etc/apt/sources.list.d/google-chrome.list | ||
apt-get update > /dev/null 2>&1 | ||
is_updated=1 | ||
apt-get -y install google-chrome-stable > /dev/null 2>&1 | ||
fi | ||
|
||
# Install ChromeDriver. | ||
if [[ -f "/usr/local/bin/chromedriver" ]] | ||
then | ||
echo 'ChromeDriver already installed' | ||
else | ||
if [[ ${is_updated} == 0 ]] | ||
then | ||
apt-get update > /dev/null 2>&1 | ||
is_updated=1 | ||
fi | ||
apt-get -y install unzip > /dev/null 2>&1 | ||
wget -N http://chromedriver.storage.googleapis.com/${chromedriver_ver}/chromedriver_linux64.zip -P ~/ > /dev/null 2>&1 | ||
unzip ~/chromedriver_linux64.zip -d ~/ > /dev/null 2>&1 | ||
rm ~/chromedriver_linux64.zip | ||
mv -f ~/chromedriver /usr/local/bin/chromedriver | ||
fi | ||
|
||
# Install Xvfb. | ||
if [[ -f "/usr/bin/Xvfb" ]] | ||
then | ||
echo "Xvfb already installed" | ||
else | ||
if [[ ${is_updated} == 0 ]] | ||
then | ||
apt-get update > /dev/null 2>&1 | ||
fi | ||
apt-get -y install xvfb > /dev/null 2>&1 | ||
fi |
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,23 @@ | ||
#!/usr/bin/env bash | ||
|
||
java_ver=$1 | ||
selenium_ver=$2 | ||
selenium_sub_dir=$(echo "$selenium_ver" | cut -d"." -f-2) | ||
|
||
# Install Java JRE | ||
if [[ -f "/usr/bin/java" ]] | ||
then | ||
echo 'Java already installed' | ||
else | ||
apt-get update > /dev/null 2>&1 | ||
apt-get -y install openjdk-${java_ver}-jre-headless > /dev/null 2>&1 | ||
fi | ||
|
||
# Install Selenium Server Standalone | ||
if [[ -f "/usr/local/bin/selenium-server-standalone.jar" ]] | ||
then | ||
echo 'Selenium Server Standalone already installed' | ||
else | ||
wget -N http://selenium-release.storage.googleapis.com/${selenium_sub_dir}/selenium-server-standalone-${selenium_ver}.jar -P ~/ > /dev/null 2>&1 | ||
mv -f ~/selenium-server-standalone-${selenium_ver}.jar /usr/local/bin/selenium-server-standalone.jar | ||
fi |