Skip to content

Commit

Permalink
UITest/BookLib: try to get screenshot of report working
Browse files Browse the repository at this point in the history
  • Loading branch information
jbe2277 committed Nov 2, 2024
1 parent 83d9d5a commit 5b1de4b
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 3 deletions.
4 changes: 2 additions & 2 deletions src/Samples.UITest/BookLibrary.Test/Tests/ReportingTest.cs
Original file line number Diff line number Diff line change
Expand Up @@ -21,12 +21,12 @@ public void CreateReportTest() => Run(() =>

Assert.False(reportView.PrintButton.IsEnabled); // No report available

reportView.CreateBookListReportButton.Click();
reportView.CreateBookListReportButton.Invoke();
Assert.True(reportView.PrintButton.IsEnabled);
Capture.Screen().ToFile(GetScreenshotFile("BookListReport"));
PrintAsPdf(GetScreenshotFile("BookListReport.pdf"));

reportView.CreateBorrowedBooksReportButton.Click();
reportView.CreateBorrowedBooksReportButton.Invoke();
Capture.Screen().ToFile(GetScreenshotFile("BorrowedBooksReport"));
PrintAsPdf(GetScreenshotFile("BorrowedBooksReport.pdf"));

Expand Down
4 changes: 3 additions & 1 deletion src/Samples.UITest/UITest.Core/SystemViews/PrintDialog.cs
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
using FlaUI.Core;
using FlaUI.Core.AutomationElements;
using FlaUI.Core.Conditions;
using FlaUI.Core.Definitions;

namespace UITest.SystemViews;

Expand All @@ -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<PrintDialog>();
return desktop.Find(x => new AndCondition(x.ByControlType(ControlType.Window), x.ByName("Windows Print"))).As<PrintDialog>();
}

public ComboBox PrinterSelector => this.Find("printerSelector").AsComboBox();
Expand Down

0 comments on commit 5b1de4b

Please sign in to comment.