Last active
January 22, 2020 09:06
-
-
Save Eflyax/87fcd6fdaad2aa1b0eb21021ff28db62 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/sh | |
echo $(pwd)/tests/selenium/ci.conf.js; | |
if [ -z "$3" ] | |
then | |
configFile="ci.conf.js" | |
else | |
configFile=$3 | |
fi | |
if [ -z "$4" ] | |
then | |
configMain="conf.js" | |
else | |
configMain=$4 | |
fi | |
if [ -z "$5" ] | |
then | |
wwwRoot="/www/" | |
else | |
wwwRoot=$5 | |
fi | |
mkdir -p /home/www/$2/$1/tests/selenium/ | |
cp -Rf /root/files/wdio/node_modules /home/www/$2/$1/tests/selenium | |
cp -Rf $(pwd)/tests/selenium/ /home/www/$2/$1/tests | |
RESULT="$(python -c "import sys; sys.stdout.write(u'${1}'[:1].isnumeric() and '1' or '0')")" | |
if [ "$RESULT" = 1 ]; then | |
gopayConfig="goPay: false," | |
else | |
gopayConfig="goPay: true," | |
fi | |
cat > /home/www/$2/$1/tests/selenium/$configFile <<EOF | |
const {config} = require('./$configMain'); | |
var deepmerge = require('deepmerge'); | |
exports.config = deepmerge(config, { | |
baseUrl: 'http://$1.$2.xxxxxx.cz', | |
$gopayConfig | |
}, {clone: false}); | |
EOF | |
ls -la /home/www/$2/$1/tests/selenium/ | |
cd /home/www/$2/$1/tests/selenium | |
sudo npx wdio $configFile | tee output.txt | |
ps -ef | grep '$1' | grep -v grep | awk '{print $2}' | xargs -r kill -9 | |
if grep "Spec Files:" output.txt > /dev/null | |
then | |
echo "Spec files found, continue..."; | |
else | |
echo "exit 0 XCV3"; | |
exit 0; | |
fi | |
rsync -avz $(pwd)/../../$wwwRoot/selenium root@xxxxxxx:/home/www/$2/$1$wwwRoot | |
if grep " failed, " output.txt > /dev/null | |
then | |
echo "exit 1 XCV4"; | |
exit 1; | |
else | |
echo "exit 0 XCV4"; | |
exit 0; | |
fi |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment