diff --git a/test/appium/tests/atomic/chats/test_group_chat.py b/test/appium/tests/atomic/chats/test_group_chat.py index 1f0b124821..22139006f1 100644 --- a/test/appium/tests/atomic/chats/test_group_chat.py +++ b/test/appium/tests/atomic/chats/test_group_chat.py @@ -1,6 +1,6 @@ from tests import marks -from tests.base_test_case import MultipleDeviceTestCase -from tests.users import chat_users +from tests.base_test_case import MultipleDeviceTestCase, SingleDeviceTestCase +from tests.users import transaction_recipients from views.sign_in_view import SignInView @@ -364,3 +364,34 @@ class TestGroupChatMultipleDevice(MultipleDeviceTestCase): self.errors.append('User was unblocked, but new messages are not received') self.errors.verify_no_errors() + + +class TestCommandsSingleDevices(SingleDeviceTestCase): + + @marks.testrail_id(5721) + @marks.medium + def test_cant_add_more_ten_participants_to_group_chat(self): + sign_in = SignInView(self.driver) + home = sign_in.create_user() + usernames = [] + + home.just_fyi('Add 10 users to contacts') + for user in transaction_recipients: + home.add_contact(transaction_recipients[user]['public_key']) + usernames.append(transaction_recipients[user]['username']) + home.get_back_to_home_view() + + home.just_fyi('Create group chat with max amount of users') + chat = home.create_group_chat(usernames, 'some_group_chat') + if chat.element_by_text(transaction_recipients['J']['username']).is_element_displayed(): + self.errors.append('11 users are in chat (10 users and admin)!') + + home.just_fyi('Verify that can not add more users via group info') + chat.chat_options.click() + group_info_view = chat.group_info.click() + if group_info_view.add_members.is_element_displayed(): + self.errors.append('Add members button is displayed when max users are added in chat') + if not group_info_view.element_by_text_part('10 members').is_element_displayed(): + self.errors.append('Amount of users is not shown on Group info screen') + + self.errors.verify_no_errors() diff --git a/test/appium/views/base_element.py b/test/appium/views/base_element.py index 930e9b4e7d..7b52f785bc 100644 --- a/test/appium/views/base_element.py +++ b/test/appium/views/base_element.py @@ -115,7 +115,7 @@ class BaseElement(object): try: return self.find_element() except NoSuchElementException: - self.driver.info('Scrolling down to %s' % self.name) + self.driver.info('Scrolling %s to %s' % (direction, self.name)) if direction == 'down': self.driver.swipe(500, 1000, 500, 500) else: diff --git a/test/appium/views/contacts_view.py b/test/appium/views/contacts_view.py index c10ef6e6be..e03f07309a 100644 --- a/test/appium/views/contacts_view.py +++ b/test/appium/views/contacts_view.py @@ -1,5 +1,6 @@ from views.base_element import BaseButton, BaseEditBox from views.base_view import BaseView +from selenium.common.exceptions import NoSuchElementException class PlusButton(BaseButton): @@ -37,8 +38,16 @@ class ConfirmPublicKeyButton(BaseButton): class UsernameCheckbox(BaseButton): def __init__(self, driver, username): super(UsernameCheckbox, self).__init__(driver) + self.username = username self.locator = self.Locator.xpath_selector("//*[@text='%s']" % username) + def click(self): + self.driver.info('Click %s username checkbox' % self.username) + try: + self.scroll_to_element().click() + except NoSuchElementException: + self.scroll_to_element(direction='up').click() + class ChatNameEditBox(BaseEditBox): def __init__(self, driver): diff --git a/test/appium/views/home_view.py b/test/appium/views/home_view.py index ca7ac4454e..bcf38374df 100644 --- a/test/appium/views/home_view.py +++ b/test/appium/views/home_view.py @@ -222,9 +222,7 @@ class HomeView(BaseView): self.plus_button.click() contacts_view = self.new_group_chat_button.click() for user_name in user_names_to_add: - user_contact = contacts_view.get_username_checkbox(user_name) - user_contact.scroll_to_element() - user_contact.click() + contacts_view.get_username_checkbox(user_name).click() contacts_view.next_button.click() contacts_view.chat_name_editbox.send_keys(group_chat_name) contacts_view.create_button.click()