diff --git a/src/Samples.UITest/BookLibrary.Test/Tests/ReportingTest.cs b/src/Samples.UITest/BookLibrary.Test/Tests/ReportingTest.cs index 786f3852..6fb49664 100644 --- a/src/Samples.UITest/BookLibrary.Test/Tests/ReportingTest.cs +++ b/src/Samples.UITest/BookLibrary.Test/Tests/ReportingTest.cs @@ -25,9 +25,8 @@ public void CreateReportTest() => Run(() => Assert.True(reportView.PrintButton.IsEnabled); Capture.Screen().ToFile(GetScreenshotFile("BookListReport")); PrintAsPdf(GetScreenshotFile("BookListReport.pdf")); - // Note: It might take some time until PDF print has been completed - reportView.CreateBorrowedBooksReportButton.Invoke(); + reportView.CreateBorrowedBooksReportButton.Click(); Capture.Screen().ToFile(GetScreenshotFile("BorrowedBooksReport")); PrintAsPdf(GetScreenshotFile("BorrowedBooksReport.pdf")); @@ -61,6 +60,9 @@ void PrintAsPdf(string fileName) var saveFileDialog = window.FirstModalWindow().As(); saveFileDialog.SetFileName(fileName); saveFileDialog.SaveButton.Click(); + + // Wait until the button is enabled again -> indication that the PDF print is completed + Retry.WhileFalse(() => reportView.PrintButton.IsEnabled, throwOnTimeout: true); } }); } \ No newline at end of file