Skip to content

Commit

Permalink
Retry some UI tests
Browse files Browse the repository at this point in the history
Improve test reliability by retrying tests that use a browser test matrix.
  • Loading branch information
martincostello committed Oct 23, 2023
1 parent 42f79bc commit c832407
Show file tree
Hide file tree
Showing 5 changed files with 9 additions and 5 deletions.
1 change: 1 addition & 0 deletions Directory.Packages.props
Original file line number Diff line number Diff line change
Expand Up @@ -41,6 +41,7 @@
<PackageVersion Include="StyleCop.Analyzers" Version="1.2.0-beta.507" />
<PackageVersion Include="Swashbuckle.AspNetCore" Version="$(SwashbuckleAspNetCoreVersion)" />
<PackageVersion Include="Swashbuckle.AspNetCore.Annotations" Version="$(SwashbuckleAspNetCoreVersion)" />
<PackageVersion Include="xRetry" Version="1.9.0" />
<PackageVersion Include="xunit" Version="2.5.3" />
<PackageVersion Include="xunit.runner.visualstudio" Version="2.5.3" />
<PackageVersion Include="Xunit.SkippableFact" Version="1.4.13" />
Expand Down
5 changes: 3 additions & 2 deletions tests/LondonTravel.Site.Tests/Integration/AlexaTests.cs
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@
using Microsoft.AspNetCore.WebUtilities;
using Microsoft.Extensions.DependencyInjection;
using Microsoft.Extensions.Primitives;
using xRetry;

namespace MartinCostello.LondonTravel.Site.Integration;

Expand All @@ -27,7 +28,7 @@ public AlexaTests(HttpServerFixture fixture, ITestOutputHelper outputHelper)
Fixture.Services!.GetRequiredService<InMemoryDocumentStore>().Clear();
}

[Theory]
[RetryTheory]
[ClassData(typeof(BrowsersTestData))]
public async Task Can_Authorize_Alexa(string browserType, string? browserChannel)
{
Expand All @@ -52,7 +53,7 @@ await WithNavigatorAsync(
});
}

[Theory]
[RetryTheory]
[ClassData(typeof(BrowsersTestData))]
public async Task Can_Get_Preferences_From_Api(string browserType, string? browserChannel)
{
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@

using MartinCostello.LondonTravel.Site.Pages;
using Microsoft.Extensions.DependencyInjection;
using xRetry;

namespace MartinCostello.LondonTravel.Site.Integration;

Expand Down Expand Up @@ -54,7 +55,7 @@ await AtPageAsync<HomePage>(
});
}

[Theory]
[RetryTheory]
[ClassData(typeof(BrowsersTestData))]
public async Task Can_Delete_Account(string browserType, string? browserChannel)
{
Expand Down Expand Up @@ -85,7 +86,7 @@ await page.DeleteAccountAsync()
});
}

[Theory]
[RetryTheory]
[ClassData(typeof(BrowsersTestData))]
public async Task Can_Link_Accounts(string browserType, string? browserChannel)
{
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ public PreferencesTests(HttpServerFixture fixture, ITestOutputHelper outputHelpe
Fixture.Services!.GetRequiredService<InMemoryDocumentStore>().Clear();
}

[Theory]
[xRetry.RetryTheory]
[ClassData(typeof(BrowsersTestData))]
public async Task Can_Manage_Preferences(string browserType, string? browserChannel)
{
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,7 @@
<PackageReference Include="Microsoft.Playwright" />
<PackageReference Include="NSubstitute" />
<PackageReference Include="Shouldly" />
<PackageReference Include="xRetry" />
<PackageReference Include="xunit" />
<PackageReference Include="xunit.runner.visualstudio" />
<PackageReference Include="Xunit.SkippableFact" />
Expand Down

0 comments on commit c832407

Please sign in to comment.