2018-01-14 17:43:36 +00:00
|
|
|
import logging
|
|
|
|
|
|
|
|
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)
|
|
|
|
self.locator = self.Locator.xpath_selector("//*[@content-desc='request-password']")
|
|
|
|
|
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()
|
|
|
|
logging.info('Tap on %s' % self.name)
|
|
|
|
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
|