1
|
#!/bin/bash -x
|
2
|
#
|
3
|
# USAGE:
|
4
|
# bash -ex /usr/lib/selenium/headlessSelenium.sh [WORKSPACE_ROOT]
|
5
|
# whereas WORKSPACE_ROOT points to workspace root in the jenkins workspace
|
6
|
# which contains the whole project
|
7
|
#
|
8
|
if [ -z "$WORKSPACE_ROOT" ]; then
|
9
|
WORKSPACE_ROOT=$1
|
10
|
fi
|
11
|
|
12
|
FIREFOX_BIN="/usr/lib/iceweasel/firefox-bin"
|
13
|
|
14
|
DISPLAY=":99"
|
15
|
|
16
|
#
|
17
|
# This option creates screen screennum and sets its width, height, and depth to W, H, and D respectively.
|
18
|
# By default, only screen 0 exists and has the dimensions 1280x1024x8.
|
19
|
#
|
20
|
SCREEN="0 1280x1024x16"
|
21
|
|
22
|
#Use virtual X server
|
23
|
VIRTUAL_X="Xvfb $DISPLAY"
|
24
|
|
25
|
#init
|
26
|
if [ -z "$(pidof Xvfb)" ]; then
|
27
|
$VIRTUAL_X &
|
28
|
else
|
29
|
echo "Xvfb already running with pid $(pidof Xvfb)"
|
30
|
fi
|
31
|
export DISPLAY
|
32
|
|
33
|
cd $WORKSPACE_ROOT
|
34
|
|
35
|
if [ -n $2 ]; then
|
36
|
CONF_FILE_OPTION="-Ddataportal.test.conf=$2"
|
37
|
fi
|
38
|
|
39
|
echo "cleaning up old screenshots"
|
40
|
rm -fr screenshots
|
41
|
mkdir screenshots
|
42
|
|
43
|
mvn -Dwebdriver.firefox.bin=${FIREFOX_BIN} -DargLine="${CONF_FILE_OPTION}" clean test
|