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");
});
}