2018-01-14 17:43:36 +00:00
|
|
|
from views.base_element import BaseButton, BaseEditBox
|
2018-01-03 09:34:40 +00:00
|
|
|
from views.contacts_view import ContactsView
|
|
|
|
|
|
|
|
|
2018-03-15 20:01:08 +00:00
|
|
|
class StartNewChatButton(BaseButton):
|
2018-01-03 09:34:40 +00:00
|
|
|
def __init__(self, driver):
|
2018-03-15 20:01:08 +00:00
|
|
|
super(StartNewChatButton, self).__init__(driver)
|
|
|
|
self.locator = self.Locator.accessibility_id('start-1-1-chat-button')
|
2018-01-03 09:34:40 +00:00
|
|
|
|
|
|
|
|
|
|
|
class NewGroupChatButton(BaseButton):
|
|
|
|
|
|
|
|
def __init__(self, driver):
|
|
|
|
super(NewGroupChatButton, self).__init__(driver)
|
2018-03-15 20:01:08 +00:00
|
|
|
self.locator = self.Locator.accessibility_id('start-group-chat-button')
|
2018-01-03 09:34:40 +00:00
|
|
|
|
|
|
|
|
2018-02-14 13:48:18 +00:00
|
|
|
class JoinPublicChatButton(BaseButton):
|
|
|
|
|
|
|
|
def __init__(self, driver):
|
|
|
|
super(JoinPublicChatButton, self).__init__(driver)
|
2018-03-15 20:01:08 +00:00
|
|
|
self.locator = self.Locator.accessibility_id('join-public-chat-button')
|
2018-02-14 13:48:18 +00:00
|
|
|
|
|
|
|
|
2018-02-19 18:39:54 +00:00
|
|
|
class ChatNameEditBox(BaseEditBox):
|
2018-01-03 09:34:40 +00:00
|
|
|
def __init__(self, driver):
|
2018-02-19 18:39:54 +00:00
|
|
|
super(ChatNameEditBox, self).__init__(driver)
|
2018-03-15 20:01:08 +00:00
|
|
|
self.locator = self.Locator.accessibility_id('chat-name-input')
|
2018-01-03 09:34:40 +00:00
|
|
|
|
|
|
|
|
2018-03-28 10:21:39 +00:00
|
|
|
class OpenDAppButton(BaseButton):
|
2018-02-07 13:18:55 +00:00
|
|
|
def __init__(self, driver):
|
2018-03-28 10:21:39 +00:00
|
|
|
super(OpenDAppButton, self).__init__(driver)
|
2018-03-15 20:01:08 +00:00
|
|
|
self.locator = self.Locator.accessibility_id('open-dapp-button')
|
2018-02-07 13:18:55 +00:00
|
|
|
|
|
|
|
|
|
|
|
class OpenButton(BaseButton):
|
|
|
|
def __init__(self, driver):
|
|
|
|
super(OpenButton, self).__init__(driver)
|
2018-03-15 20:01:08 +00:00
|
|
|
self.locator = self.Locator.accessibility_id('open-dapp-button')
|
2018-02-07 13:18:55 +00:00
|
|
|
|
2018-10-04 17:44:08 +00:00
|
|
|
def navigate(self):
|
|
|
|
from views.web_views.base_web_view import BaseWebView
|
|
|
|
return BaseWebView(self.driver)
|
|
|
|
|
2018-02-07 13:18:55 +00:00
|
|
|
|
2018-07-19 09:57:45 +00:00
|
|
|
class CreateButton(BaseButton):
|
2018-02-14 13:48:18 +00:00
|
|
|
def __init__(self, driver):
|
2018-07-19 09:57:45 +00:00
|
|
|
super(CreateButton, self).__init__(driver)
|
2018-03-15 20:01:08 +00:00
|
|
|
self.locator = self.Locator.accessibility_id('create-button')
|
2018-02-14 13:48:18 +00:00
|
|
|
|
|
|
|
|
2018-02-13 17:22:41 +00:00
|
|
|
class EnterUrlEditbox(BaseEditBox):
|
2018-01-03 09:34:40 +00:00
|
|
|
def __init__(self, driver):
|
2018-02-13 17:22:41 +00:00
|
|
|
super(EnterUrlEditbox, self).__init__(driver)
|
2018-03-15 20:01:08 +00:00
|
|
|
self.locator = self.Locator.accessibility_id('dapp-url-input')
|
2018-02-13 17:22:41 +00:00
|
|
|
|
|
|
|
|
2018-02-19 18:39:54 +00:00
|
|
|
class UsernameCheckbox(BaseButton):
|
|
|
|
def __init__(self, driver, username):
|
|
|
|
super(UsernameCheckbox, self).__init__(driver)
|
2018-02-19 11:51:53 +00:00
|
|
|
self.locator = self.Locator.xpath_selector("//*[@text='%s']/../../android.widget.CheckBox" % username)
|
2018-02-19 18:39:54 +00:00
|
|
|
|
|
|
|
|
2018-07-03 12:40:44 +00:00
|
|
|
class InviteFriendsButton(BaseButton):
|
|
|
|
def __init__(self, driver):
|
|
|
|
super(InviteFriendsButton, self).__init__(driver)
|
|
|
|
self.locator = self.Locator.accessibility_id('invite-friends-button')
|
|
|
|
|
|
|
|
|
2018-02-13 17:22:41 +00:00
|
|
|
class StartNewChatView(ContactsView):
|
|
|
|
def __init__(self, driver):
|
|
|
|
super(StartNewChatView, self).__init__(driver)
|
2018-01-03 09:34:40 +00:00
|
|
|
|
2018-03-15 20:01:08 +00:00
|
|
|
self.start_new_chat_button = StartNewChatButton(self.driver)
|
2018-01-03 09:34:40 +00:00
|
|
|
self.new_group_chat_button = NewGroupChatButton(self.driver)
|
2018-02-14 13:48:18 +00:00
|
|
|
self.join_public_chat_button = JoinPublicChatButton(self.driver)
|
2018-01-03 09:34:40 +00:00
|
|
|
|
2018-03-28 10:21:39 +00:00
|
|
|
self.open_d_app_button = OpenDAppButton(self.driver)
|
2018-02-07 13:18:55 +00:00
|
|
|
self.open_button = OpenButton(self.driver)
|
2018-07-03 12:40:44 +00:00
|
|
|
self.invite_friends_button = InviteFriendsButton(self.driver)
|
2018-02-07 13:18:55 +00:00
|
|
|
|
2018-02-19 18:39:54 +00:00
|
|
|
self.chat_name_editbox = ChatNameEditBox(self.driver)
|
2018-02-13 17:22:41 +00:00
|
|
|
self.enter_url_editbox = EnterUrlEditbox(self.driver)
|
2018-07-19 09:57:45 +00:00
|
|
|
self.create_button = CreateButton(self.driver)
|
2018-02-19 18:39:54 +00:00
|
|
|
|
|
|
|
def get_username_checkbox(self, username: str):
|
|
|
|
return UsernameCheckbox(self.driver, username)
|