2018-01-26 11:07:09 +00:00
|
|
|
from tests import info
|
2018-01-14 17:43:36 +00:00
|
|
|
from selenium.common.exceptions import NoSuchElementException, TimeoutException
|
|
|
|
from views.base_element import BaseButton, BaseEditBox
|
2018-01-03 09:34:40 +00:00
|
|
|
from views.base_view import BaseView
|
2017-08-28 10:02:20 +00:00
|
|
|
|
2018-01-03 09:34:40 +00:00
|
|
|
|
2017-08-28 10:02:20 +00:00
|
|
|
class RequestPasswordIcon(BaseButton):
|
|
|
|
|
|
|
|
def __init__(self, driver):
|
|
|
|
super(RequestPasswordIcon, self).__init__(driver)
|
2018-01-26 11:07:09 +00:00
|
|
|
self.locator = self.Locator.accessibility_id('request-password')
|
2017-08-28 10:02:20 +00:00
|
|
|
|
2017-09-26 10:50:34 +00:00
|
|
|
def click(self):
|
2017-10-05 19:41:17 +00:00
|
|
|
self.wait_for_element(10)
|
2017-09-26 10:50:34 +00:00
|
|
|
self.find_element().click()
|
2018-01-26 11:07:09 +00:00
|
|
|
info('Tap on %s' % self.name)
|
2017-09-26 10:50:34 +00:00
|
|
|
return self.navigate()
|
|
|
|
|
2017-08-28 10:02:20 +00:00
|
|
|
|
2017-10-23 10:23:14 +00:00
|
|
|
class RecoverButton(BaseButton):
|
|
|
|
|
|
|
|
def __init__(self, driver):
|
|
|
|
super(RecoverButton, self).__init__(driver)
|
|
|
|
self.locator = self.Locator.xpath_selector("//*[@text='Recover']")
|
|
|
|
|
|
|
|
def navigate(self):
|
2018-01-03 09:34:40 +00:00
|
|
|
from views.recover_access_view import RecoverAccessView
|
|
|
|
return RecoverAccessView(self.driver)
|
2017-10-23 10:23:14 +00:00
|
|
|
|
|
|
|
|
2018-01-14 17:43:36 +00:00
|
|
|
class ChatRequestInput(BaseEditBox):
|
|
|
|
|
|
|
|
def __init__(self, driver):
|
|
|
|
super(ChatRequestInput, self).__init__(driver)
|
|
|
|
self.locator = \
|
|
|
|
self.Locator.xpath_selector("//android.widget.EditText[@content-desc!='chat-message-input']")
|
|
|
|
|
|
|
|
|
2018-01-03 09:34:40 +00:00
|
|
|
class ConsoleView(BaseView):
|
2017-08-28 10:02:20 +00:00
|
|
|
|
|
|
|
def __init__(self, driver):
|
2018-01-03 09:34:40 +00:00
|
|
|
super(ConsoleView, self).__init__(driver)
|
|
|
|
|
|
|
|
self.request_password_icon = RequestPasswordIcon(self.driver)
|
|
|
|
self.recover_button = RecoverButton(self.driver)
|
2018-01-14 17:43:36 +00:00
|
|
|
self.chat_request_input = ChatRequestInput(self.driver)
|
2018-01-03 09:34:40 +00:00
|
|
|
|
|
|
|
self.accept_agreements()
|
|
|
|
|
|
|
|
def accept_agreements(self):
|
2017-09-11 10:43:42 +00:00
|
|
|
for i in self.ok_button_apk, self.continue_button_apk:
|
2017-08-31 13:39:41 +00:00
|
|
|
try:
|
|
|
|
i.click()
|
|
|
|
except (NoSuchElementException, TimeoutException):
|
|
|
|
pass
|
2018-01-26 11:07:09 +00:00
|
|
|
|
|
|
|
def create_user(self):
|
|
|
|
self.request_password_icon.click()
|
|
|
|
self.chat_request_input.send_keys("qwerty1234")
|
2018-02-19 11:51:53 +00:00
|
|
|
self.send_message_button.click()
|
2018-01-26 11:07:09 +00:00
|
|
|
self.chat_request_input.send_keys("qwerty1234")
|
2018-02-19 11:51:53 +00:00
|
|
|
self.send_message_button.click()
|
2018-01-26 11:07:09 +00:00
|
|
|
self.find_full_text(
|
|
|
|
"Here is your signing phrase. You will use it to verify your transactions. Write it down and keep it safe!")
|
|
|
|
|
|
|
|
def recover_access(self, passphrase, password, username):
|
|
|
|
recover_access_view = self.recover_button.click()
|
|
|
|
recover_access_view.passphrase_input.send_keys(passphrase)
|
|
|
|
recover_access_view.password_input.send_keys(password)
|
|
|
|
recover_access_view.confirm_recover_access.click()
|
|
|
|
recovered_user = recover_access_view.element_by_text(username, 'button')
|
|
|
|
recover_access_view.confirm()
|
|
|
|
recovered_user.click()
|
|
|
|
recover_access_view.password_input.send_keys(password)
|
|
|
|
recover_access_view.sign_in_button.click()
|
2018-02-09 15:16:07 +00:00
|
|
|
recover_access_view.find_full_text('Wallet', 60)
|