Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Update visual tree verification infra to get rid of the term "master" #2725

Merged
merged 5 commits into from
Jun 30, 2020
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion build/Helix/PrepareHelixPayload.ps1
Original file line number Diff line number Diff line change
Expand Up @@ -69,4 +69,4 @@ Copy-Item "build\helix\runtests.cmd" $payloadDir
Copy-Item "build\helix\InstallTestAppDependencies.ps1" "$payloadDir"
Copy-Item "build\Helix\EnsureMachineState.ps1" "$payloadDir"
Copy-Item "version.props" "$payloadDir"
Copy-Item "build\Helix\CopyVisualTreeMasters.ps1" "$payloadDir"
Copy-Item "build\Helix\CopyVisualTreeVerificationFiles.ps1" "$payloadDir"
45 changes: 23 additions & 22 deletions build/Helix/ProcessHelixFiles.ps1
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ Param(
)

$helixLinkFile = "$OutputFolder\LinksToHelixTestFiles.html"
$visualTreeMasterFolder = "$OutputFolder\VisualTreeMasters"
$visualTreeVerificationFolder = "$OutputFolder\UpdatedVisualTreeVerificationFiles"

$accessTokenParam = ""
if($HelixAccessToken)
Expand Down Expand Up @@ -71,9 +71,9 @@ foreach ($testRun in $testRuns.value)

$screenShots = $files | where { $_.Name.EndsWith(".jpg") }
$dumps = $files | where { $_.Name.EndsWith(".dmp") }
$visualTreeMasters = $files | where { $_.Name.EndsWith(".xml") -And (-Not $_.Name.Contains('testResults')) }
$visualTreeVerificationFiles = $files | where { $_.Name.EndsWith(".xml") -And (-Not $_.Name.Contains('testResults')) }
$pgcFiles = $files | where { $_.Name.EndsWith(".pgc") }
if ($screenShots.Count + $dumps.Count + $visualTreeMasters.Count + $pgcFiles.Count -gt 0)
if ($screenShots.Count + $dumps.Count + $visualTreeVerificationFiles.Count + $pgcFiles.Count -gt 0)
{
if(-Not $isTestRunNameShown)
{
Expand All @@ -83,19 +83,20 @@ foreach ($testRun in $testRuns.value)
Out-File -FilePath $helixLinkFile -Append -InputObject "<h3>$helixWorkItemName</h3>"
Generate-File-Links $screenShots "Screenshots"
Generate-File-Links $dumps "CrashDumps"
Generate-File-Links $visualTreeMasters "VisualTreeMasters"
Generate-File-Links $visualTreeVerificationFiles "visualTreeVerificationFiles"
Generate-File-Links $pgcFiles "PGC files"
$misc = $files | where { ($screenShots -NotContains $_) -And ($dumps -NotContains $_) -And ($visualTreeMasters -NotContains $_) -And ($pgcFiles -NotContains $_) }
$misc = $files | where { ($screenShots -NotContains $_) -And ($dumps -NotContains $_) -And ($visualTreeVerificationFiles -NotContains $_) -And ($pgcFiles -NotContains $_) }
Generate-File-Links $misc "Misc"

if( -Not (Test-Path $visualTreeMasterFolder) )
if( -Not (Test-Path $visualTreeVerificationFolder) )
{
New-Item $visualTreeMasterFolder -ItemType Directory
New-Item $visualTreeVerificationFolder -ItemType Directory
}
foreach($masterFile in $visualTreeMasters)
foreach($verificationFile in $visualTreeVerificationFiles)
{
$destination = "$visualTreeMasterFolder\$($masterFile.Name)"
Write-Host "Copying $($masterFile.Name) to $destination"

$destination = "$visualTreeVerificationFolder\$($verificationFile.Name)"
Write-Host "Copying $($verificationFile.Name) to $destination"
$link = "$($masterFile.Link)$accessTokenParam"
$webClient.DownloadFile($link, $destination)
}
Expand Down Expand Up @@ -123,12 +124,12 @@ foreach ($testRun in $testRuns.value)
}
}

if(Test-Path $visualTreeMasterFolder)
if(Test-Path $visualTreeVerificationFolder)
{
Write-Host "Merge duplicated master files..."
$masterFiles = Get-ChildItem $visualTreeMasterFolder
Write-Host "Merge duplicated verification files..."
$verificationFiles = Get-ChildItem $visualTreeVerificationFolder
$prefixList = @()
foreach($file in $masterFiles)
foreach($file in $verificationFiles)
{
$prefix = $file.BaseName.Split('-')[0]
if($prefixList -NotContains $prefix)
Expand All @@ -140,17 +141,17 @@ if(Test-Path $visualTreeMasterFolder)
foreach($prefix in $prefixList)
{
$filesToDelete = @()
$versionedMasters = $masterFiles | Where { $_.BaseName.StartsWith("$prefix-") } | Sort-Object -Property Name -Descending
if($versionedMasters.Count > 1)
$versionedVerificationFiles = $verificationFiles | Where { $_.BaseName.StartsWith("$prefix-") } | Sort-Object -Property Name -Descending
if($versionedVerificationFiles.Count > 1)
{
for ($i=0; $i -lt $versionedMasters.Length-1; $i++)
for ($i=0; $i -lt $versionedVerificationFiles.Length-1; $i++)
{
$v1 = Get-Content $versionedMasters[$i].FullName
$v2 = Get-Content $versionedMasters[$i+1].FullName
$v1 = Get-Content $versionedVerificationFiles[$i].FullName
$v2 = Get-Content $versionedVerificationFiles[$i+1].FullName
$diff = Compare-Object $v1 $v2
if($diff.Length -eq 0)
{
$filesToDelete += $versionedMasters[$i]
$filesToDelete += $versionedVerificationFiles[$i]
}
}
$filesToDelete | ForEach-Object {
Expand All @@ -159,7 +160,7 @@ if(Test-Path $visualTreeMasterFolder)
}
}

Write-Host "Renaming $($versionedMasters[-1].Name) to $prefix.xml"
Move-Item $versionedMasters[-1].FullName "$visualTreeMasterFolder\$prefix.xml" -Force
Write-Host "Renaming $($versionedVerificationFiles[-1].Name) to $prefix.xml"
Move-Item $versionedVerificationFiles[-1].FullName "$visualTreeVerificationFolder\$prefix.xml" -Force
}
}
2 changes: 1 addition & 1 deletion build/Helix/runtests.cmd
Original file line number Diff line number Diff line change
Expand Up @@ -88,7 +88,7 @@ move te.wtl te_rerun_multiple.wtl

copy /y te_rerun_multiple.wtl %HELIX_WORKITEM_UPLOAD_ROOT%
copy /y WexLogFileOutput\*.jpg %HELIX_WORKITEM_UPLOAD_ROOT%
powershell -ExecutionPolicy Bypass .\CopyVisualTreeMasters.ps1
powershell -ExecutionPolicy Bypass .\CopyVisualTreeVerificationFiles.ps1

:SkipReruns

Expand Down
2 changes: 1 addition & 1 deletion dev/AutoSuggestBox/APITests/AutoSuggestBoxTests.cs
Original file line number Diff line number Diff line change
Expand Up @@ -66,7 +66,7 @@ public void VerifyAutoSuggestBoxCornerRadius()
public void VerifyVisualTree()
{
var autoSuggestBox = SetupAutoSuggestBox();
VisualTreeTestHelper.VerifyVisualTree(root: autoSuggestBox, masterFilePrefix: "AutoSuggestBox");
VisualTreeTestHelper.VerifyVisualTree(root: autoSuggestBox, verificationFileNamePrefix: "AutoSuggestBox");
}

private AutoSuggestBox SetupAutoSuggestBox()
Expand Down
2 changes: 1 addition & 1 deletion dev/CalendarView/APITests/CalendarViewTests.cs
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@ public void VerifyVisualTree()
});
TestUtilities.SetAsVisualTreeRoot(calendarView);

VisualTreeTestHelper.VerifyVisualTree(root: calendarView, masterFilePrefix: "CalendarView");
VisualTreeTestHelper.VerifyVisualTree(root: calendarView, verificationFileNamePrefix: "CalendarView");
}
}
}
2 changes: 1 addition & 1 deletion dev/ColorPicker/APITests/ColorPickerTests.cs
Original file line number Diff line number Diff line change
Expand Up @@ -278,7 +278,7 @@ public void VerifyVisualTree()
});
TestUtilities.SetAsVisualTreeRoot(colorPicker);

VisualTreeTestHelper.VerifyVisualTree(root: colorPicker, masterFilePrefix: "ColorPicker");
VisualTreeTestHelper.VerifyVisualTree(root: colorPicker, verificationFileNamePrefix: "ColorPicker");
}

// This takes a FrameworkElement parameter so you can pass in either a ColorPicker or a ColorSpectrum.
Expand Down
2 changes: 1 addition & 1 deletion dev/ComboBox/APITests/ComboBoxTests.cs
Original file line number Diff line number Diff line change
Expand Up @@ -101,7 +101,7 @@ public void VerifyVisualTree()
});
IdleSynchronizer.Wait();

VisualTreeTestHelper.VerifyVisualTree(root: comboBox, masterFilePrefix: "ComboBox");
VisualTreeTestHelper.VerifyVisualTree(root: comboBox, verificationFileNamePrefix: "ComboBox");
}

private ComboBox SetupComboBox(bool useContent = true)
Expand Down
16 changes: 8 additions & 8 deletions dev/CommonStyles/APITests/CommonStylesTests.cs
Original file line number Diff line number Diff line change
Expand Up @@ -119,7 +119,7 @@ public void VerifyVisualTreeForControlsInCommonStyles()
try
{
Log.Comment($"Verify visual tree for {control}");
VisualTreeTestHelper.VerifyVisualTree(xaml: XamlStringForControl(control), masterFilePrefix: control);
VisualTreeTestHelper.VerifyVisualTree(xaml: XamlStringForControl(control), verificationFileNamePrefix: control);
}
catch (Exception e)
{
Expand Down Expand Up @@ -175,7 +175,7 @@ public void VerifyVisualTreeForCommandBarOverflowMenu()
var visualTreeDumperFilter = new VisualTreeDumper.DefaultFilter();
visualTreeDumperFilter.PropertyNameAllowedList.Remove("MaxWidth");
visualTreeDumperFilter.PropertyNameAllowedList.Remove("MaxHeight");
VisualTreeTestHelper.VerifyVisualTree(root: overflowContent, masterFilePrefix: "CommandBarOverflowMenu", filter: visualTreeDumperFilter);
VisualTreeTestHelper.VerifyVisualTree(root: overflowContent, verificationFileNamePrefix: "CommandBarOverflowMenu", filter: visualTreeDumperFilter);
}

private string XamlStringForControl(string controlName)
Expand Down Expand Up @@ -213,7 +213,7 @@ public void VerifyVisualTreeForAppBarAndAppBarToggleButton()
</StackPanel>
</Grid>";
VisualTreeTestHelper.VerifyVisualTree(xaml: xaml,
masterFilePrefix: "VerifyVisualTreeForAppBarAndAppBarToggleButton");
verificationFileNamePrefix: "VerifyVisualTreeForAppBarAndAppBarToggleButton");
}

[TestMethod]
Expand All @@ -227,7 +227,7 @@ public void VerifyVisualTreeExampleLoadAndVerifyForAllThemes()
var xaml = @"<Grid Width='400' Height='400' xmlns='http://schemas.microsoft.com/winfx/2006/xaml/presentation' xmlns:x='http://schemas.microsoft.com/winfx/2006/xaml'>
</Grid>";
VisualTreeTestHelper.VerifyVisualTree(xaml: xaml,
masterFilePrefix: "VerifyVisualTreeExampleLoadAndVerifyForAllThemes",
verificationFileNamePrefix: "VerifyVisualTreeExampleLoadAndVerifyForAllThemes",
theme: Theme.All);
}

Expand All @@ -247,7 +247,7 @@ public void VerifyVisualTreeExampleLoadAndVerifyForDarkThemeWithCustomName()
(root as FrameworkElement).RequestedTheme = ElementTheme.Dark;
});
VisualTreeTestHelper.VerifyVisualTree(root: root,
masterFilePrefix: "VerifyVisualTreeExampleLoadAndVerifyForDarkThemeWithCustomName");
verificationFileNamePrefix: "VerifyVisualTreeExampleLoadAndVerifyForDarkThemeWithCustomName");
}

[TestMethod]
Expand All @@ -262,7 +262,7 @@ public void VerifyVisualTreeExampleForLightTheme()
</Grid>";
UIElement root = VisualTreeTestHelper.SetupVisualTree(xaml);
VisualTreeTestHelper.VerifyVisualTree(root: root,
masterFilePrefix: "VerifyVisualTreeExampleForLightTheme",
verificationFileNamePrefix: "VerifyVisualTreeExampleForLightTheme",
theme: Theme.Light);
}

Expand All @@ -280,7 +280,7 @@ public void VerifyVisualTreeExampleWithCustomerFilter()
</Grid>";

VisualTreeTestHelper.VerifyVisualTree(xaml: xaml,
masterFilePrefix: "VerifyVisualTreeExampleWithCustomerFilter",
verificationFileNamePrefix: "VerifyVisualTreeExampleWithCustomerFilter",
filter: new CustomizedFilter());
}

Expand All @@ -298,7 +298,7 @@ public void VerifyVisualTreeExampleWithCustomerPropertyValueTranslator()
</Grid>";

VisualTreeTestHelper.VerifyVisualTree(xaml: xaml,
masterFilePrefix: "VerifyVisualTreeExampleWithCustomerPropertyValueTranslator",
verificationFileNamePrefix: "VerifyVisualTreeExampleWithCustomerPropertyValueTranslator",
translator: new CustomizedTranslator());
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -158,34 +158,34 @@ public void VerifyVisualTree()
{
using(VisualTreeVerifier visualTreeVerifier = new VisualTreeVerifier())
{
// Generate a basic NavigationView master file for all the pane display modes
// Generate a basic NavigationView verification file for all the pane display modes
foreach (var paneDisplayMode in Enum.GetValues(typeof(NavigationViewPaneDisplayMode)))
{
var filePrefix = "NavigationView" + paneDisplayMode;
NavigationViewPaneDisplayMode displayMode = (NavigationViewPaneDisplayMode)paneDisplayMode;

// We can skip generating a master file for Left mode since Auto is achieving the same result.
// We can skip generating a verification file for Left mode since Auto is achieving the same result.
if (displayMode == NavigationViewPaneDisplayMode.Left)
{
continue;
}

Log.Comment($"Verify visual tree for NavigationViewPaneDisplayMode: {paneDisplayMode}");
var navigationView = SetupNavigationView(displayMode);
visualTreeVerifier.VerifyVisualTreeNoException(root: navigationView, masterFilePrefix: filePrefix);
visualTreeVerifier.VerifyVisualTreeNoException(root: navigationView, verificationFileNamePrefix: filePrefix);
}

Log.Comment($"Verify visual tree for NavigationViewScrolling");
var leftNavViewScrolling = SetupNavigationViewScrolling(NavigationViewPaneDisplayMode.Left);
visualTreeVerifier.VerifyVisualTreeNoException(root: leftNavViewScrolling, masterFilePrefix: "NavigationViewScrolling");
visualTreeVerifier.VerifyVisualTreeNoException(root: leftNavViewScrolling, verificationFileNamePrefix: "NavigationViewScrolling");

Log.Comment($"Verify visual tree for NavigationViewLeftPaneContent");
var leftNavViewPaneContent = SetupNavigationViewPaneContent(NavigationViewPaneDisplayMode.Left);
visualTreeVerifier.VerifyVisualTreeNoException(root: leftNavViewPaneContent, masterFilePrefix: "NavigationViewLeftPaneContent");
visualTreeVerifier.VerifyVisualTreeNoException(root: leftNavViewPaneContent, verificationFileNamePrefix: "NavigationViewLeftPaneContent");

Log.Comment($"Verify visual tree for NavigationViewTopPaneContent");
var topNavViewPaneContent = SetupNavigationViewPaneContent(NavigationViewPaneDisplayMode.Top);
visualTreeVerifier.VerifyVisualTreeNoException(root: topNavViewPaneContent, masterFilePrefix: "NavigationViewTopPaneContent");
visualTreeVerifier.VerifyVisualTreeNoException(root: topNavViewPaneContent, verificationFileNamePrefix: "NavigationViewTopPaneContent");
}
}

Expand Down Expand Up @@ -619,7 +619,7 @@ public void VerifyVerifyHeaderContentMarginOnMinimalNav()
VerifyVerifyHeaderContentMargin(NavigationViewPaneDisplayMode.LeftMinimal, "VerifyVerifyHeaderContentMarginOnMinimalNav");
}

private void VerifyVerifyHeaderContentMargin(NavigationViewPaneDisplayMode paneDisplayMode, string masterFilePrefix)
private void VerifyVerifyHeaderContentMargin(NavigationViewPaneDisplayMode paneDisplayMode, string verificationFileNamePrefix)
{
UIElement headerContent = null;

Expand All @@ -637,7 +637,7 @@ private void VerifyVerifyHeaderContentMargin(NavigationViewPaneDisplayMode paneD

VisualTreeTestHelper.VerifyVisualTree(
root: headerContent,
masterFilePrefix: masterFilePrefix);
verificationFileNamePrefix: verificationFileNamePrefix);
}

[TestMethod]
Expand Down
2 changes: 1 addition & 1 deletion dev/TreeView/APITests/TreeViewTests.cs
Original file line number Diff line number Diff line change
Expand Up @@ -499,7 +499,7 @@ public void VerifyVisualTree()
});
TestUtilities.SetAsVisualTreeRoot(treeView);

VisualTreeTestHelper.VerifyVisualTree(root: treeView, masterFilePrefix: "TreeView");
VisualTreeTestHelper.VerifyVisualTree(root: treeView, verificationFileNamePrefix: "TreeView");
}

[TestMethod]
Expand Down
Loading