mirror of
https://github.com/ProtonMail/proton-bridge.git
synced 2026-02-04 08:18:34 +00:00
test(BRIDGE-136): Download Bridge
This commit is contained in:
committed by
Gordana Zafirova
parent
cf9b35163a
commit
fd709b0d08
@ -16,42 +16,44 @@ namespace ProtonMailBridge.UI.Tests.Results
|
||||
private Button OkToAcknowledgeAccountAlreadySignedIn => NotificationWindow.FindFirstDescendant(cf => cf.ByControlType(ControlType.Button).And(cf.ByName("OK"))).AsButton();
|
||||
private AutomationElement[] TextFields => Window.FindAllDescendants(cf => cf.ByControlType(ControlType.Text));
|
||||
private TextBox SynchronizingField => TextFields[4].AsTextBox();
|
||||
private TextBox AccountDisabledErrorText => Window.FindFirstDescendant(cf => cf.ByControlType(ControlType.Text).And(cf.ByName("failed to create new API client: 422 POST https://mail-api.proton.me/auth/v4: This account has been suspended due to a potential policy violation. If you believe this is in error, please contact us at https://proton.me/support/appeal-abuse (Code=10003, Status=422)"))).AsTextBox();
|
||||
private TextBox AccountDelinquentErrorText => Window.FindFirstDescendant(cf => cf.ByControlType(ControlType.Text).And(cf.ByName("failed to create new API client: 422 POST https://mail-api.proton.me/auth/v4: Use of this client requires permissions not available to your account (Code=2011, Status=422)"))).AsTextBox();
|
||||
private TextBox AccountDisabledErrorText => Window.FindAllDescendants(cf => cf.ByControlType(ControlType.Text)).FirstOrDefault(e =>!string.IsNullOrEmpty(e.Name) && e.Name.IndexOf("This account has been suspended due to a potential policy violation.", StringComparison.OrdinalIgnoreCase) >= 0)?.AsTextBox();
|
||||
private TextBox IncorrectLoginCredentialsErrorText => Window.FindFirstDescendant(cf => cf.ByControlType(ControlType.Text).And(cf.ByName("Incorrect login credentials"))).AsTextBox();
|
||||
private TextBox EnterEmailOrUsernameErrorText => Window.FindFirstDescendant(cf => cf.ByControlType(ControlType.Text).And(cf.ByName("Enter email or username"))).AsTextBox();
|
||||
private TextBox EnterPasswordErrorText => Window.FindFirstDescendant(cf => cf.ByControlType(ControlType.Text).And(cf.ByName("Enter password"))).AsTextBox();
|
||||
private TextBox ConnectedStateText => Window.FindFirstDescendant(cf => cf.ByControlType(ControlType.Text).And(cf.ByName("Connected"))).AsTextBox();
|
||||
private CheckBox SplitAddressesToggle => AccountView.FindFirstDescendant(cf => cf.ByControlType(ControlType.CheckBox).And(cf.ByName("Split addresses toggle"))).AsCheckBox();
|
||||
|
||||
|
||||
|
||||
public HomeResult CheckConnectedState()
|
||||
{
|
||||
Assert.That(ConnectedStateText.IsAvailable, Is.True);
|
||||
RetryHelper.Eventually(() => ConnectedStateText.IsAvailable);
|
||||
return this;
|
||||
}
|
||||
public HomeResult CheckIfLoggedIn()
|
||||
{
|
||||
Assert.That(SignOutButton.IsAvailable, Is.True);
|
||||
RetryHelper.Eventually(() => SignOutButton.IsAvailable);
|
||||
return this;
|
||||
}
|
||||
public HomeResult CheckIfSynchronizingBarIsShown()
|
||||
{
|
||||
Assert.That(SynchronizingField.IsAvailable && SynchronizingField.Name.StartsWith("Synchronizing"), Is.True);
|
||||
RetryHelper.Eventually(() => SynchronizingField.IsAvailable && SynchronizingField.Name.StartsWith("Synchronizing"));
|
||||
return this;
|
||||
}
|
||||
public HomeResult CheckIfFreeAccountErrorIsDisplayed(string ErrorText)
|
||||
{
|
||||
Assert.That(FreeAccountErrorText.Name == ErrorText, Is.True);
|
||||
RetryHelper.Eventually(() => FreeAccountErrorText.Name == ErrorText);
|
||||
return this;
|
||||
}
|
||||
public HomeResult CheckIfAccountIsSignedOut()
|
||||
{
|
||||
Assert.That(SignedOutAccount.IsAvailable, Is.True);
|
||||
RetryHelper.Eventually(() => SignedOutAccount.IsAvailable);
|
||||
return this;
|
||||
}
|
||||
public HomeResult CheckIfAccountAlreadySignedInIsDisplayed()
|
||||
{
|
||||
Assert.That(AlreadySignedInText.IsAvailable, Is.True);
|
||||
|
||||
RetryHelper.Eventually(() => AlreadySignedInText.IsAvailable);
|
||||
return this;
|
||||
}
|
||||
public HomeResult ClickOkToAcknowledgeAccountAlreadySignedIn ()
|
||||
@ -67,32 +69,30 @@ namespace ProtonMailBridge.UI.Tests.Results
|
||||
}
|
||||
|
||||
public HomeResult CheckIfEnterUsernameAndEnterPasswordErrorMsgsAreDisplayed()
|
||||
{
|
||||
Assert.That(EnterEmailOrUsernameErrorText.IsAvailable && EnterPasswordErrorText.IsAvailable, Is.True);
|
||||
{
|
||||
RetryHelper.Eventually(() => EnterEmailOrUsernameErrorText.IsAvailable && EnterPasswordErrorText.IsAvailable);
|
||||
return this;
|
||||
}
|
||||
|
||||
public HomeResult CheckIfDsabledAccountErrorIsDisplayed()
|
||||
{
|
||||
Assert.That(AccountDisabledErrorText.IsAvailable, Is.True);
|
||||
return this;
|
||||
}
|
||||
|
||||
public HomeResult CheckIfDelinquentAccountErrorIsDisplayed()
|
||||
{
|
||||
Assert.That(AccountDelinquentErrorText.IsAvailable, Is.True);
|
||||
RetryHelper.Eventually(() => AccountDisabledErrorText.IsAvailable);
|
||||
return this;
|
||||
}
|
||||
|
||||
public HomeResult CheckIfNotificationTextIsShown()
|
||||
{
|
||||
Assert.That(AlreadySignedInText.IsAvailable, Is.True);
|
||||
RetryHelper.Eventually(() => AlreadySignedInText.IsAvailable);
|
||||
return this;
|
||||
}
|
||||
|
||||
public HomeResult CheckIfSplitAddressesIsDisabledByDefault()
|
||||
{
|
||||
Assert.That(SplitAddressesToggle.IsToggled, Is.False);
|
||||
RetryHelper.Eventually(() =>
|
||||
{
|
||||
bool isNotToggled = SplitAddressesToggle.IsToggled == null || !(bool)SplitAddressesToggle.IsToggled;
|
||||
return isNotToggled;
|
||||
});
|
||||
return this;
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user