From d2aac6c905446576e8a04c7baf70d7c1ee002b4b Mon Sep 17 00:00:00 2001 From: Churikova Tetiana Date: Tue, 28 Jun 2022 17:54:14 +0200 Subject: [PATCH] e2e: fixes nightly failures --- .../views/notification.cljs | 6 +- test/appium/tests/__init__.py | 2 +- .../tests/medium/test_activity_center.py | 3 +- .../tests/medium/test_browser_profile.py | 58 +++++++++---------- test/appium/tests/medium/test_chats_m.py | 1 + .../appium/tests/medium/test_single_device.py | 3 + test/appium/views/home_view.py | 27 +++++++++ 7 files changed, 67 insertions(+), 33 deletions(-) diff --git a/src/status_im/ui/screens/notifications_center/views/notification.cljs b/src/status_im/ui/screens/notifications_center/views/notification.cljs index 8fad25cd56..88383158c9 100644 --- a/src/status_im/ui/screens/notifications_center/views/notification.cljs +++ b/src/status_im/ui/screens/notifications_center/views/notification.cljs @@ -17,11 +17,13 @@ (defn contact-request-actions [request-id] [react/view {:flex-direction :row} - [animation/pressable {:on-press #(re-frame/dispatch [:contact-requests.ui/accept-request request-id])} + [animation/pressable {:on-press #(re-frame/dispatch [:contact-requests.ui/accept-request request-id]) + :accessibility-label :accept-cr} [icons/icon :main-icons/checkmark-circle {:width 35 :height 35 :color colors/green}]] - [animation/pressable {:on-press #(re-frame/dispatch [:contact-requests.ui/decline-request request-id])} + [animation/pressable {:on-press #(re-frame/dispatch [:contact-requests.ui/decline-request request-id]) + :accessibility-label :decline-cr} [icons/icon :main-icons/cancel {:width 35 :height 35 :container-style {:margin-left 16} diff --git a/test/appium/tests/__init__.py b/test/appium/tests/__init__.py index b107d03dba..2dccf68380 100644 --- a/test/appium/tests/__init__.py +++ b/test/appium/tests/__init__.py @@ -46,7 +46,7 @@ bootnode_address = "enode://a8a97f126f5e3a340cb4db28a1187c325290ec08b2c9a6b1f198 "fd3de3acb09cc38b5a05272e583a2365ad1fa67f66c55b34@167.99.210.203:30404" # referred to https://github.com/status-im/status-react/blob/develop/resources/config/fleets.json mailserver_address = 'enode://b74859176c9751d314aeeffc26ec9f866a412752e7ddec91b19018a18e7cca8d637cfe2cedcb972f8eb64d81' \ - '6fbd5b4e89c7e8c7fd7df8a1329fa43db80b0bfe:pass@47.52.90.156:443' + '6fbd5b4e89c7e8c7fd7df8a1329fa43db80b0bfe@47.52.90.156:443' staging_fleet = 'eth.staging' prod_fleet = 'eth.prod' # This fleet is used in the tests diff --git a/test/appium/tests/medium/test_activity_center.py b/test/appium/tests/medium/test_activity_center.py index 3303ccc0b6..16d2b7e963 100644 --- a/test/appium/tests/medium/test_activity_center.py +++ b/test/appium/tests/medium/test_activity_center.py @@ -45,6 +45,7 @@ class TestActivityCenterMultipleDeviceMedium(MultipleSharedDeviceTestCase): self.home_1.notifications_unread_badge.wait_and_click(20) self.home_1.notifications_select_button.click() self.home_1.element_by_text_part(self.username_2[:10]).click() + self.home_1.element_by_text_part("Please add me to your contacts").click() self.home_1.element_by_text_part(self.group_chat_name_1).click() self.home_1.notifications_reject_and_delete_button.click() if self.home_1.element_by_text_part(self.username_2[:20]).is_element_displayed(2): @@ -160,7 +161,7 @@ class TestActivityCenterMultipleDeviceMedium(MultipleSharedDeviceTestCase): self.home_1.just_fyi("Device1 joins Group chat 3") group_chat_1 = self.home_1.get_chat(self.group_chat_name_3).click() - group_chat_1.join_chat_button.click() + group_chat_1.join_chat_button.click_if_shown() group_chat_1.home_button.double_click() self.home_2.just_fyi("Device2 mentions Device1 in Group chat 3") diff --git a/test/appium/tests/medium/test_browser_profile.py b/test/appium/tests/medium/test_browser_profile.py index 56500bef60..ead6a7acbd 100644 --- a/test/appium/tests/medium/test_browser_profile.py +++ b/test/appium/tests/medium/test_browser_profile.py @@ -61,28 +61,6 @@ class TestBrowserProfileOneDevice(MultipleSharedDeviceTestCase): self.errors.verify_no_errors() - @marks.testrail_id(702179) - def test_browser_refresh_page(self): - - dapp = self.home.dapp_tab_button.click() - url = 'app.uniswap.org' - - dapp.just_fyi("Check refresh button") - web_page = dapp.open_url(url) - dapp.allow_button.click() - element_on_start_page = dapp.element_by_text('Select a token') - dapp.allow_button.click() - element_on_start_page.scroll_and_click() - - # when bottom sheet is opened, elements by text couldn't be found - element_on_start_page.wait_for_invisibility_of_element(20) - web_page.browser_refresh_page_button.click() - - if not element_on_start_page.is_element_displayed(30): - self.errors.append("Page failed to be refreshed") - - self.errors.verify_no_errors() - @marks.testrail_id(702201) def test_browser_resolve_ipns_name(self): ipns_url = 'uniswap.eth' @@ -94,9 +72,9 @@ class TestBrowserProfileOneDevice(MultipleSharedDeviceTestCase): self.home.just_fyi('Opening url containing ipns name') dapp = self.home.dapp_tab_button.click() web_page = dapp.open_url(ipns_url) - if not dapp.allow_button.is_element_displayed(60): - self.home.driver.fail('No permission is asked for dapp, so IPNS name is not resolved') - dapp.allow_button.click() + element_on_start_page = dapp.element_by_text('Select a token') + if not element_on_start_page.is_element_displayed(60): + self.home.driver.fail('No start element is shown for dapp, so IPNS name is not resolved') # Switching back to ropsten web_page.profile_button.click() @@ -104,6 +82,28 @@ class TestBrowserProfileOneDevice(MultipleSharedDeviceTestCase): self.errors.verify_no_errors() + @marks.testrail_id(702179) + def test_browser_refresh_page(self): + + dapp = self.home.dapp_tab_button.click() + url = 'app.uniswap.org' + + dapp.just_fyi("Check refresh button") + web_page = dapp.open_url(url) + dapp.allow_button.click_if_shown() + element_on_start_page = dapp.element_by_text('Select a token') + dapp.allow_button.click_if_shown() + element_on_start_page.scroll_and_click() + + # when bottom sheet is opened, elements by text couldn't be found + element_on_start_page.wait_for_invisibility_of_element(20) + web_page.browser_refresh_page_button.click() + + if not element_on_start_page.is_element_displayed(30): + self.errors.append("Page failed to be refreshed") + + self.errors.verify_no_errors() + @marks.testrail_id(702151) def test_browser_open_url_with_non_english_text(self): dapp = self.home.dapp_tab_button.click() @@ -227,8 +227,8 @@ class TestBrowserProfileOneDevice(MultipleSharedDeviceTestCase): 'username': basic_user['username'], }, 'pasting_ens_another_domain': { - 'contact_code': ens_user['ens_another'], - 'username': '@%s' % ens_user['ens_another'], + 'contact_code': ens_user['ens'], + 'username': '@%s' % ens_user['ens'], 'nickname': 'my_dear_friend' }, @@ -258,7 +258,7 @@ class TestBrowserProfileOneDevice(MultipleSharedDeviceTestCase): (key, users[key]['nickname'])) self.home.just_fyi('Remove contact and check that it disappeared') - user_to_remove = '@%s' % ens_user['ens_another'] + user_to_remove = '@%s' % ens_user['ens'] profile.element_by_text(user_to_remove).click() chat.remove_from_contacts.click() chat.close_button.click() @@ -269,7 +269,7 @@ class TestBrowserProfileOneDevice(MultipleSharedDeviceTestCase): 'Relogin and open profile view of the contact removed from Contact list to ensure there is no crash') profile.profile_button.click() profile.relogin() - one_to_one_chat = self.home.add_contact(public_key=ens_user['ens_another'], add_in_contacts=False) + one_to_one_chat = self.home.add_contact(public_key=ens_user['ens'], add_in_contacts=False) one_to_one_chat.chat_options.click() profile = one_to_one_chat.view_profile_button.click() if profile.remove_from_contacts.is_element_displayed(): diff --git a/test/appium/tests/medium/test_chats_m.py b/test/appium/tests/medium/test_chats_m.py index e1d1d18459..caf694fb0a 100644 --- a/test/appium/tests/medium/test_chats_m.py +++ b/test/appium/tests/medium/test_chats_m.py @@ -33,6 +33,7 @@ class TestTimelineHistoryNodesBootnodesMultipleDeviceMergedMedium(MultipleShared self.home_2.add_contact(self.public_key_1, add_in_contacts=False) @marks.testrail_id(702284) + @marks.xfail(reason='flaky; sometimes can be errorred due to scroll of long timeline') def test_public_chat_timeline_different_statuses_reaction(self): emoji_message = random.choice(list(emoji.EMOJI_UNICODE)) emoji_unicode = emoji.EMOJI_UNICODE[emoji_message] diff --git a/test/appium/tests/medium/test_single_device.py b/test/appium/tests/medium/test_single_device.py index 127bd53c2f..c668ec1175 100644 --- a/test/appium/tests/medium/test_single_device.py +++ b/test/appium/tests/medium/test_single_device.py @@ -1011,6 +1011,9 @@ class TestChatManagement(SingleDeviceTestCase): for user in users: usernames.append(user['username']) + profile = home.profile_button.click() + profile.element_by_text('20').wait_for_visibility_of_element(120) + home.home_button.double_click() home.just_fyi('Create group chat with max amount of users') chat = home.create_group_chat(usernames, 'some_group_chat') diff --git a/test/appium/views/home_view.py b/test/appium/views/home_view.py index b254d3537a..5b0a4999cb 100644 --- a/test/appium/views/home_view.py +++ b/test/appium/views/home_view.py @@ -136,6 +136,22 @@ class ActivityCenterChatElement(SilentButton): except NoSuchElementException: return '' + def accept_contact_request(self): + try: + accept_element = Button(self.driver, xpath=self.locator + '/*[@content-desc="accept-cr"]').find_element() + except NoSuchElementException: + return '' + if accept_element: + accept_element.click() + + def decline_contact_request(self): + try: + decline_element = Button(self.driver, xpath=self.locator + '/*[@content-desc="decline-cr"]').find_element() + except NoSuchElementException: + return '' + if decline_element: + decline_element.click() + class PushNotificationElement(SilentButton): def __init__(self, driver, pn_text): @@ -251,6 +267,17 @@ class HomeView(BaseView): chat_element = ActivityCenterChatElement(self.driver, chat_name[:25]) return chat_element + def handle_contact_request(self, username: str, accept=True): + self.notifications_unread_badge.wait_and_click() + chat_element = ActivityCenterChatElement(self.driver, username[:25]) + if accept: + self.driver.info("Accepting contact request for %s" % username) + chat_element.accept_contact_request() + chat_element.click() + else: + self.driver.info("Rejecting contact request for %s" % username) + chat_element.decline_contact_request() + def get_username_below_start_new_chat_button(self, username_part): return Text(self.driver, xpath="//*[@content-desc='enter-contact-code-input']/../..//*[starts-with(@text,'%s')]" % username_part)