I have a simple app that contains a button, and the content of that button changes after it is pressed (Avalonia for app and Avalonia Headless Tests for UI tests). I'm trying to make my UI tests visible for future debugging purposes, but I can't find any relevant information in the documentation to address this issue. Below is the code I'm currently working with:
Test:
[AvaloniaTest]
public void Should_Find_Button_And_Check_Text()
{
var window = new MainWindow();
window.Show();
var button = window.FindControl<Button>("ClickMeButton");
Assert.IsNotNull(button, "Кнопка ClickMeButton не найдена.");
Console.WriteLine("Before click: " + button.Content);
button.Command?.Execute(button.CommandParameter);
button.RaiseEvent(new RoutedEventArgs(Button.ClickEvent));
Console.WriteLine("After click: " + button.Content);
}
Start of testing process
[assembly: AvaloniaTestApplication(typeof(TestAppBuilder))]
public class TestAppBuilder
{
public static AppBuilder BuildAvaloniaApp() =>
AppBuilder.Configure<App>()
.UsePlatformDetect()
.UseReactiveUI()
.SetupWithClassicDesktopLifetime(new string[0])
.LogToTrace();
}