"
+ Out-File -FilePath $helixLinkFile -Append -InputObject "
$sectionName
"
+ Out-File -FilePath $helixLinkFile -Append -InputObject "
"
+ foreach($file in $files)
+ {
+ Out-File -FilePath $helixLinkFile -Append -InputObject "- $($file.Name)
"
+ }
+ Out-File -FilePath $helixLinkFile -Append -InputObject "
"
+ Out-File -FilePath $helixLinkFile -Append -InputObject "
"
+ }
+}
+
+#Create output directory
+New-Item $OutputFolder -ItemType Directory
+
+$azureDevOpsRestApiHeaders = @{
+ "Accept"="application/json"
+ "Authorization"="Basic $([System.Convert]::ToBase64String([System.Text.ASCIIEncoding]::ASCII.GetBytes(":$AccessToken")))"
+}
+
+. "$PSScriptRoot/AzurePipelinesHelperScripts.ps1"
+
+$queryUri = GetQueryTestRunsUri -CollectionUri $CollectionUri -TeamProject $TeamProject -BuildUri $BuildUri -IncludeRunDetails
+Write-Host "queryUri = $queryUri"
+
+$testRuns = Invoke-RestMethod -Uri $queryUri -Method Get -Headers $azureDevOpsRestApiHeaders
+$webClient = New-Object System.Net.WebClient
+[System.Collections.Generic.List[string]]$workItems = @()
+
+foreach ($testRun in $testRuns.value)
+{
+ $testResults = Invoke-RestMethod -Uri "$($testRun.url)/results?api-version=5.0" -Method Get -Headers $azureDevOpsRestApiHeaders
+ $isTestRunNameShown = $false
+
+ foreach ($testResult in $testResults.value)
+ {
+ if ("comment" -in $testResult)
+ {
+ $info = ConvertFrom-Json $testResult.comment
+ $helixJobId = $info.HelixJobId
+ $helixWorkItemName = $info.HelixWorkItemName
+
+ $workItem = "$helixJobId-$helixWorkItemName"
+
+ if (-not $workItems.Contains($workItem))
+ {
+ $workItems.Add($workItem)
+ $filesQueryUri = "https://helix.dot.net/api/2019-06-17/jobs/$helixJobId/workitems/$helixWorkItemName/files$accessTokenParam"
+ $files = Invoke-RestMethod -Uri $filesQueryUri -Method Get
+
+ $screenShots = $files | where { $_.Name.EndsWith(".jpg") }
+ $dumps = $files | where { $_.Name.EndsWith(".dmp") }
+ $pgcFiles = $files | where { $_.Name.EndsWith(".pgc") }
+ if ($screenShots.Count + $dumps.Count + $pgcFiles.Count -gt 0)
+ {
+ if(-Not $isTestRunNameShown)
+ {
+ Out-File -FilePath $helixLinkFile -Append -InputObject "