Remove test workaround that is no longer needed now the underlying issue is resolved
This commit is contained in:
parent
a76a891865
commit
fad4fb22fa
|
|
@ -8,7 +8,6 @@ using System.Net.Http;
|
||||||
using Microsoft.Extensions.CommandLineUtils;
|
using Microsoft.Extensions.CommandLineUtils;
|
||||||
using Xunit;
|
using Xunit;
|
||||||
using Xunit.Abstractions;
|
using Xunit.Abstractions;
|
||||||
using System.Threading;
|
|
||||||
|
|
||||||
namespace Templates.Test.Helpers
|
namespace Templates.Test.Helpers
|
||||||
{
|
{
|
||||||
|
|
@ -108,31 +107,6 @@ namespace Templates.Test.Helpers
|
||||||
Assert.Equal(statusCode, response.StatusCode);
|
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()
|
public IWebDriver VisitInBrowser()
|
||||||
{
|
{
|
||||||
_output.WriteLine($"Opening browser at {_listeningUri}...");
|
_output.WriteLine($"Opening browser at {_listeningUri}...");
|
||||||
|
|
|
||||||
|
|
@ -46,11 +46,7 @@ namespace Templates.Test
|
||||||
{
|
{
|
||||||
using (var aspNetProcess = StartAspNetProcess(targetFrameworkOverride, publish))
|
using (var aspNetProcess = StartAspNetProcess(targetFrameworkOverride, publish))
|
||||||
{
|
{
|
||||||
// TODO: Remove the retry from here. Instead, work around the issue in the actual
|
aspNetProcess.AssertStatusCode("/", HttpStatusCode.OK, "text/html");
|
||||||
// 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");
|
|
||||||
|
|
||||||
if (WebDriverFactory.HostSupportsBrowserAutomation)
|
if (WebDriverFactory.HostSupportsBrowserAutomation)
|
||||||
{
|
{
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue