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 2021-06-04 11:23:48 +05:30 committed by Sunil Mohan Adapa
parent e070fed8e8
commit ca8c5bba4c
No known key found for this signature in database
GPG Key ID: 43EA1CFF0AA7C5F2
3 changed files with 16 additions and 8 deletions

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
```

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

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"
(