mirror of
https://github.com/freedombox/FreedomBox.git
synced 2026-05-27 10:44:33 +00:00
functional_tests: Allow provisioning VM for functional tests
It's now possible to run the tests in the VM more easily without copy-pasting too much from HACKING.md. `vagrant provision --provisiion-with tests` will take care of the dependencies. freedombox/plinth#1521 - Provision VM to run function functional tests Reviewed-by: James Valleroy <jvalleroy@mailbox.org>
This commit is contained in:
parent
5c2a8c0b40
commit
d31b0ee3c7
11
HACKING.md
11
HACKING.md
@ -169,6 +169,9 @@ executed (red).
|
||||
|
||||
### Install Dependencies
|
||||
|
||||
**For running tests in the VM** run `vagrant provision --provision-with tests`.
|
||||
Otherwise follow the instructions below.
|
||||
|
||||
```
|
||||
$ pip3 install splinter
|
||||
$ pip3 install pytest-splinter
|
||||
@ -209,7 +212,13 @@ tests will create the required user using FreedomBox's first boot process.
|
||||
|
||||
### Run Functional Tests
|
||||
|
||||
Run
|
||||
**When inside a VM you will need to target the guest VM**
|
||||
|
||||
```bash
|
||||
export FREEDOMBOX_URL=https://localhost
|
||||
```
|
||||
|
||||
You will be running `py.test-3`.
|
||||
|
||||
```
|
||||
$ py.test-3 --include-functional
|
||||
|
||||
1
Vagrantfile
vendored
1
Vagrantfile
vendored
@ -44,6 +44,7 @@ Vagrant.configure(2) do |config|
|
||||
# Install ncurses-term
|
||||
DEBIAN_FRONTEND=noninteractive apt-get install -y ncurses-term
|
||||
SHELL
|
||||
config.vm.provision "tests", run: "never", type: "shell", path: "functional_tests/install.sh"
|
||||
config.vm.post_up_message = "FreedomBox virtual machine is ready
|
||||
for development. You can run the development version of Plinth using
|
||||
the following command.
|
||||
|
||||
32
functional_tests/install.sh
Executable file
32
functional_tests/install.sh
Executable file
@ -0,0 +1,32 @@
|
||||
#!/bin/bash
|
||||
set -euo pipefail
|
||||
IFS=$'\n\t'
|
||||
|
||||
echo "Installing requirements"
|
||||
sudo apt-get install -yq --no-install-recommends \
|
||||
python3-pytest \
|
||||
python3-pip firefox \
|
||||
xvfb
|
||||
pip3 install splinter pytest-splinter pytest-bdd pytest-xvfb
|
||||
|
||||
echo "Installing geckodriver"
|
||||
(
|
||||
DL_DIR=/tmp/gecko
|
||||
GECKO_VERSION="v0.24.0"
|
||||
FILENAME="geckodriver-${GECKO_VERSION}-linux64.tar.gz"
|
||||
GECKO_URL="https://github.com/mozilla/geckodriver/releases/download/$GECKO_VERSION/$FILENAME"
|
||||
|
||||
test -e /usr/local/bin/geckodriver && echo "geckodriver already installed" && exit 0
|
||||
|
||||
mkdir -p $DL_DIR
|
||||
cd $DL_DIR
|
||||
if ! [[ -e $FILENAME ]] ; then
|
||||
wget --no-clobber \
|
||||
--continue \
|
||||
--no-verbose \
|
||||
"$GECKO_URL"
|
||||
fi
|
||||
tar xf $FILENAME
|
||||
sudo mv geckodriver /usr/local/bin/geckodriver
|
||||
echo "Done"
|
||||
)
|
||||
Loading…
x
Reference in New Issue
Block a user