From 3447032d5974adc6d56a860fec33d1c6938af716 Mon Sep 17 00:00:00 2001 From: Churikova Tetiana Date: Tue, 12 Apr 2022 11:22:26 +0200 Subject: [PATCH] e2e: pairing group --- test/appium/support/testrail_report.py | 1 + .../test_multiple_driver_tests.py | 302 +++++++++--------- test/appium/tests/test_performance.py | 1 - test/appium/views/chat_view.py | 4 + 4 files changed, 157 insertions(+), 151 deletions(-) diff --git a/test/appium/support/testrail_report.py b/test/appium/support/testrail_report.py index ce981567f0..75ba3dabf5 100644 --- a/test/appium/support/testrail_report.py +++ b/test/appium/support/testrail_report.py @@ -113,6 +113,7 @@ class TestrailReport(BaseTestReport): test_cases['pr']['keycard_tx'] = 50663 test_cases['pr']['1_1_chat_commands'] = 50825 test_cases['pr']['ens'] = 50827 + test_cases['pr']['sync'] = 50834 ## Nightly e2e test_cases['nightly']['medium'] = 736 test_cases['nightly']['chat'] = 50811 diff --git a/test/appium/tests/atomic/zzz_multiple_drivers_tests/test_multiple_driver_tests.py b/test/appium/tests/atomic/zzz_multiple_drivers_tests/test_multiple_driver_tests.py index c5b7aec87d..bb62c0e7d9 100644 --- a/test/appium/tests/atomic/zzz_multiple_drivers_tests/test_multiple_driver_tests.py +++ b/test/appium/tests/atomic/zzz_multiple_drivers_tests/test_multiple_driver_tests.py @@ -5,7 +5,6 @@ from tests.users import transaction_senders, basic_user, ens_user, ens_user_rops from views.sign_in_view import SignInView from views.chat_view import ChatView - # TODO: moved here until resolve of 13048 @pytest.mark.xdist_group(name="group_chat_3") @marks.critical @@ -207,168 +206,171 @@ class TestGroupChatMultipleDeviceMerged(MultipleSharedDeviceTestCase): 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) +@pytest.mark.xdist_group(name="sync_2") +@marks.critical +class TestSyncMultipleDevicesMerged(MultipleSharedDeviceTestCase): -class TestGroupChatMultipleDevice(MultipleDeviceTestCase): - @marks.testrail_id(5762) - @marks.high - def test_pair_devices_sync_one_to_one_contacts_nicknames_public_chat(self): - self.create_drivers(3) - device_1, device_2, device_3 = SignInView(self.drivers[0]), SignInView(self.drivers[1]), SignInView( - self.drivers[2]) + @classmethod + def setup_class(cls): + cls.drivers, cls.loop = create_shared_drivers(2) + cls.no_contact_nickname = 'no_contact_nickname' + cls.device_1, cls.device_2 = SignInView(cls.drivers[0]), SignInView(cls.drivers[1]) + cls.home_1 = cls.device_1.create_user() - no_contact_nickname = 'no_contact_nickname' - name_1, name_2 = 'device_%s' % device_1.driver.number, 'device_%s' % device_2.driver.number - message_before_sync, message_after_sync = 'sent before sync', 'sent after sync' - message_blocked_before, message_blocked_after = 'I am blocked user', 'Not blocked anymore' - public_chat_before_sync, public_chat_after_sync = device_1.get_random_chat_name(), 'after-pairing' + cls.name_1, cls.name_2 = 'device_%s' % cls.drivers[0].number, 'device_%s' % cls.drivers[1].number + cls.message_before_sync, cls.message_after_sync = 'sent before sync', 'sent after sync' + cls.contact_before_sync = basic_user + cls.public_chat_before_sync, cls.public_chat_after_sync = cls.home_1.get_random_chat_name(), 'after-pairing' - device_3.just_fyi("Block contact: create user for blocking from main device") - home_3 = device_3.create_user() - public_chat_3 = home_3.join_public_chat(public_chat_before_sync) - public_chat_3.send_message(message_blocked_before) - self.drivers[2].quit() + cls.home_1.just_fyi("(main device): get recovery phrase") + cls.profile_1 = cls.home_1.profile_button.click() + cls.profile_1.privacy_and_security_button.click() + cls.profile_1.backup_recovery_phrase_button.click() + cls.profile_1.ok_continue_button.click() + cls.recovery_phrase = cls.profile_1.get_recovery_phrase() + cls.profile_1.close_button.click() + cls.profile_1.home_button.click() + cls.profile_1.get_recovery_phrase() - device_1.just_fyi("(main device): create main user") - home_1 = device_1.create_user() - profile_1 = home_1.profile_button.click() - profile_1.privacy_and_security_button.click() - profile_1.backup_recovery_phrase_button.click() - profile_1.ok_continue_button.click() - recovery_phrase = profile_1.get_recovery_phrase() - profile_1.close_button.click() - profile_1.home_button.click() - profile_1.get_recovery_phrase() + cls.home_1.just_fyi('Add contact, 1-1 chat (main device): 3-random, contact with ENS, start 1-1') + cls.chat_1 = cls.home_1.add_contact(cls.contact_before_sync['public_key']) + cls.chat_1.send_message(cls.message_before_sync) + cls.chat_1.home_button.click() + cls.home_1.add_contact(ens_user['ens']) + cls.chat_1.home_button.click() - device_1.just_fyi('Add contact, 1-1 chat (main device): 3-random, contact with ENS, start 1-1') - chat_1 = home_1.add_contact(basic_user['public_key']) - chat_1.send_message(message_before_sync) - chat_1.home_button.click() - chat_1 = home_1.add_contact(ens_user['ens']) - chat_1.home_button.click() + cls.home_1.just_fyi('Chats, contacts (main device): join public chat, block user, set nickname') + public_chat_1 = cls.home_1.join_public_chat(cls.public_chat_before_sync) + public_chat_1.home_button.click() + cls.home_1.add_contact(transaction_senders['A']['public_key'], add_in_contacts=False, + nickname=cls.no_contact_nickname) + cls.chat_1.open_user_profile_from_1_1_chat() + cls.chat_1.block_contact() - device_1.just_fyi('Chats, contacts (main device): join public chat, block user, set nickname') - public_chat_1 = home_1.join_public_chat(public_chat_before_sync) - public_chat_1.open_user_profile_from_public_chat(message_blocked_before) - public_chat_1.set_nickname(no_contact_nickname, close_profile=False) - public_chat_1.block_contact() + cls.device_2.just_fyi("(secondary device): restore same multiaccount on another device") + cls.home_2 = cls.device_2.recover_access(passphrase=' '.join(cls.recovery_phrase.values())) + cls.profile_1, cls.profile_2 = cls.home_1.profile_button.click(), cls.home_2.profile_button.click() - device_2.just_fyi("(secondary device): restore same multiaccount on another device") - home_2 = device_2.recover_access(passphrase=' '.join(recovery_phrase.values())) - profile_1, profile_2 = home_1.profile_button.click(), home_2.profile_button.click() + cls.device_2.just_fyi('Nicknames (main device): set nickname for contact') + cls.profile_1.open_contact_from_profile(cls.contact_before_sync['username']) + cls.nickname = 'my_basic_user' + cls.chat_1.set_nickname(cls.nickname) + cls.device_1.back_button.click() - device_2.just_fyi('Nicknames (main device): set nickname for contact') - profile_1.open_contact_from_profile(basic_user['username']) - nickname = 'my_basic_user' - chat_1.set_nickname(nickname) - device_1.back_button.click() + cls.device_2.just_fyi('Pair main and secondary devices') + cls.profile_2.discover_and_advertise_device(cls.name_2) + cls.profile_1.discover_and_advertise_device(cls.name_1) + cls.profile_1.get_toggle_device_by_name(cls.name_2).wait_and_click() + cls.profile_1.sync_all_button.click() + cls.profile_1.sync_all_button.wait_for_visibility_of_element(20) + [device.profile_button.double_click() for device in (cls.profile_1, cls.profile_2)] - device_2.just_fyi('Pair main and secondary devices') - profile_2.discover_and_advertise_device(name_2) - profile_1.discover_and_advertise_device(name_1) - profile_1.get_toggle_device_by_name(name_2).wait_and_click() - profile_1.sync_all_button.click() - profile_1.sync_all_button.wait_for_visibility_of_element(20) - [device.profile_button.click() for device in (profile_1, profile_2)] - - device_2.just_fyi('Contacts (secondary device): check contacts + blocked users after initial sync') - profile_2.contacts_button.scroll_to_element(9, 'up') - profile_2.contacts_button.click() - if not profile_2.blocked_users_button.is_element_displayed(30): + @marks.testrail_id(702194) + def test_sync_initial_contacts_blocked_users(self): + self.profile_2.contacts_button.scroll_to_element(9, 'up') + self.profile_2.contacts_button.click() + if not self.profile_2.blocked_users_button.is_element_displayed(30): self.errors.append('Blocked users are not synced after initial sync') - for name in (basic_user['username'], nickname, '@%s' % ens_user['ens']): - if not profile_2.element_by_text(name).is_element_displayed(): - self.errors.append('"%s" is not found in Contacts after initial sync' % name) - profile_2.blocked_users_button.click() - if not profile_2.element_by_text(no_contact_nickname).is_element_displayed(): + for name in (basic_user['username'], self.nickname, '@%s' % ens_user['ens']): + if not self.profile_2.element_by_text(name).is_element_displayed(): + self.errors.append('"%s" is not found in Contacts on initial sync' % name) + self.profile_2.blocked_users_button.click() + if not self.profile_2.element_by_text(self.no_contact_nickname).is_element_displayed(): self.errors.append( - "'%s' nickname without addeing to contacts is not synced after initial sync" % no_contact_nickname) - profile_2.profile_button.double_click() - - device_1.just_fyi("Contacts(main device): unblock user, send message from unblocked user") - profile_1.profile_button.click() - profile_1.contacts_button.scroll_to_element(direction='up') - profile_1.contacts_button.click() - profile_1.blocked_users_button.click() - profile_1.element_by_text(no_contact_nickname).click() - public_chat_1.unblock_contact_button.click() - profile_1.close_button.click() - - device_1.just_fyi('Chats, contacts, nickname (main device): send message to 1-1, add new contact') - profile_1.home_button.click(desired_view='chat') - public_chat_1.back_button.click() - home_1.get_chat(nickname).click() - chat_1.send_message(message_after_sync) - chat_1.back_button.click() - new_contact, new_contact_ens = transaction_senders['A'], ens_user_ropsten - home_1.add_contact(new_contact['public_key']) - home_1.home_button.click() - home_1.add_contact(new_contact_ens['ens']) - - device_2.just_fyi('Contacts (secondary device): check unblocked user, new contact') - profile_2.contacts_button.click() - profile_2.blocked_users_button.wait_for_invisibility_of_element(60) - for name in (new_contact['username'], '@%s' % new_contact_ens['ens']): - if not profile_2.element_by_text(name).is_element_displayed(60): - self.errors.append('"%s" is not found in Contacts after adding when devices are paired' % name) - - device_1.just_fyi('Contacts (main device): set nickname, (secondary device): check that synced') - home_1.profile_button.double_click() - profile_1.contacts_button.scroll_to_element(9, 'up') - profile_1.open_contact_from_profile(transaction_senders['A']['username']) - nickname_after_sync = 'my_transaction sender' - chat_1.set_nickname(nickname_after_sync) - device_1.home_button.double_click() - if not profile_2.element_by_text(nickname_after_sync).is_element_displayed(60): - self.errors.append( - '"%s" is not updated in Contacts after setting nickname when devices are paired' % nickname_after_sync) - - device_2.just_fyi("Chats(secondary device): check public chats") - profile_2.home_button.click() - if not home_2.element_by_text_part(public_chat_before_sync).is_element_displayed(): - self.errors.append( - '"%s" is not found in Home after initial sync when devices are paired' % public_chat_before_sync) - public_chat_2 = home_2.get_chat('#%s' % public_chat_before_sync).click() - if public_chat_2.chat_element_by_text(message_blocked_before).is_element_displayed(30): - self.errors.append('Message %s from previously blocked user is fetched' % message_blocked_before) - - home_2.just_fyi("Chats (secondary device): check messages in 1-1") - public_chat_2.home_button.click() - chat = home_2.get_chat(nickname).click() - if chat.chat_element_by_text(message_before_sync).is_element_displayed(): - self.errors.append('"%s" message sent before pairing is synced' % message_before_sync) - if not chat.chat_element_by_text(message_after_sync).is_element_displayed(60): - self.errors.append('"%s" message in 1-1 is not synced' % message_after_sync) - - device_1.just_fyi('Chats (main device):add new public chat, (secondary device): check that synced') - home_1.join_public_chat(public_chat_after_sync) - home_2 = chat.get_back_to_home_view() - if not home_2.element_by_text_part(public_chat_after_sync).is_element_displayed(20): - self.errors.append( - '"%s" public chat is not synced after adding when devices are paired' % public_chat_after_sync) - - home_1.just_fyi('Contacts (main device): remove and block contact') - home_1.profile_button.double_click() - profile_1.contacts_button.scroll_to_element(9, 'up') - profile_1.open_contact_from_profile(nickname) - chat_1.block_contact() - profile_1.element_by_text(nickname_after_sync).click() - chat_1.remove_from_contacts.click() - - home_2.just_fyi('Contacts (secondary device): check removed and blocked contact') - home_2.element_by_text_part(nickname).wait_for_invisibility_of_element(60) - home_2.profile_button.click() - profile_2.contacts_button.click() - profile_2.element_by_text(nickname_after_sync).wait_for_invisibility_of_element(60) - - device_1.just_fyi('Chats (main device):delete added public chat, (secondary device): check that synced') - for profile in (profile_1, profile_2): - profile.get_back_to_home_view() - profile.home_button.double_click() - home_1.delete_chat_long_press('#%s' % public_chat_after_sync) - home_2.element_by_text('#%s' % public_chat_after_sync).wait_for_invisibility_of_element(60) - + "'%s' nickname without adding to contacts is not synced on initial sync" % self.no_contact_nickname) self.errors.verify_no_errors() + @marks.testrail_id(702195) + def test_sync_initial_public_chats(self): + [device.home_button.double_click() for device in (self.profile_1, self.profile_2)] + if not self.home_2.element_by_text_part(self.public_chat_before_sync).is_element_displayed(): + self.errors.append( + "'%s' public chat is not appeared on secondary device on initial sync" % self.public_chat_before_sync) + self.errors.verify_no_errors() + + @marks.testrail_id(702196) + def test_sync_contacts_block_unblock(self): + [device.profile_button.double_click() for device in (self.profile_1, self.profile_2)] + new_user_for_block = transaction_senders['C'] + + self.profile_1.just_fyi("Contacts(main device): block and unblock user") + self.profile_1.profile_button.click() + self.profile_1.contacts_button.scroll_to_element(direction='up') + self.profile_1.contacts_button.click() + self.profile_1.blocked_users_button.click() + self.profile_1.element_by_text(self.no_contact_nickname).click() + self.chat_1.unblock_contact_button.click() + self.profile_1.close_button.click() + self.home_1.home_button.click() + self.home_1.add_contact(new_user_for_block['public_key'], add_in_contacts=False) + self.chat_1.open_user_profile_from_1_1_chat() + self.chat_1.block_contact() + + self.device_2.just_fyi('Contacts (secondary device): check unblocked and blocked user') + self.profile_2.contacts_button.click() + self.profile_2.blocked_users_button.click() + if self.profile_2.element_by_text(self.no_contact_nickname).is_element_displayed(): + self.errors.append("'%s' unblocked user is not synced!" % self.no_contact_nickname) + if not self.profile_2.element_by_text(new_user_for_block['username']).is_element_displayed(): + self.errors.append("'%s' blocked user is not synced!" % new_user_for_block['username']) + self.errors.verify_no_errors() + + @marks.testrail_id(702197) + def test_sync_contacts_add_remove_set_nickname_ens(self): + [device.home_button.double_click() for device in (self.profile_1, self.profile_2)] + new_contact, new_nickname = transaction_senders['F'], "completely_new_nick" + self.home_1.add_contact(ens_user_ropsten['ens']) + self.home_1.home_button.click() + self.home_1.add_contact(new_contact['public_key']) + + self.device_2.just_fyi('Contacts (secondary device):check new contact') + self.profile_2.profile_button.double_click() + self.profile_2.contacts_button.scroll_to_element(direction='up') + self.profile_2.contacts_button.click() + for contact in (new_contact['username'], '@%s' % ens_user_ropsten['ens']): + if not self.profile_2.element_by_text(contact).is_element_displayed(): + self.errors.append("'%s' new contact is not synced!" % contact) + + self.device_1.just_fyi('(Main device): set nickname, (secondary device): check nickname') + self.chat_1.open_user_profile_from_1_1_chat() + self.chat_1.set_nickname(new_nickname) + if not self.profile_2.element_by_text(new_nickname).is_element_displayed(): + self.errors.append("'%s' new nickname is not synced!" % new_nickname) + + self.device_1.just_fyi('(Main device): remove contact, (secondary device): check removed contact') + self.chat_1.open_user_profile_from_1_1_chat() + self.chat_1.remove_from_contacts.click() + self.chat_1.close_button.click() + self.profile_2.element_by_text(new_nickname).is_element_disappeared(40) + self.errors.verify_no_errors() + + @marks.testrail_id(702198) + def test_sync_1_1_chat_message(self): + [device.home_button.double_click() for device in (self.profile_1, self.profile_2)] + self.home_1.get_chat(self.nickname).click() + self.chat_1.send_message(self.message_after_sync) + + self.home_2.just_fyi("Chats (secondary device): check messages in 1-1") + chat = self.home_2.get_chat(self.nickname).click() + if chat.chat_element_by_text(self.message_before_sync).is_element_displayed(): + self.errors.append('"%s" message sent before pairing is synced' % self.message_before_sync) + if not chat.chat_element_by_text(self.message_after_sync).is_element_displayed(60): + self.errors.append('"%s" message in 1-1 is not synced' % self.message_after_sync) + self.errors.verify_no_errors() + + @marks.testrail_id(702199) + def test_sync_public_chat_add_remove(self): + [device.home_button.double_click() for device in (self.profile_1, self.profile_2)] + self.home_1.join_public_chat(self.public_chat_after_sync) + if not self.home_2.element_by_text("#%s" % self.public_chat_after_sync).is_element_displayed(10): + self.errors.append('Public chat "%s" is not synced' % self.public_chat_after_sync) + self.home_1.home_button.click() + self.home_1.delete_chat_long_press('#%s' % self.public_chat_after_sync) + if not self.home_2.element_by_text('#%s' % self.public_chat_after_sync).is_element_disappeared(60): + self.errors.append('Remove of "%s" public chat is not synced!' % self.public_chat_after_sync) + self.errors.verify_no_errors() + +class TestGroupChatMultipleDevice(MultipleDeviceTestCase): @marks.testrail_id(6324) @marks.medium diff --git a/test/appium/tests/test_performance.py b/test/appium/tests/test_performance.py index 1a7a4b9af3..2d981e1dbe 100644 --- a/test/appium/tests/test_performance.py +++ b/test/appium/tests/test_performance.py @@ -19,7 +19,6 @@ class TestPerformance(SingleDeviceTestCase): return timestamps_by_event @marks.testrail_id(6216) - @marks.high @marks.skip def test_time_to_load_sign_in_screen(self): diff --git a/test/appium/views/chat_view.py b/test/appium/views/chat_view.py index e98291ea53..bb79b9f15e 100644 --- a/test/appium/views/chat_view.py +++ b/test/appium/views/chat_view.py @@ -936,6 +936,10 @@ class ChatView(BaseView): chat_element.find_element() chat_element.member_photo.click() + def open_user_profile_from_1_1_chat(self): + self.chat_options.click() + self.view_profile_button.click() + def set_nickname(self, nickname, close_profile=True): self.driver.info("Setting nickname:%s" % nickname) self.profile_nickname_button.click()