forked from btcpayserver/btcpayserver-php-client
-
Notifications
You must be signed in to change notification settings - Fork 1
/
integration_tests.sh
executable file
·89 lines (83 loc) · 2.05 KB
/
integration_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
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
#!/usr/bin/env bash
set_variables ()
{
while true
do
read -p "Input Email: " EMAIL
regex="^[a-z0-9!#\$%&'*+/=?^_\`{|}~-]+(\.[a-z0-9!#$%&'*+/=?^_\`{|}~-]+)*@([a-z0-9]([a-z0-9-]*[a-z0-9])?\.)+[a-z0-9]([a-z0-9-]*[a-z0-9])?\$";
if [[ "$EMAIL" =~ $regex ]]
then
export BTCPAY_EMAIL=$EMAIL
break
else
echo "Please input a valid email"
fi
done
while true
do
read -p "Input Password: " PASSWORD
read -p "Password Confirmation: " PASSWORD2
if [ "$PASSWORD" = "$PASSWORD2" ]
then
break
else
echo "Please input a valid password"
fi
done
while true
do
read -p "Input URL: " URL
if [ -z $URL ]
then
echo "Please input a valid URL"
else
break
fi
done
}
if [ -z "$1" ]
then
echo "No parameters passed so using Environment Variables"
if [ -z "$BTCPAY_EMAIL" ] || [ -z "$BTCPAY_PASSWORD"]
then
echo "ERROR: No Email or password are set."
echo "set BTCPAY_EMAIL and BTCPAY_PASSWORD as environment variables"
echo "or pass them as arguments when running this script"
while true; do
read -p "Do you wish to set your environment variables here? " yn
case $yn in
[Yy]* ) set_variables; break;;
[Nn]* ) echo "Closing script"; exit;;
* ) echo "Please answer yes or no.";;
esac
done
else
echo "Environment Variables already exist for BTCPAY."
fi
else
echo "Username $1 and Password $2 passed from command line"
URL=$1
EMAIL=$2
PASSWORD=$3
echo "Setting user and Password to new environment variables..."
fi
export BTCPAY_EMAIL=$EMAIL
export BTCPAY_PASSWORD=$PASSWORD
export BTCPAY_URL=$URL
echo "Using Email: $EMAIL"
echo "Using URL: $URL"
echo "Removing old keys..."
if [ -e /tmp/btcpayserver.pub ]
then
rm -rf /tmp/btcpayserver.pub
rm -rf /tmp/btcpayserver.pri
rm -rf /tmp/token.json
fi
echo "Checking if Selenium exists..."
if [ ! -f selenium-server-standalone-2.44.0.jar ]
then
echo "Downloading Selenium"
curl -O http://selenium-release.storage.googleapis.com/2.44/selenium-server-standalone-2.44.0.jar
fi
echo "Running Selenium and the tests"
php bin/behat tests/integrations