Skip to content

Commit

Permalink
UITest/BookLib: try no. 2 to improve CreateReportTest
Browse files Browse the repository at this point in the history
  • Loading branch information
jbe2277 committed Oct 31, 2024
1 parent 284c424 commit 2017174
Showing 1 changed file with 4 additions and 2 deletions.
6 changes: 4 additions & 2 deletions src/Samples.UITest/BookLibrary.Test/Tests/ReportingTest.cs
Original file line number Diff line number Diff line change
Expand Up @@ -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"));

Expand Down Expand Up @@ -61,6 +60,9 @@ void PrintAsPdf(string fileName)
var saveFileDialog = window.FirstModalWindow().As<SaveFileDialog>();
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);
}
});
}

0 comments on commit 2017174

Please sign in to comment.