forked from microsoft/microsoft-ui-xaml
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Add visual tree verification baseline (microsoft#1130)
* Add visual tree verification baseline * cr feedbacks * Add min/max width/height * Upload master files to Helix * Update master files * Set width/height on ColorPicker * Renames * Add script to update master files * Update script to merge duplicate masters * Copy master files to artifact drop folder * Update masters * Create LinksToHelixTestFiles only when test fails
- Loading branch information
Showing
91 changed files
with
31,502 additions
and
119 deletions.
There are no files selected for viewing
This file contains 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
This file contains 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
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,2 @@ | ||
$picturesFolder = [Environment]::GetFolderPath('MyPictures') | ||
Copy-Item $picturesFolder\*.xml $Env:HELIX_WORKITEM_UPLOAD_ROOT |
This file was deleted.
Oops, something went wrong.
This file contains 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
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,134 @@ | ||
Param( | ||
[string]$AccessToken = $env:SYSTEM_ACCESSTOKEN, | ||
[string]$CollectionUri = $env:SYSTEM_COLLECTIONURI, | ||
[string]$TeamProject = $env:SYSTEM_TEAMPROJECT, | ||
[string]$BuildUri = $env:BUILD_BUILDURI, | ||
[string]$OutPutFolder = "HelixOutput" | ||
) | ||
|
||
$helixLinkFile = "$OutPutFolder\LinksToHelixTestFiles.html" | ||
$visualTreeMasterFolder = "$OutPutFolder\VisualTreeMasters" | ||
|
||
function Generate-File-Links | ||
{ | ||
Param ([Array[]]$files,[string]$sectionName) | ||
if($files.Count -gt 0) | ||
{ | ||
Out-File -FilePath $helixLinkFile -Append -InputObject "<div class=$sectionName>" | ||
Out-File -FilePath $helixLinkFile -Append -InputObject "<h4>$sectionName</h4>" | ||
Out-File -FilePath $helixLinkFile -Append -InputObject "<ul>" | ||
foreach($file in $files) | ||
{ | ||
Out-File -FilePath $helixLinkFile -Append -InputObject "<li><a href=$($file.Link)>$($file.Name)</a></li>" | ||
} | ||
Out-File -FilePath $helixLinkFile -Append -InputObject "</ul>" | ||
Out-File -FilePath $helixLinkFile -Append -InputObject "</div>" | ||
} | ||
} | ||
|
||
#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) | ||
{ | ||
$testRunResultsUri = "$($testRun.url)/results?api-version=5.0" | ||
$testResults = Invoke-RestMethod -Uri "$($testRun.url)/results?api-version=5.0" -Method Get -Headers $azureDevOpsRestApiHeaders | ||
$isTestRunNameShown = $false | ||
|
||
foreach ($testResult in $testResults.value) | ||
{ | ||
$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" | ||
$files = Invoke-RestMethod -Uri $filesQueryUri -Method Get | ||
|
||
$screenShots = $files | where { $_.Name.EndsWith(".jpg") } | ||
$dumps = $files | where { $_.Name.EndsWith(".dmp") } | ||
$visualTreeMasters = $files | where { $_.Name.EndsWith(".xml") -And (-Not $_.Name.Contains('testResults')) } | ||
if($screenShots.Count+$dumps.Count+$visualTreeMasters.Count -gt 0) | ||
{ | ||
if(-Not $isTestRunNameShown) | ||
{ | ||
Out-File -FilePath $helixLinkFile -Append -InputObject "<h2>$($testRun.name)</h2>" | ||
$isTestRunNameShown = $true | ||
} | ||
Out-File -FilePath $helixLinkFile -Append -InputObject "<h3>$helixWorkItemName</h3>" | ||
Generate-File-Links $screenShots "Screenshots" | ||
Generate-File-Links $dumps "CrashDumps" | ||
Generate-File-Links $visualTreeMasters "VisualTreeMasters" | ||
$misc = $files | where { ($screenShots -NotContains $_) -And ($dumps -NotContains $_) -And ($visualTreeMasters -NotContains $_) } | ||
Generate-File-Links $misc "Misc" | ||
|
||
if( -Not (Test-Path $visualTreeMasterFolder) ) | ||
{ | ||
New-Item $visualTreeMasterFolder -ItemType Directory | ||
} | ||
foreach($masterFile in $visualTreeMasters) | ||
{ | ||
$destination = "$visualTreeMasterFolder\$($masterFile.Name)" | ||
Write-Host "Copying $($masterFile.Name) to $destination" | ||
$webClient.DownloadFile($masterFile.Link, $destination) | ||
} | ||
} | ||
} | ||
} | ||
} | ||
|
||
if(Test-Path $visualTreeMasterFolder) | ||
{ | ||
Write-Host "Merge duplicated master files..." | ||
$masterFiles = Get-ChildItem $visualTreeMasterFolder | ||
$prefixList = @() | ||
foreach($file in $masterFiles) | ||
{ | ||
$prefix = $file.BaseName.Split('-')[0] | ||
if($prefixList -NotContains $prefix) | ||
{ | ||
$prefixList += $prefix | ||
} | ||
} | ||
|
||
foreach($prefix in $prefixList) | ||
{ | ||
$filesToDelete = @() | ||
$versionedMasters = $masterFiles | Where { $_.BaseName.StartsWith($prefix) } | Sort-Object -Property Name -Descending | ||
for ($i=0; $i -lt $versionedMasters.Length-1; $i++) | ||
{ | ||
$v1 = Get-Content $versionedMasters[$i].FullName | ||
$v2 = Get-Content $versionedMasters[$i+1].FullName | ||
$diff = Compare-Object $v1 $v2 | ||
if($diff.Length -eq 0) | ||
{ | ||
$filesToDelete += $versionedMasters[$i] | ||
} | ||
} | ||
$filesToDelete | ForEach-Object { | ||
Write-Host "Deleting $($_.Name)" | ||
Remove-Item $_.FullName | ||
} | ||
|
||
Write-Host "Renaming $($versionedMasters[-1].Name) to $prefix.xml" | ||
Move-Item $versionedMasters[-1].FullName "$visualTreeMasterFolder\$prefix.xml" -Force | ||
} | ||
} |
This file contains 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
This file contains 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
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,48 @@ | ||
// Copyright (c) Microsoft Corporation. All rights reserved. | ||
// Licensed under the MIT License. See LICENSE in the project root for license information. | ||
|
||
using Common; | ||
using MUXControlsTestApp.Utilities; | ||
using Windows.UI.Xaml.Controls; | ||
using Windows.UI.Xaml.Media; | ||
using System.Linq; | ||
using System.Collections.Generic; | ||
using System; | ||
|
||
#if USING_TAEF | ||
using WEX.TestExecution; | ||
using WEX.TestExecution.Markup; | ||
using WEX.Logging.Interop; | ||
#else | ||
using Microsoft.VisualStudio.TestTools.UnitTesting; | ||
using Microsoft.VisualStudio.TestTools.UnitTesting.Logging; | ||
#endif | ||
|
||
namespace Windows.UI.Xaml.Tests.MUXControls.ApiTests | ||
{ | ||
[TestClass] | ||
public class CalendarViewTests | ||
{ | ||
[TestCleanup] | ||
public void TestCleanup() | ||
{ | ||
TestUtilities.ClearVisualTreeRoot(); | ||
} | ||
|
||
[TestMethod] | ||
public void VerifyVisualTree() | ||
{ | ||
CalendarView calendarView = null; | ||
RunOnUIThread.Execute(() => | ||
{ | ||
calendarView = new CalendarView(); | ||
calendarView.Width = 400; | ||
calendarView.Height = 400; | ||
calendarView.SetDisplayDate(new DateTime(2000, 1, 1)); | ||
}); | ||
TestUtilities.SetAsVisualTreeRoot(calendarView); | ||
|
||
VisualTreeTestHelper.VerifyVisualTree(root: calendarView, masterFilePrefix: "CalendarView"); | ||
} | ||
} | ||
} |
Oops, something went wrong.