test(app): smoke tests of every Import state and Archive view in both themes

The screen smoke host's SampleApp becomes internal so the Import and Archive
tests render the same scenes as --capture.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_012iLMBNwBE2GnphAsu4cjaC
This commit is contained in:
Claude committed 2026-10-02 22:24:11 +00:00
1 parent a0e814885c
commit c6efccf4a9
3 files changed
+102 -1

No files matched your search

@@ -0,0 +1,51 @@
using Titano.App.Archiving;
using Titano.App.Sections;
using Titano.App.Tests.Windows;
using Titano.Testing;
using Titano.Ui.Controls;
namespace Titano.App.Tests.Archiving;
/// <summary>
/// Every Archive view of <c>--capture</c> (<see cref="ArchiveScenes"/>) on the sample archive, rendered in both themes
/// in the real main window, with what each view must show.
/// </summary>
[WindowsOnly]
[Serial]
[Timeout(300_000)]
public sealed class ArchiveScreenSmokeTests
{
[Test]
public Task EveryArchiveViewRendersInBothThemes() => ScreenHost.RunAsync(async () =>
{
await using var app = await ScreenSmokeTests.SampleApp.StartAsync();
await app.Sample.FillAsync();
var archive = app.Shell.Archive;
await ArchiveScenes.ShowAsync(app.Shell, "overview");
Assert.True(archive.IsOverview);
Assert.True(archive.TreeRows[0].IsArchive);
Assert.Equal(StatusKind.Online, archive.TreeRows[0].AvailabilityKind);
Assert.True(archive.TreeRows[1].IsYear);
Assert.True(archive.TreeRows[1].IsExpanded, "the newest year opens with the screen");
Assert.Equal(5, archive.Tiles.Count);
Assert.Equal(2, archive.MonthRows.Count, "one heatmap row per year, 2025 and 2026");
Assert.NotEmpty(archive.StorageBars);
Assert.NotEmpty(archive.CameraBars);
Assert.NotEmpty(archive.FormatBars);
Assert.True(archive.ScanCommand.CanExecute(null), "an online archive can be scanned");
await app.ExpectAsync<ArchiveView>("archive-overview");
await ArchiveScenes.ShowAsync(app.Shell, "maintenance");
Assert.True(archive.IsMaintenance);
Assert.Equal(5, archive.Health.Count);
Assert.Equal(1, archive.Duplicates!.Count);
Assert.Equal(3, archive.Orphans!.Count, "unlisted photos, a row without sidecar, a folder not indexed");
await app.ExpectAsync<ArchiveView>("archive-maintenance");
await ArchiveScenes.ShowAsync(app.Shell, "rebuild");
var rebuild = Assert.NotNull(archive.Dialog as RebuildDialogViewModel);
Assert.True(rebuild.RebuildCommand.CanExecute(null));
await app.ExpectAsync<ArchiveView>("archive-rebuild");
});
}
@@ -0,0 +1,50 @@
using Titano.App.Import;
using Titano.App.Sections;
using Titano.App.Tests.Windows;
using Titano.Testing;
using Titano.Ui.Controls;
namespace Titano.App.Tests.Import;
/// <summary>
/// Every Import state of <c>--capture</c> (<see cref="ImportScenes"/>) on the simulated card, rendered in both themes
/// in the real main window, with the figures and gates each state must show.
/// </summary>
[WindowsOnly]
[Serial]
[Timeout(300_000)]
public sealed class ImportScreenSmokeTests
{
[Test]
public Task EveryImportStateRendersInBothThemes() => ScreenHost.RunAsync(async () =>
{
await using var app = await ScreenSmokeTests.SampleApp.StartAsync();
await app.Sample.FillAsync();
var import = app.Shell.Import;
await ImportScenes.ShowAsync(app.Shell, "plan");
Assert.Equal(ImportPhase.Ready, import.Phase);
Assert.Equal("EOS R5 · card A", import.SourceTitle);
Assert.Equal(3, import.Sessions.Count, "night, dawn and sunset");
Assert.Equal(50, import.Plan!.CopyCount);
Assert.Equal("Harbour sunset", import.Plan.Sessions[^1].Title);
Assert.Null(import.StartBlocker);
Assert.NotEmpty(app.FindAll<ToastHost>().SelectMany(host => host.Toasts));
await app.ExpectAsync<ImportView>("import-plan");
await ImportScenes.ShowAsync(app.Shell, "showplan");
Assert.True(import.IsDetailsOpen);
Assert.Equal(50 + 3, import.Details!.Rows.Count);
await app.ExpectAsync<ImportView>("import-showplan");
await ImportScenes.ShowAsync(app.Shell, "done");
Assert.True(import.IsDone);
var result = import.Result!;
Assert.True(result.IsComplete);
Assert.True(result.OffersDelete);
Assert.True(result.Actions.CanDelete, "a verified import and its dry run allow deleting");
Assert.Equal(49, result.Actions.DeleteCount);
Assert.False(result.Actions.CanFormat, "a photo touched since the import keeps the card from being formatted");
await app.ExpectAsync<ImportView>("import-done");
});
}
@@ -122,7 +122,7 @@ public sealed class ScreenSmokeTests
});
/// <summary>A <see cref="MainWindow"/> on capture services and sample data, shown off screen like <c>--capture</c>.</summary>
private sealed class SampleApp : IAsyncDisposable
internal sealed class SampleApp : IAsyncDisposable
{
private const double Width = 1440;
private const double Height = 900;