Add retries when initial connection fails (#21711)
* Add retries when initial connection fails
This commit is contained in:
parent
1abf560f17
commit
572c6fa4ce
|
|
@ -1,6 +1,8 @@
|
||||||
// Copyright (c) .NET Foundation. All rights reserved.
|
// 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.
|
// 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.Net;
|
||||||
using System.Threading;
|
using System.Threading;
|
||||||
using System.Threading.Tasks;
|
using System.Threading.Tasks;
|
||||||
|
|
@ -24,7 +26,7 @@ namespace Templates.Test
|
||||||
|
|
||||||
public Project Project { get; private set; }
|
public Project Project { get; private set; }
|
||||||
|
|
||||||
[ConditionalFact(Skip = "This test ran for over an hour")]
|
[Fact]
|
||||||
[QuarantinedTest("https://github.com/dotnet/aspnetcore/issues/20172")]
|
[QuarantinedTest("https://github.com/dotnet/aspnetcore/issues/20172")]
|
||||||
public async Task BlazorServerTemplateWorks_NoAuth()
|
public async Task BlazorServerTemplateWorks_NoAuth()
|
||||||
{
|
{
|
||||||
|
|
@ -137,9 +139,23 @@ namespace Templates.Test
|
||||||
|
|
||||||
private void TestBasicNavigation()
|
private void TestBasicNavigation()
|
||||||
{
|
{
|
||||||
// Give components.server enough time to load so that it can replace
|
var retries = 3;
|
||||||
// the prerendered content before we start making assertions.
|
var connected = false;
|
||||||
Thread.Sleep(5000);
|
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"));
|
Browser.Exists(By.TagName("ul"));
|
||||||
// <title> element gets project ID injected into it during template execution
|
// <title> element gets project ID injected into it during template execution
|
||||||
Browser.Equal(Project.ProjectName.Trim(), () => Browser.Title.Trim());
|
Browser.Equal(Project.ProjectName.Trim(), () => Browser.Title.Trim());
|
||||||
|
|
|
||||||
|
|
@ -6,7 +6,8 @@
|
||||||
"Web.ItemTemplates\\Microsoft.DotNet.Web.ItemTemplates.csproj",
|
"Web.ItemTemplates\\Microsoft.DotNet.Web.ItemTemplates.csproj",
|
||||||
"Web.ProjectTemplates\\Microsoft.DotNet.Web.ProjectTemplates.csproj",
|
"Web.ProjectTemplates\\Microsoft.DotNet.Web.ProjectTemplates.csproj",
|
||||||
"Web.Spa.ProjectTemplates\\Microsoft.DotNet.Web.Spa.ProjectTemplates.csproj",
|
"Web.Spa.ProjectTemplates\\Microsoft.DotNet.Web.Spa.ProjectTemplates.csproj",
|
||||||
"test\\ProjectTemplates.Tests.csproj"
|
"test\\ProjectTemplates.Tests.csproj",
|
||||||
|
"BlazorTemplates.Tests\\BlazorTemplates.Tests.csproj"
|
||||||
]
|
]
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
Loading…
Reference in New Issue