-
Notifications
You must be signed in to change notification settings - Fork 5
/
run_tests.sh
executable file
·57 lines (51 loc) · 1.32 KB
/
run_tests.sh
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
#!/usr/bin/env bash
#Usage: ./run-tests.sh <path to test>
#Example: ./run_tests.sh tests/ui
#check that pipenv is installed
if ! command -v pipenv &> /dev/null
then
echo "pipenv could not be found"
exit 1
fi
#check if pytest and fixtures are installed
if ! command -v pipenv run pytest --version&> /dev/null
then
echo "pytest is not installed"
exit 1
fi
#make sure pytest.ini is present
if ! test -f pytest.ini
then
echo "pytest.ini does not exists. Are you in the right directory ?"
exit 1
fi
#check that requirements are met if we are doing E2E testing
if [ "${E2E}" == 'yes' ]
then
#check that chromedriver is installed
if ! command -v chromedriver &> /dev/null
then
echo "Chromedriver could not be found. You can not run e2e testing"
exit 1
fi
#check that selenium client is installed
if ! pipenv graph | grep 'selenium'
then
echo "Selenium client is not installed. You can not run e2e testing"
exit 1
fi
fi
#run tests
#if path to test is provided check that it is valid and use it
#otherwise run tests from test directory defined in pytest.ini
if [ $# -eq 0 ]
then
pipenv run pytest -p no:cacheprovider
else
if ! [ -d "$1" ]
then
echo "Path to test is invalid"
exit 1
fi
pipenv run pytest -p no:cacheprovider "$1"
fi