diff --git a/.azure/pipelines/jobs/default-build.yml b/.azure/pipelines/jobs/default-build.yml index 07d5846c85d..9c9b41d2415 100644 --- a/.azure/pipelines/jobs/default-build.yml +++ b/.azure/pipelines/jobs/default-build.yml @@ -199,9 +199,9 @@ jobs: displayName: Start background dump collection - ${{ if eq(parameters.installNodeJs, 'true') }}: - task: NodeTool@0 - displayName: Install Node 16.x + displayName: Install Node 18.x inputs: - versionSpec: 16.x + versionSpec: 18.x - ${{ if and(eq(parameters.installJdk, 'true'), eq(parameters.agentOs, 'Windows')) }}: - powershell: ./eng/scripts/InstallJdk.ps1 displayName: Install JDK 11 diff --git a/src/Components/benchmarkapps/Wasm.Performance/Driver/Selenium.cs b/src/Components/benchmarkapps/Wasm.Performance/Driver/Selenium.cs index eb46e5e1062..d3c2a12c761 100644 --- a/src/Components/benchmarkapps/Wasm.Performance/Driver/Selenium.cs +++ b/src/Components/benchmarkapps/Wasm.Performance/Driver/Selenium.cs @@ -10,14 +10,15 @@ namespace Wasm.Performance.Driver; internal sealed class Selenium { + const string SeleniumHost = "127.0.0.1"; const int SeleniumPort = 4444; const bool RunHeadlessBrowser = true; const bool PoolForBrowserLogs = true; - private static async ValueTask WaitForServerAsync(int port, CancellationToken cancellationToken) + private static async ValueTask WaitForServerAsync(string host, int port, CancellationToken cancellationToken) { - var uri = new UriBuilder("http", "localhost", port, "/wd/hub/").Uri; + var uri = new UriBuilder("http", host, port, "/wd/hub/").Uri; var httpClient = new HttpClient { BaseAddress = uri, @@ -54,7 +55,7 @@ internal sealed class Selenium public static async Task CreateBrowser(CancellationToken cancellationToken, bool captureBrowserMemory = false) { - var uri = await WaitForServerAsync(SeleniumPort, cancellationToken); + var uri = await WaitForServerAsync(SeleniumHost, SeleniumPort, cancellationToken); var options = new ChromeOptions(); diff --git a/src/Shared/E2ETesting/SeleniumStandaloneServer.cs b/src/Shared/E2ETesting/SeleniumStandaloneServer.cs index 30263168009..a635d47f985 100644 --- a/src/Shared/E2ETesting/SeleniumStandaloneServer.cs +++ b/src/Shared/E2ETesting/SeleniumStandaloneServer.cs @@ -23,6 +23,9 @@ namespace Microsoft.AspNetCore.E2ETesting; public class SeleniumStandaloneServer : IDisposable { + private const string SeleniumHost = "127.0.0.1"; + private const int SeleniumProcessTimeout = 3600; // 1h 30 min + private static readonly SemaphoreSlim _semaphore = new SemaphoreSlim(1); private Process _process; @@ -30,9 +33,6 @@ public class SeleniumStandaloneServer : IDisposable private Process _sentinelProcess; private static IMessageSink _diagnosticsMessageSink; - // 1h 30 min - private const int SeleniumProcessTimeout = 3600; - public SeleniumStandaloneServer(IMessageSink diagnosticsMessageSink) { if (Instance != null || _diagnosticsMessageSink != null) @@ -85,7 +85,7 @@ public class SeleniumStandaloneServer : IDisposable private static async Task InitializeInstance(ITestOutputHelper output) { var port = FindAvailablePort(); - var uri = new UriBuilder("http", "localhost", port, "/wd/hub").Uri; + var uri = new UriBuilder("http", SeleniumHost, port, "/wd/hub").Uri; var seleniumConfigPath = typeof(SeleniumStandaloneServer).Assembly .GetCustomAttributes() @@ -111,7 +111,7 @@ public class SeleniumStandaloneServer : IDisposable var psi = new ProcessStartInfo { FileName = "npm", - Arguments = $"run selenium-standalone start -- --config \"{seleniumConfigPath}\" {chromeDriverArg} -- -port {port}", + Arguments = $"run selenium-standalone start -- --config \"{seleniumConfigPath}\" {chromeDriverArg} -- -host {SeleniumHost} -port {port}", RedirectStandardOutput = true, RedirectStandardError = true, };