e2e: 10 participants in group chat

Signed-off-by: Churikova Tetiana <churikova.tm@gmail.com>
This commit is contained in:
Churikova Tetiana 2020-05-19 10:35:02 +02:00
parent 80c6a516d8
commit d73cdbe26d
No known key found for this signature in database
GPG Key ID: 0D4EA7B33B47E6D8
4 changed files with 44 additions and 6 deletions

View File

@ -1,6 +1,6 @@
from tests import marks from tests import marks
from tests.base_test_case import MultipleDeviceTestCase from tests.base_test_case import MultipleDeviceTestCase, SingleDeviceTestCase
from tests.users import chat_users from tests.users import transaction_recipients
from views.sign_in_view import SignInView 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.append('User was unblocked, but new messages are not received')
self.errors.verify_no_errors() 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()

View File

@ -115,7 +115,7 @@ class BaseElement(object):
try: try:
return self.find_element() return self.find_element()
except NoSuchElementException: except NoSuchElementException:
self.driver.info('Scrolling down to %s' % self.name) self.driver.info('Scrolling %s to %s' % (direction, self.name))
if direction == 'down': if direction == 'down':
self.driver.swipe(500, 1000, 500, 500) self.driver.swipe(500, 1000, 500, 500)
else: else:

View File

@ -1,5 +1,6 @@
from views.base_element import BaseButton, BaseEditBox from views.base_element import BaseButton, BaseEditBox
from views.base_view import BaseView from views.base_view import BaseView
from selenium.common.exceptions import NoSuchElementException
class PlusButton(BaseButton): class PlusButton(BaseButton):
@ -37,8 +38,16 @@ class ConfirmPublicKeyButton(BaseButton):
class UsernameCheckbox(BaseButton): class UsernameCheckbox(BaseButton):
def __init__(self, driver, username): def __init__(self, driver, username):
super(UsernameCheckbox, self).__init__(driver) super(UsernameCheckbox, self).__init__(driver)
self.username = username
self.locator = self.Locator.xpath_selector("//*[@text='%s']" % 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): class ChatNameEditBox(BaseEditBox):
def __init__(self, driver): def __init__(self, driver):

View File

@ -222,9 +222,7 @@ class HomeView(BaseView):
self.plus_button.click() self.plus_button.click()
contacts_view = self.new_group_chat_button.click() contacts_view = self.new_group_chat_button.click()
for user_name in user_names_to_add: for user_name in user_names_to_add:
user_contact = contacts_view.get_username_checkbox(user_name) contacts_view.get_username_checkbox(user_name).click()
user_contact.scroll_to_element()
user_contact.click()
contacts_view.next_button.click() contacts_view.next_button.click()
contacts_view.chat_name_editbox.send_keys(group_chat_name) contacts_view.chat_name_editbox.send_keys(group_chat_name)
contacts_view.create_button.click() contacts_view.create_button.click()