e2e: Added test for message with hashtag in communtiy channel
This commit is contained in:
parent
8bab9f8f22
commit
625510d6c9
|
@ -570,7 +570,7 @@ class TestCommunityMultipleDeviceMerged(MultipleSharedDeviceTestCase):
|
||||||
# self.chat_2 = self.home_2.get_chat(self.username_1).click()
|
# self.chat_2 = self.home_2.get_chat(self.username_1).click()
|
||||||
self.home_2.just_fyi("Send message to contact (need for blocking contact) test")
|
self.home_2.just_fyi("Send message to contact (need for blocking contact) test")
|
||||||
self.chat_2.send_message(self.text_message)
|
self.chat_2.send_message(self.text_message)
|
||||||
self.chat_2.element_by_text_part('View').click()
|
self.chat_2.chat_element_by_text(self.community_name).view_community_button.click()
|
||||||
self.community_2.join_community()
|
self.community_2.join_community()
|
||||||
self.channel_2 = self.community_2.get_channel(self.channel_name).click()
|
self.channel_2 = self.community_2.get_channel(self.channel_name).click()
|
||||||
|
|
||||||
|
@ -1143,3 +1143,74 @@ class TestCommunityMultipleDeviceMerged(MultipleSharedDeviceTestCase):
|
||||||
if not community.is_element_disappeared():
|
if not community.is_element_disappeared():
|
||||||
self.errors.append('Community is still shown in the list after leave')
|
self.errors.append('Community is still shown in the list after leave')
|
||||||
self.errors.verify_no_errors()
|
self.errors.verify_no_errors()
|
||||||
|
|
||||||
|
@marks.xfail(reason="Can't invite user to closed community https://github.com/status-im/status-mobile/issues/16968",
|
||||||
|
run=False)
|
||||||
|
@marks.testrail_id(702948)
|
||||||
|
def test_community_hashtag_links_to_community_channels(self):
|
||||||
|
for home in self.homes:
|
||||||
|
home.click_system_back_button_until_element_is_shown()
|
||||||
|
self.home_2.jump_to_messages_home()
|
||||||
|
self.home_1.jump_to_communities_home()
|
||||||
|
|
||||||
|
self.home_1.just_fyi("Device 1 creates a closed community")
|
||||||
|
self.home_1.create_community(community_type="closed")
|
||||||
|
community_name = "closed community"
|
||||||
|
self.community_1.send_invite_to_community(community_name, self.username_2)
|
||||||
|
|
||||||
|
self.home_2.just_fyi("Device 2 joins the community")
|
||||||
|
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(community_name).view_community_button.click()
|
||||||
|
self.community_2.join_community()
|
||||||
|
|
||||||
|
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")
|
||||||
|
self.home_1.get_to_community_channel_from_home(community_name=community_name, channel_name=cats_channel)
|
||||||
|
self.channel_1.send_message(cats_message)
|
||||||
|
self.channel_1.click_system_back_button_until_element_is_shown(
|
||||||
|
element=self.community_1.get_channel(dogs_channel))
|
||||||
|
|
||||||
|
self.home_1.just_fyi("Device 1 sends a message with hashtag in the dogs channel")
|
||||||
|
self.community_1.get_channel(dogs_channel).click_until_presence_of_element(self.channel_1.chat_message_input)
|
||||||
|
message_with_hashtag = "#cats"
|
||||||
|
self.channel_1.send_message(message_with_hashtag)
|
||||||
|
|
||||||
|
self.home_2.just_fyi("Device 2 clicks on the message with hashtag in the community channel")
|
||||||
|
self.community_2.get_channel(dogs_channel).click_until_presence_of_element(self.channel_2.chat_message_input)
|
||||||
|
self.channel_2.chat_element_by_text(message_with_hashtag).message_body.wait_for_visibility_of_element(30)
|
||||||
|
self.channel_2.chat_element_by_text(message_with_hashtag).message_body.click_inside_element_by_coordinate(
|
||||||
|
rel_x=0.2, rel_y=0.5)
|
||||||
|
if not self.channel_2.chat_element_by_text(cats_message).is_element_displayed(30):
|
||||||
|
self.errors.append("Receiver was not navigated to the cats channel")
|
||||||
|
|
||||||
|
self.home_1.just_fyi("Device 1 clicks on the message with hashtag in the community channel")
|
||||||
|
self.channel_1.chat_element_by_text(message_with_hashtag).message_body.click_inside_element_by_coordinate(
|
||||||
|
rel_x=0.2, rel_y=0.5)
|
||||||
|
if not self.channel_1.chat_element_by_text(cats_message).is_element_displayed(30):
|
||||||
|
self.errors.append("Sender was not navigated to the cats channel")
|
||||||
|
|
||||||
|
[home.jump_to_messages_home() for home in self.homes]
|
||||||
|
|
||||||
|
self.home_2.just_fyi("Device 2 sends a message with hashtag in 1-1 chat")
|
||||||
|
self.home_2.get_chat(self.username_1).click()
|
||||||
|
self.chat_2.send_message(message_with_hashtag)
|
||||||
|
|
||||||
|
self.home_1.just_fyi("Device 1 clicks on the message with hashtag in 1-1 chat")
|
||||||
|
self.home_1.get_chat(self.username_2).click()
|
||||||
|
self.chat_1.chat_element_by_text(message_with_hashtag).message_body.wait_for_visibility_of_element(30)
|
||||||
|
self.chat_1.chat_element_by_text(message_with_hashtag).message_body.click_inside_element_by_coordinate(
|
||||||
|
rel_x=0.2, rel_y=0.5)
|
||||||
|
if self.chat_1.chat_element_by_text(control_message_1_1_chat).is_element_disappeared():
|
||||||
|
self.errors.append("Receiver was navigated out of 1-1 chat")
|
||||||
|
|
||||||
|
self.home_2.just_fyi("Device 2 clicks on the message with hashtag in 1-1 chat")
|
||||||
|
self.chat_2.chat_element_by_text(message_with_hashtag).message_body.click_inside_element_by_coordinate(
|
||||||
|
rel_x=0.2, rel_y=0.5)
|
||||||
|
if self.chat_2.chat_element_by_text(control_message_1_1_chat).is_element_disappeared():
|
||||||
|
self.errors.append("Sender was navigated out of 1-1 chat")
|
||||||
|
|
||||||
|
self.errors.verify_no_errors()
|
||||||
|
|
|
@ -172,7 +172,7 @@ class TestActivityMultipleDevicePR(MultipleSharedDeviceTestCase):
|
||||||
self.home_1.get_to_community_channel_from_home(self.community_name)
|
self.home_1.get_to_community_channel_from_home(self.community_name)
|
||||||
|
|
||||||
self.chat_2 = self.home_2.get_chat(self.username_1).click()
|
self.chat_2 = self.home_2.get_chat(self.username_1).click()
|
||||||
self.chat_2.element_by_text_part('View').click()
|
self.chat_2.chat_element_by_text(self.community_name).view_community_button.click()
|
||||||
self.community_2.join_community()
|
self.community_2.join_community()
|
||||||
self.channel_2 = self.community_2.get_channel(self.channel_name).click()
|
self.channel_2 = self.community_2.get_channel(self.channel_name).click()
|
||||||
|
|
||||||
|
@ -327,7 +327,7 @@ class TestActivityMultipleDevicePR(MultipleSharedDeviceTestCase):
|
||||||
self.home_2.just_fyi("Request access to community")
|
self.home_2.just_fyi("Request access to community")
|
||||||
self.home_2.jump_to_messages_home()
|
self.home_2.jump_to_messages_home()
|
||||||
self.chat_2 = self.home_2.get_chat(self.username_1).click()
|
self.chat_2 = self.home_2.get_chat(self.username_1).click()
|
||||||
self.chat_2.element_by_text_part('View').wait_and_click(sec=60)
|
self.chat_2.chat_element_by_text(community_name).view_community_button.wait_and_click(sec=60)
|
||||||
self.community_2.join_community()
|
self.community_2.join_community()
|
||||||
[home.jump_to_communities_home() for home in (self.home_1, self.home_2)]
|
[home.jump_to_communities_home() for home in (self.home_1, self.home_2)]
|
||||||
|
|
||||||
|
|
|
@ -92,6 +92,11 @@ class BaseElement(object):
|
||||||
self.driver.info('Tap on found: %s' % self.name)
|
self.driver.info('Tap on found: %s' % self.name)
|
||||||
return self.navigate()
|
return self.navigate()
|
||||||
|
|
||||||
|
def wait_and_click(self, sec=30):
|
||||||
|
self.driver.info("Wait for element `%s` for max %ss and click when it is available" % (self.name, sec))
|
||||||
|
self.wait_for_visibility_of_element(sec)
|
||||||
|
self.click()
|
||||||
|
|
||||||
def click_until_presence_of_element(self, desired_element, attempts=4):
|
def click_until_presence_of_element(self, desired_element, attempts=4):
|
||||||
counter = 0
|
counter = 0
|
||||||
self.driver.info("Click until `%s` by `%s`: `%s` will be presented" % (
|
self.driver.info("Click until `%s` by `%s`: `%s` will be presented" % (
|
||||||
|
@ -398,11 +403,6 @@ class Button(BaseElement):
|
||||||
def __init__(self, driver, **kwargs):
|
def __init__(self, driver, **kwargs):
|
||||||
super(Button, self).__init__(driver, **kwargs)
|
super(Button, self).__init__(driver, **kwargs)
|
||||||
|
|
||||||
def wait_and_click(self, sec=30):
|
|
||||||
self.driver.info("Wait for element `%s` for max %ss and click when it is available" % (self.name, sec))
|
|
||||||
self.wait_for_visibility_of_element(sec)
|
|
||||||
self.click()
|
|
||||||
|
|
||||||
def click_until_absense_of_element(self, desired_element, attempts=3, timeout=1):
|
def click_until_absense_of_element(self, desired_element, attempts=3, timeout=1):
|
||||||
counter = 0
|
counter = 0
|
||||||
self.driver.info("Click until `%s` by `%s`: `%s` is NOT presented" % (
|
self.driver.info("Click until `%s` by `%s`: `%s` is NOT presented" % (
|
||||||
|
|
|
@ -118,12 +118,12 @@ class ProfileBlockContactButton(Button):
|
||||||
class ChatElementByText(Text):
|
class ChatElementByText(Text):
|
||||||
def __init__(self, driver, text):
|
def __init__(self, driver, text):
|
||||||
self.message_text = text
|
self.message_text = text
|
||||||
|
self.chat_item_locator = "android.view.ViewGroup[@content-desc='chat-item']"
|
||||||
if text in ["image", "sticker", "audio"]:
|
if text in ["image", "sticker", "audio"]:
|
||||||
self.message_locator = "//android.view.ViewGroup[@content-desc='%s-message']" % text
|
self.message_locator = "//android.view.ViewGroup[@content-desc='%s-message']" % text
|
||||||
else:
|
else:
|
||||||
self.message_locator = "//*[starts-with(@text,'%s')]" % text
|
self.message_locator = "//*[starts-with(@text,'%s')]" % text
|
||||||
super().__init__(driver, prefix=self.message_locator,
|
super().__init__(driver, prefix=self.message_locator, xpath="/ancestor::%s" % self.chat_item_locator)
|
||||||
xpath="/ancestor::android.view.ViewGroup[@content-desc='chat-item']")
|
|
||||||
|
|
||||||
def find_element(self):
|
def find_element(self):
|
||||||
for _ in range(2):
|
for _ in range(2):
|
||||||
|
@ -176,10 +176,12 @@ class ChatElementByText(Text):
|
||||||
|
|
||||||
return Username(self.driver, self.locator)
|
return Username(self.driver, self.locator)
|
||||||
|
|
||||||
def contains_text(self, text, wait_time=5) -> bool:
|
@property
|
||||||
element = Text(self.driver, prefix=self.locator,
|
def message_body(self):
|
||||||
xpath="//android.view.ViewGroup//android.widget.TextView[contains(@text,'%s')]" % text)
|
return Text(
|
||||||
return element.is_element_displayed(wait_time)
|
self.driver,
|
||||||
|
xpath="//%s//android.widget.TextView[contains(@text,'%s')]" % (self.chat_item_locator, self.message_text)
|
||||||
|
)
|
||||||
|
|
||||||
def wait_for_sent_state(self, wait_time=30):
|
def wait_for_sent_state(self, wait_time=30):
|
||||||
return BaseElement(self.driver, prefix=self.locator,
|
return BaseElement(self.driver, prefix=self.locator,
|
||||||
|
@ -309,6 +311,10 @@ class ChatElementByText(Text):
|
||||||
|
|
||||||
return PinnedByLabelText(self.driver, self.locator)
|
return PinnedByLabelText(self.driver, self.locator)
|
||||||
|
|
||||||
|
@property
|
||||||
|
def view_community_button(self):
|
||||||
|
return BaseElement(self.driver, xpath=self.locator + "//*[@text='View']")
|
||||||
|
|
||||||
|
|
||||||
class UsernameOptions(Button):
|
class UsernameOptions(Button):
|
||||||
def __init__(self, driver, username):
|
def __init__(self, driver, username):
|
||||||
|
@ -393,7 +399,8 @@ class CommunityView(HomeView):
|
||||||
self.join_button = Button(self.driver, accessibility_id="show-request-to-join-screen-button")
|
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.join_community_button = Button(self.driver, accessibility_id="join-community-button")
|
||||||
self.follow_button = Button(self.driver, translation_id="follow")
|
self.follow_button = Button(self.driver, translation_id="follow")
|
||||||
self.community_tags = BaseElement(self.driver, xpath="//*[@content-desc='chat-name-text']/../android.widget.HorizontalScrollView")
|
self.community_tags = BaseElement(
|
||||||
|
self.driver, xpath="//*[@content-desc='chat-name-text']/../android.widget.HorizontalScrollView")
|
||||||
|
|
||||||
#### NEW UI
|
#### NEW UI
|
||||||
# Communities initial page
|
# Communities initial page
|
||||||
|
|
Loading…
Reference in New Issue