From 0705420c4ff3c8d3b6e3093cf8bf83ef7c54c1f8 Mon Sep 17 00:00:00 2001 From: Ben Sampica Date: Sat, 20 Aug 2022 20:15:59 -0500 Subject: [PATCH] Fix flaky test and smol refactor (#153) --- src/Tests/Features/FreeAgents/BidCountdownTests.cs | 2 +- src/Tests/RedirectTests.cs | 10 +++++----- 2 files changed, 6 insertions(+), 6 deletions(-) diff --git a/src/Tests/Features/FreeAgents/BidCountdownTests.cs b/src/Tests/Features/FreeAgents/BidCountdownTests.cs index 5635d05..ef8f310 100644 --- a/src/Tests/Features/FreeAgents/BidCountdownTests.cs +++ b/src/Tests/Features/FreeAgents/BidCountdownTests.cs @@ -13,7 +13,7 @@ public void CountsDownEverySecondUntilZero() }); cut.WaitForState(() => cut.Markup.Contains("1 second"), TimeSpan.FromSeconds(5)); - cut.WaitForState(() => cut.Markup.Contains("0 seconds")); + cut.WaitForState(() => cut.Markup.Contains("0 seconds"), TimeSpan.FromSeconds(3)); cut.Render(); cut.Markup.Should().Contain("0 seconds"); diff --git a/src/Tests/RedirectTests.cs b/src/Tests/RedirectTests.cs index e5ae971..40eeefe 100644 --- a/src/Tests/RedirectTests.cs +++ b/src/Tests/RedirectTests.cs @@ -2,14 +2,14 @@ namespace DynamoLeagueBlazor.Tests; -public class RedirectTests +public class RedirectTests : IntegrationTestBase { [Fact] public async Task GivenAnyRequest_WhenIsHttp_ThenIsRedirectedToHttps() { - var webApplicationFactory = new WebApplicationFactory(); + var application = CreateUnauthenticatedApplication(); - var client = webApplicationFactory.CreateClient(new WebApplicationFactoryClientOptions + var client = application.CreateClient(new WebApplicationFactoryClientOptions { AllowAutoRedirect = false, BaseAddress = new Uri("http://www.test.com") @@ -23,9 +23,9 @@ public async Task GivenAnyRequest_WhenIsHttp_ThenIsRedirectedToHttps() [Fact] public async Task GivenAnyRequest_WhenIsNotWww_ThenIsRedirectedToWww() { - var webApplicationFactory = new WebApplicationFactory(); + var application = CreateUnauthenticatedApplication(); - var client = webApplicationFactory.CreateClient(new WebApplicationFactoryClientOptions + var client = application.CreateClient(new WebApplicationFactoryClientOptions { AllowAutoRedirect = false, BaseAddress = new Uri("https://test.com")