diff --git a/eng/Versions.props b/eng/Versions.props index 70f9153070a2..c1763579743a 100644 --- a/eng/Versions.props +++ b/eng/Versions.props @@ -245,7 +245,7 @@ 1.0.2 12.0.2 13.0.4 - 0.180.0 + 0.191.1 3.0.0 7.1.0 4.0.0-beta1 diff --git a/eng/helix/content/RunTests/Program.cs b/eng/helix/content/RunTests/Program.cs index 4de3d6537319..62f04432ac4c 100644 --- a/eng/helix/content/RunTests/Program.cs +++ b/eng/helix/content/RunTests/Program.cs @@ -32,6 +32,8 @@ static async Task Main(string[] args) { keepGoing = await runner.InstallPlaywrightAsync(); } +#else + Console.WriteLine("Playwright install skipped."); #endif runner.DisplayContents(); diff --git a/eng/helix/content/RunTests/RunTests.csproj b/eng/helix/content/RunTests/RunTests.csproj index 948c3b72dce6..479a28eac6c3 100644 --- a/eng/helix/content/RunTests/RunTests.csproj +++ b/eng/helix/content/RunTests/RunTests.csproj @@ -8,6 +8,6 @@ - + diff --git a/eng/helix/content/RunTests/TestRunner.cs b/eng/helix/content/RunTests/TestRunner.cs index 2a48452d7356..6e1fe013fce3 100644 --- a/eng/helix/content/RunTests/TestRunner.cs +++ b/eng/helix/content/RunTests/TestRunner.cs @@ -45,11 +45,16 @@ public bool SetupEnvironment() #if INSTALLPLAYWRIGHT // Playwright will download and look for browsers to this directory - var playwrightBrowsers = Path.Combine(helixDir, "ms-playwright"); + var playwrightBrowsers = Environment.GetEnvironmentVariable("PLAYWRIGHT_BROWSERS_PATH"); Console.WriteLine($"Setting PLAYWRIGHT_BROWSERS_PATH: {playwrightBrowsers}"); EnvironmentVariables.Add("PLAYWRIGHT_BROWSERS_PATH", playwrightBrowsers); + var playrightDriver = Environment.GetEnvironmentVariable("PLAYWRIGHT_DRIVER_PATH"); + Console.WriteLine($"Setting PLAYWRIGHT_DRIVER_PATH: {playrightDriver}"); + EnvironmentVariables.Add("PLAYWRIGHT_DRIVER_PATH", playrightDriver); +#else + Console.WriteLine($"Skipping setting PLAYWRIGHT_BROWSERS_PATH"); #endif - + Console.WriteLine($"Creating nuget restore directory: {nugetRestore}"); Directory.CreateDirectory(nugetRestore); @@ -95,8 +100,9 @@ public async Task InstallPlaywrightAsync() { try { - Console.WriteLine($"Installing Playwright to {EnvironmentVariables["PLAYWRIGHT_BROWSERS_PATH"]}"); - await Playwright.InstallAsync(EnvironmentVariables["PLAYWRIGHT_BROWSERS_PATH"]); + Console.WriteLine($"Installing Playwright to Browsers: {Environment.GetEnvironmentVariable("PLAYWRIGHT_BROWSERS_PATH")} Driver: {Environment.GetEnvironmentVariable("PLAYWRIGHT_DRIVER_PATH")}"); + await Playwright.InstallAsync(Environment.GetEnvironmentVariable("PLAYWRIGHT_BROWSERS_PATH"), Environment.GetEnvironmentVariable("PLAYWRIGHT_DRIVER_PATH")); + DisplayContents(Environment.GetEnvironmentVariable("PLAYWRIGHT_BROWSERS_PATH")); return true; } catch (Exception e) @@ -106,7 +112,7 @@ public async Task InstallPlaywrightAsync() } } #endif - + public async Task InstallAspNetAppIfNeededAsync() { try @@ -170,7 +176,7 @@ await ProcessUtil.RunAsync($"{Options.DotnetRoot}/dotnet", errorDataReceived: Console.Error.WriteLine, throwOnError: false, cancellationToken: new CancellationTokenSource(TimeSpan.FromMinutes(2)).Token); - + // ';' is the path separator on Windows, and ':' on Unix Options.Path += OperatingSystem.IsWindows() ? ";" : ":"; Options.Path += $"{Environment.GetEnvironmentVariable("DOTNET_CLI_HOME")}/.dotnet/tools"; @@ -341,9 +347,7 @@ public void UploadResults() // Combine the directory name + log name for the copied log file name to avoid overwriting duplicate test names in different test projects var logName = $"{Path.GetFileName(Path.GetDirectoryName(file))}_{Path.GetFileName(file)}"; Console.WriteLine($"Copying: {file} to {Path.Combine(HELIX_WORKITEM_UPLOAD_ROOT, logName)}"); - // Need to copy to HELIX_WORKITEM_UPLOAD_ROOT and HELIX_WORKITEM_UPLOAD_ROOT/../ in order for Azure Devops attachments to link properly and for Helix to store the logs File.Copy(file, Path.Combine(HELIX_WORKITEM_UPLOAD_ROOT, logName)); - File.Copy(file, Path.Combine(HELIX_WORKITEM_UPLOAD_ROOT, "..", logName)); } } else @@ -357,9 +361,7 @@ public void UploadResults() { var fileName = Path.GetFileName(file); Console.WriteLine($"Copying: {file} to {Path.Combine(HELIX_WORKITEM_UPLOAD_ROOT, fileName)}"); - // Need to copy to HELIX_WORKITEM_UPLOAD_ROOT and HELIX_WORKITEM_UPLOAD_ROOT/../ in order for Azure Devops attachments to link properly and for Helix to store the logs File.Copy(file, Path.Combine(HELIX_WORKITEM_UPLOAD_ROOT, fileName)); - File.Copy(file, Path.Combine(HELIX_WORKITEM_UPLOAD_ROOT, "..", fileName)); } } else diff --git a/eng/helix/content/runtests.ps1 b/eng/helix/content/runtests.ps1 index 98c9f3c6e02e..20b892a88d34 100644 --- a/eng/helix/content/runtests.ps1 +++ b/eng/helix/content/runtests.ps1 @@ -14,10 +14,11 @@ param( $env:DOTNET_SKIP_FIRST_TIME_EXPERIENCE = 1 $env:DOTNET_MULTILEVEL_LOOKUP = 0 -$env:PLAYWRIGHT_BROWSERS_PATH = "$currentDirectory\ms-playwright" $env:InstallPlaywright = "$InstallPlaywright" - $currentDirectory = Get-Location +$env:PLAYWRIGHT_BROWSERS_PATH = "$currentDirectory\ms-playwright" +$env:PLAYWRIGHT_DRIVER_PATH = "$currentDirectory\.playwright\win-x64\native\playwright.cmd" + $envPath = "$env:PATH;$env:HELIX_CORRELATION_PAYLOAD\node\bin" function InvokeInstallDotnet([string]$command) { diff --git a/eng/helix/content/runtests.sh b/eng/helix/content/runtests.sh index a388a6279c91..357481f5eac3 100644 --- a/eng/helix/content/runtests.sh +++ b/eng/helix/content/runtests.sh @@ -2,6 +2,8 @@ dotnet_sdk_version="$2" dotnet_runtime_version="$3" +helixQueue="$5" +installPlaywright="${10}" RESET="\033[0m" RED="\033[0;31m" @@ -25,8 +27,47 @@ export DOTNET_CLI_HOME="$DIR/.home$RANDOM" export DOTNET_SKIP_FIRST_TIME_EXPERIENCE=1 -# Set playwright browser path +# Set playwright stuff export PLAYWRIGHT_BROWSERS_PATH="$DIR/ms-playwright" +if [[ "$helixQueue" == *"OSX"* ]]; then + export PLAYWRIGHT_DRIVER_PATH="$DIR/.playwright/osx/native/playwright.sh" + PLAYWRIGHT_NODE_PATH=$DIR/.playwright/osx/native/node +else + export PLAYWRIGHT_DRIVER_PATH="$DIR/.playwright/unix/native/playwright.sh" + PLAYWRIGHT_NODE_PATH=$DIR/.playwright/unix/native/node +fi +export InstallPlaywright="$installPlaywright" +if [ -f "$PLAYWRIGHT_DRIVER_PATH" ]; then + if [[ "$helixQueue" != *"OSX"* ]]; then + echo "Installing Playwright requirements..." + sudo apt-get install -y libdbus-glib-1-2 + sudo apt-get install -y libbrotli1 + sudo apt-get install -y libegl1 + sudo apt-get install -y libnotify4 + sudo apt-get install -y libvpx5 + sudo apt-get install -y libopus0 + sudo apt-get install -y libwoff1 + sudo apt-get install -y libgstreamer-plugins-base1.0-0 + sudo apt-get install -y libgstreamer1.0-0 + sudo apt-get install -y libgstreamer-gl1.0-0 + sudo apt-get install -y libgstreamer-plugins-bad1.0-0 + sudo apt-get install -y libopenjp2-7 + sudo apt-get install -y libwebpdemux2 + sudo apt-get install -y libwebp6 + sudo apt-get install -y libenchant1c2a + sudo apt-get install -y libsecret-1-0 + sudo apt-get install -y libhyphen0 + sudo apt-get install -y libgles2 + sudo apt-get install -y gstreamer1.0-libav + sudo apt-get install -y libxkbcommon0 + sudo apt-get install -y libgtk-3-0 + sudo apt-get install -y libharfbuzz-icu0 + fi + echo "chmod +x $PLAYWRIGHT_DRIVER_PATH" + chmod +x $PLAYWRIGHT_DRIVER_PATH + echo "chmod +x $PLAYWRIGHT_NODE_PATH" + chmod +x $PLAYWRIGHT_NODE_PATH +fi RESET="\033[0m" RED="\033[0;31m" @@ -83,8 +124,8 @@ exit_code=0 echo "Restore: $DOTNET_ROOT/dotnet restore RunTests/RunTests.csproj --ignore-failed-sources" $DOTNET_ROOT/dotnet restore RunTests/RunTests.csproj --ignore-failed-sources -echo "Running tests: $DOTNET_ROOT/dotnet run --no-restore --project RunTests/RunTests.csproj -- --target $1 --runtime $4 --queue $5 --arch $6 --quarantined $7 --ef $8 --helixTimeout $9" -$DOTNET_ROOT/dotnet run --no-restore --project RunTests/RunTests.csproj -- --target $1 --runtime $4 --queue $5 --arch $6 --quarantined $7 --ef $8 --helixTimeout $9 +echo "Running tests: $DOTNET_ROOT/dotnet run --no-restore --project RunTests/RunTests.csproj -- --target $1 --runtime $4 --queue $helixQueue --arch $6 --quarantined $7 --ef $8 --helixTimeout $9" +$DOTNET_ROOT/dotnet run --no-restore --project RunTests/RunTests.csproj -- --target $1 --runtime $4 --queue $helixQueue --arch $6 --quarantined $7 --ef $8 --helixTimeout $9 exit_code=$? echo "Finished tests...exit_code=$exit_code" diff --git a/eng/targets/Helix.Common.props b/eng/targets/Helix.Common.props index c3fe23fb1241..c54123f03387 100644 --- a/eng/targets/Helix.Common.props +++ b/eng/targets/Helix.Common.props @@ -12,14 +12,14 @@ - + - + diff --git a/eng/targets/Helix.targets b/eng/targets/Helix.targets index 9592591f1d87..c8d332b9977a 100644 --- a/eng/targets/Helix.targets +++ b/eng/targets/Helix.targets @@ -8,8 +8,8 @@ - - Windows.7.Amd64.Open;Windows.81.Amd64.Open + + Windows.7.Amd64.Open;Windows.81.Amd64.Open;Redhat.7.Amd64.Open;Redhat.7.Amd64;Debian.9.Amd64.Open;Debian.9.Amd64.Open;Ubuntu.2004.Amd64.Open;Ubuntu.2004.Amd64;Ubuntu.1604.Amd64.Open;Ubuntu.1604.Amd64;Alpine.312.Amd64.Open;(Alpine.312.Amd64.Open)Ubuntu.1604.Amd64.Open@mcr.microsoft.com/dotnet-buildtools/prereqs:alpine-3.12-helix-20200908125345-56c6673;(Fedora.33.Amd64.Open)Ubuntu.1604.Amd64.Open@mcr.microsoft.com/dotnet-buildtools/prereqs:fedora-33-helix-20210120000908-a9df267 diff --git a/src/ProjectTemplates/BlazorTemplates.Tests/BlazorServerTemplateTest.cs b/src/ProjectTemplates/BlazorTemplates.Tests/BlazorServerTemplateTest.cs index 1855a5034b47..24fe3fa75aa6 100644 --- a/src/ProjectTemplates/BlazorTemplates.Tests/BlazorServerTemplateTest.cs +++ b/src/ProjectTemplates/BlazorTemplates.Tests/BlazorServerTemplateTest.cs @@ -108,6 +108,7 @@ await Fixture.BrowserManager.GetBrowserInstance(browserKind, BrowserContextInfo) [Theory] [MemberData(nameof(BlazorServerTemplateWorks_IndividualAuthData))] [QuarantinedTest("https://github.com/dotnet/aspnetcore/issues/30807")] + [SkipOnHelix("https://github.com/dotnet/aspnetcore/issues/30825", Queues = "All.OSX")] public async Task BlazorServerTemplateWorks_IndividualAuth(BrowserKind browserKind, bool useLocalDB) { // Additional arguments are needed. See: https://github.com/dotnet/aspnetcore/issues/24278 diff --git a/src/ProjectTemplates/BlazorTemplates.Tests/BlazorTemplates.Tests.csproj b/src/ProjectTemplates/BlazorTemplates.Tests/BlazorTemplates.Tests.csproj index 8001d254d00c..db364525ca16 100644 --- a/src/ProjectTemplates/BlazorTemplates.Tests/BlazorTemplates.Tests.csproj +++ b/src/ProjectTemplates/BlazorTemplates.Tests/BlazorTemplates.Tests.csproj @@ -6,7 +6,6 @@ true true - true true @@ -45,6 +44,8 @@ + + false true @@ -57,4 +58,13 @@ + + + + <_PublishFiles Include="$(OutputPath).playwright\**\*.*" /> + + + + + diff --git a/src/ProjectTemplates/BlazorTemplates.Tests/BlazorWasmTemplateTest.cs b/src/ProjectTemplates/BlazorTemplates.Tests/BlazorWasmTemplateTest.cs index fd21ae632588..9d2252ce079a 100644 --- a/src/ProjectTemplates/BlazorTemplates.Tests/BlazorWasmTemplateTest.cs +++ b/src/ProjectTemplates/BlazorTemplates.Tests/BlazorWasmTemplateTest.cs @@ -293,6 +293,7 @@ public Task BlazorWasmHostedTemplate_IndividualAuth_Works_WithLocalDB(BrowserKin [Theory] [InlineData(BrowserKind.Chromium)] [QuarantinedTest("https://github.com/dotnet/aspnetcore/issues/30820")] + [SkipOnHelix("https://github.com/dotnet/aspnetcore/issues/30825", Queues = "All.OSX")] public Task BlazorWasmHostedTemplate_IndividualAuth_Works_WithOutLocalDB(BrowserKind browserKind) { return BlazorWasmHostedTemplate_IndividualAuth_Works(browserKind, false); diff --git a/src/ProjectTemplates/BlazorTemplates.Tests/playwrightSettings.json b/src/ProjectTemplates/BlazorTemplates.Tests/playwrightSettings.json index d5e34b4795f4..48f1423de9fb 100644 --- a/src/ProjectTemplates/BlazorTemplates.Tests/playwrightSettings.json +++ b/src/ProjectTemplates/BlazorTemplates.Tests/playwrightSettings.json @@ -28,7 +28,7 @@ }, "Firefox": { "BrowserKind": "Firefox", - "IsEnabled": true + "IsEnabled": false }, "Webkit": { "BrowserKind": "Webkit", diff --git a/src/Shared/BrowserTesting/src/BrowserManager.cs b/src/Shared/BrowserTesting/src/BrowserManager.cs index 20f970736e27..1fa54b4da923 100644 --- a/src/Shared/BrowserTesting/src/BrowserManager.cs +++ b/src/Shared/BrowserTesting/src/BrowserManager.cs @@ -3,6 +3,7 @@ using System; using System.Collections.Generic; +using System.IO; using System.Linq; using System.Threading; using System.Threading.Tasks; @@ -46,7 +47,15 @@ private async Task InitializeAsync() async Task InitializeCore() { - Playwright = await PlaywrightSharp.Playwright.CreateAsync(_loggerFactory/*, debug: "pw:api"*/); + var driverPath = Environment.GetEnvironmentVariable("PLAYWRIGHT_DRIVER_PATH"); + if (!string.IsNullOrEmpty(driverPath)) + { + Playwright = await PlaywrightSharp.Playwright.CreateAsync(_loggerFactory, driverExecutablePath: driverPath, debug: "pw:api"); + } + else + { + Playwright = await PlaywrightSharp.Playwright.CreateAsync(_loggerFactory, debug: "pw:api"); + } foreach (var (browserName, options) in _browserManagerConfiguration.BrowserOptions) { if (!_launchBrowsers.ContainsKey(browserName)) diff --git a/src/Shared/BrowserTesting/src/ContextInformation.cs b/src/Shared/BrowserTesting/src/ContextInformation.cs index f197dff80c7c..9b6d9525b82c 100644 --- a/src/Shared/BrowserTesting/src/ContextInformation.cs +++ b/src/Shared/BrowserTesting/src/ContextInformation.cs @@ -52,21 +52,18 @@ private void CleanupPage(object sender, EventArgs e) internal BrowserContextOptions ConfigureUniqueHarPath(BrowserContextOptions browserContextOptions) { + var uploadDir = Environment.GetEnvironmentVariable("HELIX_WORKITEM_UPLOAD_ROOT"); if (browserContextOptions?.RecordHar?.Path != null) { var identifier = Guid.NewGuid().ToString("N"); - var harDirectory = Environment.GetEnvironmentVariable("HELIX_WORKITEM_UPLOAD_ROOT"); - if (string.IsNullOrEmpty(harDirectory)) - { - harDirectory = browserContextOptions.RecordHar.Path; - } - browserContextOptions.RecordHar.Path = Path.Combine(harDirectory, $"{identifier}.har"); + browserContextOptions.RecordHar.Path = Path.Combine( + string.IsNullOrEmpty(uploadDir) ? browserContextOptions.RecordHar.Path : uploadDir, + $"{identifier}.har"); _harPath = browserContextOptions.RecordHar.Path; } if (browserContextOptions?.RecordVideo?.Dir != null) { - var uploadDir = Environment.GetEnvironmentVariable("HELIX_WORKITEM_UPLOAD_ROOT"); if (!string.IsNullOrEmpty(uploadDir)) { browserContextOptions.RecordVideo.Dir = uploadDir;