Multi-Platform Package Manager for Stable Diffusion
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

58 lines
1.6 KiB

using Avalonia.Controls;
using Avalonia.VisualTree;
11 months ago
using FluentAvalonia.UI.Controls;
using Microsoft.Extensions.DependencyInjection;
using StabilityMatrix.Avalonia.ViewModels;
11 months ago
using StabilityMatrix.Avalonia.Views;
using StabilityMatrix.UITests.Extensions;
namespace StabilityMatrix.UITests;
1 year ago
[Collection("TempDir")]
[TestCaseOrderer("StabilityMatrix.UITests.PriorityOrderer", "StabilityMatrix.UITests")]
11 months ago
public class MainWindowTests : TestBase
{
[AvaloniaFact, TestPriority(1)]
public async Task MainWindow_ShouldOpen()
{
var (window, _) = GetMainWindow();
window.Show();
11 months ago
await Task.Delay(300);
11 months ago
await DoInitialSetup();
11 months ago
await Task.Delay(1000);
await Verify(window, Settings);
}
[AvaloniaFact, TestPriority(2)]
public async Task MainWindowViewModel_ShouldOk()
{
var viewModel = Services.GetRequiredService<MainWindowViewModel>();
await Verify(viewModel, Settings);
}
11 months ago
[AvaloniaFact, TestPriority(3)]
public async Task NavigateToModelBrowser_ShouldWork()
{
var (window, viewModel) = GetMainWindow();
await DoInitialSetup();
var y = window
.FindDescendantOfType<NavigationView>()
.GetVisualDescendants()
.OfType<NavigationViewItem>()
.FirstOrDefault(i => i.Content.ToString() == "Model Browser");
await window.ClickTargetAsync(y);
var frame = window.FindControl<Frame>("FrameView");
Assert.IsType<CheckpointBrowserPage>(frame.Content);
await Task.Delay(1000);
SaveScreenshot(window);
await Verify(window, Settings);
}
}