Skip to content

Commit

Permalink
e2e: added checks for non-token gated community channels
Browse files Browse the repository at this point in the history
  • Loading branch information
yevh-berdnyk committed Jan 4, 2024
1 parent 205962f commit 5a83287
Showing 1 changed file with 41 additions and 4 deletions.
45 changes: 41 additions & 4 deletions test/appium/tests/critical/chats/test_public_chat_browsing.py
Original file line number Diff line number Diff line change
Expand Up @@ -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()
Expand All @@ -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")
Expand All @@ -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")
Expand Down Expand Up @@ -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
Expand All @@ -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()
Expand Down

0 comments on commit 5a83287

Please sign in to comment.