Created
March 27, 2020 19:13
-
-
Save deanohyeah/1fc090e15e4b00a616b66020cea8a5db to your computer and use it in GitHub Desktop.
Parse flags passed into a script and provide a way to enter info, password username
This file contains hidden or 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
while test $# -gt 0; do | |
case "$1" in | |
-h|--help) | |
echo "[options] test_file test_file is name of individual test file you want to run" | |
echo " " | |
echo "options:" | |
echo "-h, --help show brief help" | |
echo "--headless=BOOLEAN for running tests in your chrome browser, only run one test at a time" | |
exit 0 | |
;; | |
--headless*) | |
export HEADLESS=`echo $1 | sed -e 's/^[^=]*=//g'` | |
shift | |
;; | |
*) | |
TEST_TARGET=$1 | |
break | |
;; | |
esac | |
done | |
read -p "Jules username: " USER | |
read -s -p "Password for $USER: " PASS | |
if [[ $HEADLESS == "false" && $TEST_TARGET == "" ]]; then | |
echo 'Headfull only supports one test file at a time. Please specify a file name as the last argument' | |
exit 0 | |
elif [[ $HEADLESS == "false" && $TEST_TARGET ]]; then | |
# launches connects to chrome | |
# https://developer.mozilla.org/en-US/docs/Tools/Remote_Debugging/Chrome_Desktop | |
/Applications/Google\ Chrome.app/Contents/MacOS/Google\ Chrome \ | |
--remote-debugging-port=9222 --no-first-run --no-default-browser-check \ | |
--user-data-dir=$(mktemp -d -t 'chrome-remote_data_dir') & | |
if |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment