using System.Windows; using System.Windows.Automation; using System.Windows.Automation.Peers; using System.Windows.Controls; using System.Windows.Input; using System.Windows.Media; using System.Windows.Threading; using Chronos.App.Infrastructure; using Chronos.App.Tests.Windows; using Chronos.Core.Localization; using Chronos.Testing; using Chronos.Ui.Controls; using Chronos.Ui.Theming; using Chronos.Uploader.DesignTime; using Chronos.Uploader.Shell; using Chronos.Uploader.Uploads; namespace Chronos.App.Tests.Uploader; /// /// The uploader window on the --capture sample data, shown off screen: icon-only buttons and queue rows are /// named for screen readers, rows take keyboard focus, no field shows an error before use, disabled controls say /// why, and in a right-to-left language the window mirrors while paths, file names and the media glyph do not. /// [WindowsOnly] [Serial] [Timeout(120_000)] public sealed class UploaderScreenSmokeTests { [Test] public Task EveryScreenIsNamedFocusableAndCalm() => ScreenHost.RunAsync(async () => { UiLanguage.Apply("en"); using var screen = await UploaderScreen.OpenAsync(); var vm = screen.ViewModel; screen.Sample.ShowConnect(); await screen.SettleAsync(); Assert.Equal(FlowDirection.LeftToRight, screen.Window.FlowDirection); Assert.False(vm.Connect.HasErrors, "the address is not marked before a sign-in"); Assert.Null(vm.Connect.PasswordError); Assert.Null(vm.Connect.ErrorText); foreach (var box in screen.Visible()) Assert.False(Validation.GetHasError(box), $"{AutomationProperties.GetName(box)} shows an error before use"); Assert.False(Field.GetHasError(screen.Named("Password")), "the password box shows no error before use"); screen.AssertIconButtonsNamed("connect"); // Enter signs in from the form, not from the settings panel drawn over it. var signIn = screen.Visible