1 |
6657531f
|
Andreas Kohlbecker
|
#!/bin/bash -x
|
2 |
|
|
#
|
3 |
|
|
# USAGE:
|
4 |
0ed08d92
|
Andreas Kohlbecker
|
# 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 |
6657531f
|
Andreas Kohlbecker
|
#
|
8 |
0ed08d92
|
Andreas Kohlbecker
|
if [ -z "$WORKSPACE_ROOT" ]; then
|
9 |
|
|
WORKSPACE_ROOT=$1
|
10 |
|
|
fi
|
11 |
|
|
|
12 |
6657531f
|
Andreas Kohlbecker
|
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 |
0ed08d92
|
Andreas Kohlbecker
|
cd $WORKSPACE_ROOT
|
34 |
6657531f
|
Andreas Kohlbecker
|
|
35 |
|
|
if [ -n $2 ]; then
|
36 |
|
|
CONF_FILE_OPTION="-Ddataportal.test.conf=$2"
|
37 |
|
|
fi
|
38 |
|
|
|
39 |
d68a10c6
|
Andreas Kohlbecker
|
echo "cleaning up old screenshots"
|
40 |
|
|
rm -fr screenshots
|
41 |
|
|
mkdir screenshots
|
42 |
|
|
|
43 |
7b15b2e1
|
Andreas Kohlbecker
|
mvn -Dwebdriver.firefox.bin=${FIREFOX_BIN} -DargLine="${CONF_FILE_OPTION}" clean test
|