tests: functional: Get rid of dependency on xvfb

This removes the dependencies xvfb and pytest-xvfb.

--splinter-headless can be used as a substitute for running tests in
headless mode.

[sunil: Edit description as running run-tests starts plinth in container]
[sunil: Retain the xauth command]
Signed-off-by: Sunil Mohan Adapa <sunil@medhas.org>
Reviewed-by: Veiko Aasa <veiko17@disroot.org>
Reviewed-by: Sunil Mohan Adapa <sunil@medhas.org>
This commit is contained in:
Joseph Nuthalapati authored and Sunil Mohan Adapa committed 2022-04-30 12:09:53 -07:00
1 parent e070fed8e8
commit ca8c5bba4c
3 files changed
+16 -8

No files matched your search

+13 -4
View File
@@ -71,13 +71,23 @@ development environment inside a systemd-nspawn container.
host$ ./container up
```
4. To run unit and functional tests for an app:
1. To run unit tests:
```bash
host$ ./container run-tests --pytest-args -v --include-functional --no-xvfb plinth/modules/{app name}
host$ ./container run-tests
```
5. SSH into the running container with the following command:
1. To run unit and functional tests for an app:
```bash
host$ ./container run-tests --pytest-args -v --include-functional --splinter-headless plinth/modules/{app-name}
```
Drop the option `--splinter-headless` if you want to see the tests running
in browser windows. Not specifying a module in the above command would run
functional tests for all the apps and also unit tests.
1. SSH into the running container with the following command:
```bash
host$ ./container ssh
@@ -443,7 +453,6 @@ host$ pip3 install splinter
host$ pip3 install pytest-splinter
host$ pip3 install pytest-xdist # optional, to run tests in parallel
host$ sudo apt install firefox
host$ sudo apt install xvfb python3-pytest-xvfb # optional, to avoid opening browser windows
host$ sudo apt install smbclient # optional, to test samba
```
+1 -1
View File
@@ -227,7 +227,7 @@ then
echo
fi
if [[ "{pytest_command}" =~ "--no-xvfb" ]]
if [[ "{pytest_command}" != *"--splinter-headless"* ]]
then
# Use the X11 authority file from the fbx user to run GUI programs
xauth merge /home/fbx/.Xauthority
+2 -3
View File
@@ -5,10 +5,9 @@ IFS=$'\n\t'
echo "Installing requirements"
sudo apt-get install -yq --no-install-recommends \
python3-pytest python3-pytest-django python3-pytest-xdist \
python3-pip python3-wheel firefox-esr git smbclient\
xvfb
python3-pip python3-wheel firefox-esr git smbclient
pip3 install splinter pytest-splinter pytest-xvfb pytest-reporter-html1
pip3 install --user splinter pytest-splinter pytest-reporter-html1
echo "Installing geckodriver"
(