Skip to content

Instantly share code, notes, and snippets.

@zachlayman-applitools
Last active March 10, 2020 17:15
Show Gist options
  • Save zachlayman-applitools/c5af419dbe7650a4564eee4acfea03e5 to your computer and use it in GitHub Desktop.
Save zachlayman-applitools/c5af419dbe7650a4564eee4acfea03e5 to your computer and use it in GitHub Desktop.
SERVER_URL=$1
API_KEY=$2
DATE_STR=$(date "+%Y%m%d%H%M%S")
DATE_HEADER="Date: $(date "+%a, %d %b %Y %T %Z")"
RESULTS_URL=$(curl "https://$SERVER_URL.applitools.com/api/sessions/renderinfo?apiKey=$API_KEY" | jq -r ".resultsUrl")
PUT_URL=$(echo $RESULTS_URL | sed "s/\_\_random\_\_/$DATE_STR/g")
echo "Testing PUT to:" $PUT_URL
PUT_RESULTS=$(curl -i --verbose --request PUT --url "$PUT_URL" --header "$DATE_HEADER" --header 'x-ms-blob-type: BlockBlob' --header 'x-ms-version: 2015-02-21' --form 'image=""')
echo $PUT_RESULTS
@SophieDePaula
Copy link

Instructions for Mac OS / Unix systems

  1. Download the script above.
  2. Give execute permission to script (chmod 777 unix.sh)
  3. Download and install jq (https://stedolan.github.io/jq/download/) This is a JSON parser for API Requests.
  4. Run script in a Terminal / bash shell with Applitools subdomain (i.e. mycompanyeyes) and working API Execute Key (same key that runs tests)
    e.g. ./unix.sh mycompanyeyes APPLITOOLS_API_KEY
  5. If the final output responds with a 201, then no additional whitelisting is necessary.
  6. If the final output responds with a 4XX error, you will need to whitelist the domain after the printed line "Testing PUT to:”
    e.g. Testing PUT to: https://mycompanyeyes.blob.core.windows.net/temp/blabla?sv=xxxxxxx&sr=xxx&sig=xxxxxxxx&se=xxxxx&sp=xx&accessKey=xxxxxx
    means you need to whitelist mycompanyeyes.blob.core.windows.net

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment