forked from Silverfish/proton-bridge
test(BRIDGE-133): Bridge E2E UI tests for Windows
This commit is contained in:
34
tests/e2e/ui_tests/windows_os/Windows/HomeWindow.cs
Normal file
34
tests/e2e/ui_tests/windows_os/Windows/HomeWindow.cs
Normal file
@ -0,0 +1,34 @@
|
||||
using FlaUI.Core.AutomationElements;
|
||||
using FlaUI.Core.Definitions;
|
||||
using System;
|
||||
|
||||
|
||||
namespace ProtonMailBridge.UI.Tests.Windows
|
||||
{
|
||||
public class HomeWindow : UIActions
|
||||
{
|
||||
private AutomationElement[] AccountViewButtons => AccountView.FindAllChildren(cf => cf.ByControlType(ControlType.Button));
|
||||
private Button RemoveAccountButton => AccountViewButtons[1].AsButton();
|
||||
private AutomationElement RemoveAccountConfirmModal => Window.FindFirstDescendant(cf => cf.ByControlType(ControlType.Window));
|
||||
private Button ConfirmRemoveAccountButton => RemoveAccountConfirmModal.FindFirstDescendant(cf => cf.ByControlType(ControlType.Button).And(cf.ByName("Remove this account"))).AsButton();
|
||||
private Button SignOutButton => AccountView.FindFirstDescendant(cf => cf.ByControlType(ControlType.Button).And(cf.ByName("Sign out"))).AsButton();
|
||||
public HomeWindow RemoveAccount()
|
||||
{
|
||||
try
|
||||
{
|
||||
RemoveAccountButton.Click();
|
||||
ConfirmRemoveAccountButton.Click();
|
||||
}
|
||||
catch (System.NullReferenceException)
|
||||
{
|
||||
ClientCleanup();
|
||||
}
|
||||
return this;
|
||||
}
|
||||
public HomeWindow SignOutAccount()
|
||||
{
|
||||
SignOutButton.Click();
|
||||
return this;
|
||||
}
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user