e2e: gallery test + links preview
This commit is contained in:
parent
d042f40e69
commit
4fe2ccaa84
|
@ -494,19 +494,15 @@ class TestCommunityMultipleDeviceMerged(MultipleSharedDeviceTestCase):
|
||||||
self.errors.verify_no_errors()
|
self.errors.verify_no_errors()
|
||||||
|
|
||||||
@marks.testrail_id(702859)
|
@marks.testrail_id(702859)
|
||||||
def test_1_1_chat_image_send_reply(self):
|
def test_community_one_image_send_reply(self):
|
||||||
|
|
||||||
self.home_1.just_fyi('Send image in 1-1 chat from Gallery')
|
self.home_1.just_fyi('Send image in 1-1 chat from Gallery')
|
||||||
image_description = 'description'
|
image_description = 'description'
|
||||||
self.channel_1.show_images_button.click()
|
self.channel_1.send_images_with_description(image_description)
|
||||||
self.channel_1.allow_button.click_if_shown()
|
# TODO: possible after adding proper accessibility-id to 1 image in chat
|
||||||
self.channel_1.first_image_from_gallery.click()
|
# self.channel_1.chat_message_input.click()
|
||||||
self.channel_1.images_confirm_selection_button.click()
|
# self.channel_1.chat_element_by_text(image_description).image_in_message.click()
|
||||||
self.channel_1.chat_message_input.set_value(image_description)
|
# self.channel_1.click_system_back_button()
|
||||||
self.channel_1.send_message_button.click()
|
|
||||||
self.channel_1.chat_message_input.click()
|
|
||||||
self.channel_1.chat_element_by_text(image_description).image_in_message.click()
|
|
||||||
self.channel_1.click_system_back_button()
|
|
||||||
|
|
||||||
# TODO: options for image are still WIP; add case with edit description of image and after 15901 fix
|
# TODO: options for image are still WIP; add case with edit description of image and after 15901 fix
|
||||||
# self.home_2.just_fyi('check image, description and options for receiver')
|
# self.home_2.just_fyi('check image, description and options for receiver')
|
||||||
|
@ -546,6 +542,28 @@ class TestCommunityMultipleDeviceMerged(MultipleSharedDeviceTestCase):
|
||||||
|
|
||||||
self.errors.verify_no_errors()
|
self.errors.verify_no_errors()
|
||||||
|
|
||||||
|
@marks.testrail_id(703194)
|
||||||
|
def test_community_several_images_send_reply(self):
|
||||||
|
self.home_1.just_fyi('Send several images in 1-1 chat from Gallery')
|
||||||
|
image_description, file_name = 'gallery', 'gallery_1.png'
|
||||||
|
self.channel_1.send_images_with_description(image_description, [0, 1])
|
||||||
|
|
||||||
|
self.channel_2.just_fyi("Check gallery on second device")
|
||||||
|
self.channel_2.jump_to_communities_home()
|
||||||
|
self.home_2.get_to_community_channel_from_home(self.community_name)
|
||||||
|
if self.channel_2.chat_element_by_text(image_description).image_container_in_message.is_element_differs_from_template(file_name, 5):
|
||||||
|
self.errors.append("Gallery message do not match the template!")
|
||||||
|
|
||||||
|
self.channel_2.just_fyi("Can reply to gallery")
|
||||||
|
self.channel_2.quote_message(image_description)
|
||||||
|
message_text = 'reply to gallery'
|
||||||
|
self.channel_2.chat_message_input.send_keys(message_text)
|
||||||
|
self.channel_2.send_message_button.click()
|
||||||
|
chat_element_1 = self.channel_1.chat_element_by_text(message_text)
|
||||||
|
if not chat_element_1.is_element_displayed(sec=60) or chat_element_1.replied_message_text != 'Image':
|
||||||
|
self.errors.append('Reply message was not received by the sender')
|
||||||
|
self.errors.verify_no_errors()
|
||||||
|
|
||||||
@marks.testrail_id(702840)
|
@marks.testrail_id(702840)
|
||||||
def test_community_emoji_send_copy_paste_reply(self):
|
def test_community_emoji_send_copy_paste_reply(self):
|
||||||
emoji_name = random.choice(list(emoji.EMOJI_UNICODE))
|
emoji_name = random.choice(list(emoji.EMOJI_UNICODE))
|
||||||
|
@ -574,22 +592,35 @@ class TestCommunityMultipleDeviceMerged(MultipleSharedDeviceTestCase):
|
||||||
|
|
||||||
@marks.testrail_id(702844)
|
@marks.testrail_id(702844)
|
||||||
def test_community_links_with_previews_github_youtube_twitter_gif_send_enable(self):
|
def test_community_links_with_previews_github_youtube_twitter_gif_send_enable(self):
|
||||||
giphy_url = 'https://giphy.com/gifs/this-is-fine-QMHoU66sBXqqLqYvGO'
|
preview_urls = {
|
||||||
preview_urls = {'github_pr': {'url': 'https://github.com/status-im/status-mobile/pull/11707',
|
# TODO: disabled because of the bug in 15891
|
||||||
'txt': 'Update translations by jinhojang6 · Pull Request #11707 · status-im/status-mobile',
|
# 'giphy':{'url': 'https://giphy.com/gifs/this-is-fine-QMHoU66sBXqqLqYvGO',
|
||||||
'subtitle': 'GitHub'},
|
# 'title': 'This Is Fine GIF - Find & Share on GIPHY',
|
||||||
|
# 'description': 'Discover & share this Meme GIF with everyone you know. GIPHY is how you search, share, discover, and create GIFs.',
|
||||||
|
# 'link': 'giphy.com'},
|
||||||
|
'github_pr': {'url': 'https://github.com/status-im/status-mobile/pull/11707',
|
||||||
|
'title': 'Update translations by jinhojang6 · Pull Request #11707 · status-im/status-mobile',
|
||||||
|
'description': 'Update translation json files of 19 languages.',
|
||||||
|
'link': 'github.com'},
|
||||||
'yotube_short': {
|
'yotube_short': {
|
||||||
'url': 'https://youtu.be/Je7yErjEVt4',
|
'url': 'https://youtu.be/Je7yErjEVt4',
|
||||||
'txt': 'Status, your gateway to Ethereum',
|
'title': 'Status, your gateway to Ethereum',
|
||||||
'subtitle': 'YouTube'},
|
'description': 'Learn more at https://status.im. This video aims to provide an explanation '
|
||||||
|
'and brief preview of the utility that will be supported by the Status App - provid...',
|
||||||
|
'link': 'youtu.be'},
|
||||||
'yotube_full': {
|
'yotube_full': {
|
||||||
'url': 'https://www.youtube.com/watch?v=XN-SVmuJH2g&list=PLbrz7IuP1hrgNtYe9g6YHwHO6F3OqNMao',
|
'url': 'https://www.youtube.com/watch?v=XN-SVmuJH2g&list=PLbrz7IuP1hrgNtYe9g6YHwHO6F3OqNMao',
|
||||||
'txt': 'Status & Keycard – Hardware-Enforced Security',
|
'title': 'Status & Keycard – Hardware-Enforced Security',
|
||||||
'subtitle': 'YouTube'},
|
'description': 'With Status and Keycard, you can enable hardware enforced authorizations to '
|
||||||
|
'your Status account and transactions. Two-factor authentication to access your ac...',
|
||||||
|
'link': 'www.youtube.com'},
|
||||||
'yotube_mobile': {
|
'yotube_mobile': {
|
||||||
'url': 'https://m.youtube.com/watch?v=Je7yErjEVt4',
|
'url': 'https://m.youtube.com/watch?v=Je7yErjEVt4',
|
||||||
'txt': 'Status, your gateway to Ethereum',
|
'title': 'Status, your gateway to Ethereum',
|
||||||
'subtitle': 'YouTube'},
|
'description': 'Learn more at https://status.im. This video aims to provide an explanation '
|
||||||
|
'and brief preview of the utility that will be supported by the Status App - provid...',
|
||||||
|
'link': 'm.youtube.com',
|
||||||
|
},
|
||||||
|
|
||||||
# twitter link is temporary removed from check as current xpath locator in message.preview_title is not applicable for this type of links
|
# twitter link is temporary removed from check as current xpath locator in message.preview_title is not applicable for this type of links
|
||||||
# 'twitter': {
|
# 'twitter': {
|
||||||
|
@ -599,36 +630,31 @@ class TestCommunityMultipleDeviceMerged(MultipleSharedDeviceTestCase):
|
||||||
# }
|
# }
|
||||||
}
|
}
|
||||||
|
|
||||||
self.home_1.just_fyi("Check enabling and sending first gif")
|
|
||||||
self.channel_2.send_message(giphy_url)
|
|
||||||
self.channel_2.element_by_translation_id("dont-ask").click()
|
|
||||||
self.channel_1.element_by_text("Enable").wait_and_click()
|
|
||||||
|
|
||||||
self.channel_1.element_by_translation_id("enable-all").wait_and_click()
|
|
||||||
self.channel_1.click_system_back_button()
|
|
||||||
if not self.channel_1.get_preview_message_by_text(giphy_url).preview_image:
|
|
||||||
self.errors.append("No preview is shown for %s" % giphy_url)
|
|
||||||
for key in preview_urls:
|
for key in preview_urls:
|
||||||
self.home_2.just_fyi("Checking %s preview case" % key)
|
self.home_2.just_fyi("Checking %s preview case" % key)
|
||||||
data = preview_urls[key]
|
data = preview_urls[key]
|
||||||
self.channel_2.send_message(data['url'])
|
url = data['url']
|
||||||
message = self.channel_1.get_preview_message_by_text(data['url'])
|
self.channel_2.chat_message_input.set_value(url)
|
||||||
if message.preview_title:
|
self.channel_2.url_preview_composer.wait_for_element(20)
|
||||||
if data['txt'] not in message.preview_title.text:
|
if self.channel_2.url_preview_composer_text.text != data['title']:
|
||||||
self.errors.append("Title '%s' does not match expected" % message.preview_title.text)
|
self.errors.append(
|
||||||
else:
|
"Preview text is not expected, it is '%s'" % self.channel_2.url_preview_composer_text.text)
|
||||||
self.drivers[0].fail("No preview is shown!")
|
self.channel_2.send_message_button.click()
|
||||||
if message.preview_subtitle:
|
self.channel_1.get_preview_message_by_text(url).wait_for_element(60)
|
||||||
if message.preview_subtitle.text != data['subtitle']:
|
message = self.channel_1.get_preview_message_by_text(url)
|
||||||
self.errors.append("Subtitle '%s' does not match expected" % message.preview_subtitle.text)
|
# if not message.preview_image:
|
||||||
else:
|
# self.errors.append("No preview is shown for %s" % link_data['url'])
|
||||||
self.drivers[0].fail("No preview title is shown!")
|
if message.preview_title.text != data['title']:
|
||||||
|
self.errors.append("Title is not equal expected for '%s', actual is '%s'" % (url, message.preview_title.text))
|
||||||
|
|
||||||
|
if message.preview_subtitle.text != data['description']:
|
||||||
|
self.errors.append(
|
||||||
|
"Description is not equal expected for '%s', actual is '%s'" % (url, message.preview_subtitle.text))
|
||||||
|
|
||||||
|
if message.preview_link.text != data['link']:
|
||||||
|
self.errors.append("Link is not equal expected for '%s', actual is '%s'" % (url, message.preview_link.text))
|
||||||
|
|
||||||
self.home_2.just_fyi("Check if after do not ask again previews are not shown and no enable button appear")
|
|
||||||
if self.channel_2.element_by_translation_id("enable").is_element_displayed():
|
|
||||||
self.errors.append("Enable button is still shown after clicking on 'Don't ask again'")
|
|
||||||
if self.channel_2.get_preview_message_by_text(giphy_url).preview_image:
|
|
||||||
self.errors.append("Preview is shown for sender without permission")
|
|
||||||
self.errors.verify_no_errors()
|
self.errors.verify_no_errors()
|
||||||
|
|
||||||
@marks.testrail_id(702841)
|
@marks.testrail_id(702841)
|
||||||
|
|
|
@ -282,6 +282,15 @@ class ChatElementByText(Text):
|
||||||
except NoSuchElementException:
|
except NoSuchElementException:
|
||||||
self.driver.fail("No image is found in message!")
|
self.driver.fail("No image is found in message!")
|
||||||
|
|
||||||
|
@property
|
||||||
|
def image_container_in_message(self):
|
||||||
|
try:
|
||||||
|
self.driver.info("Trying to access images (image container) inside message with text '%s'" % self.message_text)
|
||||||
|
ChatElementByText(self.driver, self.message_text).wait_for_sent_state(60)
|
||||||
|
return Button(self.driver, xpath='%s//*[@content-desc="image-container"]' % self.locator)
|
||||||
|
except NoSuchElementException:
|
||||||
|
self.driver.fail("No image container is found in message!")
|
||||||
|
|
||||||
@property
|
@property
|
||||||
def pinned_by_label(self):
|
def pinned_by_label(self):
|
||||||
class PinnedByLabelText(Text):
|
class PinnedByLabelText(Text):
|
||||||
|
@ -478,8 +487,7 @@ class PreviewMessage(ChatElementByText):
|
||||||
def preview_title(self):
|
def preview_title(self):
|
||||||
class PreviewTitle(SilentButton):
|
class PreviewTitle(SilentButton):
|
||||||
def __init__(self, driver, parent_locator: str):
|
def __init__(self, driver, parent_locator: str):
|
||||||
super().__init__(driver, prefix=parent_locator,
|
super().__init__(driver, prefix=parent_locator, xpath="//*[@content-desc='title']")
|
||||||
xpath="//*[@content-desc='member-photo']/ancestor::android.view.ViewGroup[1]/preceding-sibling::android.widget.TextView[2]")
|
|
||||||
|
|
||||||
return PreviewMessage.return_element_or_empty(PreviewTitle(self.driver, self.locator))
|
return PreviewMessage.return_element_or_empty(PreviewTitle(self.driver, self.locator))
|
||||||
|
|
||||||
|
@ -487,11 +495,18 @@ class PreviewMessage(ChatElementByText):
|
||||||
def preview_subtitle(self):
|
def preview_subtitle(self):
|
||||||
class PreviewSubTitle(SilentButton):
|
class PreviewSubTitle(SilentButton):
|
||||||
def __init__(self, driver, parent_locator: str):
|
def __init__(self, driver, parent_locator: str):
|
||||||
super().__init__(driver, prefix=parent_locator,
|
super().__init__(driver, prefix=parent_locator, xpath="//*[@content-desc='description']")
|
||||||
xpath="//*[@content-desc='member-photo']/ancestor::android.view.ViewGroup[1]/preceding-sibling::android.widget.TextView[3]")
|
|
||||||
|
|
||||||
return PreviewMessage.return_element_or_empty(PreviewSubTitle(self.driver, self.locator))
|
return PreviewMessage.return_element_or_empty(PreviewSubTitle(self.driver, self.locator))
|
||||||
|
|
||||||
|
@property
|
||||||
|
def preview_link(self):
|
||||||
|
class PreviewLink(SilentButton):
|
||||||
|
def __init__(self, driver, parent_locator: str):
|
||||||
|
super().__init__(driver, prefix=parent_locator, xpath="//*[@content-desc='link']")
|
||||||
|
|
||||||
|
return PreviewMessage.return_element_or_empty(PreviewLink(self.driver, self.locator))
|
||||||
|
|
||||||
|
|
||||||
class CommunityLinkPreviewMessage(ChatElementByText):
|
class CommunityLinkPreviewMessage(ChatElementByText):
|
||||||
def __init__(self, driver, text: str):
|
def __init__(self, driver, text: str):
|
||||||
|
@ -716,6 +731,8 @@ class ChatView(BaseView):
|
||||||
# Chat input
|
# Chat input
|
||||||
self.chat_message_input = ChatMessageInput(self.driver)
|
self.chat_message_input = ChatMessageInput(self.driver)
|
||||||
self.cancel_reply_button = Button(self.driver, accessibility_id="reply-cancel-button")
|
self.cancel_reply_button = Button(self.driver, accessibility_id="reply-cancel-button")
|
||||||
|
self.url_preview_composer = Button(self.driver, accessibility_id="url-preview")
|
||||||
|
self.url_preview_composer_text = Text(self.driver, xpath='//*[@content-desc="url-preview"]//*[@content-desc="title"]')
|
||||||
self.quote_username_in_message_input = EditBox(self.driver,
|
self.quote_username_in_message_input = EditBox(self.driver,
|
||||||
xpath="//*[@content-desc='reply-cancel-button']/preceding::android.widget.TextView[2]")
|
xpath="//*[@content-desc='reply-cancel-button']/preceding::android.widget.TextView[2]")
|
||||||
self.chat_item = Button(self.driver, xpath="(//*[@content-desc='chat-item'])[1]")
|
self.chat_item = Button(self.driver, xpath="(//*[@content-desc='chat-item'])[1]")
|
||||||
|
@ -739,7 +756,6 @@ class ChatView(BaseView):
|
||||||
self.show_images_button = Button(self.driver, accessibility_id="open-images-button")
|
self.show_images_button = Button(self.driver, accessibility_id="open-images-button")
|
||||||
self.take_photo_button = Button(self.driver, accessibility_id="take-picture")
|
self.take_photo_button = Button(self.driver, accessibility_id="take-picture")
|
||||||
self.image_from_gallery_button = Button(self.driver, accessibility_id="open-gallery")
|
self.image_from_gallery_button = Button(self.driver, accessibility_id="open-gallery")
|
||||||
self.first_image_from_gallery = Button(self.driver, accessibility_id="image-0")
|
|
||||||
self.images_confirm_selection_button = Button(self.driver, accessibility_id="confirm-selection")
|
self.images_confirm_selection_button = Button(self.driver, accessibility_id="confirm-selection")
|
||||||
self.images_area_in_gallery = Button(self.driver,
|
self.images_area_in_gallery = Button(self.driver,
|
||||||
xpath="//*[@content-desc='open-gallery']/following-sibling::android.view.ViewGroup[1]")
|
xpath="//*[@content-desc='open-gallery']/following-sibling::android.view.ViewGroup[1]")
|
||||||
|
@ -807,13 +823,6 @@ class ChatView(BaseView):
|
||||||
self.nickname_input_field = EditBox(self.driver, accessibility_id="nickname-input")
|
self.nickname_input_field = EditBox(self.driver, accessibility_id="nickname-input")
|
||||||
self.remove_from_contacts = Button(self.driver, accessibility_id="Remove from contacts-item-button")
|
self.remove_from_contacts = Button(self.driver, accessibility_id="Remove from contacts-item-button")
|
||||||
|
|
||||||
# Timeline (My Status tab)
|
|
||||||
self.timeline_add_new_status_button = Button(self.driver, accessibility_id="plus-button")
|
|
||||||
self.timeline_my_status_editbox = EditBox(self.driver, accessibility_id="my-status-input")
|
|
||||||
self.timeline_open_images_panel_button = Button(self.driver, accessibility_id="open-images-panel-button")
|
|
||||||
self.timeline_send_my_status_button = Button(self.driver, accessibility_id="send-my-status-button")
|
|
||||||
self.timeline_own_account_photo = Button(self.driver, accessibility_id="own-account-photo")
|
|
||||||
|
|
||||||
# Communities
|
# Communities
|
||||||
self.create_community_button = Button(self.driver, translation_id="create-community")
|
self.create_community_button = Button(self.driver, translation_id="create-community")
|
||||||
self.community_name_edit_box = EditBox(self.driver, translation_id="name-your-community-placeholder")
|
self.community_name_edit_box = EditBox(self.driver, translation_id="name-your-community-placeholder")
|
||||||
|
@ -1115,20 +1124,6 @@ class ChatView(BaseView):
|
||||||
final_timestamps = [t[1:] if t[0] == '0' else t for t in timestamps]
|
final_timestamps = [t[1:] if t[0] == '0' else t for t in timestamps]
|
||||||
return final_timestamps
|
return final_timestamps
|
||||||
|
|
||||||
def set_new_status(self, status='something is happening', image=False):
|
|
||||||
self.driver.info("## Setting new status:'%s', image set is: '%s'" %
|
|
||||||
(BaseElement(self.driver).exclude_emoji(status), str(image)), device=False)
|
|
||||||
self.timeline_add_new_status_button.click_until_presence_of_element(self.timeline_my_status_editbox)
|
|
||||||
self.timeline_my_status_editbox.set_value(status)
|
|
||||||
|
|
||||||
if image:
|
|
||||||
self.timeline_open_images_panel_button.click()
|
|
||||||
if self.allow_button.is_element_displayed():
|
|
||||||
self.allow_button.click()
|
|
||||||
self.first_image_from_gallery.click()
|
|
||||||
self.timeline_send_my_status_button.click()
|
|
||||||
self.driver.info("## New status is set successfully!", device=False)
|
|
||||||
|
|
||||||
def get_transaction_message_by_asset(self, transaction_value, incoming=True) -> object:
|
def get_transaction_message_by_asset(self, transaction_value, incoming=True) -> object:
|
||||||
if incoming:
|
if incoming:
|
||||||
transaction_message = self.get_incoming_transaction(account=None, transaction_value=transaction_value)
|
transaction_message = self.get_incoming_transaction(account=None, transaction_value=transaction_value)
|
||||||
|
@ -1156,6 +1151,19 @@ class ChatView(BaseView):
|
||||||
except TimeoutException:
|
except TimeoutException:
|
||||||
self.driver.fail("Mentions list is not shown")
|
self.driver.fail("Mentions list is not shown")
|
||||||
|
|
||||||
|
def get_image_by_index(self, index=0):
|
||||||
|
return Button(self.driver, accessibility_id="image-%s" % index)
|
||||||
|
|
||||||
|
def send_images_with_description(self, description, indexes=None):
|
||||||
|
if indexes is None:
|
||||||
|
indexes = [0]
|
||||||
|
self.show_images_button.click()
|
||||||
|
self.allow_button.click_if_shown()
|
||||||
|
[self.get_image_by_index(i).click() for i in indexes]
|
||||||
|
self.images_confirm_selection_button.click()
|
||||||
|
self.chat_message_input.set_value(description)
|
||||||
|
self.send_message_button.click()
|
||||||
|
|
||||||
@staticmethod
|
@staticmethod
|
||||||
def get_resolved_chat_key(username, chat_key):
|
def get_resolved_chat_key(username, chat_key):
|
||||||
return '%s • %s…%s' % (username, chat_key[:6], chat_key[-4:])
|
return '%s • %s…%s' % (username, chat_key[:6], chat_key[-4:])
|
||||||
|
|
Binary file not shown.
After Width: | Height: | Size: 158 KiB |
Loading…
Reference in New Issue