Skip to content

Commit

Permalink
UITest/InfoMan: assert Document text
Browse files Browse the repository at this point in the history
  • Loading branch information
jbe2277 committed Dec 8, 2024
1 parent 68ff1c5 commit 7d8d1fd
Show file tree
Hide file tree
Showing 3 changed files with 14 additions and 1 deletion.
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
using FlaUI.Core.AutomationElements;
using FlaUI.Core;

namespace UITest.InformationManager.Controls;

public class Document(FrameworkAutomationElementBase element) : AutomationElement(element)
{
public string GetText(int maxLenght) => Patterns.Text.Pattern.DocumentRange.GetText(maxLenght);
}
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
using FlaUI.Core.AutomationElements;
using UITest.InformationManager.Controls;
using UITest.InformationManager.Views;
using Xunit;
using Xunit.Abstractions;
Expand All @@ -22,6 +23,7 @@ public void SearchEmailsAndAssertLists() => Run(() =>
for (int i = 0; i < count; i++) Log.WriteLine($"{i:00}: {emailListView.EmailItems[i].ToReceivedTuple()}");

AssertEmail(true, emailListView.EmailItems[0], emailView, "[email protected]", "[email protected]", "8/9/2012", "5:58:21 AM", "Nunc sed dis suscipit");
Assert.Equal("Scelerisque est odio", emailView.Document.As<Document>().GetText(20));

Assert.Equal("Search", emailListView.SearchBox.SearchHintLabel.Text);
emailListView.SearchBox.SearchTextBox.Text = "!";
Expand All @@ -34,7 +36,6 @@ public void SearchEmailsAndAssertLists() => Run(() =>
var item = emailListView.EmailList.SelectedItem.As<EmailListItem>();
AssertEmail(true, item, emailView, "[email protected]", "[email protected]", "9/5/2005", "4:34:45 PM", "Taciti enim");


window.RootTreeItem.OutboxNode.Select();
emailListView = window.EmailLayoutView.EmailListView;
emailView = window.EmailLayoutView.EmailView;
Expand Down
3 changes: 3 additions & 0 deletions src/Samples.UITest/InformationManager.Test/Views/EmailView.cs
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
using FlaUI.Core.AutomationElements;
using FlaUI.Core.Definitions;
using FlaUI.Core;

namespace UITest.InformationManager.Views;
Expand All @@ -16,4 +17,6 @@ public class EmailView(FrameworkAutomationElementBase element) : AutomationEleme
public Label BccLabel => this.Find("BccLabel").AsLabel();

public Label SentLabel => this.Find("SentLabel").AsLabel();

public AutomationElement Document => this.Find(x => x.ByControlType(ControlType.Document));
}

0 comments on commit 7d8d1fd

Please sign in to comment.