Skip to content

Commit

Permalink
e2e: fixes 6.09
Browse files Browse the repository at this point in the history
  • Loading branch information
yevh-berdnyk committed Sep 6, 2023
1 parent 155f57c commit 7502e95
Show file tree
Hide file tree
Showing 8 changed files with 33 additions and 23 deletions.
2 changes: 0 additions & 2 deletions test/appium/tests/base_test_case.py
Original file line number Diff line number Diff line change
Expand Up @@ -27,8 +27,6 @@

implicit_wait = 5

app_package = 'im.status.ethereum'


def get_capabilities_local():
desired_caps = dict()
Expand Down
6 changes: 4 additions & 2 deletions test/appium/tests/critical/chats/test_1_1_public_chats.py
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
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

Expand Down Expand Up @@ -162,6 +162,7 @@ def test_1_1_chat_command_request_and_send_tx_stt_in_1_1_chat_offline(self):
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)
Expand Down Expand Up @@ -1122,7 +1123,7 @@ def test_1_1_chat_non_latin_messages_stack_update_profile_photo(self):
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()

Expand Down Expand Up @@ -1369,6 +1370,7 @@ def test_1_1_chat_is_shown_message_sent_delivered_from_offline(self):
# 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)
Expand Down
3 changes: 2 additions & 1 deletion test/appium/tests/critical/chats/test_group_chat.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
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

Expand Down Expand Up @@ -412,6 +412,7 @@ def test_group_chat_offline_pn(self):
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)
Expand Down
6 changes: 4 additions & 2 deletions test/appium/tests/critical/test_public_chat_browsing.py
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@
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
Expand Down Expand Up @@ -134,7 +134,7 @@ def test_public_chat_tag_message(self):

@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)
Expand Down Expand Up @@ -323,6 +323,7 @@ def prepare_devices(self):
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()
Expand Down Expand Up @@ -912,6 +913,7 @@ def test_community_contact_block_unblock_offline(self):
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()
Expand Down
3 changes: 2 additions & 1 deletion test/appium/tests/medium/test_chats_m.py
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@

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

Expand Down Expand Up @@ -940,6 +940,7 @@ def test_keycard_1_1_chat_command_request_and_send_tx_stt_in_1_1_chat_offline_op

@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"
Expand Down
6 changes: 5 additions & 1 deletion test/appium/views/base_view.py
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,6 @@
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
Expand Down Expand Up @@ -644,6 +643,7 @@ def jump_to_card_by_text(self, text: str):
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:
Expand Down Expand Up @@ -746,6 +746,10 @@ def open_universal_web_link(self, deep_link):
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):
Expand Down
2 changes: 1 addition & 1 deletion test/appium/views/chat_view.py
Original file line number Diff line number Diff line change
Expand Up @@ -1209,7 +1209,7 @@ def mention_user(self, user_name: str):
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")

Expand Down
28 changes: 15 additions & 13 deletions test/appium/views/home_view.py
Original file line number Diff line number Diff line change
Expand Up @@ -361,19 +361,21 @@ def handle_contact_request(self, username: str, action='accept'):
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,
Expand Down

0 comments on commit 7502e95

Please sign in to comment.