e2e refactoring: group and public chat

This commit is contained in:
Churikova Tetiana 2022-01-27 21:41:57 +01:00
parent b1780a7128
commit 4bf393ec3d
No known key found for this signature in database
GPG Key ID: 0D4EA7B33B47E6D8
12 changed files with 425 additions and 413 deletions

View File

@ -102,6 +102,12 @@ class TestrailReport(BaseTestReport):
test_cases['upgrade'] = 881
test_cases['public_chat'] = 50654
test_cases['one_to_one_chat'] = 50655
test_cases['group_chat'] = 50656
test_pr = list()
for key in test_cases:
if key != 'medium' and key != 'upgrade':
test_pr.append(test_cases[key])
case_ids = list()
for arg in argv:
if "run_testrail_ids" in arg:
@ -109,7 +115,7 @@ class TestrailReport(BaseTestReport):
case_ids = value.split(',')
if len(case_ids) == 0:
if 'critical or high' in argv:
for case in self.get_cases([test_cases['critical'], test_cases['public_chat'], test_cases['one_to_one_chat']]):
for case in self.get_cases(test_pr):
case_ids.append(case['id'])
elif 'upgrade' in argv and 'not upgrade' not in argv:
for case in self.get_cases([test_cases['upgrade']]):

View File

@ -759,10 +759,13 @@ class TestProfileMultipleDevice(MultipleDeviceTestCase):
home_1.create_group_chat(user_names_to_add=[default_username_2], group_chat_name=new_group_chat)
invite = group_chat_2.pn_invited_to_group_chat(default_username_1, new_group_chat)
home_2.get_pn(invite).wait_for_visibility_of_element(30)
if not home_2.get_pn(invite).group_chat_icon.is_element_image_similar_to_template(logo_group):
self.errors.append("Group chat invite is not updated with custom logo!")
home_2.get_pn(invite).click()
pn = home_2.get_pn(invite)
if pn:
if not pn.group_chat_icon.is_element_image_similar_to_template(logo_group):
self.errors.append("Group chat invite is not updated with custom logo!")
pn.click()
else:
home_2.click_system_back_button(2)
profile_1.just_fyi('Check profile image updated in on login view')
home_1.profile_button.click()

View File

@ -91,8 +91,6 @@ class TestWalletManagement(SingleDeviceTestCase):
@marks.testrail_id(5346)
@marks.flaky
@marks.high
@marks.skip
# TODO: skipped due to 13016
def test_collectible_from_wallet(self):
passphrase = wallet_users['F']['passphrase']
home = SignInView(self.driver).recover_access(passphrase=passphrase)

View File

@ -10,33 +10,6 @@ from views.chat_view import ChatView
class TestChatManagement(SingleDeviceTestCase):
@marks.testrail_id(5319)
@marks.critical
def test_long_press_to_delete_chat(self):
home = SignInView(self.driver).create_user()
messages = [home.get_random_message() for _ in range(3)]
home.just_fyi("Creating 3 types of chats")
chat = home.add_contact(basic_user['public_key'])
one_to_one, public, group = basic_user['username'], '#public-delete-long-press', 'group'
chat.get_back_to_home_view()
home.create_group_chat([basic_user['username']], group)
chat.get_back_to_home_view()
home.join_public_chat(public[1:])
chat.get_back_to_home_view()
home.just_fyi("Deleting all types of chats and check that they will not reappear after relogin")
i = 0
for chat_name in one_to_one, public, group:
chat = home.get_chat(chat_name).click()
chat.send_message(messages[i])
chat.get_back_to_home_view()
home.leave_chat_long_press(chat_name) if chat_name == group else home.delete_chat_long_press(chat_name)
i += 1
home.relogin()
for chat_name in one_to_one, public, group:
if home.get_chat_from_home_view(chat_name).is_element_displayed():
self.driver.fail('Deleted %s is present after relaunch app' % chat_name)
@marks.testrail_id(5387)
@marks.high

View File

@ -1,178 +1,221 @@
from tests import marks
from tests.base_test_case import MultipleDeviceTestCase, SingleDeviceTestCase
from tests.base_test_case import MultipleDeviceTestCase, SingleDeviceTestCase, MultipleSharedDeviceTestCase, create_shared_drivers
from tests.users import transaction_senders, ens_user
from views.sign_in_view import SignInView
from views.chat_view import ChatView
import random
import emoji
import pytest
class TestGroupChatMultipleDevice(MultipleDeviceTestCase):
@pytest.mark.xdist_group(name="group_chat_3")
class TestPublicChatMultipleDeviceMerged(MultipleSharedDeviceTestCase):
@classmethod
def setup_class(cls):
cls.drivers, cls.loop = create_shared_drivers(3)
cls.message_before_adding = 'message before adding new user'
cls.message_to_admin = 'Hey, admin!'
cls.homes, cls.public_keys, cls.usernames, cls.chats = {}, {}, {}, {}
for key in cls.drivers:
sign_in = SignInView(cls.drivers[key])
cls.homes[key] = sign_in.create_user(enable_notifications=True)
cls.public_keys[key], cls.usernames[key] = sign_in.get_public_key_and_username(True)
sign_in.home_button.click()
cls.chat_name = cls.homes[0].get_random_chat_name()
cls.homes[0].just_fyi('Admin adds future members to contacts')
for i in range(1, 3):
cls.homes[0].add_contact(cls.public_keys[i])
cls.homes[0].home_button.double_click()
cls.homes[0].just_fyi('Member adds admin to contacts to see PNs and put app in background')
cls.homes[1].add_contact(cls.public_keys[0])
cls.homes[1].home_button.double_click()
cls.homes[0].just_fyi('Admin creates group chat')
cls.chats[0] = cls.homes[0].create_group_chat([cls.usernames[1]], cls.chat_name)
for i in range(1, 3):
cls.chats[i] = ChatView(cls.drivers[i])
cls.chats[0].send_message(cls.message_before_adding)
@marks.testrail_id(3994)
@marks.high
def test_create_new_group_chat_messaging_pn_delivered(self):
self.create_drivers(2)
device_1, device_2 = SignInView(self.drivers[0]), SignInView(self.drivers[1])
home_1, home_2 = device_1.create_user(), device_2.create_user(enable_notifications=True)
key_1, username_1 = device_1.get_public_key_and_username(True)
device_1.home_button.click()
chat_name = home_1.get_random_chat_name()
home_2.just_fyi('Add admin to contacts to see PN about group chat invite')
home_2.home_button.double_click()
home_2.add_contact(key_1)
home_1.plus_button.click()
home_1.just_fyi('Check default placeholder when trying to create group chat without contacts')
home_1.new_group_chat_button.click()
if not home_1.element_by_translation_id("invite-friends").is_element_displayed():
self.errors.append("No placeholder is shown when there are no contacts")
home_1.get_back_to_home_view()
device_2.just_fyi('Create group chat with new user, check system messages for sender')
key_2, username_2 = device_2.get_public_key_and_username(True)
device_2.home_button.click()
home_1.add_contact(key_2)
home_1.get_back_to_home_view()
home_2.put_app_to_background()
home_2.open_notification_bar()
chat_1 = home_1.create_group_chat([username_2], chat_name)
home_2.just_fyi('check that PN invite to group chat is received and after tap you are redirected to group chat')
pns = [chat_1.pn_invited_to_group_chat(username_1, chat_name),
chat_1.pn_wants_you_to_join_to_group_chat(username_1, chat_name)]
@marks.critical
def test_group_pn_system_messages_when_invited(self):
self.homes[1].just_fyi("Check system messages in PNs")
self.homes[1].put_app_to_background()
self.homes[1].open_notification_bar()
pns = [self.chats[0].pn_invited_to_group_chat(self.usernames[0], self.chat_name),
self.chats[0].pn_wants_you_to_join_to_group_chat(self.usernames[0], self.chat_name)]
for pn in pns:
if not home_2.get_pn(pn).is_element_displayed(30):
if not self.homes[1].get_pn(pn):
self.errors.append('%s is not shown after invite to group chat' % pn)
group_invite_pn = home_2.get_pn(pns[0])
if self.homes[1].get_pn(pns[0]):
group_invite_pn = self.homes[1].get_pn(pns[0])
group_invite_pn.click()
else:
self.homes[1].click_system_back_button(2)
self.homes[1].get_chat(self.chat_name).click()
if not group_invite_pn.group_chat_icon.is_element_displayed(30):
self.errors.append('No icon is shown for PN for group invite')
group_invite_pn.click()
create_system_message = chat_1.create_system_message(username_1, chat_name)
invite_system_message = chat_1.invite_system_message(username_1, username_2)
join_system_message = chat_1.join_system_message(username_2)
invited_to_join = chat_1.invited_to_join_system_message(username_1, chat_name)
create_for_admin_system_message = chat_1.create_for_admin_system_message(chat_name)
self.homes[1].just_fyi("Check system messages in group chat for admin and member")
create_system_message = self.chats[0].create_system_message(self.usernames[0], self.chat_name)
invite_system_message = self.chats[0].invite_system_message(self.usernames[0], self.usernames[1])
invited_to_join = self.chats[0].invited_to_join_system_message(self.usernames[0], self.chat_name)
create_for_admin_system_message = self.chats[0].create_for_admin_system_message(self.chat_name)
for message in [create_for_admin_system_message, create_system_message, invite_system_message]:
if not chat_1.chat_element_by_text(message):
if not self.chats[0].chat_element_by_text(message):
self.errors.append('%s system message is not shown' % message)
device_2.just_fyi('Navigate to group chat, check system messages for member')
if not home_2.get_chat(chat_name).is_element_displayed():
self.drivers[0].fail('Group chat was not created!')
chat_2 = home_2.get_chat(chat_name).click()
for element in chat_2.join_chat_button, chat_2.decline_invitation_button:
if not element.is_element_displayed():
self.drivers[0].fail('"Join Chat" or "Decline" is not shown for member of group chat')
for message in [invited_to_join, create_system_message, invite_system_message]:
if not chat_2.chat_element_by_text(message):
if not self.chats[1].chat_element_by_text(message):
self.errors.append('%s system message is not shown' % message)
device_2.just_fyi(
'Join to group chat, check system messages and send messages to group chat, check message status is delivered')
chat_2.join_chat_button.click()
for chat in (chat_1, chat_2):
if not chat.chat_element_by_text(join_system_message).is_element_displayed(30):
self.drivers[0].fail('System message after joining group chat is not shown')
chat_2.home_button.click(desired_view="home")
message_1 = "Message from device: %s" % chat_1.driver.number
chat_1.send_message(message_1)
if chat_1.chat_element_by_text(message_1).status != 'delivered':
self.errors.append(
'Message status is not delivered, it is %s!' % chat_1.chat_element_by_text(message_1).status)
home_2.put_app_to_background()
home_2.just_fyi('check that PN is received and after tap you are redirected to public chat')
home_2.open_notification_bar()
home_2.element_by_text_part("Message from device: %s" % chat_1.driver.number).click()
chat_2.send_message("Message from device: %s" % chat_2.driver.number)
for chat in (chat_1, chat_2):
for chat_driver in (chat_1, chat_2):
if not chat.chat_element_by_text(
"Message from device: %s" % chat_driver.driver.number).is_element_displayed():
self.errors.append("Message from device '%s' was not received" % chat_driver.driver.number)
self.errors.verify_no_errors()
@marks.testrail_id(3997)
@marks.medium
def test_leave_group_chat_highligted_via_group_info(self):
self.create_drivers(2)
device_1, device_2 = SignInView(self.drivers[0]), SignInView(self.drivers[1])
home_1, home_2 = device_1.create_user(), device_2.create_user()
chat_name = home_1.get_random_chat_name()
@marks.testrail_id(700731)
@marks.critical
def test_group_join_send_text_messages_pn(self):
message_to_admin = self.message_to_admin
[self.homes[i].home_button.double_click() for i in range(3)]
self.homes[1].get_chat(self.chat_name).click()
device_2.just_fyi('Create and join group chat')
public_key_2, username_2 = device_2.get_public_key_and_username(True)
public_key_1 = home_1.get_public_key_and_username()
[home.home_button.click() for home in (home_1, home_2)]
home_2.add_contact(public_key_1)
home_1.add_contact(public_key_2)
[home.home_button.click() for home in (home_1, home_2)]
chat_1 = home_1.create_group_chat([username_2], chat_name)
self.chats[1].just_fyi('Join to group chat')
join_system_message = self.chats[1].join_system_message(self.usernames[1])
self.chats[1].join_chat_button.click()
if not self.chats[1].chat_element_by_text(join_system_message).is_element_displayed(30):
self.drivers[1].fail('System message after joining group chat is not shown')
self.chats[1].send_message(message_to_admin)
home_2.just_fyi("Check that new group chat from contact is highlited")
chat_2_element = home_2.get_chat(chat_name)
if chat_2_element.no_message_preview.is_element_differs_from_template('highligted_preview_group.png', 0):
self.errors.append("Preview message is not hightligted or text is not shown! ")
left_system_message = chat_1.leave_system_message(username_2)
chat_2 = home_2.get_chat(chat_name).click()
chat_2.home_button.click()
if not chat_2_element.no_message_preview.is_element_differs_from_template('highligted_preview_group.png', 0):
self.errors.append("Preview message is still hightligted after opening! ")
home_2.get_chat(chat_name).click()
chat_2.join_chat_button.click()
self.chats[0].just_fyi('check that PN is received and after tap you are redirected to group chat')
self.chats[0].open_notification_bar()
pn = self.homes[0].get_pn(message_to_admin)
if pn:
pn.click()
else:
self.homes[0].click_system_back_button()
self.homes[0].get_chat(self.chat_name).click()
device_2.just_fyi('Send several message and leave chat')
for chat in chat_1, chat_2:
chat.send_message('sent before leaving')
chat_2.leave_chat_via_group_info()
if not chat_1.chat_element_by_text(left_system_message).is_element_displayed():
self.errors.append('No system message after user left the group chat')
if home_2.element_by_text(chat_name).is_element_displayed():
self.errors.append("Group chat '%s' is shown, but user has left" % chat_name)
self.chats[1].just_fyi('Check message status and message delivery')
message_status = self.chats[1].chat_element_by_text(message_to_admin).status
if message_status != 'delivered':
self.errors.append('Message status is not delivered, it is %s!' % message_status)
for message in (join_system_message, message_to_admin):
if not self.chats[0].chat_element_by_text(message).is_element_displayed(30):
self.drivers[0].fail('Message %s was not received by admin' % message)
self.errors.verify_no_errors()
device_2.just_fyi('Send message after user is left and check that it is not reappeared')
message = 'sent after leaving'
chat_1.send_message(message)
if home_2.element_by_text(chat_name).is_element_displayed():
self.errors.append("Group chat '%s' reappeared when new message is sent" % chat_name)
@marks.testrail_id(700732)
@marks.critical
def test_group_add_new_member_activity_centre(self):
[self.homes[i].home_button.double_click() for i in range(3)]
self.homes[0].get_chat(self.chat_name).click()
self.chats[0].add_members_to_group_chat([self.usernames[2]])
self.chats[2].just_fyi("Check there will be no PN but unread in AC if got invite from non-contact")
if not self.homes[2].notifications_unread_badge.is_element_displayed(60):
self.drivers[2].fail("Group chat is not appeared in AC!")
self.homes[2].open_notification_bar()
if self.homes[2].element_by_text_part(self.usernames[0]).is_element_displayed():
self.errors.append("PN about group chat invite is shown when invited by non-contact")
self.homes[2].click_system_back_button()
self.homes[2].get_chat(self.chat_name).click()
self.chats[2].join_chat_button.click()
for message in (self.message_to_admin, self.message_before_adding):
if self.chats[2].chat_element_by_text(message).is_element_displayed():
self.errors.append('%s is shown for new user' % message)
self.errors.verify_no_errors()
@marks.testrail_id(3998)
@marks.critical
def test_group_offline_pn(self):
[self.homes[i].home_button.double_click() for i in range(3)]
chat_name = 'for_offline_pn'
self.homes[0].create_group_chat([self.usernames[1], self.usernames[2]], chat_name)
self.homes[0].home_button.double_click()
for i in range(1, 3):
self.homes[i].get_chat(chat_name).click()
self.chats[i].join_chat_button.click()
message_1, message_2 = 'message from old member', 'message from new member'
self.homes[0].just_fyi("Put admin device to offline and send messages from members")
self.homes[0].toggle_airplane_mode()
self.chats[1].send_message(message_1)
self.chats[2].send_message(message_2)
self.homes[0].just_fyi("Put admin device to online and check that messages and PNs will be fetched")
self.homes[0].toggle_airplane_mode()
self.homes[0].connection_offline_icon.wait_for_invisibility_of_element(60)
self.homes[0].open_notification_bar()
for message in (message_1, message_2):
if not self.homes[0].get_pn(message):
self.errors.append('%s PN was not fetched from offline' % message)
self.homes[0].click_system_back_button()
unread_group = self.homes[0].get_chat(chat_name)
if not unread_group.new_messages_counter.text == '2':
self.errors.append('%s does not match unread messages' % unread_group.new_messages_counter.text)
unread_group.click()
self.homes[0].just_fyi("check that messages are shown for every member")
for i in range(3):
for message in (message_1, message_2):
if not self.chats[i].chat_element_by_text(message).is_element_displayed():
self.errors.append('%s if not shown for device %s' % (message, str(i)))
self.errors.verify_no_errors()
@marks.testrail_id(5756)
@marks.medium
def test_decline_invitation_to_group_chat(self):
self.create_drivers(2)
device_1, device_2 = SignInView(self.drivers[0]), SignInView(self.drivers[1])
home_1, home_2 = device_1.create_user(), device_2.create_user()
chat_name = home_1.get_random_chat_name()
home_1.plus_button.click()
@marks.critical
def test_group_decline_invite_chat_highligted(self):
chat_name = 'for_invited'
left_system_message = self.chats[0].leave_system_message(self.usernames[1])
[self.homes[i].home_button.double_click() for i in range(3)]
self.homes[0].create_group_chat([self.usernames[1]], chat_name)
device_2.just_fyi('Create group chat with new user')
public_key_2, username_2 = device_2.get_public_key_and_username(True)
device_2.home_button.click()
home_1.add_contact(public_key_2)
home_1.get_back_to_home_view()
chat_1 = home_1.create_group_chat([username_2], chat_name)
chat_2 = home_2.get_chat(chat_name).click()
self.homes[1].just_fyi("Check that new group chat from contact is highlited")
chat_2_element = self.homes[1].get_chat(chat_name)
if chat_2_element.no_message_preview.is_element_differs_from_template('highligted_preview_group.png', 0):
self.errors.append("Preview message is not hightligted or text is not shown! ")
chat_2 = self.homes[1].get_chat(chat_name).click()
chat_2.home_button.click()
if not chat_2_element.no_message_preview.is_element_differs_from_template('highligted_preview_group.png', 0):
self.errors.append("Preview message is still hightligted after opening! ")
self.homes[1].get_chat(chat_name).click()
chat_2.decline_invitation_button.click()
left_system_message = chat_2.leave_system_message(username_2)
if chat_1.chat_element_by_text(left_system_message).is_element_displayed():
self.errors.append(
'System message after user left the group chat is shown if declined before accepting in Activity Centre')
if home_2.element_by_text(chat_name).is_element_displayed():
self.errors.append("Group chat '%s' is shown, but user has left" % chat_name)
if self.chats[0].chat_element_by_text(left_system_message).is_element_displayed():
self.errors.append('System message when user declined invite is shown')
if self.homes[1].element_by_text(chat_name).is_element_displayed():
self.errors.append("Group chat '%s' is shown, but user declined invite" % chat_name)
device_2.just_fyi('Send message after invite is declined and check that it is not reappeared')
self.homes[0].just_fyi('Send message after invite is declined and check that it is not reappeared')
message = 'sent after leaving'
chat_1.send_message(message)
if home_2.element_by_text(chat_name).is_element_displayed():
self.chats[0].send_message(message)
if self.homes[1].element_by_text(chat_name).is_element_displayed():
self.errors.append("Group chat '%s' reappeared when new message is sent" % chat_name)
self.errors.verify_no_errors()
@marks.testrail_id(3997)
@marks.critical
def test_group_leave_relogin(self):
self.drivers[2].quit()
[self.homes[i].home_button.double_click() for i in range(2)]
self.homes[0].home_button.double_click()
self.homes[1].get_chat(self.chat_name).click()
join_button = self.chats[1].join_chat_button
if join_button.is_element_displayed():
join_button.click()
self.homes[0].just_fyi("Admin deleted chat via long press")
self.homes[0].leave_chat_long_press(self.chat_name)
self.homes[0].just_fyi("Member sends some message, admin relogins and check chat does not reappear")
self.chats[1].send_message(self.message_to_admin)
self.homes[0].relogin()
if self.homes[0].get_chat_from_home_view(self.chat_name).is_element_displayed():
self.drivers[0].fail('Deleted %s is present after relaunch app' % self.chat_name)
class TestGroupChatMultipleDevice(MultipleDeviceTestCase):
@marks.testrail_id(5694)
@marks.medium
def test_make_admin_member_of_group_chat(self):

View File

@ -193,7 +193,7 @@ class TestMessagesOneToOneChatMultiple(MultipleDeviceTestCase):
@marks.testrail_id(695843)
@marks.high
def test_edit_delete_message_in_one_to_one_and_public_chats(self):
def test_edit_delete_message_in_one_to_one_(self):
self.create_drivers(2)
device_1, device_2 = SignInView(self.drivers[0]), SignInView(self.drivers[1])
home_1, home_2 = device_1.create_user(enable_notifications=True), device_2.create_user()
@ -202,14 +202,6 @@ class TestMessagesOneToOneChatMultiple(MultipleDeviceTestCase):
public_key_1, username_1 = home_1.get_public_key_and_username(return_username=True)
public_key_2, username_2 = home_2.get_public_key_and_username(return_username=True)
[home.home_button.click() for home in (home_1, home_2)]
chat_name = home_1.get_random_chat_name()
home_1.join_public_chat(chat_name)
public_chat_1 = home_1.get_chat_view()
message_before_edit, message_after_edit = "Message BEFORE edit 1", "Message AFTER edit 2"
public_chat_1.send_message(message_before_edit)
public_chat_1.edit_message_in_chat(message_before_edit, message_after_edit)
if not public_chat_1.element_by_text_part("⌫ Edited").is_element_displayed(60):
self.errors.append('No mark in message bubble about this message was edited')
device_2.just_fyi(
"Device 1 sends text message and edits it in 1-1 chat. Device2 checks edited message is shown")
@ -255,18 +247,6 @@ class TestMessagesOneToOneChatMultiple(MultipleDeviceTestCase):
self.errors.append("Push notification was not removed after initial message deletion")
home_1.click_system_back_button(2)
chat_private_2.just_fyi("Check for that edited message is shown for Device 2 and delete message in public chat")
[home.home_button.double_click() for home in (home_1, home_2)]
public_chat_1, public_chat_2 = home_1.get_chat('#%s' % chat_name).click(), home_2.join_public_chat(chat_name)
if not public_chat_2.element_by_text_part("⌫ Edited").is_element_displayed(60):
self.errors.append('No mark in message bubble about this message was edited')
if not public_chat_2.element_by_text_part(message_after_edit).is_element_displayed(60):
self.errors.append('Message is not edited.')
public_chat_1.delete_message_in_chat(message_after_edit)
for chat in (public_chat_1, public_chat_2):
if chat.chat_element_by_text(message_after_edit).is_element_displayed(30):
self.errors.append("Deleted message is shown in chat view for public chat")
self.errors.verify_no_errors()
@marks.testrail_id(5782)
@ -575,7 +555,7 @@ class TestMessagesOneToOneChatMultiple(MultipleDeviceTestCase):
@marks.testrail_id(5373)
@marks.high
def test_send_and_open_links_with_previews(self):
def test_send_and_open_emoji_link_in_one_to_one(self):
self.create_drivers(2)
device_1, device_2 = SignInView(self.drivers[0]), SignInView(self.drivers[1])
@ -604,59 +584,9 @@ class TestMessagesOneToOneChatMultiple(MultipleDeviceTestCase):
web_view = chat_2.open_in_status_button.click()
if not web_view.element_by_text('Private, Secure Communication').is_element_displayed(60):
self.errors.append('URL was not opened from 1-1 chat')
home_2.dapp_tab_button.double_click()
chat_2.home_button.click()
home_1.just_fyi("Check that link can be opened from public chat")
chat_name = ''.join(random.choice(string.ascii_lowercase) for _ in range(7))
chat_1 = home_1.join_public_chat(chat_name)
chat_2 = home_2.join_public_chat(chat_name)
chat_2.send_message(url_message)
chat_1.element_starts_with_text(url_message, 'button').click()
web_view = chat_1.open_in_status_button.click()
if not web_view.element_by_text('Private, Secure Communication').is_element_displayed(60):
self.errors.append('URL was not opened from 1-1 chat')
home_1.home_button.click(desired_view='chat')
preview_urls = {'github_pr': {'url': 'https://github.com/status-im/status-react/pull/11707',
'txt': 'Update translations by jinhojang6 · Pull Request #11707 · status-im/status-react',
'subtitle': 'GitHub'},
'yotube': {
'url': 'https://www.youtube.com/watch?v=XN-SVmuJH2g&list=PLbrz7IuP1hrgNtYe9g6YHwHO6F3OqNMao',
'txt': 'Status & Keycard Hardware-Enforced Security',
'subtitle': 'YouTube'},
'twitter': {
'url': 'https://twitter.com/ethdotorg/status/1445161651771162627?s=20',
'txt': "We've rethought how we translate content, allowing us to translate",
'subtitle': 'Twitter'
}}
home_1.just_fyi("Check enabling and sending first gif")
giphy_url = 'https://giphy.com/gifs/this-is-fine-QMHoU66sBXqqLqYvGO'
chat_2.send_message(giphy_url)
chat_2.element_by_translation_id("dont-ask").click()
chat_1.element_by_translation_id("enable").wait_and_click()
chat_1.element_by_translation_id("enable-all").wait_and_click()
chat_1.close_modal_view_from_chat_button.click()
if not chat_1.get_preview_message_by_text(giphy_url).preview_image:
self.errors.append("No preview is shown for %s" % giphy_url)
for key in preview_urls:
home_2.just_fyi("Checking %s preview case" % key)
data = preview_urls[key]
chat_2.send_message(data['url'])
message = chat_1.get_preview_message_by_text(data['url'])
if data['txt'] not in message.preview_title.text:
self.errors.append("Title '%s' does not match expected" % message.preview_title.text)
if message.preview_subtitle.text != data['subtitle']:
self.errors.append("Subtitle '%s' does not match expected" % message.preview_subtitle.text)
home_2.just_fyi("Check if after do not ask again previews are not shown and no enable button appear")
if chat_2.element_by_translation_id("enable").is_element_displayed():
self.errors.append("Enable button is still shown after clicking on 'Den't ask again'")
if chat_2.get_preview_message_by_text(giphy_url).preview_image:
self.errors.append("Preview is shown for sender without permission")
self.errors.verify_no_errors()
@marks.testrail_id(5362)
@marks.medium
def test_unread_messages_counter_preview_highlited_1_1_chat(self):

View File

@ -10,9 +10,10 @@ from tests import marks
from tests.base_test_case import MultipleDeviceTestCase, SingleDeviceTestCase, create_shared_drivers, \
MultipleSharedDeviceTestCase
from views.sign_in_view import SignInView
from selenium.common.exceptions import NoSuchElementException
@pytest.mark.xdist_group(name="public_chat")
@pytest.mark.xdist_group(name="public_chat_2")
class TestPublicChatMultipleDeviceMerged(MultipleSharedDeviceTestCase):
@classmethod
@ -23,16 +24,19 @@ class TestPublicChatMultipleDeviceMerged(MultipleSharedDeviceTestCase):
profile_1 = cls.home_1.profile_button.click()
cls.username_1 = profile_1.default_username_text.text
profile_1.home_button.click()
cls.home_2.home_button.click()
cls.pub_chat_delete_long_press = 'pub-chat'
cls.text_message = 'hello'
cls.home_1.join_public_chat(cls.pub_chat_delete_long_press)
[home.home_button.click() for home in (cls.home_1, cls.home_2)]
cls.public_chat_name = cls.home_1.get_random_chat_name()
cls.chat_1, cls.chat_2 = cls.home_1.join_public_chat(cls.public_chat_name), cls.home_2.join_public_chat(cls.public_chat_name)
cls.chat_1.send_message(cls.text_message)
@marks.testrail_id(5313)
@marks.critical
def test_public_chat_text_timestamps_while_on_different_tab(self):
message = 'hello'
def test_public_message_send_check_timestamps_while_on_different_tab(self):
message = self.text_message
self.chat_2.dapp_tab_button.click()
self.chat_1.send_message(message)
sent_time_variants = self.chat_1.convert_device_time_to_chat_timestamp()
timestamp = self.chat_1.chat_element_by_text(message).timestamp_on_tap
if timestamp not in sent_time_variants:
@ -44,9 +48,32 @@ class TestPublicChatMultipleDeviceMerged(MultipleSharedDeviceTestCase):
self.errors.append("Default username '%s' is not shown next to the received message" % self.username_1)
self.errors.verify_no_errors()
@marks.testrail_id(700734)
@marks.critical
def test_public_message_edit(self):
message_before_edit, message_after_edit = self.text_message, "Message AFTER edit 2"
self.chat_1.edit_message_in_chat(message_before_edit, message_after_edit)
for chat in (self.chat_1, self.chat_2):
if not chat.element_by_text_part("⌫ Edited").is_element_displayed(60):
self.errors.append('No mark in message bubble about this message was edited')
if not self.chat_2.element_by_text_part(message_after_edit).is_element_displayed(60):
self.errors.append('Message is not edited')
self.errors.verify_no_errors()
@marks.testrail_id(700735)
@marks.critical
def test_public_message_delete(self):
message_to_delete = 'delete me, please'
self.chat_1.send_message(message_to_delete)
self.chat_1.delete_message_in_chat(message_to_delete)
for chat in (self.chat_1, self.chat_2):
if not chat.chat_element_by_text(message_to_delete).is_element_disappeared(30):
self.errors.append("Deleted message is shown in chat view for public chat")
self.errors.verify_no_errors()
@marks.testrail_id(700719)
@marks.critical
def test_public_emoji(self):
def test_public_emoji_send_copy_paste_reply(self):
emoji_name = random.choice(list(emoji.EMOJI_UNICODE))
emoji_unicode = emoji.EMOJI_UNICODE[emoji_name]
emoji_message = emoji.emojize(emoji_name)
@ -106,49 +133,204 @@ class TestPublicChatMultipleDeviceMerged(MultipleSharedDeviceTestCase):
[home.get_chat('#' + self.public_chat_name).click() for home in (self.home_1, self.home_2)]
self.chat_1.send_message(message)
self.chat_2.chat_element_by_text(message).wait_for_element(20)
self.chat_2.just_fyi("Check that unread messages counter doesn't reappear after relogin")
driver_2 = self.drivers[1]
driver_2.close_app()
driver_2.launch_app()
SignInView(driver_2).sign_in()
self.home_2.reopen_app()
chat_element = self.home_2.get_chat('#' + self.public_chat_name)
if chat_element.new_messages_public_chat.is_element_displayed():
self.drivers[0].fail('New messages counter is shown after relogin')
self.errors.verify_no_errors()
@marks.testrail_id(5319)
@marks.critical
def test_public_delete_chat_long_press(self):
[chat.home_button.double_click() for chat in (self.chat_1, self.chat_2)]
self.home_1.delete_chat_long_press('#%s' % self.pub_chat_delete_long_press)
self.home_2.just_fyi("Send message to deleted chat")
self.deleted_chat_2 = self.home_2.join_public_chat(self.pub_chat_delete_long_press)
self.deleted_chat_2.send_message()
if self.home_1.get_chat_from_home_view('#%s' % self.pub_chat_delete_long_press).is_element_displayed():
self.drivers[0].fail('Deleted public chat reappears after sending message to it')
self.home_1.reopen_app()
if self.home_1.get_chat_from_home_view('#%s' % self.pub_chat_delete_long_press).is_element_displayed():
self.drivers[0].fail('Deleted public chat reappears after relogin')
class TestPublicChatMultipleDevice(MultipleDeviceTestCase):
@marks.testrail_id(700736)
@marks.critical
def test_public_link_send_open(self):
[chat.home_button.double_click() for chat in (self.chat_1, self.chat_2)]
[home.get_chat('#' + self.public_chat_name).click() for home in (self.home_1, self.home_2)]
url_message = 'http://status.im'
self.chat_2.send_message(url_message)
self.chat_1.element_starts_with_text(url_message, 'button').click()
web_view = self.chat_1.open_in_status_button.click()
if not web_view.element_by_text('Private, Secure Communication').is_element_displayed(60):
self.drivers[0].fail('URL was not opened from public chat')
@marks.testrail_id(700737)
@marks.critical
def test_public_links_with_previews_github_youtube_twitter_gif_send_enable(self):
[chat.home_button.double_click() for chat in (self.chat_1, self.chat_2)]
[home.get_chat('#' + self.public_chat_name).click() for home in (self.home_1, self.home_2)]
giphy_url = 'https://giphy.com/gifs/this-is-fine-QMHoU66sBXqqLqYvGO'
preview_urls = {'github_pr': {'url': 'https://github.com/status-im/status-react/pull/11707',
'txt': 'Update translations by jinhojang6 · Pull Request #11707 · status-im/status-react',
'subtitle': 'GitHub'},
'yotube': {
'url': 'https://www.youtube.com/watch?v=XN-SVmuJH2g&list=PLbrz7IuP1hrgNtYe9g6YHwHO6F3OqNMao',
'txt': 'Status & Keycard Hardware-Enforced Security',
'subtitle': 'YouTube'},
'twitter': {
'url': 'https://twitter.com/ethdotorg/status/1445161651771162627?s=20',
'txt': "We've rethought how we translate content, allowing us to translate",
'subtitle': 'Twitter'
}}
self.home_1.just_fyi("Check enabling and sending first gif")
self.chat_2.send_message(giphy_url)
self.chat_2.element_by_translation_id("dont-ask").click()
self.chat_1.element_by_translation_id("enable").wait_and_click()
self.chat_1.element_by_translation_id("enable-all").wait_and_click()
self.chat_1.close_modal_view_from_chat_button.click()
if not self.chat_1.get_preview_message_by_text(giphy_url).preview_image:
self.errors.append("No preview is shown for %s" % giphy_url)
for key in preview_urls:
self.home_2.just_fyi("Checking %s preview case" % key)
data = preview_urls[key]
self.chat_2.send_message(data['url'])
message = self.chat_1.get_preview_message_by_text(data['url'])
if data['txt'] not in message.preview_title.text:
self.errors.append("Title '%s' does not match expected" % message.preview_title.text)
if message.preview_subtitle.text != data['subtitle']:
self.errors.append("Subtitle '%s' does not match expected" % message.preview_subtitle.text)
self.home_2.just_fyi("Check if after do not ask again previews are not shown and no enable button appear")
if self.chat_2.element_by_translation_id("enable").is_element_displayed():
self.errors.append("Enable button is still shown after clicking on 'Den't ask again'")
if self.chat_2.get_preview_message_by_text(giphy_url).preview_image:
self.errors.append("Preview is shown for sender without permission")
self.errors.verify_no_errors()
@marks.testrail_id(6270)
@marks.medium
def test_mark_all_messages_as_read_public_chat(self):
self.create_drivers(2)
device_1, device_2 = SignInView(self.drivers[0]), SignInView(self.drivers[1])
home_1, home_2 = device_1.create_user(), device_2.create_user()
chat_name = home_1.get_random_chat_name()
chat_1, chat_2 = home_1.join_public_chat(chat_name), home_2.join_public_chat(chat_name)
home_1.get_back_to_home_view()
message = 'test message'
chat_2.send_message(message)
@marks.critical
def test_public_mark_all_messages_as_read(self):
[chat.home_button.double_click() for chat in (self.chat_1, self.chat_2)]
self.home_2.get_chat('#' + self.public_chat_name).click()
self.chat_2.send_message(self.text_message)
if not home_1.home_button.public_unread_messages.is_element_displayed():
if not self.home_1.home_button.public_unread_messages.is_element_displayed():
self.errors.append('New messages public chat badge is not shown on Home button')
chat_element = home_1.get_chat('#' + chat_name)
chat_element = self.home_1.get_chat('#' + self.public_chat_name)
if not chat_element.new_messages_public_chat.is_element_displayed():
self.errors.append('New messages counter is not shown in public chat')
chat_element.long_press_element()
home_1.mark_all_messages_as_read_button.click()
home_1.get_back_to_home_view()
if home_1.home_button.public_unread_messages.is_element_displayed():
self.errors.append('New messages public chat badge is shown on Home button')
self.home_1.mark_all_messages_as_read_button.click()
self.home_1.home_button.double_click()
if self.home_1.home_button.public_unread_messages.is_element_displayed():
self.errors.append('New messages public chat badge is shown on Home button after marking messages as read')
if chat_element.new_messages_public_chat.is_element_displayed():
self.errors.append('Unread messages badge is shown in public chat while while there are no unread messages')
self.errors.verify_no_errors()
@pytest.mark.xdist_group(name="public_chat_1")
class TestPublicChatOneDeviceMerged(MultipleSharedDeviceTestCase):
@classmethod
def setup_class(cls):
cls.drivers, cls.loop = create_shared_drivers(1)
cls.sign_in = SignInView(cls.drivers[0])
cls.home = cls.sign_in.create_user()
cls.public_chat_name = cls.home.get_random_chat_name()
cls.chat = cls.home.join_public_chat(cls.public_chat_name)
@marks.testrail_id(5675)
@marks.critical
def test_public_fetch_more_history(self):
self.home.just_fyi("Check that can fetch previous history for several days")
device_time = parser.parse(self.drivers[0].device_time)
yesterday = (device_time - timedelta(days=1)).strftime("%b %-d, %Y")
before_yesterday = (device_time - timedelta(days=2)).strftime("%b %-d, %Y")
quiet_time_yesterday, quiet_time_before_yesterday = '24 hours', '2 days'
fetch_more = self.home.get_translation_by_key("load-more-messages")
for message in (yesterday, quiet_time_yesterday):
if not self.chat.element_by_text_part(message).is_element_displayed(120):
self.drivers[0].fail('"%s" is not shown' % message)
self.chat.element_by_text_part(fetch_more).wait_and_click(120)
self.chat.element_by_text_part(fetch_more).wait_for_visibility_of_element(180)
for message in (before_yesterday, quiet_time_before_yesterday):
if not self.chat.element_by_text_part(message).is_element_displayed():
self.drivers[0].fail('"%s" is not shown' % message)
self.home.just_fyi("Check that can fetch previous history for month")
times = {
"three-days": '5 days',
"one-week": '12 days',
"one-month": ['43 days', '42 days', '41 days', '40 days'],
}
profile = self.home.profile_button.click()
profile.sync_settings_button.click()
profile.sync_history_for_button.click()
for period in times:
profile.just_fyi("Checking %s period" % period)
profile.element_by_translation_id(period).click()
profile.home_button.click(desired_view='chat')
self.chat.element_by_text_part(fetch_more).wait_and_click(120)
if period != "one-month":
if not profile.element_by_text_part(times[period]).is_element_displayed(30):
self.errors.append("'Quiet here for %s' is not shown after fetching more history" % times[period])
else:
variants = times[period]
self.chat.element_by_text_part(fetch_more).wait_for_invisibility_of_element(120)
res = any(profile.element_by_text_part(variant).is_element_displayed(30) for variant in variants)
if not res:
self.errors.append("History is not fetched for one month!")
self.home.profile_button.click(desired_element_text=profile.get_translation_by_key("default-sync-period"))
self.errors.verify_no_errors()
@marks.testrail_id(5396)
@marks.critical
def test_public_navigate_to_chat_when_relaunch(self):
text_message = 'some_text'
self.home.home_button.double_click()
self.home.get_chat('#%s' % self.public_chat_name).click()
self.chat.send_message(text_message)
self.chat.reopen_app()
if not self.chat.chat_element_by_text(text_message).is_element_displayed(30):
self.drivers[0].fail("Not navigated to chat view after reopening app")
@marks.testrail_id(700738)
@marks.critical
def test_public_tag_message(self):
tag_message = '#wuuut'
self.home.home_button.double_click()
self.home.get_chat('#%s' % self.public_chat_name).click()
self.home.just_fyi("Check that will be redirected to chat view on tap on tag message")
self.chat.send_message(tag_message)
self.chat.element_starts_with_text(tag_message).click()
self.chat.element_by_text_part(self.public_chat_name).wait_for_invisibility_of_element()
if not self.chat.user_name_text.text == tag_message:
self.errors.append('Could not redirect a user to a public chat tapping the tag message.')
self.home.just_fyi("Check that chat is added to home view")
self.chat.home_button.double_click()
if not self.home.element_by_text(tag_message).is_element_displayed():
self.errors.append('Could not find the public chat in user chat list.')
self.errors.verify_no_errors()
@marks.testrail_id(700739)
@marks.critical
def test_public_chat_open_using_deep_link(self):
self.drivers[0].close_app()
chat_name = self.home.get_random_chat_name()
deep_link = 'status-im://%s' % chat_name
self.sign_in.open_weblink_and_login(deep_link)
try:
assert self.chat.user_name_text.text == '#' + chat_name
except (AssertionError, NoSuchElementException):
self.driver.fail("Public chat '%s' is not opened" % chat_name)
class TestPublicChatMultipleDevice(MultipleDeviceTestCase):
@marks.testrail_id(6342)
@marks.medium
def test_different_status_in_timeline(self):
@ -254,68 +436,9 @@ class TestPublicChatMultipleDevice(MultipleDeviceTestCase):
self.errors.verify_no_errors()
class TestPublicChatSingleDevice(SingleDeviceTestCase):
@marks.testrail_id(5675)
@marks.high
def test_redirect_to_public_chat_tapping_tag_message_fetch_more_history(self):
signin = SignInView(self.driver)
home_view = signin.create_user()
chat_name = 'montagne-angerufen'
chat = home_view.join_public_chat(chat_name)
tag_message = '#spectentur'
signin.just_fyi("Check that will be redirected to chat view on tap on tag message")
chat.send_message(tag_message)
chat.element_starts_with_text(tag_message).click()
chat.element_by_text_part(chat_name).wait_for_invisibility_of_element()
if not chat.user_name_text.text == tag_message:
self.errors.append('Could not redirect a user to a public chat tapping the tag message.')
signin.just_fyi("Check that can fetch previous history")
device_time = parser.parse(signin.driver.device_time)
yesterday = (device_time - timedelta(days=1)).strftime("%b %-d, %Y")
before_yesterday = (device_time - timedelta(days=2)).strftime("%b %-d, %Y")
quiet_time_yesterday, quiet_time_before_yesterday = '24 hours', '2 days'
fetch_more = signin.get_translation_by_key("load-more-messages")
for message in (yesterday, quiet_time_yesterday):
if not chat.element_by_text_part(message).is_element_displayed(120):
self.driver.fail('"%s" is not shown' % message)
chat.element_by_text_part(fetch_more).wait_and_click(120)
chat.element_by_text_part(fetch_more).wait_for_visibility_of_element(180)
for message in (before_yesterday, quiet_time_before_yesterday):
if not chat.element_by_text_part(message).is_element_displayed():
self.driver.fail('"%s" is not shown' % message)
signin.just_fyi("Check that chat is added to home view")
home_view = chat.get_back_to_home_view()
if not home_view.element_by_text(tag_message).is_element_displayed():
self.errors.append('Could not find the public chat in user chat list.')
times = {
"three-days": '5 days',
"one-week": '12 days',
"one-month": ['43 days', '42 days', '41 days', '40 days'],
}
signin.just_fyi("Check that can fetch more history")
home_view.element_by_text(tag_message).click()
profile = home_view.profile_button.click()
profile.sync_settings_button.click()
profile.sync_history_for_button.click()
for period in times:
profile.just_fyi("Checking %s period" % period)
profile.element_by_translation_id(period).click()
profile.home_button.click(desired_view='chat')
chat.element_by_text_part(fetch_more).wait_and_click(120)
if period != "one-month":
if not profile.element_by_text_part(times[period]).is_element_displayed(30):
self.errors.append("'Quiet here for %s' is not shown after fetching more history" % times[period])
else:
variants = times[period]
chat.element_by_text_part(fetch_more).wait_for_invisibility_of_element(120)
res = any(profile.element_by_text_part(variant).is_element_displayed(30) for variant in variants)
if not res:
self.errors.append("History is not fetched for one month!")
home_view.profile_button.click(desired_element_text=profile.get_translation_by_key("default-sync-period"))
self.errors.verify_no_errors()

View File

@ -8,20 +8,6 @@ from views.sign_in_view import SignInView
class TestDeepLinks(SingleDeviceTestCase):
@marks.testrail_id(5396)
@marks.high
def test_open_public_chat_using_deep_link(self):
sign_in_view = SignInView(self.driver)
sign_in_view.create_user()
self.driver.close_app()
chat_name = sign_in_view.get_random_chat_name()
deep_link = 'status-im://%s' % chat_name
sign_in_view.open_weblink_and_login(deep_link)
chat_view = sign_in_view.get_chat_view()
try:
assert chat_view.user_name_text.text == '#' + chat_name
except (AssertionError, NoSuchElementException):
self.driver.fail("Public chat '%s' is not opened" % chat_name)
@marks.testrail_id(5441)
@marks.medium

View File

@ -7,62 +7,6 @@ from views.chat_view import ChatView
class TestGroupChatMultipleDevice(MultipleDeviceTestCase):
@marks.testrail_id(3998)
@marks.high
def test_offline_add_new_group_chat_member(self):
message_before_adding = 'message before adding new user'
message_after_adding = 'message from new member'
message_from_old_member_after_adding = 'message from old member'
self.create_drivers(3)
homes, public_keys, usernames, chats = {}, {}, {}, {}
for key in self.drivers:
sign_in_view = SignInView(self.drivers[key])
homes[key] = sign_in_view.create_user()
public_keys[key], usernames[key] = sign_in_view.get_public_key_and_username(True)
sign_in_view.home_button.click()
chat_name = homes[0].get_random_chat_name()
for i in range(1, 3):
homes[0].add_contact(public_keys[i])
homes[0].get_back_to_home_view()
chats[0] = homes[0].create_group_chat([usernames[1]], chat_name)
chats[0].send_message(message_before_adding)
homes[1].just_fyi('Join to chat as chat member')
chats[1] = homes[1].get_chat(chat_name).click()
chats[1].join_chat_button.click()
homes[2].just_fyi('Put not added member device to offline and check that invite will be fetched')
invite_system_message = chats[0].invite_system_message(usernames[0], usernames[1])
homes[2].toggle_airplane_mode()
chats[0].add_members_to_group_chat([usernames[2]])
homes[2].toggle_airplane_mode()
homes[2].connection_offline_icon.wait_for_invisibility_of_element(60)
if not homes[2].get_chat(chat_name).is_element_displayed():
self.drivers[0].fail('Invite to group chat was not fetched from offline')
chats[2] = homes[2].get_chat(chat_name).click()
if not chats[2].element_by_text(invite_system_message).is_element_displayed():
self.errors.append('Message about adding first chat member is not shown for new added member')
if chats[2].element_by_text(message_before_adding).is_element_displayed():
self.errors.append('Message sent before adding user is shown')
chats[0].just_fyi('Put admin device to offline and check that message from new member will be fetched')
chats[0].toggle_airplane_mode()
chats[2].join_chat_button.click()
chats[2].send_message(message_after_adding)
chats[0].toggle_airplane_mode()
for key in chats:
if not chats[key].chat_element_by_text(message_after_adding).is_element_displayed(40):
self.errors.append("Message with text '%s' was not received" % message_after_adding)
chats[0].just_fyi('Send message from old member and check that it is fetched')
chats[1].send_message(message_from_old_member_after_adding)
for key in chats:
if not chats[key].chat_element_by_text(message_from_old_member_after_adding).is_element_displayed(20):
self.errors.append("Message with text '%s' was not received" % message_from_old_member_after_adding)
self.errors.verify_no_errors()
@marks.testrail_id(5762)
@marks.high
def test_pair_devices_sync_one_to_one_contacts_nicknames_public_chat(self):

View File

@ -551,6 +551,12 @@ class BaseView(object):
sign_in_view = self.get_sign_in_view()
sign_in_view.sign_in(password)
def reopen_app(self, password=common_password):
self.driver.close_app()
self.driver.launch_app()
sign_in_view = self.get_sign_in_view()
sign_in_view.sign_in(password)
def close_share_popup(self):
self.driver.info("Closing share popup")
TouchAction(self.driver).tap(None, 255, 104, 1).perform()

View File

@ -357,5 +357,5 @@ class HomeView(BaseView):
def get_pn(self, pn_text: str):
self.driver.info("Getting PN by '%s'" % pn_text)
PushNotificationElement(self.driver, pn_text).wait_for_element(60)
return PushNotificationElement(self.driver, pn_text)
expected_element = PushNotificationElement(self.driver, pn_text)
return expected_element if expected_element.is_element_displayed(60) else False

View File

@ -16,7 +16,7 @@ class OptionsButton(Button):
class OpenOnEtherscanButton(Button):
def __init__(self, driver):
super().__init__(driver, translation_id="open-on-etherscan")
super().__init__(driver, translation_id="open-on-block-explorer")
class TransactionTable(BaseElement):