Skip to content

Commit

Permalink
e2e: False failures fixes
Browse files Browse the repository at this point in the history
  • Loading branch information
yevh-berdnyk committed Dec 10, 2024
1 parent 949e78a commit c8b0634
Show file tree
Hide file tree
Showing 8 changed files with 17 additions and 18 deletions.
8 changes: 0 additions & 8 deletions test/appium/tests/activity_center/test_activity_center.py
Original file line number Diff line number Diff line change
Expand Up @@ -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():
Expand Down
4 changes: 2 additions & 2 deletions test/appium/tests/critical/chats/test_group_chat.py
Original file line number Diff line number Diff line change
Expand Up @@ -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()
Expand Down Expand Up @@ -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):
Expand Down
4 changes: 4 additions & 0 deletions test/appium/tests/critical/chats/test_public_chat_browsing.py
Original file line number Diff line number Diff line change
Expand Up @@ -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:
Expand Down Expand Up @@ -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:
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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://"
Expand Down
2 changes: 1 addition & 1 deletion test/appium/tests/critical/test_fallback.py
Original file line number Diff line number Diff line change
Expand Up @@ -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()

Expand Down
8 changes: 4 additions & 4 deletions test/appium/tests/critical/test_wallet.py
Original file line number Diff line number Diff line change
Expand Up @@ -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")
Expand Down
1 change: 1 addition & 0 deletions test/appium/views/home_view.py
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down
6 changes: 4 additions & 2 deletions test/appium/views/sign_in_view.py
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down

0 comments on commit c8b0634

Please sign in to comment.