From c6efccf4a9aa807fb1d27f0fd64e6ae12e4b8a6f Mon Sep 17 00:00:00 2001 From: Claude Date: Fri, 2 Oct 2026 22:24:11 +0000 Subject: [PATCH] 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 Claude-Session: https://claude.ai/code/session_012iLMBNwBE2GnphAsu4cjaC --- .../Archive/ArchiveScreenSmokeTests.cs | 51 +++++++++++++++++++ .../Import/ImportScreenSmokeTests.cs | 50 ++++++++++++++++++ .../Windows/ScreenSmokeTests.cs | 2 +- 3 files changed, 102 insertions(+), 1 deletion(-) create mode 100644 tests/Titano.App.Tests/Archive/ArchiveScreenSmokeTests.cs create mode 100644 tests/Titano.App.Tests/Import/ImportScreenSmokeTests.cs diff --git a/tests/Titano.App.Tests/Archive/ArchiveScreenSmokeTests.cs b/tests/Titano.App.Tests/Archive/ArchiveScreenSmokeTests.cs new file mode 100644 index 00000000..a56b4132 --- /dev/null +++ b/tests/Titano.App.Tests/Archive/ArchiveScreenSmokeTests.cs @@ -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; + +/// +/// Every Archive view of --capture () on the sample archive, rendered in both themes +/// in the real main window, with what each view must show. +/// +[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("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("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("archive-rebuild"); + }); +} diff --git a/tests/Titano.App.Tests/Import/ImportScreenSmokeTests.cs b/tests/Titano.App.Tests/Import/ImportScreenSmokeTests.cs new file mode 100644 index 00000000..1f437ff9 --- /dev/null +++ b/tests/Titano.App.Tests/Import/ImportScreenSmokeTests.cs @@ -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; + +/// +/// Every Import state of --capture () on the simulated card, rendered in both themes +/// in the real main window, with the figures and gates each state must show. +/// +[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().SelectMany(host => host.Toasts)); + await app.ExpectAsync("import-plan"); + + await ImportScenes.ShowAsync(app.Shell, "showplan"); + Assert.True(import.IsDetailsOpen); + Assert.Equal(50 + 3, import.Details!.Rows.Count); + await app.ExpectAsync("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("import-done"); + }); +} diff --git a/tests/Titano.App.Tests/Windows/ScreenSmokeTests.cs b/tests/Titano.App.Tests/Windows/ScreenSmokeTests.cs index fd589fa2..bc8647fc 100644 --- a/tests/Titano.App.Tests/Windows/ScreenSmokeTests.cs +++ b/tests/Titano.App.Tests/Windows/ScreenSmokeTests.cs @@ -122,7 +122,7 @@ public sealed class ScreenSmokeTests }); /// A on capture services and sample data, shown off screen like --capture. - private sealed class SampleApp : IAsyncDisposable + internal sealed class SampleApp : IAsyncDisposable { private const double Width = 1440; private const double Height = 900;