diff --git a/Lombiq.Tests.UI.Tests.UI/TestCases/CustomAdminPrefixTestCases.cs b/Lombiq.Tests.UI.Tests.UI/TestCases/CustomAdminPrefixTestCases.cs index bffe1a0eb..197c6ce36 100644 --- a/Lombiq.Tests.UI.Tests.UI/TestCases/CustomAdminPrefixTestCases.cs +++ b/Lombiq.Tests.UI.Tests.UI/TestCases/CustomAdminPrefixTestCases.cs @@ -22,6 +22,7 @@ public static Task NavigationWithCustomAdminPrefixShouldWorkAsync( configuration => { configuration.HtmlValidationConfiguration.RunHtmlValidationAssertionOnAllPageChanges = false; + configuration.OrchardCoreConfiguration.BeforeAppStart += (_, argsBuilder) => { argsBuilder.AddWithValue("OrchardCore:OrchardCore_Admin:AdminUrlPrefix", "custom-admin"); @@ -29,6 +30,13 @@ public static Task NavigationWithCustomAdminPrefixShouldWorkAsync( return Task.CompletedTask; }; + // Using a custom setup operation so UITT will consider it unique, and not reuse its snapshot with other + // tests if this one ends up running first. This is necessary because the AdminUrlPrefix is saved to the + // DB by the OrchardCore.AdminMenu feature, like for the admin menu's Blog item; we don't want the other + // tests to use that. + var originalSetupOperation = configuration.SetupConfiguration.SetupOperation; + configuration.SetupConfiguration.SetupOperation = context => originalSetupOperation(context); + return Task.CompletedTask; }); }