diff --git a/test/appium/tests/base_test_case.py b/test/appium/tests/base_test_case.py index 46c83b10fe..6fff6eb593 100644 --- a/test/appium/tests/base_test_case.py +++ b/test/appium/tests/base_test_case.py @@ -27,8 +27,6 @@ executor_local = 'http://localhost:4723/wd/hub' implicit_wait = 5 -app_package = 'im.status.ethereum' - def get_capabilities_local(): desired_caps = dict() 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 d2b8e329ac..b0e435167e 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 @@ -7,7 +7,7 @@ from _pytest.outcomes import Failed from selenium.common.exceptions import TimeoutException, NoSuchElementException from tests import marks, common_password, run_in_parallel, transl -from tests.base_test_case import MultipleSharedDeviceTestCase, create_shared_drivers, app_package +from tests.base_test_case import MultipleSharedDeviceTestCase, create_shared_drivers from tests.users import transaction_senders, basic_user, ens_user, ens_user_message_sender from views.sign_in_view import SignInView @@ -162,6 +162,7 @@ class TestCommandsMultipleDevicesMerged(MultipleSharedDeviceTestCase): self.wallet_2.home_button.click() self.home_1.wallet_button.double_click() initial_amount_stt = self.wallet_1.get_asset_amount_by_name('STT') + app_package = self.home_1.driver.current_package self.home_1.driver.terminate_app(app_package) self.home_2.just_fyi('Request %s STT in 1-1 chat and check it is visible for sender and receiver' % amount) @@ -1122,7 +1123,7 @@ class TestOneToOneChatMultipleSharedDevicesNewUi(MultipleSharedDeviceTestCase): if not self.chat_2.chat_message_input.is_element_displayed(): self.home_2.get_chat(self.username_1).click() if self.chat_2.chat_element_by_text(message).member_photo.is_element_differs_from_template("member3.png", - diff=6): + diff=7): self.errors.append("Image of user in 1-1 chat is too different from template!") self.errors.verify_no_errors() @@ -1369,6 +1370,7 @@ class TestOneToOneChatMultipleSharedDevicesNewUiTwo(MultipleSharedDeviceTestCase # self.chat_1.jump_to_card_by_text(self.username_2) self.home_1.just_fyi('Turn on airplane mode and check that offline status is shown on home view') for home in self.homes: + app_package = self.home_1.driver.current_package home.toggle_airplane_mode() if not home.chats_tab.is_element_displayed() and not home.chat_floating_screen.is_element_displayed(): home.driver.activate_app(app_package) diff --git a/test/appium/tests/critical/chats/test_group_chat.py b/test/appium/tests/critical/chats/test_group_chat.py index 7de9f929b4..7b1fb471c1 100644 --- a/test/appium/tests/critical/chats/test_group_chat.py +++ b/test/appium/tests/critical/chats/test_group_chat.py @@ -5,7 +5,7 @@ from _pytest.outcomes import Failed from selenium.common.exceptions import NoSuchElementException, TimeoutException from tests import marks, run_in_parallel, transl -from tests.base_test_case import MultipleSharedDeviceTestCase, create_shared_drivers, app_package +from tests.base_test_case import MultipleSharedDeviceTestCase, create_shared_drivers from views.chat_view import ChatView from views.sign_in_view import SignInView @@ -412,6 +412,7 @@ class TestGroupChatMultipleDeviceMergedNewUI(MultipleSharedDeviceTestCase): message_1, message_2 = 'message from old member', 'message from new member' self.homes[0].just_fyi("Put admin device to offline and send messages from members") + app_package = self.drivers[0].current_package self.homes[0].toggle_airplane_mode() self.chats[1].send_message(message_1) self.chats[2].send_message(message_2) diff --git a/test/appium/tests/critical/test_public_chat_browsing.py b/test/appium/tests/critical/test_public_chat_browsing.py index 0edf20f0f7..c407c88b3a 100644 --- a/test/appium/tests/critical/test_public_chat_browsing.py +++ b/test/appium/tests/critical/test_public_chat_browsing.py @@ -10,7 +10,7 @@ from dateutil import parser from selenium.common.exceptions import NoSuchElementException, TimeoutException from tests import marks, test_dapp_name, test_dapp_url, run_in_parallel, pytest_config_global, transl -from tests.base_test_case import create_shared_drivers, MultipleSharedDeviceTestCase, app_package +from tests.base_test_case import create_shared_drivers, MultipleSharedDeviceTestCase from views.chat_view import CommunityView from views.dbs.waku_backup import user as waku_user from views.sign_in_view import SignInView @@ -134,7 +134,7 @@ class TestPublicChatBrowserOneDeviceMerged(MultipleSharedDeviceTestCase): @marks.testrail_id(700739) def test_public_chat_open_using_deep_link(self): - self.drivers[0].terminate_app(app_package) + self.drivers[0].terminate_app(self.drivers[0].current_package) chat_name = self.home.get_random_chat_name() deep_link = 'status-im://%s' % chat_name self.sign_in.open_weblink_and_login(deep_link) @@ -323,6 +323,7 @@ class TestCommunityOneDeviceMerged(MultipleSharedDeviceTestCase): self.channel = self.community_view.get_channel(self.channel_name).click() @marks.testrail_id(703503) + @marks.xfail(reason="https://github.com/status-im/status-mobile/issues/17175", run=False) def test_community_discovery(self): self.home.navigate_back_to_home_view() self.home.communities_tab.click() @@ -912,6 +913,7 @@ class TestCommunityMultipleDeviceMerged(MultipleSharedDeviceTestCase): self.channel_1.block_contact() self.chat_1.just_fyi('Check that messages from blocked user are hidden in public chat and close app') + app_package = self.device_1.driver.current_package if not self.chat_1.chat_element_by_text(message_to_disappear).is_element_disappeared(30): self.errors.append("Messages from blocked user is not cleared in public chat ") self.chat_1.navigate_back_to_home_view() diff --git a/test/appium/tests/medium/test_chats_m.py b/test/appium/tests/medium/test_chats_m.py index 6fe9afbfa3..8e3e477f77 100644 --- a/test/appium/tests/medium/test_chats_m.py +++ b/test/appium/tests/medium/test_chats_m.py @@ -6,7 +6,7 @@ import pytest from tests import bootnode_address, mailserver_address, mailserver_ams, used_fleet, background_service_message from tests import marks -from tests.base_test_case import MultipleSharedDeviceTestCase, create_shared_drivers, app_package +from tests.base_test_case import MultipleSharedDeviceTestCase, create_shared_drivers from tests.users import transaction_senders, ens_user from views.sign_in_view import SignInView @@ -940,6 +940,7 @@ class TestChatKeycardMentionsMediumMultipleDevice(MultipleSharedDeviceTestCase): @marks.testrail_id(702296) def test_block_user_from_1_1_chat_header_check_mentions_and_push_notification_service(self): + app_package = self.device_1.driver.current_package [home.home_button.double_click() for home in (self.home_1, self.home_2)] message_before_block_1 = "Before block from recipient" message_before_block_2 = "Before block from sender" diff --git a/test/appium/views/base_view.py b/test/appium/views/base_view.py index 60fa0609c4..0c53fcc86b 100644 --- a/test/appium/views/base_view.py +++ b/test/appium/views/base_view.py @@ -11,7 +11,6 @@ from selenium.common.exceptions import NoSuchElementException, TimeoutException from selenium.webdriver.support import expected_conditions from selenium.webdriver.support.wait import WebDriverWait -from base_test_case import app_package from support.device_apps import start_web_browser from tests import common_password, pytest_config_global, transl from views.base_element import Button, BaseElement, EditBox, Text, CheckBox @@ -644,6 +643,7 @@ class BaseView(object): self.element_by_text(text).click() def reopen_app(self, password=common_password, sign_in=True): + app_package = self.driver.current_package self.driver.terminate_app(app_package) self.driver.activate_app(app_package) if sign_in: @@ -746,6 +746,10 @@ class BaseView(object): def upgrade_app(self): self.driver.info("Upgrading apk to apk_upgrade") self.driver.install_app(pytest_config_global['apk_upgrade'], replace=True) + if self.driver.is_app_installed('im.status.ethereum'): + app_package = 'im.status.ethereum' + else: + app_package = 'im.status.ethereum.pr' self.app = self.driver.activate_app(app_package) def search_by_keyword(self, keyword): diff --git a/test/appium/views/chat_view.py b/test/appium/views/chat_view.py index 9c436ba534..735167a764 100644 --- a/test/appium/views/chat_view.py +++ b/test/appium/views/chat_view.py @@ -1209,7 +1209,7 @@ class ChatView(BaseView): self.chat_message_input.send_keys("@") try: self.mentions_list.wait_for_element() - self.user_list_element_by_name(user_name).click() + self.user_list_element_by_name(user_name).wait_for_rendering_ended_and_click() except TimeoutException: self.driver.fail("Mentions list is not shown") diff --git a/test/appium/views/home_view.py b/test/appium/views/home_view.py index 8a33926945..998fd2035f 100644 --- a/test/appium/views/home_view.py +++ b/test/appium/views/home_view.py @@ -361,19 +361,21 @@ class HomeView(BaseView): if self.notifications_unread_badge.is_element_displayed(30): self.open_activity_center_button.click() chat_element = ActivityCenterElement(self.driver, username[:25]) - if action == 'accept': - self.driver.info("Accepting incoming CR for %s" % username) - chat_element.accept_contact_request() - elif action == 'decline': - self.driver.info("Rejecting incoming CR for %s" % username) - chat_element.decline_contact_request() - elif action == 'cancel': - self.driver.info("Canceling outgoing CR for %s" % username) - chat_element.cancel_contact_request() - else: - self.driver.fail("Illegal option for CR!") - self.close_activity_centre.wait_for_rendering_ended_and_click() - self.chats_tab.wait_for_visibility_of_element() + try: + if action == 'accept': + self.driver.info("Accepting incoming CR for %s" % username) + chat_element.accept_contact_request() + elif action == 'decline': + self.driver.info("Rejecting incoming CR for %s" % username) + chat_element.decline_contact_request() + elif action == 'cancel': + self.driver.info("Canceling outgoing CR for %s" % username) + chat_element.cancel_contact_request() + else: + self.driver.fail("Illegal option for CR!") + finally: + self.close_activity_centre.wait_for_rendering_ended_and_click() + self.chats_tab.wait_for_visibility_of_element() def get_username_below_start_new_chat_button(self, username_part): return Text(self.driver,