Created
May 24, 2017 23:20
-
-
Save fouad-j/c3ac057889be284ff4acfe24f1673353 to your computer and use it in GitHub Desktop.
prototype for e2e launcher to use it in jenkins for example
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
#!/usr/bin/env bash | |
set -u | |
source utils.sh | |
declare -A servers=([INTEGRATION]='pi@pi' [HOMOLOGATION]='fouad@integration' [UAT]='ubuntu@lisa-prod'); | |
rapport_directory="./report/$(date +%d_%m_%Y__%H_%M)"; | |
environment=${servers['HOMOLOGATION']}; | |
username=""; | |
password=""; | |
OPTERR=0 | |
while getopts ":s:u:p:h" option ; do | |
case $option in | |
s ) | |
case "$OPTARG" in | |
"INTEGRATION"|"HOMOLOGATION"|"UAT") environment=${servers[$OPTARG]};; | |
*) echo "Error: unknown environment" >&2; exit 1 ;; | |
esac | |
;; | |
u ) username=$OPTARG ;; | |
p ) password=$OPTARG ;; | |
h ) usage; exit 0 ;; | |
: ) echo "Missed argument for -$OPTARG" >&2; usage; exit 1 ;; | |
? ) echo "Unknown option -$OPTARG" >&2; usage; exit 1 ;; | |
esac | |
done | |
shift $((OPTIND - 1)); | |
if [ -d "$rapport_directory" ] ; then | |
mkdir -p $rapport_directory | |
fi | |
spalsh; | |
column -t -s '"'<<- END | |
------------------------------------ | |
"Start E2E Tests:" | |
------------------------------------ | |
Environment: $environment | |
Account: $username | |
Report: $rapport_directory | |
------------------------------------ | |
END | |
echo ">> Npm install modules"; | |
#npm install 2>&1 "${rapport_directory}/logs_selenium_server"; | |
if [ $? -ne 0 ]; then | |
echo "[KO] Npm install fail"; exit 1; | |
fi | |
echo "[OK] npm install successfully"; | |
separator | |
echo ">> Start Server"; | |
#java -jar ./selenium/selinum.jar 2>&1 "${rapport_directory}/logs_selenium_server" & | |
echo "Please wait ..."; | |
#while ! curl http://localhost:4444/wd/hub/status &>/dev/null; do :; done | |
echo "[OK] Server started"; | |
separator | |
echo ">> Start E2E Tests"; | |
#./node_modules/protractor/protractor protractor.conf params.server=$environment params.login=$username params.password=$password; | |
if [ $? -ne 0 ]; then | |
echo "[KO] tests failed, , please check report for more details"; exit 1; | |
fi | |
echo "[OK] tests executed with successfully, please check report"; | |
separator | |
#curl -s -L http://localhost:4444/selenium-server/driver?cmd=shutDownSeleniumServer > /dev/null 2>&1 | |
#killall chromedriver; |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment