diff --git a/StabilityMatrix.UITests/MainWindowTests.cs b/StabilityMatrix.UITests/MainWindowTests.cs index 694297ba..50614ed0 100644 --- a/StabilityMatrix.UITests/MainWindowTests.cs +++ b/StabilityMatrix.UITests/MainWindowTests.cs @@ -13,6 +13,7 @@ using StabilityMatrix.Avalonia.Views.Dialogs; namespace StabilityMatrix.UITests; [UsesVerify] +[Collection("TempDir")] public class MainWindowTests { private static IServiceProvider Services => App.Services; @@ -72,6 +73,8 @@ public class MainWindowTests window.Show(); + await Task.Delay(800); + // Find the select data directory dialog var selectDataDirectoryDialog = await WaitHelper.WaitForNotNullAsync( () => GetWindowDialog(window) @@ -92,6 +95,8 @@ public class MainWindowTests ); Assert.NotNull(oneClickDialog); + await Task.Delay(1000); + await Verify(window, Settings); } } diff --git a/StabilityMatrix.UITests/Snapshots/MainWindowTests.MainWindow_ShouldOpen.received.png b/StabilityMatrix.UITests/Snapshots/MainWindowTests.MainWindow_ShouldOpen.received.png deleted file mode 100644 index 05458bb7..00000000 Binary files a/StabilityMatrix.UITests/Snapshots/MainWindowTests.MainWindow_ShouldOpen.received.png and /dev/null differ diff --git a/StabilityMatrix.UITests/Snapshots/MainWindowTests.MainWindow_ShouldOpen.received.txt b/StabilityMatrix.UITests/Snapshots/MainWindowTests.MainWindow_ShouldOpen.received.txt deleted file mode 100644 index a4c4fc4e..00000000 --- a/StabilityMatrix.UITests/Snapshots/MainWindowTests.MainWindow_ShouldOpen.received.txt +++ /dev/null @@ -1,444 +0,0 @@ -{ - Type: MainWindow, - Title: Stability Matrix, - Icon: {}, - Content: { - Type: Grid, - Children: [ - { - Type: Grid, - Background: Transparent, - Height: 32.0, - Name: TitleBarHost, - Children: [ - { - Type: Image, - Source: { - Dpi: { - X: 96.0, - Y: 96.0, - Length: 135.7645019878171, - SquaredLength: 18432.0 - }, - Size: { - AspectRatio: 1.0, - Width: 256.0, - Height: 256.0 - }, - PixelSize: { - AspectRatio: 1.0, - Width: 256, - Height: 256 - }, - Format: { - BitsPerPixel: 32 - } - }, - IsHitTestVisible: false, - Width: 18.0, - Height: 18.0, - Margin: 12,4,12,4, - IsVisible: true, - Name: WindowIcon - }, - { - Type: TextBlock, - FontSize: 12.0, - Text: Stability Matrix, - IsHitTestVisible: false, - VerticalAlignment: Center, - IsVisible: true - }, - { - Type: Border, - Padding: 6 - } - ] - }, - { - Type: NavigationView, - Content: { - Type: Frame, - Content: { - Type: LaunchPageView, - Content: { - Type: Grid, - Children: [ - { - Type: Grid, - Margin: 0,8,0,8, - Children: [ - { - Type: Grid, - Margin: 16,8,0,0, - Children: [ - { - Type: Grid, - Column: 0, - Row: 0, - Name: LaunchButtonGrid, - Children: [ - { - Type: Button, - Command: LaunchPageViewModel.LaunchAsync(string command), - Content: Launch, - Width: 95.0, - HorizontalAlignment: Left, - VerticalAlignment: Stretch, - IsVisible: false - }, - { - Type: SplitButton, - Command: LaunchPageViewModel.LaunchAsync(string command), - Flyout: { - Type: FAMenuFlyout - }, - Content: Launch, - Width: 104.0, - HorizontalAlignment: Left, - VerticalAlignment: Stretch, - IsVisible: false - } - ] - }, - { - Type: TeachingTip, - Name: TeachingTip1 - }, - { - Type: Grid, - Column: 0, - Row: 0, - IsVisible: false, - Name: StopButtonGrid, - Children: [ - { - Type: Button, - Command: {}, - Content: Stop, - Width: 95.0, - HorizontalAlignment: Left, - VerticalAlignment: Stretch, - IsVisible: false - }, - { - Type: Button, - Command: {}, - Content: Stop, - Width: 104.0, - HorizontalAlignment: Left, - VerticalAlignment: Stretch, - IsVisible: false - } - ] - }, - { - Type: Button, - Command: LaunchPageViewModel.Config(), - Content: { - Type: SymbolIcon - }, - FontSize: 16.0, - Width: 48.0, - Margin: 8,0,0,0, - HorizontalAlignment: Left, - VerticalAlignment: Stretch - } - ] - }, - { - Type: ComboBox, - SelectedIndex: -1, - Selection: { - SingleSelect: true, - SelectedIndex: -1, - AnchorIndex: -1 - }, - SelectionMode: Single, - ItemTemplate: { - DataType: InstalledPackage, - Content: { - Type: Func, - Target: XamlIlRuntimeHelpers.<>c__DisplayClass1_0, - Method: System.Object DeferredTransformationFactoryV2(System.IServiceProvider) - } - }, - IsEnabled: true, - Margin: 8,8,0,0, - HorizontalAlignment: Stretch, - VerticalAlignment: Top, - Name: SelectPackageComboBox - }, - { - Type: ToggleButton, - IsChecked: true, - Content: { - Type: Icon, - Template: { - Content: { - Type: Func, - Target: XamlIlRuntimeHelpers.<>c__DisplayClass1_0, - Method: System.Object DeferredTransformationFactoryV2(System.IServiceProvider) - } - }, - RenderTransform: { - Type: TransformGroup, - Children: [ - { - Type: RotateTransform - } - ] - } - }, - FontSize: 16.0, - Width: 48.0, - Margin: 8,8,0,0, - HorizontalAlignment: Left, - VerticalAlignment: Stretch - }, - { - Type: ToggleButton, - IsChecked: false, - Content: { - Type: SymbolIcon - }, - FontSize: 16.0, - Width: 48.0, - Margin: 8,8,16,0, - HorizontalAlignment: Left, - VerticalAlignment: Stretch - } - ] - }, - { - Type: TextEditor, - FontFamily: Cascadia Code, - Margin: 8,8,16,10, - DataContext: { - IsUpdatesRunning: false, - WriteCursorLockTimeout: 00:00:00.1000000, - Document: { - _undoStack: { - IsOriginalFile: true, - AcceptChanges: true, - CanUndo: false, - CanRedo: false, - SizeLimit: 2147483647 - }, - Text: , - Version: {}, - IsInUpdate: false, - Lines: [ - { - IsDeleted: false, - LineNumber: 1 - } - ], - LineTrackers: [ - {} - ], - UndoStack: { - IsOriginalFile: true, - AcceptChanges: true, - CanUndo: false, - CanRedo: false, - SizeLimit: 2147483647 - }, - LineCount: 1 - } - }, - Name: Console - }, - { - Type: Grid, - Row: 1, - Children: [ - { - Type: StackPanel, - Spacing: 4.0, - Margin: 8, - Children: [ - { - Type: InfoBar, - Margin: 0 - }, - { - Type: InfoBar, - Margin: 0 - } - ] - } - ] - }, - { - Type: Button, - Command: {}, - Content: Open Web UI, - FontSize: 12.0, - Margin: 24,0,24,8, - HorizontalAlignment: Stretch, - IsVisible: false - } - ] - }, - DataContext: { - Title: Launch, - IconSource: { - Type: SymbolIconSource - }, - Console: { - IsUpdatesRunning: false, - WriteCursorLockTimeout: 00:00:00.1000000, - Document: { - _undoStack: { - IsOriginalFile: true, - AcceptChanges: true, - CanUndo: false, - CanRedo: false, - SizeLimit: 2147483647 - }, - Text: , - Version: {}, - IsInUpdate: false, - Lines: [ - { - IsDeleted: false, - LineNumber: 1 - } - ], - LineTrackers: [ - {} - ], - UndoStack: { - IsOriginalFile: true, - AcceptChanges: true, - CanUndo: false, - CanRedo: false, - SizeLimit: 2147483647 - }, - LineCount: 1 - } - }, - LaunchButtonVisibility: false, - StopButtonVisibility: false, - IsLaunchTeachingTipsOpen: false, - ShowWebUiButton: false, - AutoScrollToEnd: true, - ShowManualInputPrompt: false, - ShowConfirmInputPrompt: false, - LaunchCommand: LaunchPageViewModel.LaunchAsync(string command), - ConfigCommand: LaunchPageViewModel.Config(), - SendConfirmInputCommand: LaunchPageViewModel.SendConfirmInput(bool value), - SendManualInputCommand: LaunchPageViewModel.SendManualInput(string input), - CanNavigateNext: false, - CanNavigatePrevious: false, - HasErrors: false - } - }, - Name: FrameView - }, - Name: NavigationView - }, - { - Type: TeachingTip, - Name: UpdateAvailableTeachingTip - } - ] - }, - FontFamily: Segoe UI Variable Text, - Width: 1100.0, - Height: 750.0, - IsVisible: true, - DataContext: { - Greeting: Welcome to Avalonia!, - ProgressManagerViewModel: { - Title: Download Manager, - IconSource: { - Type: SymbolIconSource - }, - IsOpen: false, - CanNavigateNext: false, - CanNavigatePrevious: false, - HasErrors: false - }, - UpdateViewModel: { - IsUpdateAvailable: true, - UpdateInfo: { - Version: { - Major: 2, - Minor: 999, - Prerelease: , - IsPrerelease: false, - IsRelease: true, - Metadata: - }, - ReleaseDate: DateTimeOffset_1, - Channel: Stable, - Type: Normal, - DownloadUrl: https://example.org, - ChangelogUrl: https://example.org, - HashBlake3: 46e11a5216c55d4c9d3c54385f62f3e1022537ae191615237f05e06d6f8690d0, - Signature: IX5/CCXWJQG0oGkYWVnuF34gTqF/dJSrDrUd6fuNMYnncL39G3HSvkXrjvJvR18MA2rQNB5z13h3/qBSf9c7DA== - }, - ShowProgressBar: false, - CurrentVersionText: v1.0.0, - NewVersionText: v2.999.0, - InstallUpdateCommand: UpdateViewModel.InstallUpdate(), - HasErrors: false - }, - SelectedCategory: { - Title: Launch, - IconSource: { - Type: SymbolIconSource - }, - Console: { - IsUpdatesRunning: false, - WriteCursorLockTimeout: 00:00:00.1000000, - Document: { - _undoStack: { - IsOriginalFile: true, - AcceptChanges: true, - CanUndo: false, - CanRedo: false, - SizeLimit: 2147483647 - }, - Text: , - Version: {}, - IsInUpdate: false, - Lines: [ - { - IsDeleted: false, - LineNumber: 1 - } - ], - LineTrackers: [ - {} - ], - UndoStack: { - IsOriginalFile: true, - AcceptChanges: true, - CanUndo: false, - CanRedo: false, - SizeLimit: 2147483647 - }, - LineCount: 1 - } - }, - LaunchButtonVisibility: false, - StopButtonVisibility: false, - IsLaunchTeachingTipsOpen: false, - ShowWebUiButton: false, - AutoScrollToEnd: true, - ShowManualInputPrompt: false, - ShowConfirmInputPrompt: false, - LaunchCommand: LaunchPageViewModel.LaunchAsync(string command), - ConfigCommand: LaunchPageViewModel.Config(), - SendConfirmInputCommand: LaunchPageViewModel.SendConfirmInput(bool value), - SendManualInputCommand: LaunchPageViewModel.SendManualInput(string input), - CanNavigateNext: false, - CanNavigatePrevious: false, - HasErrors: false - }, - HasErrors: false - } -} \ No newline at end of file diff --git a/StabilityMatrix.UITests/Snapshots/MainWindowTests.MainWindow_ShouldOpen.verified.png b/StabilityMatrix.UITests/Snapshots/MainWindowTests.MainWindow_ShouldOpen.verified.png new file mode 100644 index 00000000..a92d45a7 Binary files /dev/null and b/StabilityMatrix.UITests/Snapshots/MainWindowTests.MainWindow_ShouldOpen.verified.png differ diff --git a/StabilityMatrix.UITests/Snapshots/MainWindowTests.MainWindow_ShouldOpen.verified.txt b/StabilityMatrix.UITests/Snapshots/MainWindowTests.MainWindow_ShouldOpen.verified.txt index 5f282702..a4c4fc4e 100644 --- a/StabilityMatrix.UITests/Snapshots/MainWindowTests.MainWindow_ShouldOpen.verified.txt +++ b/StabilityMatrix.UITests/Snapshots/MainWindowTests.MainWindow_ShouldOpen.verified.txt @@ -1 +1,444 @@ - \ No newline at end of file +{ + Type: MainWindow, + Title: Stability Matrix, + Icon: {}, + Content: { + Type: Grid, + Children: [ + { + Type: Grid, + Background: Transparent, + Height: 32.0, + Name: TitleBarHost, + Children: [ + { + Type: Image, + Source: { + Dpi: { + X: 96.0, + Y: 96.0, + Length: 135.7645019878171, + SquaredLength: 18432.0 + }, + Size: { + AspectRatio: 1.0, + Width: 256.0, + Height: 256.0 + }, + PixelSize: { + AspectRatio: 1.0, + Width: 256, + Height: 256 + }, + Format: { + BitsPerPixel: 32 + } + }, + IsHitTestVisible: false, + Width: 18.0, + Height: 18.0, + Margin: 12,4,12,4, + IsVisible: true, + Name: WindowIcon + }, + { + Type: TextBlock, + FontSize: 12.0, + Text: Stability Matrix, + IsHitTestVisible: false, + VerticalAlignment: Center, + IsVisible: true + }, + { + Type: Border, + Padding: 6 + } + ] + }, + { + Type: NavigationView, + Content: { + Type: Frame, + Content: { + Type: LaunchPageView, + Content: { + Type: Grid, + Children: [ + { + Type: Grid, + Margin: 0,8,0,8, + Children: [ + { + Type: Grid, + Margin: 16,8,0,0, + Children: [ + { + Type: Grid, + Column: 0, + Row: 0, + Name: LaunchButtonGrid, + Children: [ + { + Type: Button, + Command: LaunchPageViewModel.LaunchAsync(string command), + Content: Launch, + Width: 95.0, + HorizontalAlignment: Left, + VerticalAlignment: Stretch, + IsVisible: false + }, + { + Type: SplitButton, + Command: LaunchPageViewModel.LaunchAsync(string command), + Flyout: { + Type: FAMenuFlyout + }, + Content: Launch, + Width: 104.0, + HorizontalAlignment: Left, + VerticalAlignment: Stretch, + IsVisible: false + } + ] + }, + { + Type: TeachingTip, + Name: TeachingTip1 + }, + { + Type: Grid, + Column: 0, + Row: 0, + IsVisible: false, + Name: StopButtonGrid, + Children: [ + { + Type: Button, + Command: {}, + Content: Stop, + Width: 95.0, + HorizontalAlignment: Left, + VerticalAlignment: Stretch, + IsVisible: false + }, + { + Type: Button, + Command: {}, + Content: Stop, + Width: 104.0, + HorizontalAlignment: Left, + VerticalAlignment: Stretch, + IsVisible: false + } + ] + }, + { + Type: Button, + Command: LaunchPageViewModel.Config(), + Content: { + Type: SymbolIcon + }, + FontSize: 16.0, + Width: 48.0, + Margin: 8,0,0,0, + HorizontalAlignment: Left, + VerticalAlignment: Stretch + } + ] + }, + { + Type: ComboBox, + SelectedIndex: -1, + Selection: { + SingleSelect: true, + SelectedIndex: -1, + AnchorIndex: -1 + }, + SelectionMode: Single, + ItemTemplate: { + DataType: InstalledPackage, + Content: { + Type: Func, + Target: XamlIlRuntimeHelpers.<>c__DisplayClass1_0, + Method: System.Object DeferredTransformationFactoryV2(System.IServiceProvider) + } + }, + IsEnabled: true, + Margin: 8,8,0,0, + HorizontalAlignment: Stretch, + VerticalAlignment: Top, + Name: SelectPackageComboBox + }, + { + Type: ToggleButton, + IsChecked: true, + Content: { + Type: Icon, + Template: { + Content: { + Type: Func, + Target: XamlIlRuntimeHelpers.<>c__DisplayClass1_0, + Method: System.Object DeferredTransformationFactoryV2(System.IServiceProvider) + } + }, + RenderTransform: { + Type: TransformGroup, + Children: [ + { + Type: RotateTransform + } + ] + } + }, + FontSize: 16.0, + Width: 48.0, + Margin: 8,8,0,0, + HorizontalAlignment: Left, + VerticalAlignment: Stretch + }, + { + Type: ToggleButton, + IsChecked: false, + Content: { + Type: SymbolIcon + }, + FontSize: 16.0, + Width: 48.0, + Margin: 8,8,16,0, + HorizontalAlignment: Left, + VerticalAlignment: Stretch + } + ] + }, + { + Type: TextEditor, + FontFamily: Cascadia Code, + Margin: 8,8,16,10, + DataContext: { + IsUpdatesRunning: false, + WriteCursorLockTimeout: 00:00:00.1000000, + Document: { + _undoStack: { + IsOriginalFile: true, + AcceptChanges: true, + CanUndo: false, + CanRedo: false, + SizeLimit: 2147483647 + }, + Text: , + Version: {}, + IsInUpdate: false, + Lines: [ + { + IsDeleted: false, + LineNumber: 1 + } + ], + LineTrackers: [ + {} + ], + UndoStack: { + IsOriginalFile: true, + AcceptChanges: true, + CanUndo: false, + CanRedo: false, + SizeLimit: 2147483647 + }, + LineCount: 1 + } + }, + Name: Console + }, + { + Type: Grid, + Row: 1, + Children: [ + { + Type: StackPanel, + Spacing: 4.0, + Margin: 8, + Children: [ + { + Type: InfoBar, + Margin: 0 + }, + { + Type: InfoBar, + Margin: 0 + } + ] + } + ] + }, + { + Type: Button, + Command: {}, + Content: Open Web UI, + FontSize: 12.0, + Margin: 24,0,24,8, + HorizontalAlignment: Stretch, + IsVisible: false + } + ] + }, + DataContext: { + Title: Launch, + IconSource: { + Type: SymbolIconSource + }, + Console: { + IsUpdatesRunning: false, + WriteCursorLockTimeout: 00:00:00.1000000, + Document: { + _undoStack: { + IsOriginalFile: true, + AcceptChanges: true, + CanUndo: false, + CanRedo: false, + SizeLimit: 2147483647 + }, + Text: , + Version: {}, + IsInUpdate: false, + Lines: [ + { + IsDeleted: false, + LineNumber: 1 + } + ], + LineTrackers: [ + {} + ], + UndoStack: { + IsOriginalFile: true, + AcceptChanges: true, + CanUndo: false, + CanRedo: false, + SizeLimit: 2147483647 + }, + LineCount: 1 + } + }, + LaunchButtonVisibility: false, + StopButtonVisibility: false, + IsLaunchTeachingTipsOpen: false, + ShowWebUiButton: false, + AutoScrollToEnd: true, + ShowManualInputPrompt: false, + ShowConfirmInputPrompt: false, + LaunchCommand: LaunchPageViewModel.LaunchAsync(string command), + ConfigCommand: LaunchPageViewModel.Config(), + SendConfirmInputCommand: LaunchPageViewModel.SendConfirmInput(bool value), + SendManualInputCommand: LaunchPageViewModel.SendManualInput(string input), + CanNavigateNext: false, + CanNavigatePrevious: false, + HasErrors: false + } + }, + Name: FrameView + }, + Name: NavigationView + }, + { + Type: TeachingTip, + Name: UpdateAvailableTeachingTip + } + ] + }, + FontFamily: Segoe UI Variable Text, + Width: 1100.0, + Height: 750.0, + IsVisible: true, + DataContext: { + Greeting: Welcome to Avalonia!, + ProgressManagerViewModel: { + Title: Download Manager, + IconSource: { + Type: SymbolIconSource + }, + IsOpen: false, + CanNavigateNext: false, + CanNavigatePrevious: false, + HasErrors: false + }, + UpdateViewModel: { + IsUpdateAvailable: true, + UpdateInfo: { + Version: { + Major: 2, + Minor: 999, + Prerelease: , + IsPrerelease: false, + IsRelease: true, + Metadata: + }, + ReleaseDate: DateTimeOffset_1, + Channel: Stable, + Type: Normal, + DownloadUrl: https://example.org, + ChangelogUrl: https://example.org, + HashBlake3: 46e11a5216c55d4c9d3c54385f62f3e1022537ae191615237f05e06d6f8690d0, + Signature: IX5/CCXWJQG0oGkYWVnuF34gTqF/dJSrDrUd6fuNMYnncL39G3HSvkXrjvJvR18MA2rQNB5z13h3/qBSf9c7DA== + }, + ShowProgressBar: false, + CurrentVersionText: v1.0.0, + NewVersionText: v2.999.0, + InstallUpdateCommand: UpdateViewModel.InstallUpdate(), + HasErrors: false + }, + SelectedCategory: { + Title: Launch, + IconSource: { + Type: SymbolIconSource + }, + Console: { + IsUpdatesRunning: false, + WriteCursorLockTimeout: 00:00:00.1000000, + Document: { + _undoStack: { + IsOriginalFile: true, + AcceptChanges: true, + CanUndo: false, + CanRedo: false, + SizeLimit: 2147483647 + }, + Text: , + Version: {}, + IsInUpdate: false, + Lines: [ + { + IsDeleted: false, + LineNumber: 1 + } + ], + LineTrackers: [ + {} + ], + UndoStack: { + IsOriginalFile: true, + AcceptChanges: true, + CanUndo: false, + CanRedo: false, + SizeLimit: 2147483647 + }, + LineCount: 1 + } + }, + LaunchButtonVisibility: false, + StopButtonVisibility: false, + IsLaunchTeachingTipsOpen: false, + ShowWebUiButton: false, + AutoScrollToEnd: true, + ShowManualInputPrompt: false, + ShowConfirmInputPrompt: false, + LaunchCommand: LaunchPageViewModel.LaunchAsync(string command), + ConfigCommand: LaunchPageViewModel.Config(), + SendConfirmInputCommand: LaunchPageViewModel.SendConfirmInput(bool value), + SendManualInputCommand: LaunchPageViewModel.SendManualInput(string input), + CanNavigateNext: false, + CanNavigatePrevious: false, + HasErrors: false + }, + HasErrors: false + } +} \ No newline at end of file diff --git a/StabilityMatrix.UITests/StabilityMatrix.UITests.csproj b/StabilityMatrix.UITests/StabilityMatrix.UITests.csproj index 464465ab..925d6747 100644 --- a/StabilityMatrix.UITests/StabilityMatrix.UITests.csproj +++ b/StabilityMatrix.UITests/StabilityMatrix.UITests.csproj @@ -16,7 +16,6 @@ - diff --git a/StabilityMatrix.UITests/TempDirFixture.cs b/StabilityMatrix.UITests/TempDirFixture.cs index 8f3aa369..4be0d198 100644 --- a/StabilityMatrix.UITests/TempDirFixture.cs +++ b/StabilityMatrix.UITests/TempDirFixture.cs @@ -9,7 +9,13 @@ public class TempDirFixture : IDisposable static TempDirFixture() { var tempDir = Path.Combine(Path.GetTempPath(), "StabilityMatrixTest"); + + if (Directory.Exists(tempDir)) + { + Directory.Delete(tempDir, true); + } Directory.CreateDirectory(tempDir); + ModuleTempDir = tempDir; // ReSharper disable once LocalizableElement @@ -17,7 +23,6 @@ public class TempDirFixture : IDisposable } /// - [MethodImpl(MethodImplOptions.Synchronized)] public void Dispose() { if (Directory.Exists(ModuleTempDir))