Veiko Aasa 53a0a54f18 functional-tests: Fix installation errors in install.sh script
- On Debian 10, pin pytest-bdd version to 3.2.1, this is the latest
  version that supports pytest 3.10.1.
- Install wheel and pytest-xdist packages from the Debian repos.
- Add git as a dependency for functional tests.
- Fix regexp when getting Gecko version from the Github api, for some
  reason after colon, sometimes there is a space and sometimes not.

Tests performed on Debian stable, testing and unstable:
- Installing dependencies with the install.sh script succeeds.
- No regressions when running tests.

Signed-off-by: Veiko Aasa <veiko17@disroot.org>
2021-01-05 17:31:50 +01:00

44 lines
1.2 KiB
Bash
Executable File

#!/bin/bash
set -euo pipefail
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
if [ $(lsb_release --release --short) == '10' ]
then
pip3 install pytest-bdd==3.2.1
else
pip3 install pytest-bdd
fi
pip3 install splinter pytest-splinter pytest-xvfb
echo "Installing geckodriver"
(
DL_DIR=/tmp/gecko
GECKO_VERSION=$(curl --silent "https://api.github.com/repos/mozilla/geckodriver/releases/latest" | grep -Po '"tag_name":\s*"\K.*?(?=")')
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 && \
test "$GECKO_VERSION" = "v$(geckodriver --version | head -1 | awk '{ print $2 }')" && \
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"
)