From 12ba82844a3daaca1addaec794407624e586b740 Mon Sep 17 00:00:00 2001 From: pavloburykh Date: Mon, 11 Jul 2022 14:17:31 +0300 Subject: [PATCH] e2e: new medium pairing tests --- .../medium/test_pairing_devices_sync_m.py | 146 +++++++++++++++++- test/appium/views/profile_view.py | 1 + 2 files changed, 145 insertions(+), 2 deletions(-) diff --git a/test/appium/tests/medium/test_pairing_devices_sync_m.py b/test/appium/tests/medium/test_pairing_devices_sync_m.py index f9c9e022b2..b10cbbaaf0 100644 --- a/test/appium/tests/medium/test_pairing_devices_sync_m.py +++ b/test/appium/tests/medium/test_pairing_devices_sync_m.py @@ -1,5 +1,8 @@ import pytest +import random +import string +from tests.users import wallet_users, basic_user, ens_user from tests import marks from tests.base_test_case import MultipleSharedDeviceTestCase, create_shared_drivers from views.sign_in_view import SignInView @@ -44,6 +47,37 @@ class TestPairingSyncMediumMultipleDevicesMerged(MultipleSharedDeviceTestCase): self.home_1.profile_button.double_click() self.profile_1.edit_profile_picture('sauce_logo.png') + self.profile_1.privacy_and_security_button.click() + + self.device_1.just_fyi('Set Accept new chats from contacts') + self.profile_1.accept_new_chats_from.click() + self.profile_1.accept_new_chats_from_contacts_only.click() + self.profile_1.navigate_up_button.click() + + self.device_1.just_fyi('Set see profile pictures from to everyone') + self.profile_1.show_profile_pictures_of.scroll_and_click() + self.profile_1.element_by_translation_id('everyone').click() + self.profile_1.navigate_up_button.click() + + self.device_1.just_fyi('Set show profile pictures to to none') + self.profile_1.show_profile_pictures_to.scroll_and_click() + self.profile_1.element_by_translation_id('none').click() + self.profile_1.get_back_to_home_view() + + self.home_1.just_fyi('Add watch only wallet') + self.wallet_1 = self.home_1.wallet_button.click() + self.wallet_1.add_account_button.click() + self.wallet_1.add_watch_only_address_button.click() + self.wallet_1.enter_address_input.send_keys(basic_user['address']) + self.account_name = ''.join(random.choice(string.ascii_uppercase + string.digits) for _ in range(10)) + self.wallet_1.account_name_input.send_keys(self.account_name) + self.wallet_1.add_account_generate_account_button.click() + + self.wallet_1.just_fyi('Set account currency to AFN') + currency_afg = 'Afghanistan Afghani (AFN)' + self.wallet_1.set_currency(currency_afg) + self.wallet_1.navigate_up_button.click() + self.device_1.just_fyi('Add contact, start group chat') self.home_1.home_button.click() self.home_1.add_contact(self.public_key_3) @@ -63,15 +97,123 @@ class TestPairingSyncMediumMultipleDevicesMerged(MultipleSharedDeviceTestCase): self.profile_2.discover_and_advertise_device(self.name_2) self.profile_1.discover_and_advertise_device(self.name_1) self.profile_1.get_toggle_device_by_name(self.name_2).wait_and_click() + self.profile_2.get_toggle_device_by_name(self.name_1).wait_and_click() self.profile_1.sync_all_button.click() self.profile_1.sync_all_button.wait_for_visibility_of_element(20) [device.profile_button.double_click() for device in (self.profile_1, self.profile_2)] - [device.home_button.double_click() for device in (self.profile_1, self.profile_2, self.device_3)] + [device.home_button.double_click() for device in (self.profile_1, self.device_3)] + #TODO Performing relogin as some of data does not appear after sync until relogin. Should be removed after fix of the issue #13647. + self.profile_2.relogin() + self.device_3.put_app_to_background_and_back() + + @marks.testrail_id(702133) + def test_pairing_sync_accept_new_chats_see_show_profile_picture_settings(self): + self.home_2.just_fyi('Check accept new chat value was synced') + self.profile_2 = self.home_2.profile_button.click() + self.profile_2.privacy_and_security_button.click() + self.profile_2.accept_new_chats_from.scroll_to_element() + if not self.profile_2.accept_new_chats_from_contacts_only.is_element_displayed(): + self.errors.append('Accept new chats is not set to contacts value on synced device') + + self.profile_2.just_fyi('Check see/show pictures settings are set to everyone/none') + self.profile_2.delete_my_profile_button.scroll_to_element() + if not self.profile_2.element_by_translation_id('everyone').is_element_displayed(): + self.errors.append('See pictures from setting is not set to everyone on synced device') + if not self.profile_2.element_by_translation_id('none').is_element_displayed(): + self.errors.append('Show picture to setting is not set to none on synced device') + + self.profile_2.just_fyi('Changing values of see/show pictures and accept new chats settings') + self.device_2.just_fyi('Set Accept new chats from anyone') + self.profile_2.accept_new_chats_from.scroll_to_element(direction='up') + self.profile_2.accept_new_chats_from.click() + self.profile_2.element_by_translation_id('anyone').click() + self.profile_2.navigate_up_button.click() + + self.device_3.put_app_to_background_and_back() + + self.device_2.just_fyi('Set see profile pictures from to contacts') + self.profile_2.show_profile_pictures_of.scroll_and_click() + self.profile_2.element_by_translation_id('contacts').click() + self.profile_2.navigate_up_button.click() + + self.device_2.just_fyi('Set show profile pictures to to contacts') + self.profile_2.show_profile_pictures_to.scroll_and_click() + self.profile_2.element_by_translation_id('contacts').click() + self.profile_2.get_back_to_home_view() + + self.device_1.just_fyi('Check if see/show pictures and accept chats settings values changed to ones set on paired device 2') + self.profile_1 = self.home_1.profile_button.click() + self.profile_1.privacy_and_security_button.click() + self.profile_1.accept_new_chats_from.scroll_to_element() + if not self.profile_1.element_by_translation_id('anyone').is_element_displayed(): + self.errors.append('Accept new chats is not set to anyone value on paired device') + + self.profile_1.just_fyi('Check see/show pictures settings are set to contacts/contacts') + self.profile_1.delete_my_profile_button.scroll_to_element() + if not self.profile_1.element_by_translation_id('anyone').is_element_displayed(): + self.errors.append('See/show pictures from setting is not set to contacts on paired device') + if self.profile_1.element_by_translation_id('none').is_element_displayed(): + self.errors.append('Show picture to setting is still set to none instead of contacts on paired device') + if self.profile_1.element_by_translation_id('everyone').is_element_displayed(): + self.errors.append('See picture from setting is still set to everyone instead of contacts on paired device') + + [profile.get_back_to_home_view() for profile in (self.profile_1, self.profile_2)] + self.errors.verify_no_errors() + + self.device_3.put_app_to_background_and_back() + + @marks.testrail_id(702288) + def test_pairing_sync_currency(self): + self.wallet_2 = self.home_2.wallet_button.click() + self.wallet_2.just_fyi('Check currency is set to AFN on device 2 after sync') + if not self.wallet_2.element_by_text_part('AFN').is_element_displayed(): + self.errors.append('Currency is not set to AFN on device 2 after sync') + + self.wallet_2.just_fyi('Change currency to AED on device 2') + currency_aed = 'Emirati Dirham (AED)' + self.wallet_2.set_currency(currency_aed) + self.wallet_2.navigate_up_button.click() + + self.wallet_1 = self.home_1.wallet_button.click() + self.wallet_1.just_fyi('Check currency set to AED on device 1 after changing value on paired device 2') + if not self.wallet_1.element_by_text_part('AED').is_element_displayed(): + self.errors.append('Currency is not set to AED on device 1 after value was set on paired device 2') + + self.device_3.put_app_to_background_and_back() + + self.errors.verify_no_errors() + + @marks.testrail_id(702288) + def test_pairing_sync_watch_only_account(self): + self.wallet_2 = self.home_2.wallet_button.click() + account_button = self.wallet_2.get_account_by_name(self.account_name) + if not account_button.is_element_displayed(): + self.errors.append('Watch only account is displayed on device 2 after sync') + + self.wallet_2.just_fyi('Add another watch only wallet by paired device 2') + if not self.wallet_2.add_account_button.is_element_displayed(3): + self.wallet_2.accounts_status_account.swipe_left_on_element() + self.wallet_2.add_account_button.click() + self.wallet_2.add_watch_only_address_button.click() + self.wallet_2.enter_address_input.send_keys(ens_user['address']) + account_name_2 = ''.join(random.choice(string.ascii_uppercase + string.digits) for _ in range(10)) + self.wallet_2.account_name_input.send_keys(account_name_2) + self.wallet_2.add_account_generate_account_button.click() + + self.wallet_1.just_fyi('Check newly added watch only account appeared on paired device 1') + self.wallet_1 = self.wallet_1.wallet_button.click() + account_button_2 = self.wallet_1.get_account_by_name(account_name_2) + if not account_button_2.is_element_displayed(): + self.wallet_1.accounts_status_account.swipe_left_on_element() + if not account_button_2.is_element_displayed(): + self.errors.append('New watch only account has not appeared on paired device 1') + + self.errors.verify_no_errors() @marks.testrail_id(702269) @marks.xfail(reason="too long setup, can fail with Remote end closed connection") def test_pairing_sync_initial_community_send_message(self): - # Pricture sync is not implemented yet + [device.home_button.click() for device in (self.home_1, self.home_2)] self.device_2.just_fyi('check that created/joined community and profile details are updated') if not self.home_2.get_chat(self.comm_before_sync_name, community=True).is_element_displayed(): self.errors.append('Community %s was not appeared after initial sync' % self.comm_before_sync_name) diff --git a/test/appium/views/profile_view.py b/test/appium/views/profile_view.py index c103e39c9c..0c9a774089 100644 --- a/test/appium/views/profile_view.py +++ b/test/appium/views/profile_view.py @@ -227,6 +227,7 @@ class ProfileView(BaseView): # Appearance self.appearance_button = Button(self.driver, accessibility_id="appearance-settings-button") self.show_profile_pictures_of = Button(self.driver, accessibility_id="show-profile-pictures") + self.show_profile_pictures_to = Button(self.driver, accessibility_id="show-profile-pictures-to") ## Backup recovery phrase self.backup_recovery_phrase_button = BackupRecoveryPhraseButton(self.driver) self.recovery_phrase_table = RecoveryPhraseTable(self.driver)