echo"Invalid value: $invalid_value for option: --$invalid_option"
fi
echo-e"
"
echo"$help"
echo"$help_options" | column -t-s'\'
return
}
function init_args()
{
REQ_ARGS=("password")
# get command line arguments
POSITIONAL=()
# set default arguments
url="http://localhost"
username="minds_cypress_tests"
pro_username="minds_pro_cypress_tests"
pro_password=""
env=""
_video=false
while[[$# -gt 0 ]]
do
key="$1"
case$keyin
-h|--url)
url="$2"
shift 2
;;
-u|--username)
username="$2"
shift 2
;;
-p|--password)
password="$2"
shift 2
;;
-v|--video)
_video="$2"
shift 2
;;
-pu|--pro-username)
pro_username="$2"
shift 2
;;
-pp|--pro-password)
pro_password="$2"
shift 2
;;
-e|--env)
env=",$2"
shift 2
;;
*)
POSITIONAL+=("$1")# saves unknown option in array
shift
;;
esac
done
for i in"${REQ_ARGS[@]}";do
# $i is the string of the variable name
# ${!i} is a parameter expression to get the value
# of the variable whose name is i.
req_var=${!i}
if["$req_var"=""]
then
usage """--$i"
exit
fi
done
}
init_args $@
# cd to project root.
while[[$PWD!='/'&&${PWD##*/}!='front']];do cd ..;done
#run cypress with args.
echo$(npm bin)/cypress open --configbaseUrl=$url,video=$_video--envusername=$username,password=$password,pro_username=$pro_username,pro_password=$pro_password$env$POSITIONAL
$(npm bin)/cypress open --configbaseUrl=$url,video=$_video--envusername=$username,password=$password,pro_username=$pro_username,pro_password=$pro_password$env$POSITIONAL