Files
proton-bridge/tests/e2e/ui_tests/windows_os/Results/HomeResult.cs
2024-09-17 05:23:08 +00:00

29 lines
1.2 KiB
C#

using FlaUI.Core.AutomationElements;
using FlaUI.Core.Definitions;
namespace ProtonMailBridge.UI.Tests.Results
{
public class HomeResult : UIActions
{
private Button SignOutButton => AccountView.FindFirstDescendant(cf => cf.ByControlType(ControlType.Button).And(cf.ByName("Sign out"))).AsButton();
private AutomationElement NotificationWindow => Window.FindFirstDescendant(cf => cf.ByControlType(ControlType.Window));
private TextBox FreeAccountErrorText => NotificationWindow.FindFirstDescendant(cf => cf.ByControlType(ControlType.Text)).AsTextBox();
private TextBox SignedOutAccount => AccountView.FindFirstDescendant(cf => cf.ByControlType(ControlType.Text)).AsTextBox();
public HomeResult CheckIfLoggedIn()
{
Assert.That(SignOutButton.IsAvailable, Is.True);
return this;
}
public HomeResult CheckIfFreeAccountErrorIsDisplayed(string ErrorText)
{
Assert.That(FreeAccountErrorText.Name == ErrorText, Is.True);
return this;
}
public HomeResult CheckIfAccountIsSignedOut()
{
Assert.That(SignedOutAccount.IsAvailable, Is.True);
return this;
}
}
}