Move UI tests to Windows 11 (#1866)

Calculator's UI tests currently run on Server 2022 VM images. However, the production app is primarily developed for Windows 11. This change moves the UI test jobs to run on Windows 11, so we can run our tests in an environment that's closer to what real users will experience.
This commit is contained in:
Matt Cooley
2022-07-29 07:59:28 -07:00
committed by GitHub
parent 02e9556434
commit 9185ebec34
10 changed files with 89 additions and 105 deletions

View File

@@ -36,6 +36,16 @@ jobs:
useReleaseAppxmanifest: true
condition: not(eq(variables['Build.Reason'], 'PullRequest'))
- template: ./templates/run-ui-tests.yaml
parameters:
platform: x64
runsettingsFileName: CalculatorUITests.release.runsettings
- template: ./templates/run-ui-tests.yaml
parameters:
platform: x86
runsettingsFileName: CalculatorUITests.release.runsettings
- template: ./templates/run-unit-tests.yaml
parameters:
platform: x64

View File

@@ -12,17 +12,26 @@ jobs:
condition: succeeded()
pool:
${{ if eq(parameters.isOSSBuild, true) }}:
name: EssentialExperiencesOpenSource-windows-2022
name: EssentialExperiencesOpenSource-Win11
${{ if eq(parameters.isOSSBuild, false) }}:
name: EssentialExperiences-windows-2022
name: EssentialExperiences-Win11
variables:
skipComponentGovernanceDetection: true
steps:
- checkout: none
- checkout: self
fetchDepth: 1
- powershell: Set-DisplayResolution -Width 1920 -Height 1080 -Force
displayName: Set resolution to 1920x1080
continueOnError: true
- task: PowerShell@2
displayName: Turn off animation effects
inputs:
filePath: $(Build.SourcesDirectory)\build\scripts\TurnOffAnimationEffects.ps1
- task: ScreenResolutionUtility@1
displayName: Set resolution to 1920x1080
inputs:
displaySettings: 'specific'
width: 1920
height: 1080
- task: DownloadBuildArtifacts@0
displayName: Download MsixBundle and CalculatorUITests
@@ -52,4 +61,4 @@ jobs:
platform: ${{ parameters.platform }}
configuration: Release
${{ if eq(variables['Build.Reason'], 'PullRequest') }}:
testFiltercriteria: Priority=0
testFiltercriteria: Priority=0

View File

@@ -0,0 +1,22 @@
# Copyright (c) Microsoft Corporation. All rights reserved.
# Licensed under the MIT License.
<#
.SYNOPSIS
Disables animations on the system. Equivalent to turning off the "Animation effects" setting in the Windows Settings app.
#>
Add-Type -AssemblyName System.Runtime.WindowsRuntime
$asTaskGeneric = ([System.WindowsRuntimeSystemExtensions].GetMethods() | ? { $_.Name -eq 'AsTask' -and $_.GetParameters().Count -eq 1 -and $_.GetParameters()[0].ParameterType.Name -eq 'IAsyncOperation`1' })[0]
Function WaitForAsyncAction($WinRtTask, $ResultType) {
$asTask = $asTaskGeneric.MakeGenericMethod($ResultType)
$task = $asTask.Invoke($null, @($WinRtTask))
$task.GetAwaiter().GetResult()
}
[Windows.UI.ViewManagement.Core.UISettingsController,Windows.UI.ViewManagement.Core,ContentType=WindowsRuntime] | Out-Null
$controller = WaitForAsyncAction ([Windows.UI.ViewManagement.Core.UISettingsController]::RequestDefaultAsync()) ([Windows.UI.ViewManagement.Core.UISettingsController])
$controller.SetAnimationsEnabled($false)