Remove test workaround that is no longer needed now the underlying issue is resolved

This commit is contained in:
Steve Sanderson 2017-11-17 15:10:57 +00:00
parent a76a891865
commit fad4fb22fa
2 changed files with 1 additions and 31 deletions

View File

@ -8,7 +8,6 @@ using System.Net.Http;
using Microsoft.Extensions.CommandLineUtils;
using Xunit;
using Xunit.Abstractions;
using System.Threading;
namespace Templates.Test.Helpers
{
@ -108,31 +107,6 @@ namespace Templates.Test.Helpers
Assert.Equal(statusCode, response.StatusCode);
}
public void AssertStatusCodeWithRetry(string requestUrl, HttpStatusCode statusCode, string acceptContentType = null)
{
const int MaxAttempts = 3;
for (var attemptNumber = 1; ; attemptNumber++)
{
try
{
AssertStatusCode(requestUrl, statusCode, acceptContentType);
return;
}
catch
{
if (attemptNumber >= MaxAttempts)
{
_output.WriteLine($"Giving up requesting '{requestUrl}' after {attemptNumber} attempts.");
throw;
}
_output.WriteLine($"Request to '{requestUrl}' failed, but will retry...");
Thread.Sleep(3000);
}
}
}
public IWebDriver VisitInBrowser()
{
_output.WriteLine($"Opening browser at {_listeningUri}...");

View File

@ -46,11 +46,7 @@ namespace Templates.Test
{
using (var aspNetProcess = StartAspNetProcess(targetFrameworkOverride, publish))
{
// TODO: Remove the retry from here. Instead, work around the issue in the actual
// SpaServices.Extensions code (by retrying). The issue is that @angular/cli rejects
// connections for the first second or so after it claims to be listening.
// However, you do still need to keep sending "Accept: text/html" or it returns 404.
aspNetProcess.AssertStatusCodeWithRetry("/", HttpStatusCode.OK, "text/html");
aspNetProcess.AssertStatusCode("/", HttpStatusCode.OK, "text/html");
if (WebDriverFactory.HostSupportsBrowserAutomation)
{