Skip to content

Instantly share code, notes, and snippets.

@zachlayman-applitools
Last active March 10, 2020 17:16
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save zachlayman-applitools/861d8535cfec708c7e4d53e0e0d2f5c9 to your computer and use it in GitHub Desktop.
Save zachlayman-applitools/861d8535cfec708c7e4d53e0e0d2f5c9 to your computer and use it in GitHub Desktop.
add-type @"
using System.Net;
using System.Security.Cryptography.X509Certificates;
public class TrustAllCertsPolicy : ICertificatePolicy {
public bool CheckValidationResult(
ServicePoint srvPoint, X509Certificate certificate,
WebRequest request, int certificateProblem) {
return true;
}
}
"@
$AllProtocols = [System.Net.SecurityProtocolType]'Ssl3,Tls,Tls11,Tls12'
[System.Net.ServicePointManager]::SecurityProtocol = $AllProtocols
[System.Net.ServicePointManager]::CertificatePolicy = New-Object TrustAllCertsPolicy
$server_url = $args[0]
$api_key = $args[1]
$date_str = Get-Date -Format "yyMMddhhmmss"
$date_header = Get-Date -Format "ddd, dd MMM yyyy hh:mm:ss zzz"
$results_table = curl -Method Get https://$server_url.applitools.com/api/sessions/renderinfo?apiKey=$api_key | ConvertFrom-Json
$put_url = $results_table.resultsUrl.Replace("__random__", $date_str)
Write-Host "Testing PUT to:"
Write-Host $put_url
$put_results = curl -Method Put -Body "" -Headers @{'x-ms-date' = "$date_header"; 'x-ms-blob-type' = 'BlockBlob';'x-ms-version' = '2015-02-21'} "$put_url"
Write-Host $put_results.StatusCode $put_results.StatusDescription
@SophieDePaula
Copy link

  1. Download the script above.
  2. Run script in a Powershell Window with Applitools subdomain (i.e. mycompanyeyes) and working API Execute Key (same key that runs tests)
    e.g. .\windows.ps1 “mycompanyeyes" “APPLITOOLS_API_KEY"
  3. If the final output responds with a 201, then no additional whitelisting is necessary.
  4. 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