Skip to content

Add retries when initial connection fails #21711

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

Merged
merged 2 commits into from
May 13, 2020
Merged
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
@@ -1,6 +1,8 @@
// Copyright (c) .NET Foundation. All rights reserved.
// Licensed under the Apache License, Version 2.0. See License.txt in the project root for license information.

using System;
using System.Linq;
using System.Net;
using System.Threading;
using System.Threading.Tasks;
Expand All @@ -24,7 +26,7 @@ public BlazorServerTemplateTest(ProjectFactoryFixture projectFactory, BrowserFix

public Project Project { get; private set; }

[ConditionalFact(Skip = "This test ran for over an hour")]
[Fact]
[QuarantinedTest("https://github.com/dotnet/aspnetcore/issues/20172")]
public async Task BlazorServerTemplateWorks_NoAuth()
{
Expand Down Expand Up @@ -137,9 +139,23 @@ public async Task BlazorServerTemplateWorks_IndividualAuth(bool useLocalDB)

private void TestBasicNavigation()
{
// Give components.server enough time to load so that it can replace
// the prerendered content before we start making assertions.
Thread.Sleep(5000);
var retries = 3;
var connected = false;
do
{
try
{
Browser.Contains("Information: WebSocket connected to",
() => string.Join(Environment.NewLine, Browser.GetBrowserLogs(LogLevel.Info).Select(b => b.Message)));
connected = true;
}
catch (TimeoutException) when(retries-- > 0)
{
Browser.Navigate().Refresh();
}
} while (!connected && retries > 0);


Browser.Exists(By.TagName("ul"));
// <title> element gets project ID injected into it during template execution
Browser.Equal(Project.ProjectName.Trim(), () => Browser.Title.Trim());
Expand Down
3 changes: 2 additions & 1 deletion src/ProjectTemplates/ProjectTemplatesNoDeps.slnf
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,8 @@
"Web.ItemTemplates\\Microsoft.DotNet.Web.ItemTemplates.csproj",
"Web.ProjectTemplates\\Microsoft.DotNet.Web.ProjectTemplates.csproj",
"Web.Spa.ProjectTemplates\\Microsoft.DotNet.Web.Spa.ProjectTemplates.csproj",
"test\\ProjectTemplates.Tests.csproj"
"test\\ProjectTemplates.Tests.csproj",
"BlazorTemplates.Tests\\BlazorTemplates.Tests.csproj"
]
}
}