diff --git a/t/selenium/Dockerfile b/t/selenium/Dockerfile index 1a1bd1827c..85a3659a43 100644 --- a/t/selenium/Dockerfile +++ b/t/selenium/Dockerfile @@ -54,6 +54,10 @@ RUN wget http://deb.sipwise.com/files/libtest-pretty-perl_0.31-1~bpo80+1_all.deb RUN dpkg --force-depends -i libtest-pretty-perl_0.31-1~bpo80+1_all.deb RUN apt-get --assume-yes -f install +RUN echo "cd /code && ./t/selenium/testrunner 1.2.3.4" >/home/selenium/.bash_history +RUN echo "su - selenium" >/root/.bash_history +EXPOSE 5999 + WORKDIR /home/selenium ################################################################################ @@ -61,16 +65,16 @@ WORKDIR /home/selenium # ---------------------- # When you want to build the base image from scratch (jump to the next section if you don't want to build yourself!): # % docker build --tag="ngcp-panel-tests-selenium-jessie" . -# % docker run --rm -p 5999 -i -t -v $(pwd)/../..:/code:rw ngcp-panel-tests-selenium-jessie:latest bash +# % docker run --rm -p 5999:5999 -i -t -v $(pwd)/../..:/code:rw ngcp-panel-tests-selenium-jessie:latest bash # # Use the existing docker image: # % docker pull docker1.mgm.sipwise.com/ngcp-panel-tests-selenium-jessie -# % docker run --rm -p 5999 -i -t -v $(pwd)/../..:/code:rw docker1.mgm.sipwise.com/ngcp-panel-tests-selenium-jessie:latest bash +# % docker run --rm -p 5999:5999 -i -t -v $(pwd)/../..:/code:rw docker1.mgm.sipwise.com/ngcp-panel-tests-selenium-jessie:latest bash # # Inside docker: # su - selenium # cd /code && ./t/selenium/testrunner $IP_OF_NGCP_SYSTEM # IP_OF_NGCP_SYSTEM can be e.g. IP of a `vagrant up ce-trunk` system (eth1) # # On host (where vncviewer can be e.g. from Debian package xvnc4viewer): -# % vncviewer geometry=1280x1024x16 $(docker inspect $(docker ps -l -q) | jq -r '.[0].NetworkSettings.IPAddress'):5999 +# % vncviewer geometry=1280x1024x16 localhost:5999 ################################################################################ diff --git a/t/selenium/testrunner b/t/selenium/testrunner index 76d8bf1ab4..8769b07512 100755 --- a/t/selenium/testrunner +++ b/t/selenium/testrunner @@ -22,6 +22,7 @@ SERVER="${1}" # vnc echo "Setting VNC password" printf '%s\n%s\n\n' "${PASSWORD}" "${PASSWORD}" | vncpasswd >/dev/null +PASSWORD_ENCODED=$(hexdump -v -e '"\\""x" 1/1 "%02X"' <$HOME/.vnc/passwd) xvnc_process=$(pgrep -f 'Xvnc4 :99' || true) if [ -n "${xvnc_process:-}" ] ; then echo "Warning: existing VNC server found, not restarting Xvnc4 process (PID: $xvnc_process)." @@ -38,11 +39,11 @@ DISPLAY=:99 /usr/bin/java -jar /home/selenium/selenium-server-standalone.jar -tr echo "################################################################################" echo "Finished main setup, now running tests ..." echo "Selenium server log file available at /home/selenium/selenium.log" -echo "Watch at test runs by connecting via VNC (enter password '${PASSWORD}'):" -echo "vncviewer geometry=1280x1024x16 \$(docker inspect \$(docker ps -l -q) | jq -r '.[0].NetworkSettings.IPAddress'):5999" +echo "Watch at test runs by connecting via VNC (password: '${PASSWORD}'):" +echo "echo -e '$PASSWORD_ENCODED' >/tmp/vncpasswd ; vncviewer geometry=1280x1024x16 passwd=/tmp/vncpasswd localhost:5999" RC=0 -CATALYST_SERVER="https://${SERVER}:1443/" prove -v --color -Pretty -l -It/lib t/selenium/*.t | tee -a /code/selenium.pretty || RC=$? +CATALYST_SERVER="https://${SERVER}:1443" prove -v --color -l -It/lib t/selenium/*.t | tee -a /code/selenium.pretty || RC=$? #CATALYST_SERVER=https://${SERVER}:1443/ prove --formatter TAP::Formatter::JUnit -l -It/lib t/selenium/*.t | tee -a /code/selenium.xml || RC=$? echo "Finished test execution, test execution returned with exit code ${RC}." for file in /code/selenium.pretty /code/selenium.xml ; do