diff --git a/Directory.Packages.props b/Directory.Packages.props
index f80c70431..fa6a0a480 100644
--- a/Directory.Packages.props
+++ b/Directory.Packages.props
@@ -67,7 +67,7 @@
-
+
diff --git a/bff/bff.slnf b/bff/bff.slnf
index 9f8023dc9..1b9761854 100644
--- a/bff/bff.slnf
+++ b/bff/bff.slnf
@@ -32,7 +32,9 @@
"bff\\templates\\src\\BffLocalApi\\BffLocalApi.csproj",
"bff\\templates\\src\\BffRemoteApi\\BffRemoteApi.csproj",
"bff\\test\\Bff.Tests\\Bff.Tests.csproj",
- "bff\\test\\Hosts.Tests\\Hosts.Tests.csproj"
+ "bff\\test\\Hosts.Tests\\Hosts.Tests.csproj",
+ "shared\\Xunit.Playwright\\Duende.Xunit.Playwright.csproj",
+ "shared\\ShouldlyExtensions\\ShouldlyExtensions.csproj"
]
}
-}
\ No newline at end of file
+}
diff --git a/bff/hosts/Hosts.ServiceDefaults/BffAppHostRoutes.cs b/bff/hosts/Hosts.ServiceDefaults/BffAppHostRoutes.cs
new file mode 100644
index 000000000..c4d09c79b
--- /dev/null
+++ b/bff/hosts/Hosts.ServiceDefaults/BffAppHostRoutes.cs
@@ -0,0 +1,25 @@
+// Copyright (c) Duende Software. All rights reserved.
+// See LICENSE in the project root for license information.
+
+using Duende.Xunit.Playwright;
+
+namespace Hosts.ServiceDefaults;
+
+public class BffAppHostRoutes : IAppHostServiceRoutes
+{
+ public string[] ServiceNames => AppHostServices.All;
+
+ public Uri UrlTo(string clientName)
+ {
+ var url = clientName switch
+ {
+ AppHostServices.Bff => "https://localhost:5002",
+ AppHostServices.BffBlazorPerComponent => "https://localhost:5105",
+ AppHostServices.BffMultiFrontend => "https://localhost:5005",
+ AppHostServices.BffBlazorWebassembly => "https://localhost:5006",
+ AppHostServices.TemplateBffBlazor => "https://localhost:7035",
+ _ => throw new InvalidOperationException("client not configured")
+ };
+ return new Uri(url);
+ }
+}
diff --git a/bff/hosts/Hosts.ServiceDefaults/Hosts.ServiceDefaults.csproj b/bff/hosts/Hosts.ServiceDefaults/Hosts.ServiceDefaults.csproj
index 94b11e580..2e71a9989 100644
--- a/bff/hosts/Hosts.ServiceDefaults/Hosts.ServiceDefaults.csproj
+++ b/bff/hosts/Hosts.ServiceDefaults/Hosts.ServiceDefaults.csproj
@@ -19,6 +19,7 @@
+
diff --git a/bff/test/Hosts.Tests/BffBlazorWebAssemblyTests.cs b/bff/test/Hosts.Tests/BffBlazorWebAssemblyTests.cs
index c019e3fa4..696a70c4e 100644
--- a/bff/test/Hosts.Tests/BffBlazorWebAssemblyTests.cs
+++ b/bff/test/Hosts.Tests/BffBlazorWebAssemblyTests.cs
@@ -1,7 +1,8 @@
// Copyright (c) Duende Software. All rights reserved.
// See LICENSE in the project root for license information.
-using Duende.Hosts.Tests.TestInfra.Retries;
+using Duende.Xunit.Playwright;
+using Duende.Xunit.Playwright.Retries;
using Hosts.ServiceDefaults;
using Hosts.Tests.PageModels;
using Hosts.Tests.TestInfra;
@@ -9,8 +10,8 @@ using Xunit.Abstractions;
namespace Hosts.Tests;
-public class BffBlazorWebAssemblyTests(ITestOutputHelper output, AppHostFixture fixture)
- : PlaywrightTestBase(output, fixture)
+public class BffBlazorWebAssemblyTests(ITestOutputHelper output, BffHostTestFixture fixture)
+ : BffPlaywrightTestBase(output, fixture)
{
public async Task GoToHome()
{
diff --git a/bff/test/Hosts.Tests/BffTests.cs b/bff/test/Hosts.Tests/BffTests.cs
index fb8e79c6f..f6d789908 100644
--- a/bff/test/Hosts.Tests/BffTests.cs
+++ b/bff/test/Hosts.Tests/BffTests.cs
@@ -1,18 +1,21 @@
// Copyright (c) Duende Software. All rights reserved.
// See LICENSE in the project root for license information.
+using Duende.Xunit.Playwright;
using Hosts.ServiceDefaults;
using Hosts.Tests.TestInfra;
+using Projects;
using Xunit.Abstractions;
namespace Hosts.Tests;
-public class BffTests : IntegrationTestBase
+[Collection(BffAppHostCollection.CollectionName)]
+public class BffTests : IntegrationTestBase
{
private readonly HttpClient _httpClient;
private readonly BffClient _bffClient;
- public BffTests(ITestOutputHelper output, AppHostFixture fixture) : base(output: output, fixture: fixture)
+ public BffTests(ITestOutputHelper output, BffHostTestFixture fixture) : base(output: output, fixture: fixture)
{
_httpClient = CreateHttpClient(AppHostServices.Bff);
_bffClient = new BffClient(CreateHttpClient(AppHostServices.Bff));
@@ -28,7 +31,6 @@ public class BffTests : IntegrationTestBase
[SkippableFact]
public async Task Can_initiate_login()
{
-
var response = await _httpClient.GetAsync("/");
response.StatusCode.ShouldBe(HttpStatusCode.OK);
diff --git a/bff/test/Hosts.Tests/BlazorPerComponentTests.cs b/bff/test/Hosts.Tests/BlazorPerComponentTests.cs
index 785baa227..fb99bda66 100644
--- a/bff/test/Hosts.Tests/BlazorPerComponentTests.cs
+++ b/bff/test/Hosts.Tests/BlazorPerComponentTests.cs
@@ -1,7 +1,8 @@
// Copyright (c) Duende Software. All rights reserved.
// See LICENSE in the project root for license information.
-using Duende.Hosts.Tests.TestInfra.Retries;
+using Duende.Xunit.Playwright;
+using Duende.Xunit.Playwright.Retries;
using Hosts.ServiceDefaults;
using Hosts.Tests.PageModels;
using Hosts.Tests.TestInfra;
@@ -9,8 +10,8 @@ using Xunit.Abstractions;
namespace Hosts.Tests;
-public class BlazorPerComponentTests(ITestOutputHelper output, AppHostFixture fixture)
- : PlaywrightTestBase(output, fixture)
+public class BlazorPerComponentTests(ITestOutputHelper output, BffHostTestFixture fixture)
+ : BffPlaywrightTestBase(output, fixture)
{
public async Task GoToHome()
diff --git a/bff/test/Hosts.Tests/Hosts.Tests.csproj b/bff/test/Hosts.Tests/Hosts.Tests.csproj
index 7f7f7b628..aa230a81d 100644
--- a/bff/test/Hosts.Tests/Hosts.Tests.csproj
+++ b/bff/test/Hosts.Tests/Hosts.Tests.csproj
@@ -5,6 +5,7 @@
enable
false
Debug;Release;Debug_ncrunch
+ Hosts.Tests
@@ -12,7 +13,6 @@
-
@@ -22,11 +22,9 @@
-
-
@@ -39,4 +37,8 @@
+
+
+
+
diff --git a/bff/test/Hosts.Tests/Samples/BffBlazorTemplateTests.cs b/bff/test/Hosts.Tests/Templates/BffBlazorTemplateTests.cs
similarity index 87%
rename from bff/test/Hosts.Tests/Samples/BffBlazorTemplateTests.cs
rename to bff/test/Hosts.Tests/Templates/BffBlazorTemplateTests.cs
index 583d98322..e9fe30104 100644
--- a/bff/test/Hosts.Tests/Samples/BffBlazorTemplateTests.cs
+++ b/bff/test/Hosts.Tests/Templates/BffBlazorTemplateTests.cs
@@ -1,6 +1,7 @@
// Copyright (c) Duende Software. All rights reserved.
// See LICENSE in the project root for license information.
+using Duende.Xunit.Playwright;
using Hosts.ServiceDefaults;
using Hosts.Tests.PageModels;
using Hosts.Tests.TestInfra;
@@ -8,8 +9,8 @@ using Xunit.Abstractions;
namespace Hosts.Tests.Templates;
-public class BffBlazorTemplateTests(ITestOutputHelper output, AppHostFixture fixture)
- : PlaywrightTestBase(output, fixture)
+public class BffBlazorTemplateTests(ITestOutputHelper output, BffHostTestFixture fixture)
+ : BffPlaywrightTestBase(output, fixture)
{
public async Task GoToHome()
{
diff --git a/bff/test/Hosts.Tests/TestInfra/BffAppHostCollection.cs b/bff/test/Hosts.Tests/TestInfra/BffAppHostCollection.cs
new file mode 100644
index 000000000..8a86b6824
--- /dev/null
+++ b/bff/test/Hosts.Tests/TestInfra/BffAppHostCollection.cs
@@ -0,0 +1,13 @@
+// Copyright (c) Duende Software. All rights reserved.
+// See LICENSE in the project root for license information.
+
+namespace Hosts.Tests.TestInfra;
+
+[CollectionDefinition(CollectionName)]
+public class BffAppHostCollection : ICollectionFixture
+{
+ public const string CollectionName = "apphost collection";
+ // This class has no code, and is never created. Its purpose is simply
+ // to be the place to apply [CollectionDefinition] and all the
+ // ICollectionFixture<> interfaces.
+}
diff --git a/bff/test/Hosts.Tests/TestInfra/BffHostTestFixture.cs b/bff/test/Hosts.Tests/TestInfra/BffHostTestFixture.cs
new file mode 100644
index 000000000..25378bc12
--- /dev/null
+++ b/bff/test/Hosts.Tests/TestInfra/BffHostTestFixture.cs
@@ -0,0 +1,12 @@
+// Copyright (c) Duende Software. All rights reserved.
+// See LICENSE in the project root for license information.
+
+using Duende.Xunit.Playwright;
+using Hosts.ServiceDefaults;
+using Projects;
+
+namespace Hosts.Tests.TestInfra;
+
+public class BffHostTestFixture() : AppHostFixture(new BffAppHostRoutes())
+{
+}
diff --git a/bff/test/Hosts.Tests/TestInfra/BffPlaywrightTestBase.cs b/bff/test/Hosts.Tests/TestInfra/BffPlaywrightTestBase.cs
new file mode 100644
index 000000000..49eb4840e
--- /dev/null
+++ b/bff/test/Hosts.Tests/TestInfra/BffPlaywrightTestBase.cs
@@ -0,0 +1,16 @@
+// Copyright (c) Duende Software. All rights reserved.
+// See LICENSE in the project root for license information.
+
+using Duende.Xunit.Playwright;
+using Projects;
+using Xunit.Abstractions;
+
+namespace Hosts.Tests.TestInfra;
+
+[Collection(BffAppHostCollection.CollectionName)]
+public class BffPlaywrightTestBase : PlaywrightTestBase
+{
+ public BffPlaywrightTestBase(ITestOutputHelper output, AppHostFixture fixture) : base(output, fixture)
+ {
+ }
+}
diff --git a/bff/test/Hosts.Tests/readme.md b/bff/test/Hosts.Tests/readme.md
index 5810c57a2..ee2ed467c 100644
--- a/bff/test/Hosts.Tests/readme.md
+++ b/bff/test/Hosts.Tests/readme.md
@@ -12,9 +12,6 @@ dotnet build
pwsh bin/Debug/net9.0/playwright.ps1 install --with-deps
```
-
-
-
The actual tests have been written in such a way that they only need an HTTP client to work. If you don't do anything,
then the system will start an aspire test host, run the tests, then kill the aspire host again.
diff --git a/products.slnx b/products.slnx
index 73b43cfec..469c09200 100644
--- a/products.slnx
+++ b/products.slnx
@@ -166,6 +166,7 @@
+
diff --git a/bff/test/Hosts.Tests/TestInfra/AppHostFixture.cs b/shared/Xunit.Playwright/AppHostFixture.cs
similarity index 75%
rename from bff/test/Hosts.Tests/TestInfra/AppHostFixture.cs
rename to shared/Xunit.Playwright/AppHostFixture.cs
index d70bd6efe..3fe4d0012 100644
--- a/bff/test/Hosts.Tests/TestInfra/AppHostFixture.cs
+++ b/shared/Xunit.Playwright/AppHostFixture.cs
@@ -2,46 +2,19 @@
// See LICENSE in the project root for license information.
using Aspire.Hosting;
-using Hosts.ServiceDefaults;
using Microsoft.Extensions.Logging;
#if !DEBUG_NCRUNCH
using Microsoft.Extensions.Logging.Console;
-using Projects;
#endif
using Serilog;
using Serilog.Core;
using Serilog.Extensions.Logging;
-namespace Hosts.Tests.TestInfra;
+namespace Duende.Xunit.Playwright;
-[CollectionDefinition(AppHostCollection.CollectionName)]
-public class AppHostCollection : ICollectionFixture
-{
- public const string CollectionName = "apphost collection";
- // This class has no code, and is never created. Its purpose is simply
- // to be the place to apply [CollectionDefinition] and all the
- // ICollectionFixture<> interfaces.
-}
-
-///
-/// This fixture will launch the app host, if needed.
-/// It has 3 modes:
-/// - Directly. Then the test fixture will launch an aspire test host. It will run all tests against the aspire test
-/// host.
-/// In order to make this work, there were two things that I needed to overcome (see below). Service Discovery and
-/// Shared CookieContainers.
-/// - With manually run aspire host.The advantage of this is that you can keep your aspire host running
-/// and only iterate on your tests. This is more efficient for writing the tests.It also leaves the door open to
-/// re-using these tests to run them against a deployed in stance somewhere in the future.Downside is that you cannot
-/// debug both your tests and host at the same time because visual studio compiles them in the same location.
-/// - With NCrunch. It turns out that NCrunch doesn't support building aspire projects.
-/// However, I've always found that iterating over tests using ncrunch is the fastest way to get feedback.So, to make
-/// this work, I had to add a conditional compilation.
-///
-// ReSharper disable once ClassNeverInstantiated.Global
-public class AppHostFixture : IAsyncLifetime
+public class AppHostFixture(IAppHostServiceRoutes routes) : IAsyncLifetime where THost : class
{
private readonly TextWriter _startupLogs = new StringWriter();
private WriteTestOutput? _activeWriter;
@@ -90,7 +63,7 @@ public class AppHostFixture : IAsyncLifetime
// Not running in ncrunch AND no service found running.
// So, create an AppHost that will be used for the duration of this test run.
var appHost = await DistributedApplicationTestingBuilder
- .CreateAsync();
+ .CreateAsync();
appHost.Configuration["DcpPublisher:RandomizePorts"] = "false";
appHost.Services.ConfigureHttpClientDefaults(c => c.ConfigurePrimaryHttpMessageHandler(() =>
@@ -115,7 +88,7 @@ public class AppHostFixture : IAsyncLifetime
// Wait for all the services so that their logs are mostly written.
- foreach (var resource in AppHostServices.All)
+ foreach (var resource in routes.ServiceNames)
{
await resourceNotificationService.WaitForResourceAsync(
resource,
@@ -251,18 +224,7 @@ public class AppHostFixture : IAsyncLifetime
{
if (UsingAlreadyRunningInstance)
{
- // An aspire host is already found (likely was started manually)
- // so build an http client that directly points to this host.
- var url = clientName switch
- {
- AppHostServices.Bff => "https://localhost:5002",
- AppHostServices.BffBlazorPerComponent => "https://localhost:5105",
- AppHostServices.BffMultiFrontend => "https://localhost:5005",
- AppHostServices.BffBlazorWebassembly => "https://localhost:5006",
- AppHostServices.TemplateBffBlazor => "https://localhost:7035",
- _ => throw new InvalidOperationException("client not configured")
- };
- return new Uri(url);
+ return routes.UrlTo(clientName);
}
else
{
diff --git a/bff/test/Hosts.Tests/TestInfra/AutoFollowRedirectHandler.cs b/shared/Xunit.Playwright/AutoFollowRedirectHandler.cs
similarity index 97%
rename from bff/test/Hosts.Tests/TestInfra/AutoFollowRedirectHandler.cs
rename to shared/Xunit.Playwright/AutoFollowRedirectHandler.cs
index dca958b9c..86e3d8bcd 100644
--- a/bff/test/Hosts.Tests/TestInfra/AutoFollowRedirectHandler.cs
+++ b/shared/Xunit.Playwright/AutoFollowRedirectHandler.cs
@@ -3,7 +3,7 @@
using Microsoft.Extensions.Logging;
-namespace Hosts.Tests.TestInfra;
+namespace Duende.Xunit.Playwright;
public class AutoFollowRedirectHandler(ILogger logger) : DelegatingHandler
{
diff --git a/bff/test/Hosts.Tests/TestInfra/CloningHttpMessageHandler.cs b/shared/Xunit.Playwright/CloningHttpMessageHandler.cs
similarity index 98%
rename from bff/test/Hosts.Tests/TestInfra/CloningHttpMessageHandler.cs
rename to shared/Xunit.Playwright/CloningHttpMessageHandler.cs
index 30bbfeb21..ddb0aee2d 100644
--- a/bff/test/Hosts.Tests/TestInfra/CloningHttpMessageHandler.cs
+++ b/shared/Xunit.Playwright/CloningHttpMessageHandler.cs
@@ -1,7 +1,7 @@
// Copyright (c) Duende Software. All rights reserved.
// See LICENSE in the project root for license information.
-namespace Hosts.Tests.TestInfra;
+namespace Duende.Xunit.Playwright;
public class CloningHttpMessageHandler(HttpClient innerHttpClient) : HttpMessageHandler
{
diff --git a/bff/test/Hosts.Tests/TestInfra/CookieHandler.cs b/shared/Xunit.Playwright/CookieHandler.cs
similarity index 97%
rename from bff/test/Hosts.Tests/TestInfra/CookieHandler.cs
rename to shared/Xunit.Playwright/CookieHandler.cs
index 35965f53d..69ee48426 100644
--- a/bff/test/Hosts.Tests/TestInfra/CookieHandler.cs
+++ b/shared/Xunit.Playwright/CookieHandler.cs
@@ -3,7 +3,7 @@
using Microsoft.Net.Http.Headers;
-namespace Hosts.Tests.TestInfra;
+namespace Duende.Xunit.Playwright;
public class CookieHandler : DelegatingHandler
{
diff --git a/bff/test/Hosts.Tests/TestInfra/DelegateDisposable.cs b/shared/Xunit.Playwright/DelegateDisposable.cs
similarity index 86%
rename from bff/test/Hosts.Tests/TestInfra/DelegateDisposable.cs
rename to shared/Xunit.Playwright/DelegateDisposable.cs
index 790895dbd..92e8b1473 100644
--- a/bff/test/Hosts.Tests/TestInfra/DelegateDisposable.cs
+++ b/shared/Xunit.Playwright/DelegateDisposable.cs
@@ -1,7 +1,7 @@
// Copyright (c) Duende Software. All rights reserved.
// See LICENSE in the project root for license information.
-namespace Hosts.Tests.TestInfra;
+namespace Duende.Xunit.Playwright;
public class DelegateDisposable(Action onDispose) : IDisposable
{
diff --git a/bff/test/Hosts.Tests/TestInfra/DelegateTextWriter.cs b/shared/Xunit.Playwright/DelegateTextWriter.cs
similarity index 97%
rename from bff/test/Hosts.Tests/TestInfra/DelegateTextWriter.cs
rename to shared/Xunit.Playwright/DelegateTextWriter.cs
index d505f8cbf..7cbf6f958 100644
--- a/bff/test/Hosts.Tests/TestInfra/DelegateTextWriter.cs
+++ b/shared/Xunit.Playwright/DelegateTextWriter.cs
@@ -3,7 +3,7 @@
using System.Text;
-namespace Hosts.Tests.TestInfra;
+namespace Duende.Xunit.Playwright;
public class DelegateTextWriter : TextWriter
{
diff --git a/shared/Xunit.Playwright/Duende.Xunit.Playwright.csproj b/shared/Xunit.Playwright/Duende.Xunit.Playwright.csproj
new file mode 100644
index 000000000..86adb1249
--- /dev/null
+++ b/shared/Xunit.Playwright/Duende.Xunit.Playwright.csproj
@@ -0,0 +1,36 @@
+
+
+
+ net9.0
+ enable
+ enable
+ Duende.Xunit.Playwright
+ true
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
diff --git a/shared/Xunit.Playwright/IAppHostServiceRoutes.cs b/shared/Xunit.Playwright/IAppHostServiceRoutes.cs
new file mode 100644
index 000000000..a759bbd8a
--- /dev/null
+++ b/shared/Xunit.Playwright/IAppHostServiceRoutes.cs
@@ -0,0 +1,13 @@
+// Copyright (c) Duende Software. All rights reserved.
+// See LICENSE in the project root for license information.
+
+namespace Duende.Xunit.Playwright;
+
+///
+/// This interface describes all the services in an AppHost and provides Urls to services in the host for external code.
+///
+public interface IAppHostServiceRoutes
+{
+ public string[] ServiceNames { get; }
+ public Uri UrlTo(string clientName);
+}
diff --git a/bff/test/Hosts.Tests/TestInfra/IntegrationTestBase.cs b/shared/Xunit.Playwright/IntegrationTestBase.cs
similarity index 87%
rename from bff/test/Hosts.Tests/TestInfra/IntegrationTestBase.cs
rename to shared/Xunit.Playwright/IntegrationTestBase.cs
index c0c0cfbe1..37d9a35db 100644
--- a/bff/test/Hosts.Tests/TestInfra/IntegrationTestBase.cs
+++ b/shared/Xunit.Playwright/IntegrationTestBase.cs
@@ -3,14 +3,13 @@
using Xunit.Abstractions;
-namespace Hosts.Tests.TestInfra;
+namespace Duende.Xunit.Playwright;
-[Collection(AppHostCollection.CollectionName)]
-public class IntegrationTestBase : IDisposable
+public class IntegrationTestBase : IDisposable where THost : class
{
private readonly IDisposable _loggingScope;
- public IntegrationTestBase(ITestOutputHelper output, AppHostFixture fixture)
+ public IntegrationTestBase(ITestOutputHelper output, AppHostFixture fixture)
{
Output = output;
Fixture = fixture;
@@ -23,13 +22,13 @@ public class IntegrationTestBase : IDisposable
{
#if DEBUG_NCRUNCH
// Running in NCrunch. NCrunch cannot build the aspire project, so it needs
- // to be started manually.
+ // to be started manually.
Skip.If(true, "When running the Host.Tests using NCrunch, you must start the Hosts.AppHost project manually. IE: dotnet run -p bff/samples/Hosts.AppHost. Or start without debugging from the UI. ");
#endif
}
}
- public AppHostFixture Fixture { get; }
+ public AppHostFixture Fixture { get; }
public ITestOutputHelper Output { get; }
diff --git a/bff/test/Hosts.Tests/PlaywrightTestBase.cs b/shared/Xunit.Playwright/PlaywrightTestBase.cs
similarity index 91%
rename from bff/test/Hosts.Tests/PlaywrightTestBase.cs
rename to shared/Xunit.Playwright/PlaywrightTestBase.cs
index 1b64574b2..be3d3b562 100644
--- a/bff/test/Hosts.Tests/PlaywrightTestBase.cs
+++ b/shared/Xunit.Playwright/PlaywrightTestBase.cs
@@ -2,13 +2,12 @@
// See LICENSE in the project root for license information.
using System.Reflection;
-using Hosts.Tests.TestInfra;
using Microsoft.Playwright;
using Microsoft.Playwright.Xunit;
using Xunit.Abstractions;
using Xunit.Sdk;
-namespace Hosts.Tests;
+namespace Duende.Xunit.Playwright;
public class Defaults
{
@@ -17,12 +16,11 @@ public class Defaults
}
[WithTestName]
-[Collection(AppHostCollection.CollectionName)]
-public class PlaywrightTestBase : PageTest, IDisposable
+public class PlaywrightTestBase : PageTest, IDisposable where THost : class
{
private readonly IDisposable _loggingScope;
- public PlaywrightTestBase(ITestOutputHelper output, AppHostFixture fixture)
+ public PlaywrightTestBase(ITestOutputHelper output, AppHostFixture fixture)
{
Output = output;
Fixture = fixture;
@@ -36,7 +34,7 @@ public class PlaywrightTestBase : PageTest, IDisposable
{
#if DEBUG_NCRUNCH
// Running in NCrunch. NCrunch cannot build the aspire project, so it needs
- // to be started manually.
+ // to be started manually.
Skip.If(true, "When running the Host.Tests using NCrunch, you must start the Hosts.AppHost project manually. IE: dotnet run -p bff/samples/Hosts.AppHost. Or start without debugging from the UI. ");
#endif
}
@@ -58,7 +56,7 @@ public class PlaywrightTestBase : PageTest, IDisposable
public override async Task DisposeAsync()
{
var path = Path.GetDirectoryName(Assembly.GetExecutingAssembly().Location) ?? Environment.CurrentDirectory;
- // if path ends with /bin/{build configuration}/{dotnetversion}, then strip that from the path.
+ // if path ends with /bin/{build configuration}/{dotnetversion}, then strip that from the path.
var bin = Path.GetFullPath(Path.Combine(path, "../../"));
if (bin.EndsWith("\\bin\\") || bin.EndsWith("/bin/"))
{
@@ -82,14 +80,14 @@ public class PlaywrightTestBase : PageTest, IDisposable
Locale = "en-US",
ColorScheme = ColorScheme.Light,
- // We need to ignore https errors to make this work on the build server.
+ // We need to ignore https errors to make this work on the build server.
// Even though we use dotnet dev-certs https --trust on the build agent,
- // it still claims the certs are invalid.
+ // it still claims the certs are invalid.
IgnoreHTTPSErrors = true,
};
- public AppHostFixture Fixture { get; }
+ public AppHostFixture Fixture { get; }
public ITestOutputHelper Output { get; }
diff --git a/bff/test/Hosts.Tests/TestInfra/RequestLoggingHandler.cs b/shared/Xunit.Playwright/RequestLoggingHandler.cs
similarity index 97%
rename from bff/test/Hosts.Tests/TestInfra/RequestLoggingHandler.cs
rename to shared/Xunit.Playwright/RequestLoggingHandler.cs
index 0daaaba8f..2ec91fb4e 100644
--- a/bff/test/Hosts.Tests/TestInfra/RequestLoggingHandler.cs
+++ b/shared/Xunit.Playwright/RequestLoggingHandler.cs
@@ -4,7 +4,7 @@
using System.Diagnostics;
using Microsoft.Extensions.Logging;
-namespace Hosts.Tests.TestInfra;
+namespace Duende.Xunit.Playwright;
public class RequestLoggingHandler(
ILogger log,
diff --git a/bff/test/Hosts.Tests/TestInfra/Retries/RetryableFact.cs b/shared/Xunit.Playwright/Retries/RetryableFact.cs
similarity index 88%
rename from bff/test/Hosts.Tests/TestInfra/Retries/RetryableFact.cs
rename to shared/Xunit.Playwright/Retries/RetryableFact.cs
index 22c3ef1f3..912043db9 100644
--- a/bff/test/Hosts.Tests/TestInfra/Retries/RetryableFact.cs
+++ b/shared/Xunit.Playwright/Retries/RetryableFact.cs
@@ -3,7 +3,7 @@
using Xunit.Sdk;
-namespace Duende.Hosts.Tests.TestInfra.Retries;
+namespace Duende.Xunit.Playwright.Retries;
[XunitTestCaseDiscoverer(
typeName: "Duende.Hosts.Tests.TestInfra.Retries.RetryableTestDiscoverer",
diff --git a/bff/test/Hosts.Tests/TestInfra/Retries/RetryableTestCase.cs b/shared/Xunit.Playwright/Retries/RetryableTestCase.cs
similarity index 97%
rename from bff/test/Hosts.Tests/TestInfra/Retries/RetryableTestCase.cs
rename to shared/Xunit.Playwright/Retries/RetryableTestCase.cs
index fe3965991..ecac29181 100644
--- a/bff/test/Hosts.Tests/TestInfra/Retries/RetryableTestCase.cs
+++ b/shared/Xunit.Playwright/Retries/RetryableTestCase.cs
@@ -4,7 +4,7 @@
using Xunit.Abstractions;
using Xunit.Sdk;
-namespace Duende.Hosts.Tests.TestInfra.Retries;
+namespace Duende.Xunit.Playwright.Retries;
public class RetryableTestCase(
IMessageSink sink,
diff --git a/bff/test/Hosts.Tests/TestInfra/Retries/RetryableTestDiscoverer.cs b/shared/Xunit.Playwright/Retries/RetryableTestDiscoverer.cs
similarity index 98%
rename from bff/test/Hosts.Tests/TestInfra/Retries/RetryableTestDiscoverer.cs
rename to shared/Xunit.Playwright/Retries/RetryableTestDiscoverer.cs
index 6255312bc..d460ecaae 100644
--- a/bff/test/Hosts.Tests/TestInfra/Retries/RetryableTestDiscoverer.cs
+++ b/shared/Xunit.Playwright/Retries/RetryableTestDiscoverer.cs
@@ -4,7 +4,7 @@
using Xunit.Abstractions;
using Xunit.Sdk;
-namespace Duende.Hosts.Tests.TestInfra.Retries;
+namespace Duende.Xunit.Playwright.Retries;
public class RetryableTestDiscoverer(IMessageSink messageSink) : IXunitTestCaseDiscoverer
{
diff --git a/bff/test/Hosts.Tests/TestInfra/WriteTestOutput.cs b/shared/Xunit.Playwright/WriteTestOutput.cs
similarity index 83%
rename from bff/test/Hosts.Tests/TestInfra/WriteTestOutput.cs
rename to shared/Xunit.Playwright/WriteTestOutput.cs
index d8f36c16f..fc223e6a6 100644
--- a/bff/test/Hosts.Tests/TestInfra/WriteTestOutput.cs
+++ b/shared/Xunit.Playwright/WriteTestOutput.cs
@@ -1,6 +1,6 @@
// Copyright (c) Duende Software. All rights reserved.
// See LICENSE in the project root for license information.
-namespace Hosts.Tests.TestInfra;
+namespace Duende.Xunit.Playwright;
public delegate void WriteTestOutput(string message);