diff --git a/test/appium/support/api/network_api.py b/test/appium/support/api/network_api.py index 3fc5d45e89..f9be043978 100644 --- a/test/appium/support/api/network_api.py +++ b/test/appium/support/api/network_api.py @@ -114,7 +114,7 @@ class NetworkApi(object): self.log("Failed iterate transactions(Etherscan unexpected error): " + str(e)) continue - def wait_for_confirmation_of_transaction(self, address, amount, confirmations=6, token=False): + def wait_for_confirmation_of_transaction(self, address, amount, confirmations=3, token=False): start_time = time.time() if token: token_info = "token transaction" diff --git a/test/appium/support/testrail_report.py b/test/appium/support/testrail_report.py index 6673ec7167..2ba2ab34c5 100644 --- a/test/appium/support/testrail_report.py +++ b/test/appium/support/testrail_report.py @@ -102,6 +102,7 @@ class TestrailReport(BaseTestReport): test_cases['upgrade'] = dict() ## PR e2e test_cases['pr']['critical'] = 730 + test_cases['pr']['contacts'] = 50831 test_cases['pr']['public_chat'] = 50654 test_cases['pr']['one_to_one_chat'] = 50655 test_cases['pr']['group_chat'] = 50656 diff --git a/test/appium/tests/atomic/account_management/test_create_restore_account.py b/test/appium/tests/atomic/account_management/test_create_restore_account.py index d48dfb183b..0535fc84b3 100644 --- a/test/appium/tests/atomic/account_management/test_create_restore_account.py +++ b/test/appium/tests/atomic/account_management/test_create_restore_account.py @@ -227,7 +227,7 @@ class TestOnboardingOneDeviceMerged(MultipleSharedDeviceTestCase): class TestRestoreOneDeviceMerged(MultipleSharedDeviceTestCase): @classmethod def setup_class(cls): - cls.user = transaction_senders['A'] + cls.user = transaction_senders['ETH_ADI_STT_2'] cls.drivers, cls.loop = create_shared_drivers(1) cls.sign_in = SignInView(cls.drivers[0]) cls.passphrase = fill_string_with_char(cls.user['passphrase'].upper(), ' ', 3, True, True) @@ -376,6 +376,110 @@ class TestRestoreOneDeviceMerged(MultipleSharedDeviceTestCase): self.sign_in.click_system_back_button() self.errors.verify_no_errors() + @marks.testrail_id(702189) + @marks.transaction + def test_restore_account_migrate_multiaccount_to_keycard_no_db_saved_add_wallet_sign_tx(self): + self.sign_in.driver.close_app() + self.sign_in.driver.launch_app() + self.sign_in.sign_in(password=self.password) + self.home.home_button.wait_for_visibility_of_element(30) + profile = self.home.profile_button.click() + profile.profile_button.double_click() + profile.privacy_and_security_button.click() + profile.element_by_translation_id("manage-keys-and-storage").scroll_and_click() + profile.logout_dialog.logout_button.wait_and_click() + profile.logout_button.wait_for_invisibility_of_element(30) + if not self.sign_in.element_by_translation_id("move-keystore-file").is_element_displayed(): + self.errors.append("Was not redirected to Key management screen when Manage keys from logged in state!") + + self.home.just_fyi("Checking keycard banner and starting migrate multiaccount to keycard: no db saved") + self.sign_in.close_button.click() + self.sign_in.back_button.click() + self.sign_in.multi_account_on_login_button.wait_for_visibility_of_element(30) + self.sign_in.get_multiaccount_by_position(1).click() + if not self.sign_in.get_keycard_banner.is_element_displayed(): + self.errors.append("Get a keycard banner is not shown on login screen for ordinary multiaccount") + self.sign_in.options_button.click() + self.sign_in.manage_keys_and_storage_button.click() + if not self.sign_in.element_by_text(self.user['username']).is_element_displayed(): + self.driver.fail("Default username is not shown when migrating multiaccount to keycard!") + + self.home.just_fyi("Checking validation of seed phrase during migration") + self.sign_in.enter_seed_phrase_next_button.click() + if self.sign_in.seedphrase_input.is_element_displayed(): + self.sign_in.driver.fail("Proceeded to seedphrase input without confirmed Actions") + self.sign_in.move_keystore_file_option.click() + self.sign_in.reset_database_checkbox.click() + self.sign_in.enter_seed_phrase_next_button.click() + self.sign_in.seedphrase_input.set_value(transaction_senders['A']['passphrase']) + self.sign_in.choose_storage_button.click() + if not self.sign_in.element_by_translation_id("seed-key-uid-mismatch").is_element_displayed(): + self.driver.fail("Can proceed with seed phrase of another user") + self.sign_in.element_by_translation_id("try-again").click() + self.sign_in.seedphrase_input.set_value(self.user['passphrase'][:-1]) + self.sign_in.choose_storage_button.click() + if not self.sign_in.custom_seed_phrase_label.is_element_displayed(): + self.driver.fail("Can proceed with invalid seed phrase") + self.sign_in.cancel_button.click() + self.sign_in.seedphrase_input.set_value(self.user['passphrase']) + self.sign_in.choose_storage_button.click() + if not self.sign_in.get_keycard_banner.is_element_displayed(): + self.errors.append("Get a keycard banner is not shown on Key management screen") + self.sign_in.keycard_required_option.click() + if self.sign_in.get_keycard_banner.is_element_displayed(): + self.errors.append("Get a keycard banner is shown when keycard storage is chosen") + + self.sign_in.just_fyi("Finishing migration to keycard") + self.sign_in.confirm_button.click() + keycard = self.sign_in.move_and_reset_button.click() + keycard.begin_setup_button.click() + keycard.connect_card_button.wait_and_click() + keycard.enter_default_pin() + keycard.enter_default_pin() + if not self.sign_in.element_by_translation_id("migration-successful").is_element_displayed(30): + self.driver.fail("No popup about successfull migration is shown!") + self.sign_in.ok_button.click() + self.sign_in.maybe_later_button.wait_and_click(30) + self.sign_in.lets_go_button.wait_and_click(30) + + self.sign_in.just_fyi('Check that after migrating account with assets is restored') + wallet = self.sign_in.wallet_button.click() + for asset in ['ETH', 'ADI', 'STT']: + if wallet.get_asset_amount_by_name(asset) == 0: + self.errors.append('Asset %s was not restored' % asset) + + self.sign_in.just_fyi('Check that after migration wallet address matches expected') + address = wallet.get_wallet_address() + if address != '0x%s' % self.user['address']: + self.errors.append('Restored address %s does not match expected' % address) + + self.sign_in.just_fyi('Check that after migration username and public key match expected') + public_key, default_username = self.sign_in.get_public_key_and_username(return_username=True) + profile = self.sign_in.get_profile_view() + if public_key != self.user['public_key']: + self.errors.append('Public key %s does not match expected' % public_key) + if default_username != self.user['username']: + self.errors.append('Default username %s does not match expected' % default_username) + profile.logout() + + self.sign_in.just_fyi( + 'Check that can login with migrated account, keycard banner is not shown and no option to migrate') + self.sign_in.get_multiaccount_by_position(1).click() + if self.sign_in.get_keycard_banner.is_element_displayed(): + self.errors.append("Get a keycard banner is shown on migrated keycard multiaccount") + keycard.one_button.wait_for_visibility_of_element(10) + keycard.enter_default_pin() + if not self.sign_in.home_button.is_element_displayed(30): + self.driver.fail('Keycard user is not logged in') + + self.sign_in.just_fyi('Check that can add another wallet account and send transaction') + self.home.wallet_button.click() + wallet.add_account(account_name="another_keycard_account", keycard=True) + transaction_amount_added = wallet.get_unique_amount() + wallet.send_transaction(amount=transaction_amount_added, recipient=transaction_senders['ETH_8']['address'], + keycard=True, sign_transaction=True) + self.errors.verify_no_errors() + class TestCreateAccount(SingleDeviceTestCase): diff --git a/test/appium/tests/atomic/account_management/test_keycard.py b/test/appium/tests/atomic/account_management/test_keycard.py index 5c1c73a678..a84152e5d3 100644 --- a/test/appium/tests/atomic/account_management/test_keycard.py +++ b/test/appium/tests/atomic/account_management/test_keycard.py @@ -6,141 +6,6 @@ from tests.users import basic_user, transaction_senders class TestCreateAccount(SingleDeviceTestCase): - @marks.testrail_id(6645) - @marks.critical - def test_restore_account_migrate_multiaccount_to_keycard(self): - sign_in = SignInView(self.driver) - user = transaction_senders['ETH_ADI_STT_2'] - seed = user['passphrase'] - home = sign_in.recover_access(passphrase=seed) - profile = home.profile_button.click() - profile.privacy_and_security_button.click() - profile.element_by_translation_id("manage-keys-and-storage").scroll_and_click() - profile.logout_dialog.logout_button.wait_and_click() - profile.logout_button.wait_for_invisibility_of_element(30) - if not sign_in.element_by_translation_id("move-keystore-file").is_element_displayed(): - self.errors.append("Was not redirected to Key management screen when Manage keys from logged in state!") - - home.just_fyi("Checking keycard banner and starting migrate multiaccount to keycard: no db saved") - sign_in.close_button.click() - sign_in.back_button.click() - sign_in.multi_account_on_login_button.wait_for_visibility_of_element(30) - sign_in.get_multiaccount_by_position(1).click() - if not sign_in.get_keycard_banner.is_element_displayed(): - self.errors.append("Get a keycard banner is not shown on login screen for ordinary multiaccount") - sign_in.options_button.click() - sign_in.manage_keys_and_storage_button.click() - if not sign_in.element_by_text(user['username']).is_element_displayed(): - self.driver.fail("Default username is not shown when migrating multiaccount to keycard!") - - home.just_fyi("Checking validation of seed phrase during migration") - sign_in.enter_seed_phrase_next_button.click() - if sign_in.seedphrase_input.is_element_displayed(): - self.driver.fail("Proceeded to seedphrase input without confirmed Actions") - sign_in.move_keystore_file_option.click() - sign_in.reset_database_checkbox.click() - sign_in.enter_seed_phrase_next_button.click() - sign_in.seedphrase_input.set_value(transaction_senders['A']['passphrase']) - sign_in.choose_storage_button.click() - if not sign_in.element_by_translation_id("seed-key-uid-mismatch").is_element_displayed(): - self.driver.fail("Can proceed with seed phrase of another user") - sign_in.element_by_translation_id("try-again").click() - sign_in.seedphrase_input.set_value(seed[:-1]) - sign_in.choose_storage_button.click() - if not sign_in.custom_seed_phrase_label.is_element_displayed(): - self.driver.fail("Can proceed with invalid seed phrase") - sign_in.cancel_button.click() - sign_in.seedphrase_input.set_value(seed) - sign_in.choose_storage_button.click() - if not sign_in.get_keycard_banner.is_element_displayed(): - self.errors.append("Get a keycard banner is not shown on Key management screen") - sign_in.keycard_required_option.click() - if sign_in.get_keycard_banner.is_element_displayed(): - self.errors.append("Get a keycard banner is shown when keycard storage is chosen") - - home.just_fyi("Finishing migration to keycard") - sign_in.confirm_button.click() - keycard = sign_in.move_and_reset_button.click() - keycard.begin_setup_button.click() - keycard.connect_card_button.wait_and_click() - keycard.enter_default_pin() - keycard.enter_default_pin() - if not sign_in.element_by_translation_id("migration-successful").is_element_displayed(30): - self.driver.fail("No popup about successfull migration is shown!") - sign_in.ok_button.click() - sign_in.maybe_later_button.wait_and_click(30) - sign_in.lets_go_button.wait_and_click(30) - - sign_in.just_fyi('Check that after migrating account with assets is restored') - wallet = sign_in.wallet_button.click() - for asset in ['ETH', 'ADI', 'STT']: - if wallet.get_asset_amount_by_name(asset) == 0: - self.errors.append('Asset %s was not restored' % asset) - - sign_in.just_fyi('Check that after migration wallet address matches expected') - address = wallet.get_wallet_address() - if address != '0x%s' % user['address']: - self.errors.append('Restored address %s does not match expected' % address) - - sign_in.just_fyi('Check that after migration username and public key match expected') - public_key, default_username = sign_in.get_public_key_and_username(return_username=True) - profile = sign_in.get_profile_view() - if public_key != user['public_key']: - self.errors.append('Public key %s does not match expected' % public_key) - if default_username != user['username']: - self.errors.append('Default username %s does not match expected' % default_username) - profile.logout() - - sign_in.just_fyi( - 'Check that can login with migrated account, keycard banner is not shown and no option to migrate') - sign_in.get_multiaccount_by_position(1).click() - if sign_in.get_keycard_banner.is_element_displayed(): - self.errors.append("Get a keycard banner is shown on migrated keycard multiaccount") - keycard.one_button.wait_for_visibility_of_element(10) - keycard.enter_default_pin() - if not sign_in.home_button.is_element_displayed(30): - self.driver.fail('Keycard user is not logged in') - - sign_in.just_fyi('Check that can add another wallet account and send transaction') - home.wallet_button.click() - wallet.add_account(account_name="another_keycard_account", keycard=True) - transaction_amount_added = wallet.get_unique_amount() - wallet.send_transaction(amount=transaction_amount_added, recipient=transaction_senders['ETH_8']['address'], - keycard=True, sign_transaction=True) - self.driver.reset() - home = sign_in.recover_access(passphrase=seed) - contact, nickname, message = transaction_senders['A'], 'my_friend', 'some message' - chat = home.add_contact(contact['public_key'], nickname=nickname) - chat.send_message(message) - profile = home.profile_button.click() - profile.logout() - - home.just_fyi("Checking migration to keycard: db saved (1-1 chat, nickname, messages)") - sign_in.options_button.click() - sign_in.manage_keys_and_storage_button.click() - sign_in.move_keystore_file_option.click() - sign_in.enter_seed_phrase_next_button.click() - sign_in.seedphrase_input.set_value(seed) - sign_in.choose_storage_button.click() - sign_in.keycard_required_option.click() - sign_in.confirm_button.click() - sign_in.migration_password_input.set_value(common_password) - sign_in.confirm_button.click() - keycard.begin_setup_button.click() - keycard.connect_card_button.wait_and_click() - keycard.enter_default_pin() - keycard.enter_default_pin() - if not sign_in.element_by_translation_id("migration-successful").is_element_displayed(30): - self.driver.fail("No popup about successfull migration is shown!") - sign_in.ok_button.click() - home.home_button.wait_for_element(30) - home.get_chat(nickname).click() - if chat.add_to_contacts.is_element_displayed(): - self.errors.append("User was removed from contacts after migration to kk") - if not chat.chat_element_by_text(message).is_element_displayed(): - self.errors.append("Message from 1-1 was removed from contacts after migration to kk") - self.errors.verify_no_errors() - @marks.testrail_id(5742) @marks.medium def test_keycard_interruption_creating_onboarding_flow(self): diff --git a/test/appium/tests/atomic/account_management/test_profile.py b/test/appium/tests/atomic/account_management/test_profile.py index 27a877f8cc..30a7eb8ea7 100644 --- a/test/appium/tests/atomic/account_management/test_profile.py +++ b/test/appium/tests/atomic/account_management/test_profile.py @@ -254,6 +254,86 @@ class TestEnsStickersMultipleDevicesMerged(MultipleSharedDeviceTestCase): self.errors.append('No self profile pop-up data displayed after My_profile button tap') self.errors.verify_no_errors() +# TODO: suspended according to #13257 +@pytest.mark.xdist_group(name="pairing_2") +@marks.critical +@marks.skip +class TestPairingMultipleDevicesMerged(MultipleSharedDeviceTestCase): + + @classmethod + def setup_class(cls): + from views.dbs.main_pairing.data import seed_phrase, password + cls.drivers, cls.loop = create_shared_drivers(2) + cls.device_1, cls.device_2 = SignInView(cls.drivers[0]), SignInView(cls.drivers[1]) + cls.home_1 = cls.device_1.import_db(seed_phrase=seed_phrase, import_db_folder_name='main_pairing', password=password) + cls.home_2 = cls.device_2.recover_access(seed_phrase) + + cls.home_1.just_fyi('Pair main and secondary devices') + [cls.profile_1, cls.profile_2] = [home.profile_button.click() for home in (cls.home_1, cls.home_2)] + name_1, name_2 = 'device_1', 'a_%s_2' % cls.device_2.get_unique_amount() + cls.profile_2.discover_and_advertise_device(name_2) + cls.profile_1.sync_settings_button.scroll_and_click() + cls.profile_1.devices_button.scroll_to_element() + cls.profile_1.devices_button.click() + cls.home_1.element_by_text_part(name_2).scroll_and_click() + cls.profile_1.sync_all_button.click() + cls.profile_1.sync_all_button.wait_for_visibility_of_element(20) + [profile.get_back_to_home_view() for profile in [cls.profile_1, cls.profile_2]] + [home.home_button.click() for home in [cls.home_1, cls.home_2]] + + def test_pairing_initial_sync_chats(self): + self.profile_2.just_fyi("Check chats and previews") + from views.dbs.main_pairing.data import chats + for chat in chats.keys(): + if chats[chat]['initial_sync']: + if 'preview' in chats.keys(): + actual_chat_preview = self.home_2.get_chat(chat).chat_preview.text + expected_chat_preview = chats[chat]['preview'] + if actual_chat_preview != expected_chat_preview: + self.errors.append('Expected preview for %s is "%s", in fact "%s" after initial sync' % ( + chat, expected_chat_preview, actual_chat_preview)) + + # TODO: blocked due to 13176 + # self.profile_2.just_fyi("Check unread indicator") + # if self.home_2.home_button.counter.text != '2': + # self.errors.append('New messages counter is not shown on Home button') + # for chat in chats.keys(): + # if 'unread' in chats.keys(): + # if self.home_2.get_chat(chat).new_messages_counter.text != chats[chat]['unread']: + # self.errors.append('No unread for %s after initial sync' % chat) + self.errors.verify_no_errors() + + @marks.skip + # TODO: blocked due to 13176 + def test_pairing_initial_sync_activity_centre(self): + from views.dbs.main_pairing.data import activity_centre + if self.home_2.notifications_unread_badge.is_element_displayed(): + self.home_2.notifications_unread_badge.click() + for chat in activity_centre.keys(): + from views.home_view import ActivityCenterChatElement + chat_in_ac = ActivityCenterChatElement(self.driver, chat_name=chat) + if not chat_in_ac.is_element_displayed(): + self.errors.append('No chat "%s" in activity centre' % chat) + else: + if not chat_in_ac.chat_message_preview != activity_centre[chat]: + self.errors.append('No chat preview for "%s" in activity centre, "%s" instead' % chat, chat_in_ac.chat_message_preview) + else: + self.home_2.driver.fail("No unread messages in Activity centre!") + self.errors.verify_no_errors() + + def test_pairing_initial_sync_contacts_blocked_nickname(self): + from views.dbs.main_pairing.data import contacts, blocked + self.profile_2 = self.home_2.profile_button.click() + self.profile_2.contacts_button.click() + for contact in contacts: + if not self.profile_2.element_by_text(contact).is_element_displayed(): + self.errors.append("%s contact is not synced after initial sync" % contact) + self.profile_2.blocked_users_button.click() + for blocked_user in blocked.keys(): + if not self.profile_2.element_by_text(blocked_user).is_element_displayed(): + self.errors.append("%s blocked user is not synced after initial sync" % blocked_user) + self.profile_2.get_back_to_home_view() + class TestProfileSingleDevice(SingleDeviceTestCase): @@ -764,55 +844,22 @@ class TestProfileSingleDevice(SingleDeviceTestCase): class TestProfileMultipleDevice(MultipleDeviceTestCase): - @marks.testrail_id(6646) - @marks.high - def test_set_profile_picture(self): - self.create_drivers(2) - home_1, home_2 = SignInView(self.drivers[0]).create_user(), SignInView(self.drivers[1]).create_user() - profile_1, profile_2 = home_1.profile_button.click(), home_2.profile_button.click() - public_key_1, public_key_2 = profile_1.get_public_key_and_username(), profile_2.get_public_key_and_username() - profile_2.home_button.click() - - profile_1.just_fyi("Set user Profile image from Gallery") - profile_1.edit_profile_picture(file_name='sauce_logo.png') - home_1.profile_button.click() - profile_1.swipe_down() - - if not profile_1.profile_picture.is_element_image_similar_to_template('sauce_logo_profile.png'): - self.drivers[0].fail('Profile picture was not updated') - - profile_1.just_fyi("Add user2 to contacts") - profile_1.home_button.click() - home_1.add_contact(public_key_2) - home_1.home_button.click() - - profile_1.just_fyi("Check user profile updated in chat") - message = "Text message" - public_chat_name = home_1.get_random_chat_name() - home_2.add_contact(public_key=public_key_1) - home_2.home_button.click() - public_chat_2 = home_2.join_public_chat(public_chat_name) - public_chat_1 = home_1.join_public_chat(public_chat_name) - public_chat_1.chat_message_input.send_keys(message) - public_chat_1.send_message_button.click() - if not public_chat_2.chat_element_by_text(message).member_photo.is_element_image_similar_to_template( - 'sauce_logo.png'): - self.drivers[0].fail('Profile picture was not updated in chat') - - profile_1.just_fyi("Set user Profile image by taking Photo") - home_1.profile_button.click() - profile_1.edit_profile_picture(file_name='sauce_logo.png', update_by='Make Photo') - home_1.home_button.click(desired_view='chat') - public_chat_1.chat_message_input.send_keys(message) - public_chat_1.send_message_button.click() - - if public_chat_2.chat_element_by_text(message).member_photo.is_element_image_similar_to_template( - 'sauce_logo.png'): - self.drivers[0].fail('Profile picture was not updated in chat after making photo') @marks.testrail_id(6636) @marks.medium def test_show_profile_picture_of_setting_online_indicator(self): + ####TODO: add check by make photo in this test + # profile_1.just_fyi("Set user Profile image by taking Photo") + # home_1.profile_button.click() + # profile_1.edit_profile_picture(file_name='sauce_logo.png', update_by='Make Photo') + # home_1.home_button.click(desired_view='chat') + # public_chat_1.chat_message_input.send_keys(message) + # public_chat_1.send_message_button.click() + # + # if public_chat_2.chat_element_by_text(message).member_photo.is_element_image_similar_to_template( + # 'sauce_logo.png'): + # self.drivers[0].fail('Profile picture was not updated in chat after making photo') + #### self.create_drivers(2) home_1, home_2 = SignInView(self.drivers[0]).create_user(), SignInView(self.drivers[1]).create_user(enable_notifications=True) profile_1, profile_2 = home_1.profile_button.click(), home_2.profile_button.click() @@ -1168,82 +1215,6 @@ class TestProfileMultipleDevice(MultipleDeviceTestCase): self.errors.append('History was not fetched after enabling use_history_node') self.errors.verify_no_errors() - @marks.testrail_id(6228) - @marks.high - def test_mobile_data_usage_complex_settings(self): - self.create_drivers(2) - device_1, device_2 = SignInView(self.drivers[0]), SignInView(self.drivers[1]) - home_1 = device_1.create_user() - public_chat_name, public_chat_message = 'e2e-started-before', 'message to pub chat' - public_1 = home_1.join_public_chat(public_chat_name) - public_1.send_message(public_chat_message) - - home_1.just_fyi('set mobile data to "OFF" and check that peer-to-peer connection is still working') - home_2 = device_2.create_user() - home_2.toggle_mobile_data() - home_2.mobile_connection_off_icon.wait_for_visibility_of_element(20) - for element in home_2.continue_syncing_button, home_2.stop_syncing_button, home_2.remember_my_choice_checkbox: - if not element.is_element_displayed(10): - self.drivers[0].fail('Element %s is not not shown in "Syncing mobile" bottom sheet' % element.locator) - home_2.stop_syncing_button.click() - if not home_2.mobile_connection_off_icon.is_element_displayed(): - self.drivers[0].fail('No mobile connection OFF icon is shown') - home_2.mobile_connection_off_icon.click() - for element in home_2.connected_to_n_peers_text, home_2.waiting_for_wi_fi: - if not element.is_element_displayed(): - self.errors.append("Element '%s' is not shown in Connection status bottom sheet" % element.locator) - home_2.click_system_back_button() - public_2 = home_2.join_public_chat(public_chat_name) - if public_2.chat_element_by_text(public_chat_message).is_element_displayed(30): - self.errors.append("Chat history was fetched with mobile data fetching off") - public_chat_new_message = 'new message' - public_1.send_message(public_chat_new_message) - if not public_2.chat_element_by_text(public_chat_new_message).is_element_displayed(30): - self.errors.append("Peer-to-peer connection is not working when mobile data fetching is off") - - home_2.just_fyi('set mobile data to "ON"') - home_2.home_button.click() - home_2.mobile_connection_off_icon.click() - home_2.use_mobile_data_switch.wait_and_click(30) - if not home_2.connected_to_node_text.is_element_displayed(10): - self.errors.append("Not connected to history node after enabling fetching on mobile data") - home_2.click_system_back_button() - home_2.mobile_connection_on_icon.wait_for_visibility_of_element(10) - home_2.get_chat('#%s' % public_chat_name).click() - if not public_2.chat_element_by_text(public_chat_message).is_element_displayed(180): - self.errors.append("Chat history was not fetched with mobile data fetching ON") - - home_2.just_fyi('check redirect to sync settings by tapping on "Sync" in connection status bottom sheet') - home_2.home_button.click() - home_2.mobile_connection_on_icon.click() - home_2.connection_settings_button.click() - if not home_2.element_by_translation_id("mobile-network-use-mobile").is_element_displayed(): - self.errors.append("Was not redirected to sync settings after tapping on Settings in connection bottom sheet") - - home_1.just_fyi("Check default preferences in Sync settings") - profile_1 = home_1.profile_button.click() - profile_1.sync_settings_button.click() - if not profile_1.element_by_translation_id("mobile-network-use-wifi").is_element_displayed(): - self.errors.append("Mobile data is enabled by default") - profile_1.element_by_translation_id("mobile-network-use-wifi").click() - if profile_1.ask_me_when_on_mobile_network.text != "ON": - self.errors.append("'Ask me when on mobile network' is not enabled by default") - - profile_1.just_fyi("Disable 'ask me when on mobile network' and check that it is not shown") - profile_1.ask_me_when_on_mobile_network.click() - profile_1.toggle_mobile_data() - if profile_1.element_by_translation_id("mobile-network-start-syncing").is_element_displayed(20): - self.errors.append("Popup is shown, but 'ask me when on mobile network' is disabled") - - profile_1.just_fyi("Check 'Restore default' setting") - profile_1.element_by_text('Restore Defaults').click() - if profile_1.use_mobile_data.attribute_value("checked"): - self.errors.append("Mobile data is enabled by default") - if not profile_1.ask_me_when_on_mobile_network.attribute_value("checked"): - self.errors.append("'Ask me when on mobile network' is not enabled by default") - - self.errors.verify_no_errors() - @marks.testrail_id(695856) @marks.medium def test_pair_devices_sync_photo_community_group_chats(self): diff --git a/test/appium/tests/atomic/chats/test_chats_management.py b/test/appium/tests/atomic/chats/test_chats_management.py index 96f0b64bb8..596153d431 100644 --- a/test/appium/tests/atomic/chats/test_chats_management.py +++ b/test/appium/tests/atomic/chats/test_chats_management.py @@ -349,162 +349,7 @@ class TestChatManagement(SingleDeviceTestCase): class TestChatManagementMultipleDevice(MultipleDeviceTestCase): - @marks.testrail_id(5332) - @marks.critical - def test_add_and_remove_mention_contact_with_nickname_from_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() - public_key_2, username_2 = home_2.get_public_key_and_username(return_username=True) - home_2.home_button.click() - chat_name = 'testaddcontact' - device_1.just_fyi('join same public chat') - chat_1, chat_2 = home_1.join_public_chat(chat_name), home_2.join_public_chat(chat_name) - message = 'test message' + str(round(time.time())) - chat_2.send_message(message) - - home_2.just_fyi('check that can mention user with 3-random name in public chat') - chat_1.select_mention_from_suggestion_list(username_2, typed_search_pattern=username_2[0:4]) - if chat_1.chat_message_input.text != '@' + username_2 + ' ': - self.errors.append( - '3-random username is not resolved in chat input after selecting it in mention suggestions list!') - chat_1.send_message_button.click() - chat_1.chat_element_by_text(username_2).click() - chat_1.profile_send_message.wait_for_visibility_of_element(20) - chat_1.close_button.click() - chat_2.driver.quit() - - device_1.just_fyi('Tap on userpic and check redirect to user profile') - chat_element = chat_1.chat_element_by_text(message) - chat_element.find_element() - chat_element.member_photo.click() - for element in [chat_1.contact_profile_picture, - chat_1.element_by_text(username_2, 'text'), - chat_1.profile_add_to_contacts, - chat_1.profile_send_message, - chat_1.profile_nickname]: - if not element.scroll_to_element(): - self.errors.append('%s (locator is %s ) is not visible' % (element.name, element.locator)) - if chat_1.profile_nickname.text != 'None': - self.errors.append('Default nickname is %s instead on "None"' % chat_1.profile_nickname.text) - - device_1.just_fyi('Set nickname for user without adding him to contacts, check it in public chat') - nickname = 'Name1' - chat_1.set_nickname(nickname) - expected_username = '%s %s' % (nickname, username_2) - if chat_element.username.text != expected_username: - self.errors.append('Username %s in public chat does not match expected %s' % ( - chat_element.username.text, expected_username)) - - device_1.just_fyi('Add user to contacts, mention it by nickname check contact list in Profile') - chat_element.member_photo.click() - chat_1.profile_add_to_contacts.click() - if not chat_1.remove_from_contacts.is_element_displayed(): - self.errors.append("'Add to contacts' is not changed to 'Remove from contacts'") - chat_1.close_button.click() - - home_2.just_fyi('check that can mention user with nickname in public chat') - chat_1.select_mention_from_suggestion_list(username_in_list=nickname + ' ' + username_2, - typed_search_pattern=nickname[0:2]) - if chat_1.chat_message_input.text != '@' + username_2 + ' ': - self.errors.append('3-random username is not resolved in chat input after selecting it in mention ' - 'suggestions list by nickname!') - additional_text = 'and more' - chat_1.send_as_keyevent(additional_text) - chat_1.send_message_button.click() - if not chat_1.chat_element_by_text('%s %s' % (nickname, additional_text)).is_element_displayed(): - self.errors.append("Nickname is not resolved on send message") - chat_1.get_back_to_home_view() - - device_1.just_fyi('check contact list in Profile after setting nickname') - profile_1 = chat_1.profile_button.click() - userprofile = profile_1.open_contact_from_profile(nickname) - if not userprofile.remove_from_contacts.is_element_displayed(): - self.errors.append("'Add to contacts' is not changed to 'Remove from contacts' in profile contacts") - profile_1.close_button.click() - profile_1.home_button.double_click() - - device_1.just_fyi( - 'Check that user is added to contacts below "Start new chat" and you redirected to 1-1 on tap') - home_1.plus_button.click() - home_1.start_new_chat_button.click() - if not home_1.element_by_text(nickname).is_element_displayed(): - home_1.driver.fail('List of contacts below "Start new chat" does not contain added user') - home_1.element_by_text(nickname).click() - if not chat_1.chat_message_input.is_element_displayed(): - home_1.driver.fail('No redirect to 1-1 chat if tap on Contact below "Start new chat"') - for element in (chat_1.chat_message_input, chat_1.element_by_text(nickname)): - if not element.is_element_displayed(): - self.errors.append('Expected element is not found in 1-1 after adding user to contacts from profile') - if chat_1.add_to_contacts.is_element_displayed(): - self.errors.append('"Add to contacts" button is shown in 1-1 after adding user to contacts from profile') - - device_1.just_fyi('Remove user from contacts') - chat_1.profile_button.double_click() - userprofile = profile_1.open_contact_from_profile(nickname) - userprofile.remove_from_contacts.click() - if userprofile.remove_from_contacts.is_element_displayed(): - self.errors.append("'Remove from contacts' is not changed to 'Add to contacts'") - if chat_1.profile_nickname.text != nickname: - self.errors.append("Nickname is changed after removing user from contacts") - - device_1.just_fyi('Check that user is removed from contact list in profile') - userprofile.close_button.click() - if profile_1.element_by_text(nickname).is_element_displayed(): - self.errors.append('List of contacts in profile contains removed user') - profile_1.home_button.click(desired_view='chat') - if not chat_1.add_to_contacts.is_element_displayed(): - self.errors.append('"Add to contacts" button is not shown in 1-1 after removing user from contacts') - home_1.get_back_to_home_view() - home_1.plus_button.click() - home_1.start_new_chat_button.click() - if home_1.get_username_below_start_new_chat_button(nickname).is_element_displayed(): - self.errors.append('List of contacts below "Start new chat" contains removed user') - self.errors.verify_no_errors() - - @marks.testrail_id(5786) - @marks.critical - def test_block_user_from_public_chat(self): - self.create_drivers(2) - device_1, device_2 = SignInView(self.drivers[0]), SignInView(self.drivers[1]) - message_before_block_2 = "Before block from %s" % device_2.driver.number - message_after_block_2 = "After block from %s" % device_2.driver.number - home_1, home_2 = device_1.create_user(), device_2.create_user() - - device_1.just_fyi('both devices joining the same public chat and send messages') - chat_name = device_1.get_random_chat_name() - for home in home_1, home_2: - home.join_public_chat(chat_name) - chat_public_1, chat_public_2 = home_1.get_chat_view(), home_2.get_chat_view() - for chat in chat_public_1, chat_public_2: - chat.chat_message_input.send_keys("Before block from %s" % chat.driver.number) - chat.send_message_button.click() - - device_1.just_fyi('block user') - chat_element = chat_public_1.chat_element_by_text(message_before_block_2) - chat_element.find_element() - chat_element.member_photo.click() - chat_public_1.block_contact() - - device_1.just_fyi('messages from blocked user are hidden in public chat and close app') - if chat_public_1.chat_element_by_text(message_before_block_2).is_element_displayed(): - self.errors.append( - "Messages from blocked user %s are not cleared in public chat '%s'" % ( - device_2.driver.number, chat_name)) - self.drivers[0].close_app() - - device_2.just_fyi('send message to public chat while device 1 is offline') - chat_public_2.chat_message_input.send_keys(message_after_block_2) - chat_public_2.send_message_button.click() - - device_1.just_fyi('check that new messages from blocked user are not delivered') - self.drivers[0].launch_app() - device_1.sign_in() - for message in message_before_block_2, message_after_block_2: - if chat_public_1.chat_element_by_text(message).is_element_displayed(): - self.errors.append( - "'%s' from blocked user %s are shown in public chat" % (message, device_2.driver.number)) @marks.testrail_id(5763) @marks.medium diff --git a/test/appium/tests/atomic/chats/test_keycard_commands.py b/test/appium/tests/atomic/chats/test_keycard_commands.py index 0d1f075b34..455d9d840d 100644 --- a/test/appium/tests/atomic/chats/test_keycard_commands.py +++ b/test/appium/tests/atomic/chats/test_keycard_commands.py @@ -8,76 +8,6 @@ from views.sign_in_view import SignInView class TestCommandsMultipleDevices(MultipleDeviceTestCase): - @marks.testrail_id(6293) - @marks.critical - @marks.transaction - def test_keycard_send_eth_in_1_1_chat(self): - sender = transaction_senders['ETH_2'] - self.create_drivers(2) - device_1, device_2 = SignInView(self.drivers[0]), SignInView(self.drivers[1]) - home_1 = device_1.recover_access(passphrase=sender['passphrase'], keycard=True) - home_2 = device_2.create_user(keycard=True) - recipient_public_key, recipient_username = home_2.get_public_key_and_username(return_username=True) - home_2.home_button.click() - - chat_1 = home_1.add_contact(recipient_public_key) - amount = chat_1.get_unique_amount() - account_name = chat_1.status_account_name - - home_1.just_fyi('Send %s ETH in 1-1 chat and check it for sender and receiver: Address requested' % amount) - chat_1.commands_button.click() - send_transaction = chat_1.send_command.click() - send_transaction.get_username_in_transaction_bottom_sheet_button(recipient_username).click() - if send_transaction.scan_qr_code_button.is_element_displayed(): - self.drivers[0].fail('Recipient is editable in bottom sheet when send ETH from 1-1 chat') - send_transaction.amount_edit_box.set_value(amount) - send_transaction.confirm() - send_transaction.sign_transaction_button.click() - sender_message = chat_1.get_outgoing_transaction() - if not sender_message.is_element_displayed(): - self.drivers[0].fail('No message is shown after sending ETH in 1-1 chat for sender') - sender_message.transaction_status.wait_for_element_text(sender_message.address_requested) - - chat_2 = home_2.get_chat(sender['username']).click() - receiver_message = chat_2.get_incoming_transaction() - timestamp_sender = sender_message.timestamp_command_message.text - if not receiver_message.is_element_displayed(): - self.drivers[0].fail('No message about incoming transaction in 1-1 chat is shown for receiver') - receiver_message.transaction_status.wait_for_element_text(receiver_message.address_requested) - - home_2.just_fyi('Accept and share address for sender and receiver') - for option in (receiver_message.decline_transaction, receiver_message.accept_and_share_address): - if not option.is_element_displayed(): - self.drivers[0].fail("Required options accept or share are not shown") - - select_account_bottom_sheet = receiver_message.accept_and_share_address.click() - if not select_account_bottom_sheet.get_account_in_select_account_bottom_sheet_button( - account_name).is_element_displayed(): - self.errors.append('Not expected value in "From" in "Select account": "Status" is expected') - select_account_bottom_sheet.select_button.click() - receiver_message.transaction_status.wait_for_element_text(receiver_message.shared_account) - sender_message.transaction_status.wait_for_element_text(sender_message.address_request_accepted) - - home_1.just_fyi("Sign and send transaction and check that timestamp on message is updated") - time.sleep(20) - send_message = sender_message.sign_and_send.click() - send_message.next_button.click() - send_message.sign_transaction(keycard=True) - updated_timestamp_sender = sender_message.timestamp_command_message.text - if updated_timestamp_sender == timestamp_sender: - self.errors.append("Timestamp of message is not updated after signing transaction") - - wallet_1 = chat_1.wallet_button.click() - wallet_1.find_transaction_in_history(amount=amount) - self.network_api.wait_for_confirmation_of_transaction(sender['address'], amount) - wallet_1.home_button.click(desired_view='chat') - - home_1.just_fyi("Check 'Confirmed' state for sender and receiver(use pull-to-refresh to update history)") - wallet_2 = chat_2.wallet_button.click() - wallet_2.find_transaction_in_history(amount=amount) - sender_message.transaction_status.wait_for_element_text(sender_message.confirmed, 120) - self.errors.verify_no_errors() - @marks.testrail_id(6294) @marks.medium @marks.transaction diff --git a/test/appium/tests/atomic/chats/test_one_to_one.py b/test/appium/tests/atomic/chats/test_one_to_one.py index 56ab7f4f6d..30b68d0cff 100644 --- a/test/appium/tests/atomic/chats/test_one_to_one.py +++ b/test/appium/tests/atomic/chats/test_one_to_one.py @@ -2,7 +2,8 @@ import emoji import random import pytest -from tests import marks +from time import sleep +from tests import marks, common_password from tests.base_test_case import MultipleDeviceTestCase, SingleDeviceTestCase, MultipleSharedDeviceTestCase, create_shared_drivers from tests.users import transaction_senders, basic_user, ens_user, ens_user_ropsten from views.sign_in_view import SignInView @@ -400,8 +401,347 @@ class TestOneToOneChatMultipleSharedDevices(MultipleSharedDeviceTestCase): self.errors.verify_no_errors() -class TestMessagesOneToOneChatMultiple(MultipleDeviceTestCase): +@pytest.mark.xdist_group(name="chats_contacts_keycard_2") +@marks.critical +class TestContactBlockMigrateKeycardMultipleSharedDevices(MultipleSharedDeviceTestCase): + @classmethod + def setup_class(cls): + cls.drivers, cls.loop = create_shared_drivers(2) + cls.device_1, cls.device_2 = SignInView(cls.drivers[0]), SignInView(cls.drivers[1]) + cls.sender = transaction_senders['ETH_2'] + cls.nick = "FFOO_brak!1234" + cls.message = cls.device_1.get_random_message() + cls.pub_chat_name = cls.device_1.get_random_chat_name() + cls.home_1 = cls.device_1.recover_access(cls.sender['passphrase'], keycard=True) + cls.home_2 = cls.device_2.create_user() + cls.profile_2 = cls.home_2.profile_button.click() + cls.profile_2.privacy_and_security_button.click() + cls.profile_2.backup_recovery_phrase_button.click() + recovery_phrase = cls.profile_2.backup_recovery_phrase() + cls.recovery_phrase = ' '.join(recovery_phrase.values()) + cls.public_key_2, cls.default_username_2 = cls.home_2.get_public_key_and_username(return_username=True) + cls.chat_1 = cls.home_1.add_contact(cls.public_key_2, add_in_contacts=False) + cls.chat_1.chat_options.click() + cls.chat_1.view_profile_button.click() + cls.chat_1.set_nickname(cls.nick) + [home.home_button.click() for home in [cls.home_1, cls.home_2]] + cls.home_2.add_contact(cls.sender['public_key']) + cls.home_2.home_button.click() + [home.join_public_chat(cls.pub_chat_name) for home in [cls.home_1, cls.home_2]] + cls.chat_2 = cls.home_2.get_chat_view() + cls.chat_2.send_message(cls.message) + [home.home_button.click() for home in [cls.home_1, cls.home_2]] + + @marks.testrail_id(702186) + def test_keycard_command_send_eth_1_1_chat(self): + self.home_2.get_chat(self.sender['username']).click() + self.chat_2.send_message("hey on kk!") + self.chat_2.home_button.click() + + amount = self.chat_1.get_unique_amount() + account_name = self.chat_1.status_account_name + + self.chat_1.just_fyi('Send %s ETH in 1-1 chat and check it for sender and receiver: Address requested' % amount) + self.home_1.get_chat(self.nick).click() + self.chat_1.send_message("hello again!") + self.chat_1.commands_button.click() + send_transaction = self.chat_1.send_command.click() + send_transaction.get_username_in_transaction_bottom_sheet_button(self.default_username_2).click() + if send_transaction.scan_qr_code_button.is_element_displayed(): + self.chat_1.driver.fail('Recipient is editable in bottom sheet when send ETH from 1-1 chat') + send_transaction.amount_edit_box.set_value(amount) + send_transaction.confirm() + send_transaction.sign_transaction_button.click() + sender_message = self.chat_1.get_outgoing_transaction() + if not sender_message.is_element_displayed(): + self.chat_1.driver.fail('No message is shown after sending ETH in 1-1 chat for sender') + sender_message.transaction_status.wait_for_element_text(sender_message.address_requested) + + self.home_2.get_chat(self.sender['username']).click() + receiver_message = self.chat_2.get_incoming_transaction() + timestamp_sender = sender_message.timestamp_command_message.text + if not receiver_message.is_element_displayed(30): + self.chat_2.driver.fail('No message about incoming transaction in 1-1 chat is shown for receiver') + receiver_message.transaction_status.wait_for_element_text(receiver_message.address_requested) + + self.chat_1.just_fyi('Accept and share address for sender and receiver') + for option in (receiver_message.decline_transaction, receiver_message.accept_and_share_address): + if not option.is_element_displayed(): + self.drivers[0].fail("Required options accept or share are not shown") + + select_account_bottom_sheet = receiver_message.accept_and_share_address.click() + if not select_account_bottom_sheet.get_account_in_select_account_bottom_sheet_button( + account_name).is_element_displayed(): + self.errors.append('Not expected value in "From" in "Select account": "Status" is expected') + select_account_bottom_sheet.select_button.click() + receiver_message.transaction_status.wait_for_element_text(receiver_message.shared_account) + sender_message.transaction_status.wait_for_element_text(sender_message.address_request_accepted) + + self.chat_1.just_fyi("Sign and send transaction and check that timestamp on message is updated") + sleep(20) + send_message = sender_message.sign_and_send.click() + send_message.next_button.click() + send_message.sign_transaction(keycard=True) + updated_timestamp_sender = sender_message.timestamp_command_message.text + if updated_timestamp_sender == timestamp_sender: + self.errors.append("Timestamp of message is not updated after signing transaction") + + wallet_1 = self.chat_1.wallet_button.click() + wallet_1.find_transaction_in_history(amount=amount) + self.network_api.wait_for_confirmation_of_transaction(self.sender['address'], amount, confirmations=3) + wallet_1.home_button.click(desired_view='chat') + + self.home_1.just_fyi("Check 'Confirmed' state for sender and receiver(use pull-to-refresh to update history)") + wallet_2 = self.chat_2.wallet_button.click() + wallet_2.find_transaction_in_history(amount=amount) + sender_message.transaction_status.wait_for_element_text(sender_message.confirmed, 120) + self.errors.verify_no_errors() + + @marks.testrail_id(702175) + def test_contact_add_remove_mention_default_username_nickname_public_chat(self): + [home.home_button.double_click() for home in [self.home_1, self.home_2]] + self.chat_1.just_fyi('check that can mention user with 3-random name in public chat') + self.home_1.get_chat('#%s' % self.pub_chat_name).click() + + self.chat_1.just_fyi('Set nickname for user without adding him to contacts, check it in public chat') + chat_element = self.chat_1.chat_element_by_text(self.message) + expected_username = '%s %s' % (self.nick, self.default_username_2) + if chat_element.username.text != expected_username: + self.errors.append('Username %s in public chat does not match expected %s' % ( + chat_element.username.text, expected_username)) + + self.chat_1.just_fyi('Add user to contacts, mention it by nickname check contact list in Profile') + chat_element.member_photo.click() + self.chat_1.profile_add_to_contacts.click() + if not self.chat_1.remove_from_contacts.is_element_displayed(): + self.errors.append("'Add to contacts' is not changed to 'Remove from contacts'") + self.chat_1.close_button.click() + + self.chat_1.just_fyi('check that can mention user with nickname or default username in public chat') + self.chat_1.select_mention_from_suggestion_list(username_in_list=self.nick + ' ' + self.default_username_2, + typed_search_pattern=self.nick[0:2]) + if self.chat_1.chat_message_input.text != '@' + self.default_username_2 + ' ': + self.errors.append('Username is not resolved in chat input after selecting it in mention ' + 'suggestions list by nickname!') + self.chat_1.chat_message_input.clear() + for pattern in (self.nick[0:2], self.default_username_2[0:4]): + self.chat_1.select_mention_from_suggestion_list(username_in_list=self.nick + ' ' + self.default_username_2, + typed_search_pattern=self.default_username_2[0:4]) + if self.chat_1.chat_message_input.text != '@' + self.default_username_2 + ' ': + self.errors.append('Username is not resolved in chat input after selecting it in mention ' + 'suggestions list by default username!') + additional_text = 'and more' + self.chat_1.send_as_keyevent(additional_text) + self.chat_1.send_message_button.click() + if not self.chat_1.chat_element_by_text('%s %s' % (self.nick, additional_text)).is_element_displayed(): + self.errors.append("Nickname is not resolved on send message") + self.chat_1.get_back_to_home_view() + + self.chat_1.just_fyi('check contact list in Profile after setting nickname') + profile_1 = self.chat_1.profile_button.click() + userprofile = profile_1.open_contact_from_profile(self.nick) + if not userprofile.remove_from_contacts.is_element_displayed(): + self.errors.append("'Add to contacts' is not changed to 'Remove from contacts' in profile contacts") + profile_1.close_button.click() + profile_1.home_button.double_click() + + self.chat_1.just_fyi( + 'Check that user is added to contacts below "Start new chat" and you redirected to 1-1 on tap') + self.home_1.plus_button.click() + self.home_1.start_new_chat_button.click() + if not self.home_1.element_by_text(self.nick).is_element_displayed(): + self.home_1.driver.fail('List of contacts below "Start new chat" does not contain added user') + self.home_1.element_by_text(self.nick).click() + if not self.chat_1.chat_message_input.is_element_displayed(): + self.chat_1.driver.fail('No redirect to 1-1 chat if tap on Contact below "Start new chat"') + for element in (self.chat_1.chat_message_input, self.chat_1.element_by_text(self.nick)): + if not element.is_element_displayed(): + self.errors.append('Expected element is not found in 1-1 after adding user to contacts from profile') + if self.chat_1.add_to_contacts.is_element_displayed(): + self.errors.append('"Add to contacts" button is shown in 1-1 after adding user to contacts from profile') + + self.chat_1.just_fyi('Remove user from contacts') + self.chat_1.chat_options.click() + self.chat_1.view_profile_button.click() + self.chat_1.remove_from_contacts.click_until_absense_of_element(self.chat_1.remove_from_contacts) + if self.chat_1.profile_nickname.text != self.nick: + self.errors.append("Nickname is changed after removing user from contacts") + + self.chat_1.just_fyi('Check that user is removed from contact list in profile') + self.chat_1.close_button.click() + if not self.chat_1.add_to_contacts.is_element_displayed(): + self.errors.append('"Add to contacts" button is not shown in 1-1 after removing user from contacts') + self.chat_1.profile_button.double_click() + profile_1.contacts_button.click() + if profile_1.element_by_text(self.nick).is_element_displayed(): + self.errors.append('Contact is shown in Profile after removing user from contacts') + self.errors.verify_no_errors() + + @marks.testrail_id(702176) + def test_contact_block_unblock_public_chat_offline(self): + [home.home_button.double_click() for home in [self.home_1, self.home_2]] + + self.chat_1.just_fyi('Block user') + self.home_1.get_chat("#%s" % self.pub_chat_name).click() + chat_element = self.chat_1.chat_element_by_text(self.message) + chat_element.find_element() + chat_element.member_photo.click() + self.chat_1.block_contact() + + self.chat_1.just_fyi('messages from blocked user are hidden in public chat and close app') + if self.chat_1.chat_element_by_text(self.message).is_element_displayed(): + self.errors.append("Messages from blocked user is not cleared in public chat ") + self.chat_1.home_button.click() + if self.home_1.element_by_text(self.nick).is_element_displayed(): + self.errors.append("1-1 chat from blocked user is not removed!") + self.chat_1.toggle_airplane_mode() + + self.home_2.just_fyi('send message to public chat while device 1 is offline') + message_blocked, message_unblocked = "Message from blocked user", "Hurray! unblocked" + self.home_2.get_chat("#%s" % self.pub_chat_name).click() + self.chat_2.send_message(message_blocked) + + self.chat_1.just_fyi('check that new messages from blocked user are not delivered') + self.chat_1.toggle_airplane_mode() + self.home_1.get_chat("#%s" % self.pub_chat_name).click() + for message in self.message, message_blocked: + if self.chat_1.chat_element_by_text(message).is_element_displayed(): + self.errors.append( + "'%s' from blocked user is fetched from offline in public chat" % (message)) + + self.chat_2.just_fyi('Unblock user and check that can see further messages') + profile_1 = self.home_1.get_profile_view() + self.chat_1.profile_button.double_click() + profile_1.contacts_button.wait_and_click() + profile_1.blocked_users_button.wait_and_click() + profile_1.element_by_text(self.nick).click() + self.chat_1.unblock_contact_button.click() + self.chat_1.close_button.click() + [home.home_button.click(desired_view='chat') for home in [self.home_1, self.home_2]] + self.chat_2.send_message(message_unblocked) + self.chat_2.home_button.double_click() + self.home_2.add_contact(self.sender['public_key']) + self.chat_2.send_message(message_unblocked) + if not self.chat_1.chat_element_by_text(message_unblocked).is_element_displayed(): + self.errors.append("Message was not received in public chat after user unblock!") + self.chat_1.home_button.click() + self.home_1.get_chat(self.nick, wait_time=30).click() + if not self.chat_1.chat_element_by_text(message_unblocked).is_element_displayed(): + self.errors.append("Message was not received in 1-1 chat after user unblock!") + self.errors.verify_no_errors() + + @marks.testrail_id(702188) + def test_cellular_settings_on_off_public_chat_fetching_history(self): + [home.home_button.double_click() for home in [self.home_1, self.home_2]] + public_chat_name, public_chat_message = 'e2e-started-before', 'message to pub chat' + public_1 = self.home_1.join_public_chat(public_chat_name) + public_1.send_message(public_chat_message) + + self.home_2.just_fyi('set mobile data to "OFF" and check that peer-to-peer connection is still working') + self.home_2.set_network_to_cellular_only() + self.home_2.mobile_connection_off_icon.wait_for_visibility_of_element(20) + for element in (self.home_2.continue_syncing_button, self.home_2.stop_syncing_button, + self.home_2.remember_my_choice_checkbox): + if not element.is_element_displayed(10): + self.drivers[0].fail( + 'Element %s is not not shown in "Syncing mobile" bottom sheet' % element.locator) + self.home_2.stop_syncing_button.click() + if not self.home_2.mobile_connection_off_icon.is_element_displayed(): + self.drivers[0].fail('No mobile connection OFF icon is shown') + self.home_2.mobile_connection_off_icon.click() + for element in self.home_2.connected_to_n_peers_text, self.home_2.waiting_for_wi_fi: + if not element.is_element_displayed(): + self.errors.append("Element '%s' is not shown in Connection status bottom sheet" % element.locator) + self.home_2.click_system_back_button() + public_2 = self.home_2.join_public_chat(public_chat_name) + if public_2.chat_element_by_text(public_chat_message).is_element_displayed(30): + self.errors.append("Chat history was fetched with mobile data fetching off") + public_chat_new_message = 'new message' + public_1.send_message(public_chat_new_message) + if not public_2.chat_element_by_text(public_chat_new_message).is_element_displayed(30): + self.errors.append("Peer-to-peer connection is not working when mobile data fetching is off") + + self.home_2.just_fyi('set mobile data to "ON"') + self.home_2.home_button.click() + self.home_2.mobile_connection_off_icon.click() + self.home_2.use_mobile_data_switch.wait_and_click(30) + if not self.home_2.connected_to_node_text.is_element_displayed(10): + self.errors.append("Not connected to history node after enabling fetching on mobile data") + self.home_2.click_system_back_button() + self.home_2.mobile_connection_on_icon.wait_for_visibility_of_element(10) + self.home_2.get_chat('#%s' % public_chat_name).click() + if not public_2.chat_element_by_text(public_chat_message).is_element_displayed(180): + self.errors.append("Chat history was not fetched with mobile data fetching ON") + + self.home_2.just_fyi('check redirect to sync settings by tapping on "Sync" in connection status bottom sheet') + self.home_2.home_button.click() + self.home_2.mobile_connection_on_icon.click() + self.home_2.connection_settings_button.click() + if not self.home_2.element_by_translation_id("mobile-network-use-mobile").is_element_displayed(): + self.errors.append( + "Was not redirected to sync settings after tapping on Settings in connection bottom sheet") + + self.home_2.just_fyi("Check default preferences in Sync settings") + profile_1 = self.home_1.get_profile_view() + self.home_1.profile_button.double_click() + profile_1.sync_settings_button.click() + if not profile_1.element_by_translation_id("mobile-network-use-wifi").is_element_displayed(): + self.errors.append("Mobile data is enabled by default") + profile_1.element_by_translation_id("mobile-network-use-wifi").click() + if profile_1.ask_me_when_on_mobile_network.text != "ON": + self.errors.append("'Ask me when on mobile network' is not enabled by default") + + profile_1.just_fyi("Disable 'ask me when on mobile network' and check that it is not shown") + profile_1.ask_me_when_on_mobile_network.click() + profile_1.set_network_to_cellular_only() + if profile_1.element_by_translation_id("mobile-network-start-syncing").is_element_displayed(20): + self.errors.append("Popup is shown, but 'ask me when on mobile network' is disabled") + + profile_1.just_fyi("Check 'Restore default' setting") + profile_1.element_by_text('Restore Defaults').click() + if profile_1.use_mobile_data.attribute_value("checked"): + self.errors.append("Mobile data is enabled by default") + if not profile_1.ask_me_when_on_mobile_network.attribute_value("checked"): + self.errors.append("'Ask me when on mobile network' is not enabled by default") + self.errors.verify_no_errors() + + @marks.testrail_id(702177) + def test_restore_account_migrate_multiaccount_to_keycard_db_saved(self): + self.home_1.driver.quit() + self.home_2.profile_button.double_click() + self.profile_2.logout() + + self.device_2.just_fyi("Checking migration to keycard: db saved (1-1 chat, nickname, messages)") + self.device_2.options_button.click() + self.device_2.manage_keys_and_storage_button.click() + self.device_2.move_keystore_file_option.click() + self.device_2.enter_seed_phrase_next_button.click() + self.device_2.seedphrase_input.set_value(self.recovery_phrase) + self.device_2.choose_storage_button.click() + self.device_2.keycard_required_option.click() + self.device_2.confirm_button.click() + self.device_2.migration_password_input.set_value(common_password) + self.device_2.confirm_button.click() + from views.keycard_view import KeycardView + keycard = KeycardView(self.device_2.driver) + keycard.begin_setup_button.click() + keycard.connect_card_button.wait_and_click() + keycard.enter_default_pin() + keycard.enter_default_pin() + if not self.device_2.element_by_translation_id("migration-successful").is_element_displayed(30): + self.driver.fail("No popup about successfull migration is shown!") + self.device_2.ok_button.click() + self.home_2.home_button.wait_for_element(30) + if not self.home_2.element_by_text_part(self.pub_chat_name).is_element_displayed(): + self.errors.append("Public chat was removed from home after migration to kk") + self.home_2.get_chat(self.sender['username']).click() + if self.chat_2.add_to_contacts.is_element_displayed(): + self.errors.append("User was removed from contacts after migration to kk") + self.errors.verify_no_errors() + + +class TestMessagesOneToOneChatMultiple(MultipleDeviceTestCase): @marks.testrail_id(5362) @marks.medium def test_unread_messages_counter_preview_highlited_1_1_chat(self): @@ -474,7 +814,6 @@ class TestMessagesOneToOneChatSingle(SingleDeviceTestCase): chat.chat_element_by_text(message_text[:-2]).wait_for_visibility_of_element(2) - @marks.testrail_id(6298) @marks.medium def test_can_scan_qr_with_chat_key_from_home_start_chat(self): diff --git a/test/appium/tests/atomic/test_upgrade.py b/test/appium/tests/atomic/test_upgrade.py index c1440874bd..e96774f896 100644 --- a/test/appium/tests/atomic/test_upgrade.py +++ b/test/appium/tests/atomic/test_upgrade.py @@ -3,10 +3,10 @@ from tests import marks, pytest_config_global, test_dapp_name, staging_fleet, ma from tests.base_test_case import SingleDeviceTestCase, MultipleDeviceTestCase from tests.users import upgrade_users, transaction_recipients, basic_user, ens_user, transaction_senders from views.sign_in_view import SignInView -import views.upgrade_dbs.chats.data as chat_data -import views.upgrade_dbs.dapps.data as dapp_data -import views.upgrade_dbs.pairing.data as sync_data -import views.upgrade_dbs.group.data as group +import views.dbs.chats.data as chat_data +import views.dbs.dapps.data as dapp_data +import views.dbs.pairing.data as sync_data +import views.dbs.group.data as group @marks.upgrade @@ -18,7 +18,8 @@ class TestUpgradeApplication(SingleDeviceTestCase): sign_in = SignInView(self.driver) unread_one_to_one_name, unread_public_name = 'All Whopping Dassierat', '#before-upgrade' chats = chat_data.chats - home = sign_in.import_db(user=upgrade_users['chats'], import_db_folder_name='chats') + seed = upgrade_users['chats']['passphrase'] + home = sign_in.import_db(seed_phrase=seed, import_db_folder_name='chats') home.just_fyi("Grab profile version") profile = home.profile_button.click() @@ -141,7 +142,8 @@ class TestUpgradeApplication(SingleDeviceTestCase): def test_dapps_browser_several_accounts_upgrade(self): sign_in = SignInView(self.driver) favourites = dapp_data.dapps['favourites'] - home = sign_in.import_db(user=transaction_recipients['K'], import_db_folder_name='dapps') + seed = transaction_recipients['K']['passphrase'] + home = sign_in.import_db(seed_phrase=seed, import_db_folder_name='dapps') home.upgrade_app() sign_in.sign_in() dapps = home.dapp_tab_button.click() @@ -254,9 +256,10 @@ class TestUpgradeMultipleApplication(MultipleDeviceTestCase): device_2_public_key = device_2_home.get_public_key_and_username() device_2_home.home_button.click() user = upgrade_users['chats'] + seed = user['passphrase'] device_1.just_fyi("Import db, upgrade") - home = device_1.import_db(user=user, import_db_folder_name='chats') + home = device_1.import_db(seed_phrase=seed, import_db_folder_name='chats') home.upgrade_app() home = device_1.sign_in() @@ -310,8 +313,9 @@ class TestUpgradeMultipleApplication(MultipleDeviceTestCase): device_1, device_2 = SignInView(self.drivers[0]), SignInView(self.drivers[1]) device_1.just_fyi("Import db, upgrade") - home_1 = device_1.import_db(user=user, import_db_folder_name='pairing/main') - home_2 = device_2.import_db(user=user, import_db_folder_name='pairing/secondary') + seed = user['passphrase'] + home_1 = device_1.import_db(seed_phrase=seed, import_db_folder_name='pairing/main') + home_2 = device_2.import_db(seed_phrase=seed, import_db_folder_name='pairing/secondary') for device in (device_1, device_2): device.upgrade_app() device.sign_in() @@ -397,8 +401,8 @@ class TestUpgradeMultipleApplication(MultipleDeviceTestCase): device_1, device_2 = SignInView(self.drivers[0]), SignInView(self.drivers[1]) device_1.just_fyi("Import db, upgrade") - home_1 = device_1.import_db(user=admin, import_db_folder_name='group/admin') - home_2 = device_2.import_db(user=member, import_db_folder_name='group/member') + home_1 = device_1.import_db(seed_phrase=admin['passphrase'], import_db_folder_name='group/admin') + home_2 = device_2.import_db(seed_phrase=member['passphrase'], import_db_folder_name='group/member') for device in (device_1, device_2): device.upgrade_app() device.sign_in() @@ -485,7 +489,7 @@ class TestUpgradeMultipleApplication(MultipleDeviceTestCase): device_1, device_2 = SignInView(self.drivers[0]), SignInView(self.drivers[1]) device_1.just_fyi("Import db") - home_1 = device_1.import_db(user=user, import_db_folder_name='group/admin') + home_1 = device_1.import_db(seed_phrase=user['passphrase'], import_db_folder_name='group/admin') home_2 = device_2.create_user() profile_2 = home_2.profile_button.click() public_key_2, username_2 = profile_2.get_public_key_and_username(return_username=True) 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 a5eeb570c4..c5b7aec87d 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 @@ -209,7 +209,6 @@ class TestGroupChatMultipleDeviceMerged(MultipleSharedDeviceTestCase): class TestGroupChatMultipleDevice(MultipleDeviceTestCase): - @marks.testrail_id(5762) @marks.high def test_pair_devices_sync_one_to_one_contacts_nicknames_public_chat(self): @@ -370,6 +369,7 @@ class TestGroupChatMultipleDevice(MultipleDeviceTestCase): self.errors.verify_no_errors() + @marks.testrail_id(6324) @marks.medium def test_invite_to_group_chat_handling(self): diff --git a/test/appium/views/base_view.py b/test/appium/views/base_view.py index 6dcf076580..0823561874 100644 --- a/test/appium/views/base_view.py +++ b/test/appium/views/base_view.py @@ -515,7 +515,6 @@ class BaseView(object): message = 'test message:' return message + ''.join(random.choice(string.ascii_lowercase) for _ in range(10)) - def get_back_to_home_view(self, times_to_click_on_back_btn=3): counter = 0 while BackButton(self.driver).is_element_displayed(2) or self.close_button.is_element_displayed(2): diff --git a/test/appium/views/upgrade_dbs/chats/data.py b/test/appium/views/dbs/chats/data.py similarity index 100% rename from test/appium/views/upgrade_dbs/chats/data.py rename to test/appium/views/dbs/chats/data.py diff --git a/test/appium/views/upgrade_dbs/chats/export.db b/test/appium/views/dbs/chats/export.db similarity index 100% rename from test/appium/views/upgrade_dbs/chats/export.db rename to test/appium/views/dbs/chats/export.db diff --git a/test/appium/views/upgrade_dbs/dapps/data.py b/test/appium/views/dbs/dapps/data.py similarity index 100% rename from test/appium/views/upgrade_dbs/dapps/data.py rename to test/appium/views/dbs/dapps/data.py diff --git a/test/appium/views/upgrade_dbs/dapps/export.db b/test/appium/views/dbs/dapps/export.db similarity index 100% rename from test/appium/views/upgrade_dbs/dapps/export.db rename to test/appium/views/dbs/dapps/export.db diff --git a/test/appium/views/upgrade_dbs/group/admin/export.db b/test/appium/views/dbs/group/admin/export.db similarity index 100% rename from test/appium/views/upgrade_dbs/group/admin/export.db rename to test/appium/views/dbs/group/admin/export.db diff --git a/test/appium/views/upgrade_dbs/group/data.py b/test/appium/views/dbs/group/data.py similarity index 100% rename from test/appium/views/upgrade_dbs/group/data.py rename to test/appium/views/dbs/group/data.py diff --git a/test/appium/views/upgrade_dbs/group/member/export.db b/test/appium/views/dbs/group/member/export.db similarity index 100% rename from test/appium/views/upgrade_dbs/group/member/export.db rename to test/appium/views/dbs/group/member/export.db diff --git a/test/appium/views/dbs/main_pairing/data.py b/test/appium/views/dbs/main_pairing/data.py new file mode 100644 index 0000000000..c8f71b6e26 --- /dev/null +++ b/test/appium/views/dbs/main_pairing/data.py @@ -0,0 +1,45 @@ +seed_phrase = 'west dwarf festival fabric pelican gallery jewel bind snack fiction awkward second' +password = 'password' + +chats = { + 'Group with history': { + 'initial_sync': False, + 'unread': '1', + 'preview': 'Good bye' + }, + 'Cheerful Empty Rhino': { + 'initial_sync': False, + 'unread': '1', + }, + '#public-with-history': { + 'initial_sync': True, + 'preview': 'fgsdjhfgdsjhf' + }, + '#public-cleared-history': { + 'initial_sync': True, + 'unread': '1', + 'preview': 'No messages' + }, + 'Test_community': { + 'initial_sync': True, + } +} +contacts = ['@pavlo', 'Cheerful Empty Rhino'] +user_nickname = { + 'public_key': '0x043f30313e1b2a8b9df78f1c13c14180a75e689ba1687728a1e49f6e922121b7915803296c091c0051db033aff76bd63d9' + '882d3d19cb993c3e1bf3bea2bceb695e', + 'nickname': 'test_nickname' +} +activity_centre = {'test group': 'No messages', + 'Rowdy Slushy Harvestmen': 'Hi!'} + +# Blocked users added or not to contacts +blocked = { + 'Wiry Mistyrose Sidewinder': True, + 'Huge Dental Hoiho': False +} + +dapps = { + 'Apple' : 'https://apple.com', + 'BBC - homepage': 'https://bbc.com' +} \ No newline at end of file diff --git a/test/appium/views/dbs/main_pairing/export.db b/test/appium/views/dbs/main_pairing/export.db new file mode 100644 index 0000000000..0b525ae856 Binary files /dev/null and b/test/appium/views/dbs/main_pairing/export.db differ diff --git a/test/appium/views/upgrade_dbs/pairing/data.py b/test/appium/views/dbs/pairing/data.py similarity index 100% rename from test/appium/views/upgrade_dbs/pairing/data.py rename to test/appium/views/dbs/pairing/data.py diff --git a/test/appium/views/upgrade_dbs/pairing/main/export.db b/test/appium/views/dbs/pairing/main/export.db similarity index 100% rename from test/appium/views/upgrade_dbs/pairing/main/export.db rename to test/appium/views/dbs/pairing/main/export.db diff --git a/test/appium/views/upgrade_dbs/pairing/secondary/export.db b/test/appium/views/dbs/pairing/secondary/export.db similarity index 100% rename from test/appium/views/upgrade_dbs/pairing/secondary/export.db rename to test/appium/views/dbs/pairing/secondary/export.db diff --git a/test/appium/views/sign_in_view.py b/test/appium/views/sign_in_view.py index 9ecd01e55f..25cc198397 100644 --- a/test/appium/views/sign_in_view.py +++ b/test/appium/views/sign_in_view.py @@ -261,18 +261,18 @@ class SignInView(BaseView): self.open_universal_web_link(url_weblink) self.sign_in() - def import_db(self, user, import_db_folder_name): + def import_db(self, seed_phrase, import_db_folder_name, password=common_password): from tests.base_test_case import AbstractTestCase self.driver.info('## Importing database', device=False) import_file_name = 'export.db' - home = self.recover_access(user['passphrase']) + home = self.recover_access(passphrase=seed_phrase, password=password) profile = home.profile_button.click() - full_path_to_file = os.path.join(appium_root_project_path, 'views/upgrade_dbs/%s/%s' % + full_path_to_file = os.path.join(appium_root_project_path, 'views/dbs/%s/%s' % (import_db_folder_name, import_file_name)) profile.logout() self.multi_account_on_login_button.wait_for_visibility_of_element(30) self.get_multiaccount_by_position(1).click() - self.password_input.set_value(common_password) + self.password_input.set_value(password) self.driver.push_file(source_path=full_path_to_file, destination_path='%s%s' % (AbstractTestCase().app_path, import_file_name)) self.options_button.click()