From 5a832871fec0de8e5cb2fcf9f4385c108abcb0fd Mon Sep 17 00:00:00 2001 From: Yevheniia Berdnyk Date: Thu, 4 Jan 2024 19:14:49 +0200 Subject: [PATCH] e2e: added checks for non-token gated community channels --- .../chats/test_public_chat_browsing.py | 45 +++++++++++++++++-- 1 file changed, 41 insertions(+), 4 deletions(-) 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 62df30e80cc..1f8fc336779 100644 --- a/test/appium/tests/critical/chats/test_public_chat_browsing.py +++ b/test/appium/tests/critical/chats/test_public_chat_browsing.py @@ -990,8 +990,6 @@ def test_community_leave(self): self.errors.verify_no_errors() @marks.testrail_id(702948) - @marks.xfail( - reason="Can't navigate to a channel by hashtag link, https://github.com/status-im/status-mobile/issues/18095") def test_community_hashtag_links_to_community_channels(self): for home in self.homes: home.navigate_back_to_home_view() @@ -1002,11 +1000,32 @@ def test_community_hashtag_links_to_community_channels(self): self.home_1.create_community(community_type="closed") community_name = "closed community" self.community_1.share_community(community_name, self.username_2) + self.community_1.get_to_community_channel_from_home(community_name, "general") + control_message_general_chat = "this message should be visible to the user before joining" + self.channel_1.send_message(control_message_general_chat) - self.home_2.just_fyi("Device 2 joins the community") + self.home_2.just_fyi("Device 2 checks the community channels and message inside") self.home_2.get_chat(self.username_1).click() control_message_1_1_chat = "it is just a message text" self.chat_2.send_message(control_message_1_1_chat) + self.chat_2.chat_element_by_text("https://status.app/c/").click_on_link_inside_message_body() + closed_com_channels = dogs_channel, cats_channel = "dogs", "cats" # not checking the last channel '# rules' to avoid scrolling + not_shown = list() + for chan_name in closed_com_channels: + if not self.community_2.get_channel(chan_name).is_element_displayed(): + not_shown.append(chan_name) + if not_shown: + self.errors.append("Not all channels are shown in community before joining: %s" % not_shown) + chan = self.community_2.get_channel("general") + if chan.is_element_displayed(): + chan.click() + if not self.channel_2.chat_element_by_text(control_message_general_chat).is_element_displayed(20): + self.errors.append("Message in community channel is not visible for user before join") + else: + not_shown.append("general") + + self.home_2.just_fyi("Device 2 joins the community") + self.home_2.jump_to_card_by_text(self.username_1) self.community_2.join_community(open_community=False) self.home_1.just_fyi("Device 1 accepts the community request") @@ -1021,7 +1040,6 @@ def test_community_hashtag_links_to_community_channels(self): self.home_1.activity_notification_swipe_button.click() self.home_1.close_activity_centre.click() - dogs_channel, cats_channel = "dogs", "cats" cats_message = "Where is a cat?" self.home_1.just_fyi("Device 1 sends a message in the cats channel") @@ -1084,6 +1102,16 @@ def test_community_join_when_node_owner_offline(self): self.home_1.create_community(community_type="open") community_name = "open community" self.community_1.share_community(community_name, self.username_2) + self.community_1.get_to_community_channel_from_home(community_name, "general") + control_message_general_chat = "this message should be visible to the user before joining" + self.channel_1.send_message(control_message_general_chat) + try: + self.channel_1.chat_element_by_text(control_message_general_chat).wait_for_status_to_be( + expected_status='Delivered', + timeout=60) + message_sent = True + except TimeoutException: + message_sent = False self.home_1.just_fyi("Device 1 goes offline") app_package = self.device_1.driver.current_package @@ -1103,6 +1131,15 @@ def test_community_join_when_node_owner_offline(self): self.errors.append("Toast element with the text \"%s\" doesn't appear" % exp_text) if not self.community_2.community_status_pending.is_element_displayed(): self.errors.append("Pending status is not displayed") + general_channel = self.community_2.get_channel("general") + if general_channel.is_element_displayed(): + general_channel.click() + if not self.channel_2.chat_element_by_text(control_message_general_chat).is_element_displayed(30): + self.errors.append( + "Message in community channel is not visible for user before join, it was indicated as" \ + "%s sent for the sender before he went offline" % "" if message_sent else "not") + else: + self.errors.append("Community channel is not displayed for user before join") self.community_2.toast_content_element.wait_for_invisibility_of_element(30) self.community_2.close_community_view_button.click() self.home_2.pending_communities_tab.click()