Commit fd6f18c1 authored by Robert Lyon's avatar Robert Lyon
Browse files

Changes to allow behat to run in multi jobs



Change-Id: If416f9b458e91b0e22ab76a9fbae572932ca7f0e
Signed-off-by: Robert Lyon's avatarRobert Lyon <robertl@catalyst.net.nz>
(cherry picked from commit 1d66962e)
parent 83007f1b
...@@ -157,7 +157,9 @@ class BehatConfigManager { ...@@ -157,7 +157,9 @@ class BehatConfigManager {
'files_path' => get_mahararoot_dir() . '/test/behat/upload_files', 'files_path' => get_mahararoot_dir() . '/test/behat/upload_files',
'sessions' => array( 'sessions' => array(
'default' => array( 'default' => array(
'selenium2' => null 'selenium2' => array (
'wd_host' => $CFG->behat_selenium2
),
), ),
'headless' => array( 'headless' => array(
'goutte' => null 'goutte' => null
......
...@@ -5,12 +5,18 @@ ACTION=$1 ...@@ -5,12 +5,18 @@ ACTION=$1
SCRIPTPATH=`readlink -f "${BASH_SOURCE[0]}"` SCRIPTPATH=`readlink -f "${BASH_SOURCE[0]}"`
MAHARAROOT=`dirname $( dirname $( dirname "$SCRIPTPATH" ))` MAHARAROOT=`dirname $( dirname $( dirname "$SCRIPTPATH" ))`
SERVER=0 SERVER=0
test -z $SELENIUM_PORT && export SELENIUM_PORT=4400
test -z $PHP_PORT && export PHP_PORT=8000
test -z $XVFB_PORT && export XVFB_PORT=10
echo "S: $SELENIUM_PORT"
echo "P: $PHP_PORT"
# Wait and check if the selenium server is running in maximum 15 seconds # Wait and check if the selenium server is running in maximum 15 seconds
function is_selenium_running { function is_selenium_running {
for i in `seq 1 15`; do for i in `seq 1 15`; do
sleep 1 sleep 1
res=$(curl -o /dev/null --silent --write-out '%{http_code}\n' http://localhost:4444/wd/hub/status) res=$(curl -o /dev/null --silent --write-out '%{http_code}\n' http://localhost:${SELENIUM_PORT}/wd/hub/status)
if [ $res == "200" ]; then if [ $res == "200" ]; then
return 0; return 0;
fi fi
...@@ -20,7 +26,7 @@ function is_selenium_running { ...@@ -20,7 +26,7 @@ function is_selenium_running {
function cleanup { function cleanup {
echo "Shutdown Selenium" echo "Shutdown Selenium"
curl -o /dev/null --silent http://localhost:4444/selenium-server/driver/?cmd=shutDownSeleniumServer curl -o /dev/null --silent http://localhost:${SELENIUM_PORT}/selenium-server/driver/?cmd=shutDownSeleniumServer
if [[ $SERVER ]] if [[ $SERVER ]]
then then
...@@ -109,11 +115,11 @@ then ...@@ -109,11 +115,11 @@ then
then then
# we want to run selenium headless on a different display - this allows for that ;) # we want to run selenium headless on a different display - this allows for that ;)
echo "Starting Xvfb ..." echo "Starting Xvfb ..."
Xvfb :10 -ac > /dev/null 2>&1 & echo "PID [$!]" Xvfb :${XVFB_PORT} -ac > /tmp/xvfb.log 2>&1 & echo "PID [$!]"
DISPLAY=:10 nohup java -jar $SELENIUM_PATH > /dev/null 2>&1 & echo $! DISPLAY=:${XVFB_PORT} nohup java -jar $SELENIUM_PATH -port ${SELENIUM_PORT} > /tmp/selenium.log 2>&1 & echo $!
else else
java -jar $SELENIUM_PATH &> /dev/null & java -jar $SELENIUM_PATH -port ${SELENIUM_PORT} &> /tmp/selenium.log &
fi fi
if is_selenium_running; then if is_selenium_running; then
...@@ -125,7 +131,7 @@ then ...@@ -125,7 +131,7 @@ then
fi fi
echo "Start PHP server" echo "Start PHP server"
php --server localhost:8000 --docroot $MAHARAROOT/htdocs &>/dev/null & php --server localhost:${PHP_PORT} --docroot $MAHARAROOT/htdocs &> /tmp/php.log &
SERVER=$! SERVER=$!
BEHATCONFIGFILE=`php htdocs/testing/frameworks/behat/cli/util.php --config` BEHATCONFIGFILE=`php htdocs/testing/frameworks/behat/cli/util.php --config`
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment