From 5fffc230c9dece94e83a96d04867b6c2d11e9341 Mon Sep 17 00:00:00 2001 From: Churikova Tetiana Date: Fri, 24 Mar 2023 11:06:20 +0100 Subject: [PATCH] e2e: new community screens --- test/appium/support/testrail_report.py | 2 +- .../critical/test_public_chat_browsing.py | 25 +++-- .../tests/medium/test_activity_center.py | 20 ++-- .../test_deeplink_chat_share_profile.py | 94 +++++++++---------- test/appium/views/chat_view.py | 21 ++++- 5 files changed, 92 insertions(+), 70 deletions(-) diff --git a/test/appium/support/testrail_report.py b/test/appium/support/testrail_report.py index 9ba655602b..7a424e64d1 100644 --- a/test/appium/support/testrail_report.py +++ b/test/appium/support/testrail_report.py @@ -123,7 +123,7 @@ class TestrailReport(BaseTestReport): test_cases['pr']['critical'] = 50955 test_cases['pr']['one_to_one_chat'] = 50956 - test_cases['pr']['deep_links'] = 50967 + # test_cases['pr']['deep_links'] = 50967 test_cases['pr']['group_chat'] = 50964 test_cases['pr']['community_single'] = 50983 test_cases['pr']['community_multiple'] = 50982 diff --git a/test/appium/tests/critical/test_public_chat_browsing.py b/test/appium/tests/critical/test_public_chat_browsing.py index 956521fce7..7a85f64d6f 100644 --- a/test/appium/tests/critical/test_public_chat_browsing.py +++ b/test/appium/tests/critical/test_public_chat_browsing.py @@ -309,10 +309,13 @@ class TestCommunityOneDeviceMerged(MultipleSharedDeviceTestCase): self.home = self.sign_in.create_user() self.home.communities_tab.click_until_presence_of_element(self.home.plus_button) self.community_name = self.home.get_random_chat_name() - self.channel_name = self.home.get_random_chat_name() - self.community = self.home.create_community(name=self.community_name, description='test description', - require_approval=False) - self.channel = self.community.add_channel(name=self.channel_name) + self.channel_name = 'general' + self.community = self.home.create_community(name=self.community_name, description='test description') + + self.home.jump_to_communities_home() + self.home.get_chat(self.community_name, community=True).click() + community_view = self.home.get_community_view() + self.channel = community_view.get_channel(self.channel_name).click() @marks.testrail_id(702846) def test_community_navigate_to_channel_when_relaunch(self): @@ -378,16 +381,20 @@ class TestCommunityMultipleDeviceMerged(MultipleSharedDeviceTestCase): self.home_1.just_fyi("Open community to message") self.home_1.communities_tab.click() self.community_name = self.home_1.get_random_chat_name() - self.channel_name = self.home_1.get_random_chat_name() + self.channel_name = 'general' self.home_1.create_community(name=self.community_name, description='community to test', require_approval=False) - self.community_1 = CommunityView(self.drivers[0]) - self.community_1.send_invite_to_community(self.default_username_2) - self.channel_1 = self.community_1.add_channel(self.channel_name) + self.home_1.jump_to_communities_home() + self.home_1.get_chat(self.community_name, community=True).click() + community_view = self.home_1.get_community_view() + self.channel_1 = community_view.get_channel(self.channel_name).click() self.channel_1.send_message(self.text_message) + self.community_1 = CommunityView(self.drivers[0]) + self.community_1.send_invite_to_community(self.community_name, self.default_username_2) + self.chat_2 = self.home_2.get_chat(self.default_username_1).click() self.chat_2.element_by_text_part('View').click() self.community_2 = CommunityView(self.drivers[1]) - self.community_2.join_button.click() + self.community_2.join_community() self.home_1.just_fyi("Reopen community view to use new interface") for home in (self.home_1, self.home_2): diff --git a/test/appium/tests/medium/test_activity_center.py b/test/appium/tests/medium/test_activity_center.py index ad06f7feb3..88fd15b3ad 100644 --- a/test/appium/tests/medium/test_activity_center.py +++ b/test/appium/tests/medium/test_activity_center.py @@ -211,16 +211,20 @@ class TestActivityMultipleDevicePR(MultipleSharedDeviceTestCase): self.home_1.just_fyi("Open community to message") self.home_1.communities_tab.click() self.community_name = self.home_1.get_random_chat_name() - self.channel_name = self.home_1.get_random_chat_name() + self.channel_name = 'general' self.home_1.create_community(name=self.community_name, description='community to test', require_approval=False) + self.home_1.jump_to_communities_home() + self.home_1.get_chat(self.community_name, community=True).click() + community_view = self.home_1.get_community_view() + self.channel_1 = community_view.get_channel(self.channel_name).click() + self.channel_1.send_message(self.text_message) self.community_1 = CommunityView(self.drivers[0]) - self.community_1.send_invite_to_community(self.default_username_2) - self.channel_1 = self.community_1.add_channel(self.channel_name) + self.community_1.send_invite_to_community(self.community_name, self.default_username_2) + self.chat_2 = self.home_2.get_chat(self.default_username_1).click() self.chat_2.element_by_text_part('View').click() self.community_2 = CommunityView(self.drivers[1]) - self.community_2.join_button.click() - self.channel_1.send_message(self.text_message) + self.community_2.join_community() self.home_1.just_fyi("Reopen community view to use new interface") for home in (self.home_1, self.home_2): @@ -372,7 +376,7 @@ class TestActivityMultipleDevicePR(MultipleSharedDeviceTestCase): community_name = 'commun_to_check_notif' self.channel_name = self.home_1.get_random_chat_name() self.home_1.create_community(name=community_name, description='community to test', require_approval=True) - self.home_1.click_system_back_button_until_element_is_shown() + self.home_1.reopen_app() community_element = self.home_1.get_chat(community_name, community=True) self.community_1.share_community(community_element, self.default_username_2) @@ -380,8 +384,8 @@ class TestActivityMultipleDevicePR(MultipleSharedDeviceTestCase): self.home_2.jump_to_messages_home() self.chat_2 = self.home_2.get_chat(self.default_username_1).click() self.chat_2.element_by_text_part('View').click() - self.community_2.request_access_button.click() - self.community_2.jump_to_communities_home() + self.community_2.join_community() + [home.jump_to_communities_home() for home in (self.home_1, self.home_2)] self.home_1.just_fyi("Checking unread indicators") self.home_1.notifications_unread_badge.wait_for_visibility_of_element(120) diff --git a/test/appium/tests/medium/test_deeplink_chat_share_profile.py b/test/appium/tests/medium/test_deeplink_chat_share_profile.py index f89caeaa68..fe1a935325 100644 --- a/test/appium/tests/medium/test_deeplink_chat_share_profile.py +++ b/test/appium/tests/medium/test_deeplink_chat_share_profile.py @@ -334,54 +334,54 @@ class TestDeeplinkChatProfileOneDevice(MultipleSharedDeviceTestCase): self.errors.verify_no_errors() +# Skipped before proper testing of ENS names on goerli +# @pytest.mark.xdist_group(name="new_one_1") +# @marks.new_ui_critical +# class TestDeeplinkOneDeviceNewUI(MultipleSharedDeviceTestCase): +# +# def prepare_devices(self): +# self.drivers, self.loop = create_shared_drivers(1) +# self.sign_in = SignInView(self.drivers[0]) +# self.home = self.sign_in.create_user() +# self.public_key, self.default_username = self.home.get_public_key_and_username(return_username=True) +# self.home.click_system_back_button_until_element_is_shown() +# self.home.chats_tab.click_until_presence_of_element(self.home.plus_button) +# +# @marks.testrail_id(702774) +# def test_deep_link_with_invalid_user_public_key_own_profile_key(self): +# self.drivers[0].close_app() +# +# self.sign_in.just_fyi('Check that no error when opening invalid deep link') +# deep_link = 'status-im://u/%s' % self.public_key[:-10] +# self.sign_in.open_weblink_and_login(deep_link) +# self.home = self.sign_in.get_home_view() +# self.home.chats_tab.click_until_presence_of_element(self.home.plus_button) +# if not self.home.plus_button.is_element_displayed(): +# self.errors.append( +# "Can't navigate to chats tab after app opened from deep link with invalid public key") +# self.drivers[0].close_app() +# +# self.sign_in.just_fyi('Check that no error when opening own valid deep link') +# deep_link = 'status-im://u/%s' % self.public_key +# self.sign_in.open_weblink_and_login(deep_link) +# profile = self.home.get_profile_view() +# if profile.default_username_text.text != self.default_username: +# self.errors.append("Can't navigate to profile from deep link with own public key") +# self.errors.verify_no_errors() -@pytest.mark.xdist_group(name="new_one_1") -@marks.new_ui_critical -class TestDeeplinkOneDeviceNewUI(MultipleSharedDeviceTestCase): - - def prepare_devices(self): - self.drivers, self.loop = create_shared_drivers(1) - self.sign_in = SignInView(self.drivers[0]) - self.home = self.sign_in.create_user() - self.public_key, self.default_username = self.home.get_public_key_and_username(return_username=True) - self.home.click_system_back_button_until_element_is_shown() - self.home.chats_tab.click_until_presence_of_element(self.home.plus_button) - - @marks.testrail_id(702774) - def test_deep_link_with_invalid_user_public_key_own_profile_key(self): - self.drivers[0].close_app() - - self.sign_in.just_fyi('Check that no error when opening invalid deep link') - deep_link = 'status-im://u/%s' % self.public_key[:-10] - self.sign_in.open_weblink_and_login(deep_link) - self.home = self.sign_in.get_home_view() - self.home.chats_tab.click_until_presence_of_element(self.home.plus_button) - if not self.home.plus_button.is_element_displayed(): - self.errors.append( - "Can't navigate to chats tab after app opened from deep link with invalid public key") - self.drivers[0].close_app() - - self.sign_in.just_fyi('Check that no error when opening own valid deep link') - deep_link = 'status-im://u/%s' % self.public_key - self.sign_in.open_weblink_and_login(deep_link) - profile = self.home.get_profile_view() - if profile.default_username_text.text != self.default_username: - self.errors.append("Can't navigate to profile from deep link with own public key") - self.errors.verify_no_errors() - - @marks.testrail_id(702775) - @marks.xfail(reason="Profile is often not opened in e2e builds for some reason. Needs to be investigated.") - def test_deep_link_open_user_profile(self): - for user_ident in ens_user['ens'], ens_user['ens_upgrade'], ens_user['public_key']: - self.drivers[0].close_app() - deep_link = 'status-im://u/%s' % user_ident - self.sign_in.open_weblink_and_login(deep_link) - chat = self.sign_in.get_chat_view() - chat.wait_for_element_starts_with_text(ens_user['ens']) - - for text in ens_user['ens'], self.sign_in.get_translation_by_key("add-to-contacts"): - if not chat.element_by_text(text).scroll_to_element(10): - self.drivers[0].fail("User profile screen is not opened") + # @marks.testrail_id(702775) + # @marks.xfail(reason="Profile is often not opened in e2e builds for some reason. Needs to be investigated.") + # def test_deep_link_open_user_profile(self): + # for user_ident in ens_user['ens']: + # self.drivers[0].close_app() + # deep_link = 'status-im://u/%s' % user_ident + # self.sign_in.open_weblink_and_login(deep_link) + # chat = self.sign_in.get_chat_view() + # chat.wait_for_element_starts_with_text(ens_user['ens']) + # + # for text in ens_user['ens'], self.sign_in.get_translation_by_key("add-to-contacts"): + # if not chat.element_by_text(text).scroll_to_element(10): + # self.drivers[0].fail("User profile screen is not opened") # @marks.testrail_id(702777) # @marks.skip(reason="Skipping until chat names are implemented in new UI") diff --git a/test/appium/views/chat_view.py b/test/appium/views/chat_view.py index d15233ab0e..49826a18df 100644 --- a/test/appium/views/chat_view.py +++ b/test/appium/views/chat_view.py @@ -337,8 +337,9 @@ class CommunityView(HomeView): self.channel_name_edit_box = EditBox(self.driver, translation_id="name-your-channel-placeholder") self.channel_descripton = ChatView(self.driver).community_description_edit_box self.community_options_button = Button(self.driver, accessibility_id="community-menu-button") + self.view_members_button = Button(self.driver, accessibility_id="view-members") self.community_info_button = Button(self.driver, translation_id="community-info") - self.invite_button = Button(self.driver, accessibility_id="invite-button") + self.invite_button = Button(self.driver, accessibility_id="community-invite-people") # Community info page self.community_membership_request_value = Text(self.driver, translation_id="members-label", @@ -358,13 +359,20 @@ class CommunityView(HomeView): # Requesting access to community / joining community self.request_access_button = Button(self.driver, translation_id="request-access") self.membership_request_pending_text = Text(self.driver, translation_id="membership-request-pending") - self.join_button = Button(self.driver, translation_id="join") + self.join_button = Button(self.driver, accessibility_id="show-request-to-join-screen-button") + self.join_community_button = Button(self.driver, accessibility_id="join-community-button") self.follow_button = Button(self.driver, translation_id="follow") #### NEW UI # Communities initial page self.community_description_text = Text(self.driver, accessibility_id="community-description-text") + def join_community(self): + self.join_button.click() + self.checkbox_button.scroll_and_click() + self.join_community_button.scroll_and_click() + + def get_channel(self, channel_name: str): self.driver.info("Getting %s channel element in community" % channel_name) chat_element = self.get_chat(username=channel_name, community_channel=True, wait_time=30) @@ -407,12 +415,15 @@ class CommunityView(HomeView): Button(self.driver, xpath="//*[starts-with(@text,'%s')]%s" % (username, decline_suffix)).click() self.close_button.click() - def send_invite_to_community(self, user_names_to_invite): + def send_invite_to_community(self, community_name, user_names_to_invite): if isinstance(user_names_to_invite, str): user_names_to_invite = [user_names_to_invite] self.driver.info("Send %s invite to community" % ', '.join(map(str, user_names_to_invite))) - self.community_options_button.click() - self.community_info_button.click() + self.jump_to_communities_home() + home = self.get_home_view() + community_element = home.get_chat(community_name, community=True) + community_element.long_press_until_element_is_shown(self.view_members_button) + self.view_members_button.click_until_presence_of_element(self.invite_button) self.invite_button.click() for user_name in user_names_to_invite: user_contact = self.element_by_text_part(user_name)