diff --git a/build/AzurePipelinesTemplates/WinUI-InstallDependencies-Steps.yml b/build/AzurePipelinesTemplates/WinUI-InstallDependencies-Steps.yml index 270df48f26..5e8439f683 100644 --- a/build/AzurePipelinesTemplates/WinUI-InstallDependencies-Steps.yml +++ b/build/AzurePipelinesTemplates/WinUI-InstallDependencies-Steps.yml @@ -109,15 +109,6 @@ steps: arguments: 'restore build\packages.TestInProduction.config -Source $(WinUIInternalFeedUri) -PackagesDirectory $(Build.SourcesDirectory)\packages' includeNuGetOrg: false - # Note: Restore the WebView2 Runtime package from the authenticated WinUI.Dependencies feed. - - task: 333b11bd-d341-40d9-afcf-b32d5ce6f23b@2 - displayName: 'NuGet restore WebView2 Runtime installer' - condition: succeeded() - inputs: - command: 'custom' - arguments: 'restore build\packages.webview2.config -Source $(WinUIInternalFeedUri) -PackagesDirectory $(Build.SourcesDirectory)\packages' - includeNuGetOrg: false - - task: VSBuild@1 displayName: 'Restore Maestro dependencies' condition: and(succeeded(), ne(variables['Build.Repository.Provider'], 'GitHub'), ne(variables['Build.Repository.Provider'], 'GitHubEnterprise')) diff --git a/build/AzurePipelinesTemplates/WinUI-RunTestPassOnPipeline-Job.yml b/build/AzurePipelinesTemplates/WinUI-RunTestPassOnPipeline-Job.yml index e6a48ce0f1..188b7c7ef4 100644 --- a/build/AzurePipelinesTemplates/WinUI-RunTestPassOnPipeline-Job.yml +++ b/build/AzurePipelinesTemplates/WinUI-RunTestPassOnPipeline-Job.yml @@ -73,6 +73,34 @@ jobs: script: | Get-Item -Path 'HKLM:\Software\Microsoft\Windows NT\CurrentVersion' + # Validation-only provisioning until Evergreen is included in the Win10-2019-LTSC image. + - ${{ if eq( parameters.testOS, 'Win10-RS5' ) }}: + - task: PowerShell@2 + displayName: 'Install Evergreen WebView2 Runtime on RS5' + inputs: + targetType: 'inline' + script: | + $ErrorActionPreference = 'Stop' + [Net.ServicePointManager]::SecurityProtocol = [Net.SecurityProtocolType]::Tls12 + + $installerPath = Join-Path $env:Agent_TempDirectory 'MicrosoftEdgeWebview2Setup.exe' + try { + Invoke-WebRequest -UseBasicParsing -Uri 'https://go.microsoft.com/fwlink/p/?LinkId=2124703' -OutFile $installerPath + + $signature = Get-AuthenticodeSignature -FilePath $installerPath + if ($signature.Status -ne 'Valid' -or $signature.SignerCertificate.Subject -notmatch 'O=Microsoft Corporation') { + throw "Evergreen WebView2 bootstrapper signature validation failed. Status: $($signature.Status); signer: $($signature.SignerCertificate.Subject)" + } + + $installer = Start-Process -FilePath $installerPath -ArgumentList '/silent', '/install' -Wait -PassThru + if ($installer.ExitCode -ne 0) { + throw "Evergreen WebView2 bootstrapper exited with code $($installer.ExitCode)." + } + } + finally { + Remove-Item -Path $installerPath -Force -ErrorAction SilentlyContinue + } + - template: WinUI-DownloadPipelineArtifacts-Steps.yml parameters: itemPattern: '**/@(helixworkitems|TestPayload)/**' diff --git a/controls/dev/WebView2/InteractionTests/WebView2Tests.cs b/controls/dev/WebView2/InteractionTests/WebView2Tests.cs index d1b5e9a282..75b3db0863 100644 --- a/controls/dev/WebView2/InteractionTests/WebView2Tests.cs +++ b/controls/dev/WebView2/InteractionTests/WebView2Tests.cs @@ -44,7 +44,7 @@ public static void ClassInitialize(TestContext testContext) EnsureBrowser(); } - // Ensure a suitable version of Edge browser or WebView2 runtime is present. If not, use mini_installer to install the runtime. + // Ensure the test image provides a WebView2 Runtime compatible with the SDK. public static void EnsureBrowser() { // If a previous run of CoreWebView2Initialized_FailedTest failed to clean up the @@ -60,24 +60,21 @@ public static void EnsureBrowser() // 3. Check if a runtime is already installed, and if it's compatible. bool hasCompatibleRuntimeInstalled = GetHasCompatibleRuntimeInstalled(browserBuildVersion, sdkBuildVersion); - // 4a. If we have a compatible runtime installed, continue on to the tests! + // 4. If we have a compatible runtime installed, continue on to the tests. if (hasCompatibleRuntimeInstalled) { return; } - // 4b. If we don't have a compatible runtime, try to install one. - - // 5. Before installing, check if Edge is already installing/updating. We can't run the standalone installer if it is. + // An Evergreen update may already be in progress. Wait for it before failing the test. bool didWait = WaitForEdgeIfAlreadyInstalling(); if (didWait && IsEdgeAlreadyInstalling()) { - Log.Error("WebView2Tests Init: Edge took more than 3 minutes to install, give up."); + Verify.Fail("WebView2Tests Init: Evergreen WebView2 Runtime update did not finish within 3 minutes."); } else if (didWait) { - // If we waited for Edge to finish installing/updating and it finished, check the versions again browserBuildVersion = GetInstalledBrowserVersion(); hasCompatibleRuntimeInstalled = GetHasCompatibleRuntimeInstalled(browserBuildVersion, sdkBuildVersion); if (hasCompatibleRuntimeInstalled) @@ -86,21 +83,11 @@ public static void EnsureBrowser() } } - // 6. If Edge wasn't already installing/updating, or it was but installed something old (unlikely), - // run the standalone installer to install it. - // This installation can sometimes fail, so we'll try a number of times before failing out. - int attemptsLeft = 5; - bool successfullyInstalled = false; - while (attemptsLeft > 0) - { - attemptsLeft--; - successfullyInstalled = TryInstallingBrowser(attemptsLeft); - if (successfullyInstalled) break; - } - if (attemptsLeft == 0 && !successfullyInstalled) - { - Log.Error("WebView2Tests Init: Browser installation failed, out of retries."); - } + Verify.Fail(string.Format( + "WebView2Tests Init: The test image must provide a compatible Evergreen WebView2 Runtime. " + + "Installed Runtime build: {0}; required SDK build: {1}.", + browserBuildVersion, + sdkBuildVersion)); } private static void RemoveFakeBrowserExecutableFolderKey() @@ -180,7 +167,7 @@ private static bool GetHasCompatibleRuntimeInstalled(int browserBuildVersion, in // Browser/Runtime version ex: 80.0.361.48 // WebView2 SDK version ex: 0.8.355 // Webview2Loader compares the build versions (361 and 355 in above example), we do so here as well - if (browserBuildVersion >= sdkBuildVersion) + if (browserBuildVersion > 0 && sdkBuildVersion > 0 && browserBuildVersion >= sdkBuildVersion) { Log.Comment("WebView2Tests Init: Installed Edge build will be used for testing... "); hasCompatibleRuntime = true; @@ -222,43 +209,6 @@ private static bool IsEdgeAlreadyInstalling() return edgeUpdateIsRunning; } - private static bool TryInstallingBrowser(int attemptsLeft) - { - bool successfullyInstalled = false; - string installer = "mini_installer.exe"; - // Note: Starting with SDK 0.9.488 / Edge version 83, evergreen WebView2 no longer targets the Stable - // browser channel. Instead, it targets another set of binaries, branded Evergreen WebView2 Runtime. - // (See https://docs.microsoft.com/en-us/microsoft-edge/webview2/releasenotes). - // - // Accordingly, Update mini_installer args to install WV2Runtime instead of full browser. - string installerArgs_WV2Runtime = "--msedgewebview --system-level"; - Log.Comment(@"WebView2Tests Init: Installing WebView2 runtime: '{0} {1}'", installer, installerArgs_WV2Runtime); - ProcessStartInfo installerStartInfo = new ProcessStartInfo(installer, installerArgs_WV2Runtime); - - Process installerProcess = Process.Start(installerStartInfo); - installerProcess.WaitForExit(); - - if (installerProcess.ExitCode == 0) - { - Log.Comment("WebView2Tests Init: {0} exited successfully", installer); - successfullyInstalled = true; - } - else - { - Log.Warning("WebView2Tests Init: {0} failed with exit code {1}! Attempts left: {2}", installer, installerProcess.ExitCode, attemptsLeft); - // Print information about some of the error codes we sometimes hit - if (installerProcess.ExitCode == 4) - { - Log.Comment("Exit code 4 = HIGHER_VERSION_EXISTS, Higher version already exists"); - } - else if (installerProcess.ExitCode == 60) - { - Log.Comment("Exit code 60 = SETUP_SINGLETON_ACQUISITION_FAILED, The setup process could not acquire the exclusive right to modify the installation."); - } - } - return successfullyInstalled; - } - [TestCleanup] public void TestCleanup() { diff --git a/dxaml/test/infra/taefhostappmanaged/TaefHostAppManaged.csproj b/dxaml/test/infra/taefhostappmanaged/TaefHostAppManaged.csproj index fa163b6e9e..f94e5a14ab 100644 --- a/dxaml/test/infra/taefhostappmanaged/TaefHostAppManaged.csproj +++ b/dxaml/test/infra/taefhostappmanaged/TaefHostAppManaged.csproj @@ -262,12 +262,6 @@ $(TestDependenciesResourcesDestinationPath) - - - - $(TestDependenciesResourcesDestinationPath) - -