From c832407880cf17b97ca8d7dc41213a5e22fdc107 Mon Sep 17 00:00:00 2001 From: martincostello Date: Mon, 23 Oct 2023 09:13:36 +0100 Subject: [PATCH] Retry some UI tests Improve test reliability by retrying tests that use a browser test matrix. --- Directory.Packages.props | 1 + tests/LondonTravel.Site.Tests/Integration/AlexaTests.cs | 5 +++-- .../Integration/AuthenticationTests.cs | 5 +++-- .../LondonTravel.Site.Tests/Integration/PreferencesTests.cs | 2 +- tests/LondonTravel.Site.Tests/LondonTravel.Site.Tests.csproj | 1 + 5 files changed, 9 insertions(+), 5 deletions(-) diff --git a/Directory.Packages.props b/Directory.Packages.props index f04a1a699..6a0f88d7c 100644 --- a/Directory.Packages.props +++ b/Directory.Packages.props @@ -41,6 +41,7 @@ + diff --git a/tests/LondonTravel.Site.Tests/Integration/AlexaTests.cs b/tests/LondonTravel.Site.Tests/Integration/AlexaTests.cs index 25516e9ed..bd156a8c3 100644 --- a/tests/LondonTravel.Site.Tests/Integration/AlexaTests.cs +++ b/tests/LondonTravel.Site.Tests/Integration/AlexaTests.cs @@ -8,6 +8,7 @@ using Microsoft.AspNetCore.WebUtilities; using Microsoft.Extensions.DependencyInjection; using Microsoft.Extensions.Primitives; +using xRetry; namespace MartinCostello.LondonTravel.Site.Integration; @@ -27,7 +28,7 @@ public AlexaTests(HttpServerFixture fixture, ITestOutputHelper outputHelper) Fixture.Services!.GetRequiredService().Clear(); } - [Theory] + [RetryTheory] [ClassData(typeof(BrowsersTestData))] public async Task Can_Authorize_Alexa(string browserType, string? browserChannel) { @@ -52,7 +53,7 @@ await WithNavigatorAsync( }); } - [Theory] + [RetryTheory] [ClassData(typeof(BrowsersTestData))] public async Task Can_Get_Preferences_From_Api(string browserType, string? browserChannel) { diff --git a/tests/LondonTravel.Site.Tests/Integration/AuthenticationTests.cs b/tests/LondonTravel.Site.Tests/Integration/AuthenticationTests.cs index a28080abe..306b585ca 100644 --- a/tests/LondonTravel.Site.Tests/Integration/AuthenticationTests.cs +++ b/tests/LondonTravel.Site.Tests/Integration/AuthenticationTests.cs @@ -3,6 +3,7 @@ using MartinCostello.LondonTravel.Site.Pages; using Microsoft.Extensions.DependencyInjection; +using xRetry; namespace MartinCostello.LondonTravel.Site.Integration; @@ -54,7 +55,7 @@ await AtPageAsync( }); } - [Theory] + [RetryTheory] [ClassData(typeof(BrowsersTestData))] public async Task Can_Delete_Account(string browserType, string? browserChannel) { @@ -85,7 +86,7 @@ await page.DeleteAccountAsync() }); } - [Theory] + [RetryTheory] [ClassData(typeof(BrowsersTestData))] public async Task Can_Link_Accounts(string browserType, string? browserChannel) { diff --git a/tests/LondonTravel.Site.Tests/Integration/PreferencesTests.cs b/tests/LondonTravel.Site.Tests/Integration/PreferencesTests.cs index 2998928b8..7a7924b9b 100644 --- a/tests/LondonTravel.Site.Tests/Integration/PreferencesTests.cs +++ b/tests/LondonTravel.Site.Tests/Integration/PreferencesTests.cs @@ -22,7 +22,7 @@ public PreferencesTests(HttpServerFixture fixture, ITestOutputHelper outputHelpe Fixture.Services!.GetRequiredService().Clear(); } - [Theory] + [xRetry.RetryTheory] [ClassData(typeof(BrowsersTestData))] public async Task Can_Manage_Preferences(string browserType, string? browserChannel) { diff --git a/tests/LondonTravel.Site.Tests/LondonTravel.Site.Tests.csproj b/tests/LondonTravel.Site.Tests/LondonTravel.Site.Tests.csproj index 83f753c42..1f9bb72d0 100644 --- a/tests/LondonTravel.Site.Tests/LondonTravel.Site.Tests.csproj +++ b/tests/LondonTravel.Site.Tests/LondonTravel.Site.Tests.csproj @@ -25,6 +25,7 @@ +