Skip to content

Commit

Permalink
Fix e2e tests
Browse files Browse the repository at this point in the history
  • Loading branch information
Serhy committed Feb 7, 2020
1 parent 74fc8bf commit 3542175
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 8 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,6 @@ def test_switch_users_and_add_new_account(self):
profile.logout()
if sign_in.ok_button.is_element_displayed():
sign_in.ok_button.click()
sign_in.back_button.click()
sign_in.your_keys_more_icon.click()
sign_in.generate_new_key_button.click()
sign_in.generate_key_button.click()
Expand Down
20 changes: 13 additions & 7 deletions test/appium/views/sign_in_view.py
Original file line number Diff line number Diff line change
Expand Up @@ -10,14 +10,20 @@ class MultiAccountButton(BaseButton):
class Username(BaseText):
def __init__(self, driver, locator_value):
super(MultiAccountButton.Username, self).__init__(driver)
self.locator = self.Locator.xpath_selector(locator_value + '/preceding-sibling::*[1]')
self.locator = self.Locator.xpath_selector(locator_value + '/android.view.ViewGroup/android.widget.TextView[1]')

def __init__(self, driver, position):
def __init__(self, driver, position=1):
super(MultiAccountButton, self).__init__(driver)
self.locator = self.Locator.xpath_selector("(//*[contains(@text,'0x')])[%s]" % position)
self.locator = self.Locator.xpath_selector("//*[@content-desc='select-account-button-%s']" % position)
self.username = self.Username(driver, self.locator.value)


class MultiAccountOnLoginButton(BaseButton):
def __init__(self, driver, position=1):
super(MultiAccountOnLoginButton, self).__init__(driver)
self.locator = self.Locator.xpath_selector("(//*[@content-desc='chat-icon'])[%s]/.." % position)


class PasswordInput(BaseEditBox):
def __init__(self, driver):
super(PasswordInput, self).__init__(driver)
Expand Down Expand Up @@ -189,6 +195,8 @@ def __init__(self, driver, skip_popups=True):
self.maybe_later_button = MaybeLaterButton(self.driver)
self.name_input = NameInput(self.driver)
self.other_multiaccounts_button = OtherMultiAccountsButton(self.driver)
self.multiaccount_button = MultiAccountButton(self.driver)
self.multi_account_on_login_button = MultiAccountOnLoginButton(self.driver)
self.privacy_policy_link = PrivacyPolicyLink(self.driver)
self.lets_go_button = LetsGoButton(self.driver)

Expand Down Expand Up @@ -223,14 +231,12 @@ def recover_access(self, passphrase: str, password: str = common_password):
return self.get_home_view()

def sign_in(self, password=common_password):
self.accept_agreements()
self.multi_account_on_login_button.click()
self.password_input.set_value(password)
self.confirm()
self.sign_in_button.click()
return self.get_home_view()

def get_account_by_position(self, position: int):
if self.ok_button.is_element_displayed():
self.ok_button.click()
account_button = MultiAccountButton(self.driver, position)
if account_button.is_element_displayed():
return account_button
Expand Down

0 comments on commit 3542175

Please sign in to comment.