Skip to content

Commit

Permalink
UITest/BookLib: wait 500ms so that report generation can finish (#57)
Browse files Browse the repository at this point in the history
* UITest/BookLib: try to get screenshot of report working

* UITest/BookLib: wait 500ms so that report generation can finish
  • Loading branch information
jbe2277 authored Nov 2, 2024
1 parent 62e311e commit 1dd7d85
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 1 deletion.
2 changes: 2 additions & 0 deletions src/Samples.UITest/BookLibrary.Test/Tests/ReportingTest.cs
Original file line number Diff line number Diff line change
Expand Up @@ -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"));

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 1dd7d85

Please sign in to comment.