diff --git a/src/Samples.UITest/BookLibrary.Test/Tests/ReportingTest.cs b/src/Samples.UITest/BookLibrary.Test/Tests/ReportingTest.cs index 6fb49664..52f7d855 100644 --- a/src/Samples.UITest/BookLibrary.Test/Tests/ReportingTest.cs +++ b/src/Samples.UITest/BookLibrary.Test/Tests/ReportingTest.cs @@ -22,11 +22,13 @@ public void CreateReportTest() => Run(() => Assert.False(reportView.PrintButton.IsEnabled); // No report available reportView.CreateBookListReportButton.Click(); + Thread.Sleep(500); Assert.True(reportView.PrintButton.IsEnabled); Capture.Screen().ToFile(GetScreenshotFile("BookListReport")); PrintAsPdf(GetScreenshotFile("BookListReport.pdf")); reportView.CreateBorrowedBooksReportButton.Click(); + Thread.Sleep(500); Capture.Screen().ToFile(GetScreenshotFile("BorrowedBooksReport")); PrintAsPdf(GetScreenshotFile("BorrowedBooksReport.pdf")); diff --git a/src/Samples.UITest/UITest.Core/SystemViews/PrintDialog.cs b/src/Samples.UITest/UITest.Core/SystemViews/PrintDialog.cs index 3d7b2048..55a4c696 100644 --- a/src/Samples.UITest/UITest.Core/SystemViews/PrintDialog.cs +++ b/src/Samples.UITest/UITest.Core/SystemViews/PrintDialog.cs @@ -1,5 +1,7 @@ using FlaUI.Core; using FlaUI.Core.AutomationElements; +using FlaUI.Core.Conditions; +using FlaUI.Core.Definitions; namespace UITest.SystemViews; @@ -8,7 +10,7 @@ public class PrintDialog(FrameworkAutomationElementBase element) : Window(elemen public static PrintDialog GetDialog(AutomationBase automation) { var desktop = automation.GetDesktop(); - return desktop.Find(x => x.ByName("Windows Print")).As(); + return desktop.Find(x => new AndCondition(x.ByControlType(ControlType.Window), x.ByName("Windows Print"))).As(); } public ComboBox PrinterSelector => this.Find("printerSelector").AsComboBox();