From c8b063493bb481d2a23e99c3713cccad2f81929a Mon Sep 17 00:00:00 2001 From: Yevheniia Berdnyk Date: Tue, 10 Dec 2024 19:26:53 +0200 Subject: [PATCH] e2e: False failures fixes --- test/appium/tests/activity_center/test_activity_center.py | 8 -------- test/appium/tests/critical/chats/test_group_chat.py | 4 ++-- .../tests/critical/chats/test_public_chat_browsing.py | 4 ++++ .../tests/critical/test_deep_and_universal_links.py | 2 +- test/appium/tests/critical/test_fallback.py | 2 +- test/appium/tests/critical/test_wallet.py | 8 ++++---- test/appium/views/home_view.py | 1 + test/appium/views/sign_in_view.py | 6 ++++-- 8 files changed, 17 insertions(+), 18 deletions(-) diff --git a/test/appium/tests/activity_center/test_activity_center.py b/test/appium/tests/activity_center/test_activity_center.py index e7033c7048c..c373f3e70ec 100644 --- a/test/appium/tests/activity_center/test_activity_center.py +++ b/test/appium/tests/activity_center/test_activity_center.py @@ -148,14 +148,6 @@ def test_activity_center_contact_request_accept_swipe_mark_all_as_read(self): @marks.testrail_id(702777) def test_add_contact_field_validation(self): - # Profile link encoded data validation - encoded_data = re.findall("u/(.*)#", self.profile_link_2)[0] - decoded_string = base64.b64decode(encoded_data).decode("utf-8", "ignore") - decoded_username = re.sub('[^A-Za-z0-9]+', '', decoded_string) - if decoded_username != self.username_2: - self.errors.append( - "Can't find username '%s' in data which profile link '%s' contains. String '%s' is found instead" % ( - self.username_2, self.profile_link_2, decoded_username)) public_key_2 = self.profile_link_2.split("#")[-1] def _device_1_creates_user(): diff --git a/test/appium/tests/critical/chats/test_group_chat.py b/test/appium/tests/critical/chats/test_group_chat.py index b02d68be767..e6ca294da71 100644 --- a/test/appium/tests/critical/chats/test_group_chat.py +++ b/test/appium/tests/critical/chats/test_group_chat.py @@ -453,7 +453,7 @@ def test_group_chat_mute_chat(self): current_time = datetime.datetime.strptime(device_time, "%Y-%m-%dT%H:%M:%S%z") expected_times = [current_time + datetime.timedelta(minutes=i) for i in range(479, 482)] expected_texts = [ - "Muted until %s %s" % (exp_time.strftime('%H:%M'), "today" if current_time.hour < 23 else "tomorrow") for + "Muted until %s %s" % (exp_time.strftime('%H:%M'), "today" if current_time.hour < 16 else "tomorrow") for exp_time in expected_times] chat = self.homes[1].get_chat(self.chat_name) chat.long_press_element() @@ -483,7 +483,7 @@ def test_group_chat_mute_chat(self): if after_mute_counter > initial_counter: self.errors.append("New messages counter near chats tab button is %s after mute, but should be %s" % ( after_mute_counter, initial_counter)) - if not chat.chat_preview.text.startswith("%s: %s" % (self.usernames[0], muted_message)): + if not chat.chat_preview.text.startswith("%s: %s" % (self.usernames[0], muted_message[:25])): self.errors.append("Message text '%s' is not shown in chat preview after mute" % muted_message) chat.click() if not self.chats[1].chat_element_by_text(muted_message).is_element_displayed(30): diff --git a/test/appium/tests/critical/chats/test_public_chat_browsing.py b/test/appium/tests/critical/chats/test_public_chat_browsing.py index 73a2cabb6bb..6f34f4e62ed 100644 --- a/test/appium/tests/critical/chats/test_public_chat_browsing.py +++ b/test/appium/tests/critical/chats/test_public_chat_browsing.py @@ -1021,6 +1021,8 @@ def test_community_leave(self): self.errors.append('Community is still shown in the list after leave') self.errors.verify_no_errors() + @marks.xfail(reason="Can't navigate to a community channel before joining the community, " + "https://github.com/status-im/status-mobile/issues/21776") @marks.testrail_id(702948) def test_community_hashtag_links_to_community_channels(self): for home in self.homes: @@ -1121,6 +1123,8 @@ def test_community_hashtag_links_to_community_channels(self): self.errors.verify_no_errors() + @marks.xfail(reason="Can't navigate to a community channel before joining the community, " + "https://github.com/status-im/status-mobile/issues/21776") @marks.testrail_id(703629) def test_community_join_when_node_owner_offline(self): for home in self.homes: diff --git a/test/appium/tests/critical/test_deep_and_universal_links.py b/test/appium/tests/critical/test_deep_and_universal_links.py index b2880a8af13..a3b166929d7 100644 --- a/test/appium/tests/critical/test_deep_and_universal_links.py +++ b/test/appium/tests/critical/test_deep_and_universal_links.py @@ -89,7 +89,7 @@ def test_deep_links_communities(self): self.home.get_chat(snt_community_name, community=True).click() snt_community_url = self.community_view.copy_community_link() self.home.reopen_app(sign_in=False) - self.sign_in.create_user(username="second user", first_user=False) + self.sign_in.create_user(first_user=False) self.home.browser_tab.click() old, new = "https://status.app/", "status-app://" diff --git a/test/appium/tests/critical/test_fallback.py b/test/appium/tests/critical/test_fallback.py index e3e7a320c3d..dcfa880f9f7 100644 --- a/test/appium/tests/critical/test_fallback.py +++ b/test/appium/tests/critical/test_fallback.py @@ -269,7 +269,7 @@ def test_fallback_validate_seed_phrase(self): self.sign_in_2.passphrase_edit_box.clear() self.sign_in_2.passphrase_edit_box.send_keys(transaction_senders['A']['passphrase']) self.sign_in_2.continue_button.click() - if not self.sign_in_2.profile_title_input.is_element_displayed(): + if not self.sign_in_2.password_input.is_element_displayed(): self.errors.append("Can't recover an access with a valid passphrase") self.sign_in_2.click_system_back_button() diff --git a/test/appium/tests/critical/test_wallet.py b/test/appium/tests/critical/test_wallet.py index 8ccc9471fcf..5c37b7d3702 100644 --- a/test/appium/tests/critical/test_wallet.py +++ b/test/appium/tests/critical/test_wallet.py @@ -59,19 +59,19 @@ def _check_balances_after_tx(self, amount_to_send, sender_balance, receiver_bala def wait_for_wallet_balance_to_update(wallet_view, user_name, initial_eth_amount): wallet_view.just_fyi("Getting ETH amount in the wallet of the %s after transaction" % user_name) - if user_name == 'sender': + if user_name == self.sender_username: exp_amount = round(initial_eth_amount - amount_to_send, 4) else: exp_amount = round(initial_eth_amount + amount_to_send, 4) # for _ in range(12): # ToDo: 120 sec wait time, enable when autoupdate feature is ready new_eth_amount = round(wallet_view.get_asset(asset_name='Ether').get_amount(), 4) - if user_name == 'sender' and new_eth_amount <= exp_amount: + if user_name == self.sender_username and new_eth_amount <= exp_amount: return - if user_name == 'receiver' and new_eth_amount >= exp_amount: + if user_name == self.receiver_username and new_eth_amount >= exp_amount: return self.errors.append( - "Eth amount in the %ss wallet is %s but should be %s" % (user_name, new_eth_amount, exp_amount)) + "Eth amount in the %s's wallet is %s but should be %s" % (user_name, new_eth_amount, exp_amount)) # ToDo: disable relogin when autoupdate feature is ready self.home_1.just_fyi("Relogin for getting an updated balance") diff --git a/test/appium/views/home_view.py b/test/appium/views/home_view.py index 8d245191f96..1c8589d0e0d 100644 --- a/test/appium/views/home_view.py +++ b/test/appium/views/home_view.py @@ -626,6 +626,7 @@ def get_new_device_installation_id(self): return element.text def get_username(self): + self.toast_content_element.wait_for_invisibility_of_element() profile_view = self.get_profile_view() profile_view = self.profile_button.click_until_presence_of_element(profile_view.default_username_text) profile_view.default_username_text.wait_for_element(3) diff --git a/test/appium/views/sign_in_view.py b/test/appium/views/sign_in_view.py index 914262e2b21..d9193313b79 100644 --- a/test/appium/views/sign_in_view.py +++ b/test/appium/views/sign_in_view.py @@ -361,8 +361,10 @@ def export_db(self, seed_phrase, file_to_export='export.db', password=common_pas def get_user_profile_by_name(self, username: str): self.driver.info("Getting username card by '%s'" % username) expected_element = UserProfileElement(self.driver, username=username) - return expected_element if expected_element.is_element_displayed(10) else self.driver.fail( - "User %s is not found!" % username) + if expected_element.is_element_displayed(10): + return expected_element + else: + raise NoSuchElementException(msg="User %s is not found!" % username) def get_user_profile_by_index(self, index: int): self.driver.info("Getting username card by index %s" % index)