From 64812cb8fdabe0d1dda6047c7a701e05a989b559 Mon Sep 17 00:00:00 2001 From: jbe2277 Date: Sun, 16 Jun 2024 13:50:04 +0200 Subject: [PATCH] Log list of available printers --- src/Samples.UITest/BookLibrary.Test/Tests/ReportingTest.cs | 2 ++ src/Samples.UITest/UITest.Core/SystemViews/LegacyPrintDialog.cs | 2 ++ 2 files changed, 4 insertions(+) diff --git a/src/Samples.UITest/BookLibrary.Test/Tests/ReportingTest.cs b/src/Samples.UITest/BookLibrary.Test/Tests/ReportingTest.cs index ab5a68fe..894eb1cf 100644 --- a/src/Samples.UITest/BookLibrary.Test/Tests/ReportingTest.cs +++ b/src/Samples.UITest/BookLibrary.Test/Tests/ReportingTest.cs @@ -51,6 +51,8 @@ void PrintAsPdf(string fileName) else { var printDialog = window.FirstModalWindow().As(); + Log.WriteLine("Printers:"); + foreach (var x in printDialog.PrinterList.Items) Log.WriteLine($"- {x.Text}"); printDialog.PrintButton.Click(); } diff --git a/src/Samples.UITest/UITest.Core/SystemViews/LegacyPrintDialog.cs b/src/Samples.UITest/UITest.Core/SystemViews/LegacyPrintDialog.cs index a5e79793..c642bef2 100644 --- a/src/Samples.UITest/UITest.Core/SystemViews/LegacyPrintDialog.cs +++ b/src/Samples.UITest/UITest.Core/SystemViews/LegacyPrintDialog.cs @@ -6,6 +6,8 @@ namespace UITest.SystemViews; public class LegacyPrintDialog(FrameworkAutomationElementBase element) : Window(element) { + public ListBox PrinterList => this.Find(x => x.ByControlType(ControlType.List).And(x.ByAutomationId("1"))).AsListBox(); + public Button PrintButton => this.Find(x => x.ByControlType(ControlType.Button).And(x.ByAutomationId("1"))).AsButton(); public Button CancelButton => this.Find(x => x.ByControlType(ControlType.Button).And(x.ByAutomationId("2"))).AsButton();