This commit is contained in:
Brennan 2023-05-10 11:27:19 -07:00 коммит произвёл GitHub
Родитель acafa53ad1
Коммит cf010a70fa
Не найден ключ, соответствующий данной подписи
Идентификатор ключа GPG: 4AEE18F83AFDEB23
3 изменённых файлов: 11 добавлений и 10 удалений

Просмотреть файл

@ -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

Просмотреть файл

@ -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<Uri> WaitForServerAsync(int port, CancellationToken cancellationToken)
private static async ValueTask<Uri> 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<RemoteWebDriver> CreateBrowser(CancellationToken cancellationToken, bool captureBrowserMemory = false)
{
var uri = await WaitForServerAsync(SeleniumPort, cancellationToken);
var uri = await WaitForServerAsync(SeleniumHost, SeleniumPort, cancellationToken);
var options = new ChromeOptions();

Просмотреть файл

@ -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<AssemblyMetadataAttribute>()
@ -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,
};