Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[browser][mt] Fix SignalRClientTests timeouts #100516

Closed
wants to merge 2 commits into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -38,6 +38,9 @@ public async Task SignalRPassMessages(string config, string transport)

List<string> consoleOutput = new();
List<string> serverOutput = new();
bool shouldRetry = true;
int retryCount = 0;
int maxRetryCount = 3;

var result = await RunSdkStyleAppForBuild(new(
Configuration: config,
Expand All @@ -62,8 +65,32 @@ public async Task SignalRPassMessages(string config, string transport)
throw new Exception(msg.Text);
}

if (msg.Text.Contains("Starting the app"))
{
await Task.Delay(TimeSpan.FromMinutes(2)); // wait for 2 minutes for the test to start
if (shouldRetry)
{
if (retryCount < maxRetryCount)
{
retryCount++;
Console.WriteLine($"Starting the {retryCount} / {maxRetryCount} retry");
string currentUrl = page.Url;
await page.GotoAsync(currentUrl);
}
else
{
throw new Exception($"Max retries reached. Test failed.\n{_testOutput}");
}
}
}

if (msg.Text.Contains("Finished GetQueryParameters"))
{
// WASM got loaded, no more retries
shouldRetry = false;
// first click after render - make sure buttons are available
await SaveClickButtonAsync(page, "button#connectButton");
}

if (msg.Text.Contains("SignalR connected"))
await SaveClickButtonAsync(page, "button#subscribeButton");
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -10,4 +10,5 @@
builder.RootComponents.Add<HeadOutlet>("head::after");
builder.Services.AddScoped(sp => new HttpClient { BaseAddress = new Uri(builder.HostEnvironment.BaseAddress) });

Helper.TestOutputWriteLine($"Starting the app");
await builder.Build().RunAsync().ConfigureAwait(false);