diff --git a/test/appium/tests/__init__.py b/test/appium/tests/__init__.py index 7b6386106a..bdbd633f1a 100644 --- a/test/appium/tests/__init__.py +++ b/test/appium/tests/__init__.py @@ -5,6 +5,7 @@ import os import json from support.appium_container import AppiumContainer from support.test_data import TestSuiteData +import functools import time @@ -28,7 +29,7 @@ async def run_in_parallel(funcs): returns = [] for func in funcs: try: - res.append(loop.run_in_executor(None, func[0], func[1])) + res.append(loop.run_in_executor(None, functools.partial(func[0], **func[1]))) except IndexError: res.append(loop.run_in_executor(None, func[0])) for k in res: diff --git a/test/appium/tests/critical/chats/test_1_1_public_chats.py b/test/appium/tests/critical/chats/test_1_1_public_chats.py index f443fb69d5..a16f175e3b 100644 --- a/test/appium/tests/critical/chats/test_1_1_public_chats.py +++ b/test/appium/tests/critical/chats/test_1_1_public_chats.py @@ -907,20 +907,18 @@ class TestOneToOneChatMultipleSharedDevicesNewUi(MultipleSharedDeviceTestCase): def prepare_devices(self): self.drivers, self.loop = create_shared_drivers(2) self.device_1, self.device_2 = SignInView(self.drivers[0]), SignInView(self.drivers[1]) - self.loop.run_until_complete(run_in_parallel(((self.device_1.create_user,), (self.device_2.create_user,)))) + self.loop.run_until_complete(run_in_parallel(((self.device_1.create_user, {'enable_notifications': True}), + (self.device_2.create_user, {'enable_notifications': True})))) self.home_1, self.home_2 = self.device_1.get_home_view(), self.device_2.get_home_view() self.profile_1 = self.home_1.get_profile_view() self.profile_2 = self.home_2.get_profile_view() users = self.loop.run_until_complete(run_in_parallel( - ((self.home_1.get_public_key_and_username, True), - (self.home_2.get_public_key_and_username, True)) + ((self.home_1.get_public_key_and_username, {'return_username': True}), + (self.home_2.get_public_key_and_username, {'return_username': True})) )) self.public_key_1, self.default_username_1 = users[0] self.public_key_2, self.default_username_2 = users[1] - self.profile_1.switch_push_notifications() - self.profile_2.switch_push_notifications() - self.profile_1.just_fyi("Sending contact request via Profile > Contacts") for home in (self.home_1, self.home_2): home.click_system_back_button_until_element_is_shown() diff --git a/test/appium/tests/critical/chats/test_group_chat.py b/test/appium/tests/critical/chats/test_group_chat.py index 687400b5c9..e93b3cf780 100644 --- a/test/appium/tests/critical/chats/test_group_chat.py +++ b/test/appium/tests/critical/chats/test_group_chat.py @@ -1,6 +1,6 @@ import pytest -from tests import marks, run_in_parallel +from tests import marks, run_in_parallel, common_password from tests.base_test_case import MultipleSharedDeviceTestCase, create_shared_drivers from views.chat_view import ChatView from views.sign_in_view import SignInView @@ -153,9 +153,9 @@ class TestGroupChatMultipleDeviceMergedNewUI(MultipleSharedDeviceTestCase): self.loop.run_until_complete( run_in_parallel( ( - (sign_in_views[0].create_user,), - (sign_in_views[1].create_user,), - (sign_in_views[2].create_user,) + (sign_in_views[0].create_user, {'enable_notifications': True}), + (sign_in_views[1].create_user, {'enable_notifications': True}), + (sign_in_views[2].create_user, {'enable_notifications': True}) ) ) ) @@ -163,22 +163,13 @@ class TestGroupChatMultipleDeviceMergedNewUI(MultipleSharedDeviceTestCase): users = self.loop.run_until_complete( run_in_parallel( ( - (self.homes[0].get_public_key_and_username, True), - (self.homes[1].get_public_key_and_username, True), - (self.homes[2].get_public_key_and_username, True) - ) - ) - ) - self.profiles = [home.get_profile_view() for home in self.homes] - self.loop.run_until_complete( - run_in_parallel( - ( - (self.profiles[0].switch_push_notifications,), - (self.profiles[1].switch_push_notifications,), - (self.profiles[2].switch_push_notifications,) + (self.homes[0].get_public_key_and_username, {'return_username': True}), + (self.homes[1].get_public_key_and_username, {'return_username': True}), + (self.homes[2].get_public_key_and_username, {'return_username': True}) ) ) ) + self.homes[0].just_fyi('Admin adds future members to contacts') for i in range(3): @@ -195,8 +186,8 @@ class TestGroupChatMultipleDeviceMergedNewUI(MultipleSharedDeviceTestCase): self.loop.run_until_complete( run_in_parallel( ( - (self.homes[1].handle_contact_request, self.usernames[0]), - (self.homes[2].handle_contact_request, self.usernames[0]) + (self.homes[1].handle_contact_request, {'username': self.usernames[0]}), + (self.homes[2].handle_contact_request, {'username': self.usernames[0]}) ) ) ) diff --git a/test/appium/tests/critical/onboarding/test_onboarding_flows.py b/test/appium/tests/critical/onboarding/test_onboarding_flows.py index 01b5c98618..ecbae46771 100644 --- a/test/appium/tests/critical/onboarding/test_onboarding_flows.py +++ b/test/appium/tests/critical/onboarding/test_onboarding_flows.py @@ -211,7 +211,7 @@ class TestOnboardingOneDeviceMerged(MultipleSharedDeviceTestCase): self.sign_in.confirm_your_password_input.set_value(common_password) self.sign_in.next_button.click() - [element.wait_and_click(10) for element in (self.sign_in.maybe_later_button, self.sign_in.lets_go_button)] + [element.wait_and_click(10) for element in (self.sign_in.maybe_later_button, self.sign_in.start_button)] self.home.cross_icon_inside_welcome_screen_button.wait_and_click(10) if not self.home.element_by_translation_id("welcome-blank-message").is_element_displayed(): self.errors.append("'%s' text is not shown after welcome view was closed" % @@ -439,7 +439,7 @@ class TestRestoreOneDeviceMerged(MultipleSharedDeviceTestCase): 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.start_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() diff --git a/test/appium/tests/critical/test_public_chat_browsing.py b/test/appium/tests/critical/test_public_chat_browsing.py index 7a85f64d6f..f5da302b51 100644 --- a/test/appium/tests/critical/test_public_chat_browsing.py +++ b/test/appium/tests/critical/test_public_chat_browsing.py @@ -6,7 +6,7 @@ import pytest from dateutil import parser from selenium.common.exceptions import NoSuchElementException -from tests import marks, test_dapp_name, test_dapp_url, run_in_parallel +from tests import marks, test_dapp_name, test_dapp_url, run_in_parallel, common_password from tests.base_test_case import create_shared_drivers, MultipleSharedDeviceTestCase from views.chat_view import CommunityView from views.sign_in_view import SignInView @@ -359,12 +359,12 @@ class TestCommunityMultipleDeviceMerged(MultipleSharedDeviceTestCase): def prepare_devices(self): self.drivers, self.loop = create_shared_drivers(2) self.device_1, self.device_2 = SignInView(self.drivers[0]), SignInView(self.drivers[1]) - self.loop.run_until_complete(run_in_parallel(((self.device_1.create_user,), (self.device_2.create_user,)))) + self.loop.run_until_complete(run_in_parallel(((self.device_1.create_user, {'enable_notifications': True}), + (self.device_2.create_user,)))) self.home_1, self.home_2 = self.device_1.get_home_view(), self.device_2.get_home_view() self.public_key_1, self.default_username_1 = self.home_1.get_public_key_and_username(return_username=True) self.public_key_2, self.default_username_2 = self.home_2.get_public_key_and_username(return_username=True) self.profile_1 = self.home_1.get_profile_view() - self.profile_1.switch_push_notifications() [home.click_system_back_button_until_element_is_shown() for home in (self.home_1, self.home_2)] [home.chats_tab.click() for home in (self.home_1, self.home_2)] self.home_1.add_contact(self.public_key_2) diff --git a/test/appium/tests/critical/wallet_and_tx/test_send_tx_dapp_keycard.py b/test/appium/tests/critical/wallet_and_tx/test_send_tx_dapp_keycard.py index da1ad9c208..99b3b3cca5 100644 --- a/test/appium/tests/critical/wallet_and_tx/test_send_tx_dapp_keycard.py +++ b/test/appium/tests/critical/wallet_and_tx/test_send_tx_dapp_keycard.py @@ -380,8 +380,8 @@ class TestKeycardTxOneDeviceMerged(MultipleSharedDeviceTestCase): keycard.pair_code_input.set_value(pair_code) self.sign_in.pair_to_this_device_button.click() keycard.enter_default_pin() - self.sign_in.maybe_later_button.click_until_presence_of_element(self.sign_in.lets_go_button) - self.sign_in.lets_go_button.click_until_absense_of_element(self.sign_in.lets_go_button) + self.sign_in.maybe_later_button.click_until_presence_of_element(self.sign_in.start_button) + self.sign_in.start_button.click_until_absense_of_element(self.sign_in.start_button) self.sign_in.home_button.wait_for_visibility_of_element(30) self.sign_in.just_fyi("Check balance will be restored after going back online") @@ -426,8 +426,8 @@ class TestKeycardTxOneDeviceMerged(MultipleSharedDeviceTestCase): keycard_flow.confirm_pin_and_proceed() seed_phrase = keycard_flow.backup_seed_phrase() self.sign_in.maybe_later_button.wait_for_visibility_of_element(30) - self.sign_in.maybe_later_button.click_until_presence_of_element(self.sign_in.lets_go_button) - self.sign_in.lets_go_button.click_until_absense_of_element(self.sign_in.lets_go_button) + self.sign_in.maybe_later_button.click_until_presence_of_element(self.sign_in.start_button) + self.sign_in.start_button.click_until_absense_of_element(self.sign_in.start_button) self.sign_in.profile_button.wait_for_visibility_of_element(30) wallet_1 = self.sign_in.wallet_button.click() wallet_address = wallet_1.get_wallet_address() diff --git a/test/appium/tests/medium/test_activity_center.py b/test/appium/tests/medium/test_activity_center.py index 88fd15b3ad..8f516e9d19 100644 --- a/test/appium/tests/medium/test_activity_center.py +++ b/test/appium/tests/medium/test_activity_center.py @@ -1,6 +1,6 @@ import pytest -from tests import marks, run_in_parallel +from tests import marks, run_in_parallel, common_password from tests.base_test_case import MultipleSharedDeviceTestCase, create_shared_drivers from views.sign_in_view import SignInView from views.chat_view import CommunityView @@ -80,18 +80,17 @@ class TestActivityCenterContactRequestMultipleDevicePR(MultipleSharedDeviceTestC def prepare_devices(self): self.drivers, self.loop = create_shared_drivers(2) self.device_1, self.device_2 = SignInView(self.drivers[0]), SignInView(self.drivers[1]) - self.loop.run_until_complete(run_in_parallel(((self.device_1.create_user,), (self.device_2.create_user,)))) + self.loop.run_until_complete(run_in_parallel(((self.device_1.create_user, {'enable_notifications': True}), + (self.device_2.create_user,)))) self.home_1, self.home_2 = self.device_1.get_home_view(), self.device_2.get_home_view() self.profile_1, self.profile_2 = self.home_1.get_profile_view(), self.home_2.get_profile_view() users = self.loop.run_until_complete(run_in_parallel( - ((self.home_1.get_public_key_and_username, True), - (self.home_2.get_public_key_and_username, True)) + ((self.home_1.get_public_key_and_username, {'return_username': True}), + (self.home_2.get_public_key_and_username, {'return_username': True})) )) self.public_key_1, self.default_username_1 = users[0] self.public_key_2, self.default_username_2 = users[1] - self.profile_1.just_fyi("Enabling PNs") - self.profile_1.switch_push_notifications() [home.click_system_back_button_until_element_is_shown() for home in [self.home_1, self.home_2]] [home.chats_tab.click() for home in [self.home_1, self.home_2]] @@ -184,12 +183,13 @@ class TestActivityMultipleDevicePR(MultipleSharedDeviceTestCase): self.drivers, self.loop = create_shared_drivers(2) self.device_1, self.device_2 = SignInView(self.drivers[0]), SignInView(self.drivers[1]) self.loop.run_until_complete( - run_in_parallel(((self.device_1.create_user,), (self.device_2.create_user,)))) + run_in_parallel(((self.device_1.create_user, ), + (self.device_2.create_user,)))) self.home_1, self.home_2 = self.device_1.get_home_view(), self.device_2.get_home_view() self.profile_1, self.profile_2 = self.home_1.get_profile_view(), self.home_2.get_profile_view() users = self.loop.run_until_complete(run_in_parallel( - ((self.home_1.get_public_key_and_username, True), - (self.home_2.get_public_key_and_username, True)) + ((self.home_1.get_public_key_and_username, {'return_username': True}), + (self.home_2.get_public_key_and_username, {'return_username': True})) )) self.public_key_1, self.default_username_1 = users[0] self.public_key_2, self.default_username_2 = users[1] diff --git a/test/appium/tests/medium/test_single_device.py b/test/appium/tests/medium/test_single_device.py index a1596310b8..d768aba2af 100644 --- a/test/appium/tests/medium/test_single_device.py +++ b/test/appium/tests/medium/test_single_device.py @@ -27,8 +27,8 @@ class TestChatManagement(SingleDeviceTestCase): keycard_view.pair_code_input.set_value(pair_code) keycard_view.confirm() keycard_view.enter_default_pin() - sign_in.maybe_later_button.click_until_presence_of_element(sign_in.lets_go_button) - sign_in.lets_go_button.click_until_absense_of_element(sign_in.lets_go_button) + sign_in.maybe_later_button.click_until_presence_of_element(sign_in.start_button) + sign_in.start_button.click_until_absense_of_element(sign_in.start_button) sign_in.home_button.wait_for_visibility_of_element(30) wallet_view = sign_in.wallet_button.click() @@ -199,7 +199,7 @@ class TestChatManagement(SingleDeviceTestCase): self.errors.append('Another seed phrase is shown after cancelling setup during Back up seed phrase') keycard_flow.backup_seed_phrase() keycard_flow.enter_default_pin() - for element in sign_in.maybe_later_button, sign_in.lets_go_button: + for element in sign_in.maybe_later_button, sign_in.start_button: element.wait_for_visibility_of_element(30) element.click() sign_in.profile_button.wait_for_visibility_of_element(30) @@ -240,7 +240,7 @@ class TestChatManagement(SingleDeviceTestCase): keycard_flow.begin_setup_button.click() keycard_flow.enter_default_pin() keycard_flow.enter_default_pin() - for element in sign_in.maybe_later_button, sign_in.lets_go_button: + for element in sign_in.maybe_later_button, sign_in.start_button: element.wait_for_visibility_of_element(30) element.click() sign_in.profile_button.wait_for_visibility_of_element(30) @@ -982,8 +982,8 @@ class TestChatManagement(SingleDeviceTestCase): sign_in.next_button.click() sign_in.confirm_your_password_input.set_value(common_password) sign_in.next_button.click() - sign_in.maybe_later_button.click_until_presence_of_element(sign_in.lets_go_button) - sign_in.lets_go_button.click() + sign_in.maybe_later_button.click_until_presence_of_element(sign_in.start_button) + sign_in.start_button.click() sign_in.just_fyi('Delete 2nd multiaccount') public_key, username = sign_in.get_public_key_and_username(return_username=True) diff --git a/test/appium/tests/medium/test_wallet_keycard_m.py b/test/appium/tests/medium/test_wallet_keycard_m.py index 1f7db74aca..cc27eebccf 100644 --- a/test/appium/tests/medium/test_wallet_keycard_m.py +++ b/test/appium/tests/medium/test_wallet_keycard_m.py @@ -163,8 +163,8 @@ class TestKeycardMediumMultipleDevicesMerged(MultipleSharedDeviceTestCase): self.sign_in.next_button.click() self.sign_in.confirm_your_password_input.set_value(common_password) self.sign_in.next_button.click() - self.sign_in.maybe_later_button.click_until_presence_of_element(self.sign_in.lets_go_button) - self.sign_in.lets_go_button.click() + self.sign_in.maybe_later_button.click_until_presence_of_element(self.sign_in.start_button) + self.sign_in.start_button.click() self.sign_in.just_fyi('Add to wallet seed phrase for restored multiaccount') wallet = self.sign_in.wallet_button.click() diff --git a/test/appium/views/base_view.py b/test/appium/views/base_view.py index 727aff985c..ef3db5bfa8 100644 --- a/test/appium/views/base_view.py +++ b/test/appium/views/base_view.py @@ -617,7 +617,7 @@ class BaseView(object): time.sleep(3) def get_public_key_and_username(self, return_username=False): - self.driver.info("Get public key and username") + self.driver.info("Get public key and username, return_username '%s'" % str(return_username)) profile_view = self.profile_button.click() default_username = profile_view.default_username_text.text profile_view.share_my_profile_button.click() diff --git a/test/appium/views/sign_in_view.py b/test/appium/views/sign_in_view.py index a9c399bd27..be5f8c124c 100644 --- a/test/appium/views/sign_in_view.py +++ b/test/appium/views/sign_in_view.py @@ -140,11 +140,11 @@ class SignInView(BaseView): xpath="(//android.widget.EditText[@content-desc='password-input'])[1]") self.confirm_your_password_input = EditBox(self.driver, xpath="(//android.widget.EditText[@content-desc='password-input'])[2]") - self.enable_notifications_button = Button(self.driver, accessibility_id="enable-notifications") - self.maybe_later_button = Button(self.driver, accessibility_id="maybe-later") + self.enable_notifications_button = Button(self.driver, accessibility_id="enable-notifications-button") + self.maybe_later_button = Button(self.driver, accessibility_id="enable-notifications-later-button") self.privacy_policy_link = PrivacyPolicyLink(self.driver) self.terms_of_use_link = TermsOfUseLink(self.driver) - self.lets_go_button = Button(self.driver, accessibility_id="lets-go-button") + self.start_button = Button(self.driver, accessibility_id="welcome-button") self.keycard_storage_button = KeycardKeyStorageButton(self.driver) self.first_username_on_choose_chat_name = Text(self.driver, xpath="//*[@content-desc='select-account-button-0']//android.widget.TextView[1]") @@ -178,8 +178,8 @@ class SignInView(BaseView): self.cancel_custom_seed_phrase_button = Button(self.driver, accessibility_id="cancel-custom-seed-phrase") def create_user(self, password=common_password, keycard=False, enable_notifications=False, second_user=False): - self.driver.info("## Creating new multiaccount (password:'%s', keycard:'%s')" % (password, str(keycard)), - device=False) + self.driver.info("## Creating new multiaccount (password:'%s', keycard:'%s', enable_notification: '%s')" % + (password, str(keycard), str(enable_notifications)), device=False) if not second_user: self.i_m_new_in_status_button.click_until_presence_of_element(self.generate_key_button) self.generate_key_button.click() @@ -194,8 +194,11 @@ class SignInView(BaseView): self.create_password_input.set_value(password) self.confirm_your_password_input.set_value(password) self.next_button.click() - - + if enable_notifications: + self.enable_notifications_button.click_until_presence_of_element(self.start_button) + else: + self.maybe_later_button.click_until_presence_of_element(self.start_button) + self.start_button.click() self.chats_tab.wait_for_visibility_of_element(30) self.driver.info("## New multiaccount is created successfully!", device=False) @@ -223,10 +226,10 @@ class SignInView(BaseView): self.next_button.click_until_presence_of_element(self.maybe_later_button) self.maybe_later_button.wait_for_element(30) if enable_notifications: - self.enable_notifications_button.click_until_presence_of_element(self.lets_go_button) + self.enable_notifications_button.click_until_presence_of_element(self.start_button) else: - self.maybe_later_button.click_until_presence_of_element(self.lets_go_button) - self.lets_go_button.click() + self.maybe_later_button.click_until_presence_of_element(self.start_button) + self.start_button.click() self.profile_button.wait_for_visibility_of_element(30) self.driver.info("## Multiaccount is recovered successfully!", device=False) return self.get_home_view()