diff docker/backend_e2e/Dockerfile @ 3427:f023f06fa344

docker (backend_e2e): added packages necessary to test Libervia + some debugging tools
author Goffi <goffi@goffi.org>
date Fri, 27 Nov 2020 16:31:05 +0100
parents bcdfe7905409
children b166a59b1724
line wrap: on
line diff
--- a/docker/backend_e2e/Dockerfile	Fri Nov 27 16:29:06 2020 +0100
+++ b/docker/backend_e2e/Dockerfile	Fri Nov 27 16:31:05 2020 +0100
@@ -4,6 +4,23 @@
 
 USER root
 
+ARG DEBIAN_FRONTEND=noninteractive
+
+RUN mkdir -m 777 /reports && \
+    apt-get install -y --no-install-recommends \
+    # firefox is needed to test Libervia via selenium
+    firefox-esr \
+    # VNC/X11 server for visual mode + window manager
+    # using openbox as it allows to resize easily when doing manual debugging/tests
+    # and it adapts correctly when doing driver.set_window_size
+    tigervnc-standalone-server openbox \
+    # useful for remote debugging
+    telnet net-tools \
+    # needed to make Firefox trust system certificates
+    # cf. https://askubuntu.com/a/1036637
+    p11-kit && \
+    ln -fs /usr/lib/x86_64-linux-gnu/pkcs11/p11-kit-trust.so /usr/lib/firefox-esr/libnssckbi.so
+
 # we install pre-generated certificates so we can do tests with valid TLS
 COPY --chown=root:root certificates/minica.pem /usr/local/share/ca-certificates/minica.crt
 COPY --chown=root:tls-cert certificates/server1.test/cert.pem /usr/share/sat/certificates/server1.test.pem
@@ -12,11 +29,40 @@
 
 COPY --chown=root:root sat.conf /etc/sat.conf
 
+RUN \
+    # we install webdriver (needed to control Firefox from Selenium)
+    # note: this is not absolutely necessary as long as we use helium because it includes
+    # is own webdriver
+    python -c 'from urllib.request import urlretrieve;\
+    urlretrieve(\
+    "https://github.com/mozilla/geckodriver/releases/download/v0.28.0"\
+    "/geckodriver-v0.28.0-linux64.tar.gz", "/usr/local/bin/geckodriver.tar.gz")' && \
+    cd /usr/local/bin && tar zxf geckodriver.tar.gz && rm -f geckodriver.tar.gz
+
 WORKDIR /home/sat
 USER sat
 
-RUN pip install pytest sh
+RUN \
+    # pytest and its plugins
+    pip install pytest pytest-timeout \
+    # needed to test jp
+    sh \
+    # needed to test libervia
+    helium \
+    # needed to check sent emails
+    aiosmtpd \
+    # useful for debugging
+    pudb
+
 RUN ./entrypoint.sh \
     # we create the file sharing component which will autoconnect when backend is started
     jp profile create file_sharing -j files.server1.test -p "" --xmpp-password test_e2e -C file_sharing -A && \
     sat stop
+
+ENV SAT_TEST_REPORT_DIR=/reports
+ENV DISPLAY=:0
+USER root
+RUN apt-get install -y openbox
+USER sat
+CMD /usr/bin/Xtigervnc -geometry 1024x768 -desktop "SàT e2e test" -rfbport 5900 -SecurityTypes None :0 & sleep 1 && openbox
+EXPOSE 5900