test(postit): run all Avalonia UI tests in the shared collection fixture

Replace [AvaloniaFact]/[AvaloniaTheory] and direct GetOrStartForAssembly
dispatches with ui.RunAsync in AvaloniaUiCollection, avoiding a second
headless session that could hang PodcastBroadcasterTests. Add a synchronous
RunAsync overload and update MessagingSessionTests contact-preference
assertions for the audio-only capabilities announced on Linux desktop.

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
This commit is contained in:
Paul Schneider 2026-11-16 15:55:32 +00:00
commit 8ab3c02ebc
Signed by: notazof
GPG key ID: AD4B9B545FBD7D12
27 changed files with 443 additions and 332 deletions

View file

@ -1,5 +1,4 @@
using Avalonia.Controls;
using Avalonia.Headless.XUnit;
using PostIt.Services;
using PostIt.ViewModels;
using PostIt.Views;
@ -9,7 +8,8 @@ using Yavsc.Api.Client;
namespace PostIt.Tests;
[Trait("Category", "non-reg")]
public sealed class PerformerDonationSettingsTests
[Collection(AvaloniaUiCollection.Name)]
public sealed class PerformerDonationSettingsTests(AvaloniaUiFixture ui)
{
[Theory]
[InlineData("performer@payments.example", "performer@payments.example")]
@ -21,8 +21,9 @@ public sealed class PerformerDonationSettingsTests
Assert.Equal(expected, vm.BuildPerformerProfileSettings().DonationPayPalEmail);
}
[AvaloniaFact]
public async Task Performer_editor_loads_displays_edits_and_saves_the_private_recipient()
[Fact]
public Task Performer_editor_loads_displays_edits_and_saves_the_private_recipient()
=> ui.RunAsync(async () =>
{
var tokenPath = Path.Combine(Path.GetTempPath(), "postit-donation-" + Guid.NewGuid().ToString("N") + ".json");
try
@ -46,7 +47,7 @@ public sealed class PerformerDonationSettingsTests
{
if (File.Exists(tokenPath)) File.Delete(tokenPath);
}
}
}, TestContext.Current.CancellationToken);
private sealed class PerformerApi(string tokenPath) : YavscApiClient(new Settings
{