diff --git a/StabilityMatrix.UITests/Extensions/WindowExtensions.cs b/StabilityMatrix.UITests/Extensions/WindowExtensions.cs index 922ea147..f86ad7b9 100644 --- a/StabilityMatrix.UITests/Extensions/WindowExtensions.cs +++ b/StabilityMatrix.UITests/Extensions/WindowExtensions.cs @@ -19,16 +19,12 @@ public static class WindowExtensions } if (targetVisualRoot.Equals(topLevel)) { - throw new ArgumentException( - "Target is not part of the same visual tree as the top level" - ); + throw new ArgumentException("Target is not part of the same visual tree as the top level"); } var point = - target.TranslatePoint( - new Point(target.Bounds.Width / 2, target.Bounds.Height / 2), - topLevel - ) ?? throw new NullReferenceException("Point is null"); + target.TranslatePoint(new Point(target.Bounds.Width / 2, target.Bounds.Height / 2), topLevel) + ?? throw new NullReferenceException("Point is null"); topLevel.MouseMove(point); topLevel.MouseDown(point, MouseButton.Left); @@ -48,16 +44,12 @@ public static class WindowExtensions } if (!targetVisualRoot.Equals(topLevel)) { - throw new ArgumentException( - "Target is not part of the same visual tree as the top level" - ); + throw new ArgumentException("Target is not part of the same visual tree as the top level"); } var point = - target.TranslatePoint( - new Point(target.Bounds.Width / 2, target.Bounds.Height / 2), - topLevel - ) ?? throw new NullReferenceException("Point is null"); + target.TranslatePoint(new Point(target.Bounds.Width / 2, target.Bounds.Height / 2), topLevel) + ?? throw new NullReferenceException("Point is null"); topLevel.MouseMove(point); topLevel.MouseDown(point, MouseButton.Left); @@ -68,6 +60,6 @@ public static class WindowExtensions // Return mouse to outside of window topLevel.MouseMove(new Point(-50, -50)); - Dispatcher.UIThread.Invoke(() => Dispatcher.UIThread.RunJobs()); + await Task.Delay(300); } } diff --git a/StabilityMatrix.UITests/MainWindowTests.cs b/StabilityMatrix.UITests/MainWindowTests.cs index a55b8cbd..1c002cf5 100644 --- a/StabilityMatrix.UITests/MainWindowTests.cs +++ b/StabilityMatrix.UITests/MainWindowTests.cs @@ -1,9 +1,9 @@ using Avalonia.Controls; -using Avalonia.Threading; using Avalonia.VisualTree; +using FluentAvalonia.UI.Controls; using Microsoft.Extensions.DependencyInjection; using StabilityMatrix.Avalonia.ViewModels; -using StabilityMatrix.Avalonia.Views.Dialogs; +using StabilityMatrix.Avalonia.Views; using StabilityMatrix.UITests.Extensions; namespace StabilityMatrix.UITests; @@ -19,30 +19,9 @@ public class MainWindowTests : TestBase var (window, _) = GetMainWindow(); window.Show(); - - await Task.Delay(300); - Dispatcher.UIThread.RunJobs(); - - // Find the select data directory dialog - var selectDataDirectoryDialog = await WaitHelper.WaitForNotNullAsync(() => GetWindowDialog(window)); - Assert.NotNull(selectDataDirectoryDialog); - - // Click continue button - var continueButton = selectDataDirectoryDialog - .GetVisualDescendants() - .OfType