Commit d31b0ee3 authored by LoveIsGrief's avatar LoveIsGrief Committed by James Valleroy

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's avatarJames Valleroy <jvalleroy@mailbox.org>
parent 5c2a8c0b
......@@ -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
......
......@@ -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.
......
#!/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"
)
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment