mirror of
https://github.com/status-im/status-mobile.git
synced 2025-01-12 17:54:32 +00:00
e2e: activity centre
This commit is contained in:
parent
77629fa7e1
commit
8dac11544e
@ -11,4 +11,5 @@ markers =
|
||||
|
||||
testrail_case_id: case ID in testrail
|
||||
flaky: flaky tests for re-run if necessary
|
||||
transaction: all cases that are related to transaction completion in Ropsten network
|
||||
transaction: all cases that are related to transaction completion in Ropsten network
|
||||
new_ui_critical: PR tests in new UI
|
@ -127,6 +127,7 @@ class TestrailReport(BaseTestReport):
|
||||
test_cases['pr']['group_chat'] = 50964
|
||||
test_cases['pr']['community_single'] = 50983
|
||||
test_cases['pr']['community_multiple'] = 50982
|
||||
test_cases['pr']['activity_centre'] = 50984
|
||||
|
||||
## Nightly e2e
|
||||
# test_cases['nightly']['medium'] = 736
|
||||
|
@ -12,9 +12,6 @@ import tests
|
||||
from support.device_stats_db import DeviceStatsDB
|
||||
from support.test_rerun import should_rerun_test
|
||||
from tests import test_suite_data, appium_container
|
||||
# from support.testrail_report import TestrailReport
|
||||
#
|
||||
# testrail_report = TestrailReport()
|
||||
|
||||
sauce_username = environ.get('SAUCE_USERNAME')
|
||||
sauce_access_key = environ.get('SAUCE_ACCESS_KEY')
|
||||
@ -245,8 +242,9 @@ def pytest_runtest_makereport(item, call):
|
||||
is_group = "xdist_group" in item.keywords._markers or "xdist_group" in item.parent.keywords._markers
|
||||
error_intro, error = 'Test setup failed:', ''
|
||||
final_error = '%s %s' % (error_intro, error)
|
||||
if hasattr(report, 'wasxfail') and str([mark.args[0] for mark in item.iter_markers(name='testrail_id')][0]) \
|
||||
in str(item.config.getoption("run_testrail_ids")):
|
||||
# if hasattr(report, 'wasxfail') and str([mark.args[0] for mark in item.iter_markers(name='testrail_id')][0]) \
|
||||
# in str(item.config.getoption("run_testrail_ids")):
|
||||
if hasattr(report, 'wasxfail'):
|
||||
if '[NOTRUN]' in report.wasxfail:
|
||||
test_suite_data.set_current_test(item.name, testrail_case_id=get_testrail_case_id(item))
|
||||
test_suite_data.current_test.create_new_testrun()
|
||||
|
@ -1284,6 +1284,7 @@ class TestOneToOneChatMultipleSharedDevicesNewUi(MultipleSharedDeviceTestCase):
|
||||
self.errors.verify_no_errors()
|
||||
|
||||
@marks.testrail_id(702731)
|
||||
@marks.xfail(reason="blocked by #14637")
|
||||
def test_1_1_chat_pin_messages(self):
|
||||
self.home_1.just_fyi("Check that Device1 can pin own message in 1-1 chat")
|
||||
self.chat_1.send_message(self.message_1)
|
||||
|
@ -309,6 +309,7 @@ class TestGroupChatMediumMultipleDeviceNewUI(MultipleSharedDeviceTestCase):
|
||||
"Message 1", "Message 2", "Message 3", "Message 4"
|
||||
|
||||
@marks.testrail_id(702732)
|
||||
@marks.xfail(reason="blocked by #14637")
|
||||
def test_group_chat_pin_messages(self):
|
||||
self.home_1.just_fyi("Enter group chat and pin message there. It's pinned for both members.")
|
||||
|
||||
|
@ -541,39 +541,39 @@ class TestCommunityOneDeviceMerged(MultipleSharedDeviceTestCase):
|
||||
if not self.channel.chat_element_by_text(text_message).is_element_displayed(30):
|
||||
self.drivers[0].fail("Not navigated to channel view after reopening app")
|
||||
|
||||
@marks.testrail_id(702847)
|
||||
# TODO long press and assertion of text in input field is currently not working on e2e builds. needs to be investigated
|
||||
@marks.skip('needs to be refactored')
|
||||
def test_community_copy_and_paste_message_in_chat_input(self):
|
||||
message_text = {'text_message': 'mmmeowesage_text'}
|
||||
formatted_message = {'message_with_link': 'https://status.im'
|
||||
}
|
||||
message_input = self.channel.chat_message_input
|
||||
if not message_input.is_element_displayed():
|
||||
self.home.communities_tab.double_click()
|
||||
self.home.get_chat(self.community_name, community=True).click()
|
||||
self.community.get_chat(self.channel_name).click()
|
||||
message_input.send_keys(message_text['text_message'])
|
||||
self.channel.send_message_button.click()
|
||||
|
||||
self.channel.copy_message_text(message_text['text_message'])
|
||||
|
||||
message_input.paste_text_from_clipboard()
|
||||
if message_input.text != message_text['text_message']:
|
||||
self.errors.append('Message %s text was not copied in a public chat' % message_text['text_message'])
|
||||
message_input.clear()
|
||||
|
||||
for message in formatted_message:
|
||||
message_input.send_keys(formatted_message[message])
|
||||
self.channel.send_message_button.click()
|
||||
|
||||
self.channel.copy_message_text(formatted_message[message])
|
||||
message_input.paste_text_from_clipboard()
|
||||
if message_input.text != formatted_message[message]:
|
||||
self.errors.append('Message %s text was not copied in community channel' % formatted_message[message])
|
||||
message_input.clear()
|
||||
|
||||
self.errors.verify_no_errors()
|
||||
# @marks.testrail_id(702847)
|
||||
# # TODO long press and assertion of text in input field is currently not working on e2e builds. needs to be investigated
|
||||
# @marks.skip('needs to be refactored')
|
||||
# def test_community_copy_and_paste_message_in_chat_input(self):
|
||||
# message_text = {'text_message': 'mmmeowesage_text'}
|
||||
# formatted_message = {'message_with_link': 'https://status.im'
|
||||
# }
|
||||
# message_input = self.channel.chat_message_input
|
||||
# if not message_input.is_element_displayed():
|
||||
# self.home.communities_tab.double_click()
|
||||
# self.home.get_chat(self.community_name, community=True).click()
|
||||
# self.community.get_chat(self.channel_name).click()
|
||||
# message_input.send_keys(message_text['text_message'])
|
||||
# self.channel.send_message_button.click()
|
||||
#
|
||||
# self.channel.copy_message_text(message_text['text_message'])
|
||||
#
|
||||
# message_input.paste_text_from_clipboard()
|
||||
# if message_input.text != message_text['text_message']:
|
||||
# self.errors.append('Message %s text was not copied in a public chat' % message_text['text_message'])
|
||||
# message_input.clear()
|
||||
#
|
||||
# for message in formatted_message:
|
||||
# message_input.send_keys(formatted_message[message])
|
||||
# self.channel.send_message_button.click()
|
||||
#
|
||||
# self.channel.copy_message_text(formatted_message[message])
|
||||
# message_input.paste_text_from_clipboard()
|
||||
# if message_input.text != formatted_message[message]:
|
||||
# self.errors.append('Message %s text was not copied in community channel' % formatted_message[message])
|
||||
# message_input.clear()
|
||||
#
|
||||
# self.errors.verify_no_errors()
|
||||
|
||||
|
||||
@pytest.mark.xdist_group(name="one_2")
|
||||
@ -713,54 +713,54 @@ class TestCommunityMultipleDeviceMerged(MultipleSharedDeviceTestCase):
|
||||
channel_1_element.click()
|
||||
self.errors.verify_no_errors()
|
||||
|
||||
@marks.testrail_id(702844)
|
||||
@marks.skip("Until preview component will be developed")
|
||||
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 = {'github_pr': {'url': 'https://github.com/status-im/status-mobile/pull/11707',
|
||||
'txt': 'Update translations by jinhojang6 · Pull Request #11707 · status-im/status-mobile',
|
||||
'subtitle': 'GitHub'},
|
||||
'yotube': {
|
||||
'url': 'https://www.youtube.com/watch?v=XN-SVmuJH2g&list=PLbrz7IuP1hrgNtYe9g6YHwHO6F3OqNMao',
|
||||
'txt': 'Status & Keycard – Hardware-Enforced Security',
|
||||
'subtitle': 'YouTube'}
|
||||
# twitter link is temporary removed from check as current xpath locator in message.preview_title is not applicable for this type of links
|
||||
# 'twitter': {
|
||||
# 'url': 'https://twitter.com/ethdotorg/status/1445161651771162627?s=20',
|
||||
# 'txt': "We've rethought how we translate content, allowing us to translate",
|
||||
# 'subtitle': 'Twitter'
|
||||
# }
|
||||
}
|
||||
|
||||
self.home_1.just_fyi("Check enabling and sending first gif")
|
||||
self.channel_2.send_message(giphy_url)
|
||||
# workaround to get chat view focused
|
||||
self.channel_2.send_message(giphy_url)
|
||||
self.channel_2.element_by_translation_id("dont-ask").click()
|
||||
# workaround to get chat view focused
|
||||
self.channel_1.send_message(giphy_url)
|
||||
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:
|
||||
self.home_2.just_fyi("Checking %s preview case" % key)
|
||||
data = preview_urls[key]
|
||||
self.channel_2.send_message(data['url'])
|
||||
message = self.channel_1.get_preview_message_by_text(data['url'])
|
||||
if data['txt'] not in message.preview_title.text:
|
||||
self.errors.append("Title '%s' does not match expected" % message.preview_title.text)
|
||||
if message.preview_subtitle.text != data['subtitle']:
|
||||
self.errors.append("Subtitle '%s' does not match expected" % message.preview_subtitle.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()
|
||||
# @marks.testrail_id(702844)
|
||||
# @marks.skip("Until preview component will be developed")
|
||||
# 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 = {'github_pr': {'url': 'https://github.com/status-im/status-mobile/pull/11707',
|
||||
# 'txt': 'Update translations by jinhojang6 · Pull Request #11707 · status-im/status-mobile',
|
||||
# 'subtitle': 'GitHub'},
|
||||
# 'yotube': {
|
||||
# 'url': 'https://www.youtube.com/watch?v=XN-SVmuJH2g&list=PLbrz7IuP1hrgNtYe9g6YHwHO6F3OqNMao',
|
||||
# 'txt': 'Status & Keycard – Hardware-Enforced Security',
|
||||
# 'subtitle': 'YouTube'}
|
||||
# # twitter link is temporary removed from check as current xpath locator in message.preview_title is not applicable for this type of links
|
||||
# # 'twitter': {
|
||||
# # 'url': 'https://twitter.com/ethdotorg/status/1445161651771162627?s=20',
|
||||
# # 'txt': "We've rethought how we translate content, allowing us to translate",
|
||||
# # 'subtitle': 'Twitter'
|
||||
# # }
|
||||
# }
|
||||
#
|
||||
# self.home_1.just_fyi("Check enabling and sending first gif")
|
||||
# self.channel_2.send_message(giphy_url)
|
||||
# # workaround to get chat view focused
|
||||
# self.channel_2.send_message(giphy_url)
|
||||
# self.channel_2.element_by_translation_id("dont-ask").click()
|
||||
# # workaround to get chat view focused
|
||||
# self.channel_1.send_message(giphy_url)
|
||||
# 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:
|
||||
# self.home_2.just_fyi("Checking %s preview case" % key)
|
||||
# data = preview_urls[key]
|
||||
# self.channel_2.send_message(data['url'])
|
||||
# message = self.channel_1.get_preview_message_by_text(data['url'])
|
||||
# if data['txt'] not in message.preview_title.text:
|
||||
# self.errors.append("Title '%s' does not match expected" % message.preview_title.text)
|
||||
# if message.preview_subtitle.text != data['subtitle']:
|
||||
# self.errors.append("Subtitle '%s' does not match expected" % message.preview_subtitle.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()
|
||||
|
||||
@marks.testrail_id(702842)
|
||||
def test_community_mark_all_messages_as_read(self):
|
||||
|
@ -1,8 +1,9 @@
|
||||
import pytest
|
||||
|
||||
from tests import marks
|
||||
from tests import marks, run_in_parallel
|
||||
from tests.base_test_case import MultipleSharedDeviceTestCase, create_shared_drivers
|
||||
from views.sign_in_view import SignInView
|
||||
from views.chat_view import CommunityView
|
||||
|
||||
|
||||
@pytest.mark.xdist_group(name="four_2")
|
||||
@ -179,3 +180,141 @@ class TestActivityCenterMultipleDeviceMedium(MultipleSharedDeviceTestCase):
|
||||
self.errors.append("Activity Center still has some chats after user has opened all of them")
|
||||
|
||||
self.errors.verify_no_errors()
|
||||
|
||||
|
||||
@pytest.mark.xdist_group(name="four_2")
|
||||
@marks.new_ui_critical
|
||||
class TestActivityCenterMultipleDevicePR(MultipleSharedDeviceTestCase):
|
||||
|
||||
def prepare_devices(self):
|
||||
self.drivers, self.loop = create_shared_drivers(2)
|
||||
self.device_1, self.device_2 = SignInView(self.drivers[0]), SignInView(self.drivers[1])
|
||||
self.loop.run_until_complete(run_in_parallel(((self.device_1.create_user,), (self.device_2.create_user,))))
|
||||
self.home_1, self.home_2 = self.device_1.get_home_view(), self.device_2.get_home_view()
|
||||
self.profile_1, self.profile_2 = self.home_1.get_profile_view(), self.home_2.get_profile_view()
|
||||
users = self.loop.run_until_complete(run_in_parallel(
|
||||
((self.home_1.get_public_key_and_username, True),
|
||||
(self.home_2.get_public_key_and_username, True))
|
||||
))
|
||||
self.public_key_1, self.default_username_1 = users[0]
|
||||
self.public_key_2, self.default_username_2 = users[1]
|
||||
|
||||
self.profile_1.just_fyi("Enabling PNs")
|
||||
self.profile_1.switch_push_notifications()
|
||||
|
||||
@marks.testrail_id(702850)
|
||||
def test_activity_center_decline_contact_request_no_pn(self):
|
||||
self.device_1.put_app_to_background()
|
||||
self.device_2.just_fyi('Device2 sends a contact request to Device1')
|
||||
self.profile_2.click_system_back_button_until_element_is_shown(self.profile_2.contacts_button)
|
||||
self.profile_2.add_contact_via_contacts_list(self.public_key_1)
|
||||
self.profile_2.click_system_back_button_until_element_is_shown(self.profile_2.contacts_button)
|
||||
|
||||
self.device_1.just_fyi("Device 2: check there is no PN when receiving new message to activity centre")
|
||||
self.device_1.open_notification_bar()
|
||||
if self.home_1.element_by_text_part("Please add me to your contacts").is_element_displayed():
|
||||
self.errors.append("Push notification with text was received for new message in activity centre")
|
||||
self.device_1.click_system_back_button(2)
|
||||
|
||||
[home.chats_tab.double_click() for home in [self.home_1, self.home_2]]
|
||||
|
||||
self.device_1.just_fyi('Device1 verifies pending contact request')
|
||||
self.home_1.contacts_tab.click()
|
||||
for indicator in (self.home_1.notifications_unread_badge, self.home_1.contact_new_badge):
|
||||
if not indicator.is_element_displayed():
|
||||
self.errors.append("Unread indicator on contacts tab or on activity center is not shown!")
|
||||
if self.home_1.pending_contact_request_text.text != '1':
|
||||
self.errors.append("The amount of contact requests is not shown!")
|
||||
|
||||
self.device_1.just_fyi('Device1 declines pending contact request')
|
||||
self.home_1.handle_contact_request(username=self.default_username_2, accept=False)
|
||||
for indicator in (self.home_1.notifications_unread_badge, self.home_1.contact_new_badge, self.home_1.pending_contact_request_text):
|
||||
if indicator.is_element_displayed():
|
||||
self.errors.append("Unread indicator on contacts tab or on activity center is shown after declining contact request!")
|
||||
|
||||
self.device_1.just_fyi("Device 2: remove device1 from Contact list")
|
||||
self.home_2.contacts_tab.click()
|
||||
self.home_2.contact_details(self.default_username_1).click()
|
||||
self.home_2.element_by_translation_id("remove-from-contacts").click()
|
||||
if not self.home_2.element_by_translation_id("no-contacts").is_element_displayed(30):
|
||||
self.errors.append("Contact was not removed from contact list")
|
||||
|
||||
self.errors.verify_no_errors()
|
||||
|
||||
@marks.testrail_id(702851)
|
||||
def test_activity_center_mentions_in_community_jump_to(self):
|
||||
self.device_2.just_fyi('Device2 sends a contact request to Device1')
|
||||
self.home_2.browser_tab.click()
|
||||
self.profile_2.click_system_back_button_until_element_is_shown(self.profile_2.contacts_button)
|
||||
self.profile_2.add_contact_via_contacts_list(self.public_key_1)
|
||||
self.profile_2.click_system_back_button_until_element_is_shown(self.profile_2.contacts_button)
|
||||
|
||||
self.device_1.just_fyi('Device1 accepts pending contact request and check contact list')
|
||||
self.home_1.chats_tab.click()
|
||||
self.home_1.handle_contact_request(username=self.default_username_2)
|
||||
self.home_1.contacts_tab.click()
|
||||
if not self.home_1.contact_details(username=self.default_username_2).is_element_displayed(20):
|
||||
self.errors.append("Contact was not added to contact list after accepting contact request")
|
||||
self.home_1.recent_tab.click()
|
||||
|
||||
self.device_1.just_fyi('Creating and join community from Device1 and Device2')
|
||||
self.text_message = 'first message in community'
|
||||
self.community_name = self.home_1.get_random_chat_name()
|
||||
self.channel_name = self.home_1.get_random_chat_name()
|
||||
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.channel_1.send_message(self.text_message)
|
||||
|
||||
self.home_2.chats_tab.click()
|
||||
self.home_2.recent_tab.click()
|
||||
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_2 = self.community_2.get_chat(self.channel_name).click()
|
||||
|
||||
self.community_2.just_fyi("Check Jump to screen and redirect on tap")
|
||||
self.channel_2.click_system_back_button()
|
||||
self.community_2.jump_to_button.click()
|
||||
for card in (self.community_name, self.default_username_1):
|
||||
if not self.community_2.element_by_text_part(card).is_element_displayed(20):
|
||||
self.errors.append("Card %s is not shown on Jump to screen!" % card)
|
||||
self.community_2.element_by_translation_id("community-channel").click()
|
||||
if not self.channel_2.chat_element_by_text(self.text_message).is_element_displayed(20):
|
||||
self.errors.append("User was not redirected to community channel after tappin on community channel card!")
|
||||
self.channel_2.click_system_back_button()
|
||||
self.community_2.jump_to_button.click()
|
||||
self.community_2.element_by_text_part(self.default_username_1).click()
|
||||
if not self.chat_2.element_by_text_part('View').is_element_displayed(20):
|
||||
self.errors.append("User was not redirected to 1-1 chat after tapping card!")
|
||||
|
||||
# Blocked because of 14648
|
||||
# self.device_2.just_fyi('Mention user1 and check activity centre')
|
||||
# self.channel_2.select_mention_from_suggestion_list(self.default_username_1, self.default_username_1[:2])
|
||||
# self.channel_2.send_as_keyevent("mention activity centre")
|
||||
# ac_chat_message = self.default_username_1 + " mention activity centre"
|
||||
# self.channel_2.send_message_button.click()
|
||||
# self.home_1.click_system_back_button_until_element_is_shown()
|
||||
# self.home_1.open_activity_center_button.click()
|
||||
# for text in ('Mention', '@%s' % ac_chat_message):
|
||||
# if self.home_1.element_by_text(text).is_element_displayed(30):
|
||||
# self.errors.append("Mention is not shown in activity centre!")
|
||||
# self.home_1.close_activity_centre.click()
|
||||
#
|
||||
# self.device_2.just_fyi('Mention user1 and check PN')
|
||||
# self.device_1.put_app_to_background()
|
||||
# self.channel_2.select_mention_from_suggestion_list(self.default_username_1, self.default_username_1[:2])
|
||||
# self.channel_2.send_as_keyevent("group")
|
||||
# group_chat_message = self.default_username_1 + " group"
|
||||
# self.channel_2.send_message_button.click()
|
||||
# self.device_1.open_notification_bar()
|
||||
# if self.home_1.get_pn(group_chat_message):
|
||||
# self.home_1.get_pn(group_chat_message).click()
|
||||
# else:
|
||||
# self.home_1.driver.fail("No PN for mention in community!")
|
||||
# if not self.channel_1.chat_element_by_text(group_chat_message).is_element_displayed(20):
|
||||
# self.errors.append("No redirect to channel after tap on PN with mention!")
|
||||
|
||||
self.errors.verify_no_errors()
|
||||
|
@ -8,7 +8,7 @@ from timeit import timeit
|
||||
from PIL import Image, ImageChops, ImageStat
|
||||
from appium.webdriver.common.mobileby import MobileBy
|
||||
from appium.webdriver.common.touch_action import TouchAction
|
||||
from selenium.common.exceptions import NoSuchElementException
|
||||
from selenium.common.exceptions import NoSuchElementException, StaleElementReferenceException
|
||||
from selenium.common.exceptions import TimeoutException
|
||||
from selenium.webdriver.support.wait import WebDriverWait
|
||||
from selenium.webdriver.support import expected_conditions
|
||||
@ -378,7 +378,7 @@ class Button(BaseElement):
|
||||
try:
|
||||
self.find_element().click()
|
||||
counter += 1
|
||||
except (NoSuchElementException, TimeoutException):
|
||||
except (NoSuchElementException, TimeoutException, StaleElementReferenceException):
|
||||
return self.navigate()
|
||||
|
||||
|
||||
|
@ -604,7 +604,7 @@ class PinnedMessagesList(BaseElement):
|
||||
return message_element
|
||||
|
||||
def get_message_pinned_by_text(self, text):
|
||||
xpath = "//*[starts-with(@text,'%s')]/../../../../*[@content-desc='pinned-by']/android.widget.TextView" % text
|
||||
xpath = "//*[starts-with(@text,'%s')]/../../../*[@content-desc='pinned-by']/android.widget.TextView" % text
|
||||
pinned_by_element = Text(self.driver, prefix=self.locator, xpath=xpath)
|
||||
self.driver.info("Looking for a pinned by message with text: %s" % text)
|
||||
return pinned_by_element
|
||||
|
@ -3,7 +3,7 @@ import time
|
||||
from selenium.common.exceptions import TimeoutException, NoSuchElementException
|
||||
|
||||
from tests import test_dapp_url
|
||||
from views.base_element import Button, Text, BaseElement, SilentButton, CheckBox
|
||||
from views.base_element import Button, Text, BaseElement, SilentButton, CheckBox, EditBox
|
||||
from views.base_view import BaseView
|
||||
|
||||
|
||||
@ -283,6 +283,13 @@ class HomeView(BaseView):
|
||||
accessibility_id="accept-and-add-activity-center")
|
||||
self.notifications_select_all = Button(self.driver, xpath="(//android.widget.CheckBox["
|
||||
"@content-desc='checkbox-off'])[1]")
|
||||
# Tabs and elements on Messages view
|
||||
self.recent_tab = Button(self.driver, accessibility_id="tab-recent")
|
||||
self.groups_tab = Button(self.driver, accessibility_id="tab-groups")
|
||||
self.contacts_tab = Button(self.driver, accessibility_id="tab-contacts")
|
||||
self.contact_new_badge = Button(self.driver, accessibility_id="notification-dot")
|
||||
self.pending_contact_request_text = Text(self.driver, xpath='//*[@content-desc="pending-contact-requests-count"]/android.widget.TextView')
|
||||
|
||||
|
||||
# Options on long tap
|
||||
self.chats_menu_invite_friends_button = Button(self.driver, accessibility_id="chats-menu-invite-friends-button")
|
||||
@ -311,6 +318,7 @@ class HomeView(BaseView):
|
||||
|
||||
# New UI
|
||||
self.new_chat_button = Button(self.driver, accessibility_id="new-chat-button")
|
||||
self.jump_to_button = Button(self.driver, accessibility_id="jump-to")
|
||||
|
||||
def wait_for_syncing_complete(self):
|
||||
self.driver.info('Waiting for syncing to complete')
|
||||
@ -421,6 +429,16 @@ class HomeView(BaseView):
|
||||
self.driver.info("## Community is created successfully!", device=False)
|
||||
return chat_view.get_community_by_name(name)
|
||||
|
||||
def import_community(self, key):
|
||||
self.driver.info("## Importing community")
|
||||
import_button = Button(self.driver, translation_id="import")
|
||||
self.plus_button.click()
|
||||
chat_view = self.communities_button.click()
|
||||
chat_view.chat_options.click()
|
||||
chat_view.element_by_translation_id("import-community").wait_and_click()
|
||||
EditBox(self.driver, xpath="//android.widget.EditText").set_value(key)
|
||||
import_button.click_until_absense_of_element(import_button)
|
||||
|
||||
def join_public_chat(self, chat_name: str):
|
||||
self.driver.info("## Creating public chat %s" % chat_name, device=False)
|
||||
self.plus_button.click_until_presence_of_element(self.join_public_chat_button, attempts=5)
|
||||
@ -470,3 +488,6 @@ class HomeView(BaseView):
|
||||
self.driver.info("Getting PN by '%s'" % pn_text)
|
||||
expected_element = PushNotificationElement(self.driver, pn_text)
|
||||
return expected_element if expected_element.is_element_displayed(60) else False
|
||||
|
||||
def contact_details(self, username):
|
||||
return Button(self.driver, xpath="//*[contains(@text,'%s')]/../android.view.ViewGroup/android.widget.ImageView" % username)
|
||||
|
Loading…
x
Reference in New Issue
Block a user