Updated group chat creation flow

This commit is contained in:
yevh-berdnyk 2018-02-19 20:39:54 +02:00 committed by Julien Eluard
parent a4bc752e77
commit d45af20a28
No known key found for this signature in database
GPG Key ID: 6FD7DB5437FCBEF6
4 changed files with 19 additions and 11 deletions

View File

@ -91,8 +91,7 @@ class TestMessages(MultipleDeviceTestCase):
for console in device_1, device_2, device_3: for console in device_1, device_2, device_3:
console.create_user() console.create_user()
console.back_button.click() console.back_button.click()
home_1, home_2, home_3 = device_1.get_home_view(), device_2.get_home_view(), \ home_1, home_2, home_3 = device_1.get_home_view(), device_2.get_home_view(), device_3.get_home_view()
device_3.get_home_view()
public_key_2, public_key_3 = home_2.get_public_key(), home_3.get_public_key() public_key_2, public_key_3 = home_2.get_public_key(), home_3.get_public_key()
profile_1 = home_1.profile_button.click() profile_1 = home_1.profile_button.click()
profile_2, profile_3 = home_2.get_profile_view(), home_3.get_profile_view() profile_2, profile_3 = home_2.get_profile_view(), home_3.get_profile_view()

View File

@ -112,7 +112,7 @@ class NextButton(BaseButton):
def __init__(self, driver): def __init__(self, driver):
super(NextButton, self).__init__(driver) super(NextButton, self).__init__(driver)
self.locator = self.Locator.xpath_selector( self.locator = self.Locator.xpath_selector(
"//android.widget.TextView[@text='NEXT']") "//android.widget.TextView[@text='Next']")
class DoneButton(BaseButton): class DoneButton(BaseButton):

View File

@ -79,17 +79,17 @@ class HomeView(BaseView):
start_new_chat = self.plus_button.click() start_new_chat = self.plus_button.click()
start_new_chat.new_group_chat_button.click() start_new_chat.new_group_chat_button.click()
for user_name in user_names_to_add: for user_name in user_names_to_add:
user_contact = start_new_chat.element_by_text(user_name, 'button') user_contact = start_new_chat.get_username_checkbox(user_name)
user_contact.scroll_to_element() user_contact.scroll_to_element()
user_contact.click() user_contact.click()
start_new_chat.next_button.click() start_new_chat.next_button.click()
start_new_chat.name_edit_box.send_keys(group_chat_name) start_new_chat.chat_name_editbox.send_keys(group_chat_name)
start_new_chat.save_button.click() start_new_chat.confirm_button.click()
def join_public_chat(self, chat_name: str): def join_public_chat(self, chat_name: str):
start_new_chat = self.plus_button.click() start_new_chat = self.plus_button.click()
start_new_chat.join_public_chat_button.click() start_new_chat.join_public_chat_button.click()
start_new_chat.name_edit_box.send_keys(chat_name) start_new_chat.chat_name_edit_box.send_keys(chat_name)
start_new_chat.confirm_button.click() start_new_chat.confirm_button.click()
def get_public_key(self): def get_public_key(self):

View File

@ -25,11 +25,11 @@ class JoinPublicChatButton(BaseButton):
"//android.widget.TextView[@text='Join public chat']") "//android.widget.TextView[@text='Join public chat']")
class NameEditBox(BaseEditBox): class ChatNameEditBox(BaseEditBox):
def __init__(self, driver): def __init__(self, driver):
super(NameEditBox, self).__init__(driver) super(ChatNameEditBox, self).__init__(driver)
self.locator = \ self.locator = \
self.Locator.xpath_selector("//android.widget.EditText[@NAF='true']") self.Locator.xpath_selector("//android.widget.EditText")
class OpenDAapButton(BaseButton): class OpenDAapButton(BaseButton):
@ -58,6 +58,12 @@ class EnterUrlEditbox(BaseEditBox):
self.locator = self.Locator.xpath_selector("//android.widget.EditText") self.locator = self.Locator.xpath_selector("//android.widget.EditText")
class UsernameCheckbox(BaseButton):
def __init__(self, driver, username):
super(UsernameCheckbox, self).__init__(driver)
self.locator = self.Locator.xpath_selector("//*[@text='%s']/../../android.view.ViewGroup[2]/*" % username)
class StartNewChatView(ContactsView): class StartNewChatView(ContactsView):
def __init__(self, driver): def __init__(self, driver):
super(StartNewChatView, self).__init__(driver) super(StartNewChatView, self).__init__(driver)
@ -69,6 +75,9 @@ class StartNewChatView(ContactsView):
self.open_d_app_button = OpenDAapButton(self.driver) self.open_d_app_button = OpenDAapButton(self.driver)
self.open_button = OpenButton(self.driver) self.open_button = OpenButton(self.driver)
self.name_edit_box = NameEditBox(self.driver) self.chat_name_editbox = ChatNameEditBox(self.driver)
self.enter_url_editbox = EnterUrlEditbox(self.driver) self.enter_url_editbox = EnterUrlEditbox(self.driver)
self.confirm_button = ConfirmButton(self.driver) self.confirm_button = ConfirmButton(self.driver)
def get_username_checkbox(self, username: str):
return UsernameCheckbox(self.driver, username)