diff --git a/src/ProjectTemplates/test/Templates.Blazor.Tests/playwrightSettings.container.json b/src/ProjectTemplates/test/Templates.Blazor.Tests/playwrightSettings.container.json new file mode 100644 index 000000000000..9cac360ea5a2 --- /dev/null +++ b/src/ProjectTemplates/test/Templates.Blazor.Tests/playwrightSettings.container.json @@ -0,0 +1,5 @@ +{ + "GlobalBrowserOptions": { + "ChromiumSandbox": false + } +} diff --git a/src/Servers/IIS/IIS/test/Common.FunctionalTests/Infrastructure/SkipIfNotAdminAttribute.cs b/src/Servers/IIS/IIS/test/Common.FunctionalTests/Infrastructure/SkipIfNotAdminAttribute.cs index 189a0efd0d46..8721e39eacbe 100644 --- a/src/Servers/IIS/IIS/test/Common.FunctionalTests/Infrastructure/SkipIfNotAdminAttribute.cs +++ b/src/Servers/IIS/IIS/test/Common.FunctionalTests/Infrastructure/SkipIfNotAdminAttribute.cs @@ -14,6 +14,11 @@ public bool IsMet { get { + if (!OperatingSystem.IsWindows()) + { + return false; + } + var identity = WindowsIdentity.GetCurrent(); var principal = new WindowsPrincipal(identity); return principal.IsInRole(WindowsBuiltInRole.Administrator) || SkipInVSTSAttribute.RunningInVSTS; diff --git a/src/Shared/BrowserTesting/src/BrowserTestBase.cs b/src/Shared/BrowserTesting/src/BrowserTestBase.cs index 6b6fc394dd71..6d571093cc77 100644 --- a/src/Shared/BrowserTesting/src/BrowserTestBase.cs +++ b/src/Shared/BrowserTesting/src/BrowserTestBase.cs @@ -21,6 +21,9 @@ public class BrowserTestBase : LoggedTest, IAsyncLifetime !string.IsNullOrWhiteSpace(Environment.GetEnvironmentVariable("ContinuousIntegrationBuild")) || !string.IsNullOrWhiteSpace(Environment.GetEnvironmentVariable("Helix")); + private static readonly bool _isContainerEnvironment = + File.Exists("/.dockerenv") || File.Exists("/run/.containerenv"); + private static readonly BrowserManagerConfiguration _config = new BrowserManagerConfiguration(CreateConfiguration()); public BrowserTestBase(ITestOutputHelper output = null) : base(output) { } @@ -55,6 +58,11 @@ private static IConfiguration CreateConfiguration() .AddJsonFile(Path.Combine(basePath, $"playwrightSettings.ci.{os}.json"), optional: true); } + if (_isContainerEnvironment) + { + builder.AddJsonFile(Path.Combine(basePath, "playwrightSettings.container.json"), optional: true); + } + if (Debugger.IsAttached) { builder.AddJsonFile(Path.Combine(basePath, "playwrightSettings.debug.json"), optional: true); diff --git a/src/Shared/E2ETesting/BrowserFixture.cs b/src/Shared/E2ETesting/BrowserFixture.cs index 861281ad1cd2..86af6f2acfe5 100644 --- a/src/Shared/E2ETesting/BrowserFixture.cs +++ b/src/Shared/E2ETesting/BrowserFixture.cs @@ -168,6 +168,7 @@ private async Task DeleteBrowserUserProfileDirectoriesAsync() opts.AddArgument("--no-sandbox"); opts.AddArgument("--ignore-certificate-errors"); + opts.AddArgument("--disable-dev-shm-usage"); // Log errors opts.SetLoggingPreference(LogType.Browser, LogLevel.All); diff --git a/src/SignalR/server/SignalR/test/Microsoft.AspNetCore.SignalR.TrimmingTests/TestTypedClients.cs b/src/SignalR/server/SignalR/test/Microsoft.AspNetCore.SignalR.TrimmingTests/TestTypedClients.cs index 41d3a8aea858..b7d96421da2a 100644 --- a/src/SignalR/server/SignalR/test/Microsoft.AspNetCore.SignalR.TrimmingTests/TestTypedClients.cs +++ b/src/SignalR/server/SignalR/test/Microsoft.AspNetCore.SignalR.TrimmingTests/TestTypedClients.cs @@ -25,6 +25,11 @@ // connect a client and ensure we can invoke a method on the server var serverUrl = app.Services.GetRequiredService().Features.Get().Addresses.First(); + +// replace IPv6Any/IPv4Any with localhost so that it's a valid address for the client connection +serverUrl = serverUrl.Replace("[::]", "localhost"); +serverUrl = serverUrl.Replace("0.0.0.0", "localhost"); + var hubConnectionBuilder = new HubConnectionBuilder() .WithUrl(serverUrl + "/testhub"); AppJsonSerializerContext.AddToJsonHubProtocol(hubConnectionBuilder.Services); diff --git a/src/Testing/src/HelixHelper.cs b/src/Testing/src/HelixHelper.cs index eb40e10daea7..6ab8cd4557c8 100644 --- a/src/Testing/src/HelixHelper.cs +++ b/src/Testing/src/HelixHelper.cs @@ -10,7 +10,7 @@ public static class HelixHelper { public static bool OnHelix() => !string.IsNullOrEmpty(GetTargetHelixQueue()); - public static string GetTargetHelixQueue() => Environment.GetEnvironmentVariable("helix"); + public static string GetTargetHelixQueue() => Environment.GetEnvironmentVariable("helix") ?? ""; // Uploads the file on helix, or puts the file in your user temp folder when running locally public static void PreserveFile(string filePath, string uploadFileName)