mirror of
https://github.com/status-im/status-mobile.git
synced 2025-02-25 06:46:37 +00:00
e2e: fixes and update
Signed-off-by: Churikova Tetiana <churikova.tm@gmail.com>
This commit is contained in:
parent
7d6bee9099
commit
3a7fecf5ce
@ -41,13 +41,13 @@ class TestGroupChatMultipleDevice(MultipleDeviceTestCase):
|
||||
home_2.open_notification_bar()
|
||||
pns = [chat_1.pn_invited_to_group_chat(username_1, chat_name), chat_1.pn_wants_you_to_join_to_group_chat(username_1, chat_name)]
|
||||
for pn in pns:
|
||||
if not home_2.element_by_text(pn).is_element_displayed(30):
|
||||
if not home_2.get_pn(pn).is_element_displayed(30):
|
||||
self.errors.append('%s is not shown after invite to group chat' % pn)
|
||||
if not home_2.pn_group_chat_invite_icon(pns[1]).is_element_displayed(30):
|
||||
self.drivers[0].fail('No icon is shown for PN')
|
||||
group_invite_pn = home_2.get_pn(pns[1])
|
||||
|
||||
home_2.pn_group_chat_invite_icon(pns[1]).click()
|
||||
home_2.element_by_text(chat_1.pn_invited_to_group_chat(username_1, chat_name))
|
||||
# if not group_invite_pn.group_chat_icon.is_element_displayed(30):
|
||||
# self.drivers[0].fail('No icon is shown for PN for group invite')
|
||||
group_invite_pn.click()
|
||||
create_system_message = chat_1.create_system_message(username_1, chat_name)
|
||||
invite_system_message = chat_1.invite_system_message(username_1, username_2)
|
||||
join_system_message = chat_1.join_system_message(username_2)
|
||||
|
@ -35,7 +35,7 @@ class TestMessagesOneToOneChatMultiple(MultipleDeviceTestCase):
|
||||
chat_1 = home_1.add_contact(public_key_2)
|
||||
chat_1.send_message(message_no_pn)
|
||||
device_2.open_notification_bar()
|
||||
if device_2.element_by_text_part(message_no_pn).is_element_displayed():
|
||||
if home_2.element_by_text(message_no_pn).is_element_displayed():
|
||||
self.errors.append("Push notification with text was received for new message in activity centre")
|
||||
device_2.get_app_from_background()
|
||||
device_2.home_button.click()
|
||||
@ -52,8 +52,8 @@ class TestMessagesOneToOneChatMultiple(MultipleDeviceTestCase):
|
||||
|
||||
device_2.just_fyi("Check text push notification and tap it")
|
||||
device_2.open_notification_bar()
|
||||
if not (device_2.element_by_text_part(message).is_element_displayed()
|
||||
and device_2.element_by_text_part(default_username_1).is_element_displayed()):
|
||||
pn = home_2.get_pn(message)
|
||||
if not pn.icon.is_element_displayed():
|
||||
device_2.driver.fail("Push notification with text was not received")
|
||||
chat_2 = device_2.click_upon_push_notification_by_text(message)
|
||||
|
||||
@ -403,6 +403,20 @@ class TestMessagesOneToOneChatMultiple(MultipleDeviceTestCase):
|
||||
if not reply_message.image_in_reply.is_element_displayed():
|
||||
self.errors.append("Image is not displayed in reply")
|
||||
|
||||
home_2.just_fyi('check share and save options on opened image')
|
||||
private_chat_2.image_message_in_chat.click()
|
||||
private_chat_2.share_image_icon_button.click()
|
||||
private_chat_2.share_via_messenger()
|
||||
if not private_chat_2.image_in_android_messenger.is_element_present():
|
||||
self.errors.append("Can't share image")
|
||||
private_chat_2.click_system_back_button()
|
||||
private_chat_2.save_image_icon_button.click()
|
||||
private_chat_2.show_images_button.click()
|
||||
private_chat_2.allow_button.wait_and_click()
|
||||
|
||||
if not private_chat_2.first_image_from_gallery.is_element_image_similar_to_template('saved.png'):
|
||||
self.errors.append("New picture was not saved!")
|
||||
|
||||
self.errors.verify_no_errors()
|
||||
|
||||
@marks.testrail_id(6316)
|
||||
@ -924,6 +938,14 @@ class TestMessagesOneToOneChatSingle(SingleDeviceTestCase):
|
||||
home.just_fyi('Mention user by ENS in 1-1 chat')
|
||||
message = '@%s hey!' % ens
|
||||
chat.send_message(message)
|
||||
|
||||
home.just_fyi('Check that ENS is shown in preview for 1-1 chat')
|
||||
chat.home_button.double_click()
|
||||
if not home.element_by_text(message).is_element_displayed():
|
||||
self.errors.append('"%s" is not show in chat preview on home screen!' % message)
|
||||
home.get_chat('@%s' % ens).click()
|
||||
|
||||
home.just_fyi('Check redirect to user profile on mention by ENS tap')
|
||||
chat.chat_element_by_text(message).click()
|
||||
if not chat.profile_block_contact.is_element_displayed():
|
||||
self.errors.append('No redirect to user profile after tapping on message with mention (ENS) in 1-1 chat')
|
||||
@ -932,7 +954,16 @@ class TestMessagesOneToOneChatSingle(SingleDeviceTestCase):
|
||||
russian_nickname = 'МОЙ дорогой ДРУх'
|
||||
chat.set_nickname(russian_nickname)
|
||||
chat.select_mention_from_suggestion_list(russian_nickname + ' @' + ens)
|
||||
chat.chat_element_by_text('%s hey!' % russian_nickname).click()
|
||||
|
||||
home.just_fyi('Check that nickname is shown in preview for 1-1 chat')
|
||||
updated_message = '%s hey!' % russian_nickname
|
||||
chat.home_button.double_click()
|
||||
if not home.element_by_text(updated_message).is_element_displayed():
|
||||
self.errors.append('"%s" is not show in chat preview on home screen!' % message)
|
||||
home.get_chat(russian_nickname).click()
|
||||
|
||||
home.just_fyi('Check redirect to user profile on mention by nickname tap')
|
||||
chat.chat_element_by_text(updated_message).click()
|
||||
if not chat.profile_block_contact.is_element_displayed():
|
||||
self.errors.append(
|
||||
'No redirect to user profile after tapping on message with mention (nickname) in 1-1 chat')
|
||||
|
@ -190,7 +190,7 @@ class TestGroupChatMultipleDevice(MultipleDeviceTestCase):
|
||||
if not chat.chat_element_by_text(message_after_sync).is_element_displayed(60):
|
||||
self.errors.append('"%s" message in 1-1 is not synced' % message_after_sync)
|
||||
|
||||
device_1.just_fyi('Chats (main device):add new public chat, (secondary device): check that synced ')
|
||||
device_1.just_fyi('Chats (main device):add new public chat, (secondary device): check that synced')
|
||||
home_1.join_public_chat(public_chat_after_sync)
|
||||
home_2 = chat.get_back_to_home_view()
|
||||
if not home_2.element_by_text_part(public_chat_after_sync).is_element_displayed(20):
|
||||
@ -211,6 +211,13 @@ class TestGroupChatMultipleDevice(MultipleDeviceTestCase):
|
||||
profile_2.contacts_button.click()
|
||||
profile_2.element_by_text(nickname_after_sync).wait_for_invisibility_of_element(60)
|
||||
|
||||
device_1.just_fyi('Chats (main device):delete added public chat, (secondary device): check that synced')
|
||||
for profile in (profile_1, profile_2):
|
||||
profile.get_back_to_home_view()
|
||||
profile.home_button.click()
|
||||
home_1.delete_chat_long_press(public_chat_after_sync)
|
||||
home_2.element_by_text(public_chat_after_sync).wait_for_invisibility_of_element(60)
|
||||
|
||||
self.errors.verify_no_errors()
|
||||
|
||||
|
||||
|
@ -73,7 +73,7 @@ class BaseElement(object):
|
||||
def find_element(self):
|
||||
for _ in range(3):
|
||||
try:
|
||||
self.driver.info('*Find %s by %s:* `%s`' % (self.name, self.by, self.locator))
|
||||
self.driver.info("Find '%s' by '%s': `%s`" % (self.name, self.by, self.locator))
|
||||
return self.driver.find_element(self.by, self.locator)
|
||||
except NoSuchElementException:
|
||||
raise NoSuchElementException(
|
||||
@ -87,11 +87,11 @@ class BaseElement(object):
|
||||
|
||||
def click(self):
|
||||
self.find_element().click()
|
||||
self.driver.info('*Tap on found %s*' % self.name)
|
||||
self.driver.info('Tap on found: %s' % self.name)
|
||||
return self.navigate()
|
||||
|
||||
def double_click(self):
|
||||
self.driver.info('*Double tap on %s*' % self.name)
|
||||
self.driver.info('Double tap on: %s' % self.name)
|
||||
[self.find_element().click() for _ in range(2)]
|
||||
|
||||
def wait_for_element(self, seconds=10):
|
||||
@ -128,7 +128,7 @@ class BaseElement(object):
|
||||
|
||||
def wait_for_element_text(self, text, wait_time=30):
|
||||
counter = 0
|
||||
self.driver.info("*Wait for text element %s to be equal to %s*" % (self.name, text))
|
||||
self.driver.info("Wait for text element '%s' to be equal to '%s'" % (self.name, text))
|
||||
while True:
|
||||
if counter >= wait_time:
|
||||
self.driver.fail(
|
||||
@ -137,11 +137,11 @@ class BaseElement(object):
|
||||
counter += 10
|
||||
time.sleep(10)
|
||||
else:
|
||||
self.driver.info('*Element %s text is equal to %s*' % (self.name, text))
|
||||
self.driver.info('Element %s text is equal to %s' % (self.name, text))
|
||||
return
|
||||
|
||||
def scroll_to_element(self, depth: int = 9, direction='down'):
|
||||
self.driver.info('*Scrolling %s to %s*' % (direction, self.name))
|
||||
self.driver.info('Scrolling %s to %s' % (direction, self.name))
|
||||
for _ in range(depth):
|
||||
try:
|
||||
return self.find_element()
|
||||
@ -244,7 +244,7 @@ class BaseElement(object):
|
||||
|
||||
def long_press_element(self):
|
||||
element = self.find_element()
|
||||
self.driver.info('*Long press on %s*' % self.name)
|
||||
self.driver.info("Long press on '%s'" % self.name)
|
||||
action = TouchAction(self.driver)
|
||||
action.long_press(element).release().perform()
|
||||
|
||||
@ -284,25 +284,25 @@ class EditBox(BaseElement):
|
||||
|
||||
def send_keys(self, value):
|
||||
self.find_element().send_keys(value)
|
||||
self.driver.info("*Type '%s' to %s*" % (self.exclude_emoji(value), self.name))
|
||||
self.driver.info("Type '%s' to '%s'" % (self.exclude_emoji(value), self.name))
|
||||
|
||||
def set_value(self, value):
|
||||
self.find_element().set_value(value)
|
||||
self.driver.info("*Type '%s' to %s*" % (self.exclude_emoji(value), self.name))
|
||||
self.driver.info("Set '%s' value for '%s'" % (self.exclude_emoji(value), self.name))
|
||||
|
||||
def clear(self):
|
||||
self.find_element().clear()
|
||||
self.driver.info('*Clear text in %s*' % self.name)
|
||||
self.driver.info("Clear text in '%s'" % self.name)
|
||||
|
||||
def delete_last_symbols(self, number_of_symbols_to_delete: int):
|
||||
self.driver.info('*Delete last %s symbols from %s*' % (number_of_symbols_to_delete, self.name))
|
||||
self.driver.info("Delete last %s symbols from '%s'" % (number_of_symbols_to_delete, self.name))
|
||||
self.click()
|
||||
for _ in range(number_of_symbols_to_delete):
|
||||
time.sleep(1)
|
||||
self.driver.press_keycode(67)
|
||||
|
||||
def paste_text_from_clipboard(self):
|
||||
self.driver.info('*Paste text from clipboard into %s*' % self.name)
|
||||
self.driver.info("Paste text from clipboard into '%s'" % self.name)
|
||||
self.long_press_element()
|
||||
time.sleep(2)
|
||||
action = TouchAction(self.driver)
|
||||
@ -311,7 +311,7 @@ class EditBox(BaseElement):
|
||||
action.press(x=x + 25, y=y - 50).release().perform()
|
||||
|
||||
def cut_text(self):
|
||||
self.driver.info('*Cut text in %s*' % self.name)
|
||||
self.driver.info("Cut text in '%s'" % self.name)
|
||||
location = self.find_element().location
|
||||
x, y = location['x'], location['y']
|
||||
action = TouchAction(self.driver)
|
||||
@ -327,7 +327,7 @@ class Text(BaseElement):
|
||||
@property
|
||||
def text(self):
|
||||
text = self.find_element().text
|
||||
self.driver.info('*%s is %s*' % (self.name, text))
|
||||
self.driver.info("'%s' is '%s'" % (self.name, text))
|
||||
return text
|
||||
|
||||
|
||||
@ -338,13 +338,13 @@ class Button(BaseElement):
|
||||
super(Button, self).__init__(driver, **kwargs)
|
||||
|
||||
def wait_and_click(self, time=30):
|
||||
self.driver.info('*Wait for element %s for max %ss and click when it is available*' % (self.name, time))
|
||||
self.driver.info("Wait for element '%s' for max %ss and click when it is available" % (self.name, time))
|
||||
self.wait_for_visibility_of_element(time)
|
||||
self.click()
|
||||
|
||||
def click_until_presence_of_element(self, desired_element, attempts=4):
|
||||
counter = 0
|
||||
self.driver.info('*Click until %s by %s:*`%s` *will be presented*' % (desired_element.name, desired_element.by, desired_element.locator))
|
||||
self.driver.info("Click until '%s' by '%s': `%s` will be presented" % (desired_element.name, desired_element.by, desired_element.locator))
|
||||
while not desired_element.is_element_present(1) and counter <= attempts:
|
||||
try:
|
||||
self.find_element().click()
|
||||
@ -357,7 +357,7 @@ class Button(BaseElement):
|
||||
|
||||
def click_until_absense_of_element(self, desired_element, attempts=3):
|
||||
counter = 0
|
||||
self.driver.info('*Click until %s by %s:*`%s` *is NOT presented*' % (desired_element.name, desired_element.by, desired_element.locator))
|
||||
self.driver.info("Click until '%s' by '%s': `%s` is NOT presented" % (desired_element.name, desired_element.by, desired_element.locator))
|
||||
while desired_element.is_element_present(1) and counter <= attempts:
|
||||
try:
|
||||
self.find_element().click()
|
||||
|
@ -323,7 +323,7 @@ class BaseView(object):
|
||||
|
||||
def just_fyi(self, string):
|
||||
self.driver.info('=========================================================================')
|
||||
self.driver.info(string)
|
||||
self.driver.info('# %s' % string)
|
||||
self.driver.info('=========================================================================')
|
||||
|
||||
def click_system_back_button(self, times=1):
|
||||
@ -332,38 +332,38 @@ class BaseView(object):
|
||||
self.driver.press_keycode(4)
|
||||
|
||||
def get_app_from_background(self):
|
||||
self.driver.info('*Get Status back from Recent apps*')
|
||||
self.driver.info('## Get Status back from Recent apps')
|
||||
self.driver.press_keycode(187)
|
||||
self.status_in_background_button.click()
|
||||
|
||||
def put_app_to_background_and_back(self, time_in_background=1):
|
||||
self.driver.info('*Put app to background and back*')
|
||||
self.driver.info('## Put app to background and back')
|
||||
self.driver.press_keycode(187)
|
||||
time.sleep(time_in_background)
|
||||
self.status_in_background_button.click()
|
||||
|
||||
def click_system_home_button(self):
|
||||
self.driver.info('*Press system Home button*')
|
||||
self.driver.info('## Press system Home button')
|
||||
self.driver.press_keycode(3)
|
||||
|
||||
def put_app_to_background(self):
|
||||
self.driver.info('*App to background*')
|
||||
self.driver.info('## App to background')
|
||||
self.driver.press_keycode(187)
|
||||
|
||||
def cut_text(self):
|
||||
self.driver.info('*Cut text*')
|
||||
self.driver.info('## Cut text')
|
||||
self.driver.press_keycode(277)
|
||||
|
||||
def copy_text(self):
|
||||
self.driver.info('*Copy text*')
|
||||
self.driver.info('## Copy text')
|
||||
self.driver.press_keycode(278)
|
||||
|
||||
def paste_text(self):
|
||||
self.driver.info('*Paste text*')
|
||||
self.driver.info('## Paste text')
|
||||
self.driver.press_keycode(279)
|
||||
|
||||
def send_as_keyevent(self, string):
|
||||
self.driver.info("*Sending as keyevent* `%s`" % string)
|
||||
self.driver.info("## Sending as keyevent `%s`" % string)
|
||||
keys = {'0': 7, '1': 8, '2': 9, '3': 10, '4': 11, '5': 12, '6': 13, '7': 14, '8': 15, '9': 16,
|
||||
|
||||
',': 55, '-': 69, '+': 81, '.': 56, '/': 76, '\\': 73, ';': 74, ' ': 62,
|
||||
@ -406,32 +406,32 @@ class BaseView(object):
|
||||
|
||||
def swipe_by_custom_coordinates(self, x_start, y_start, x_end, y_end):
|
||||
"""Uses percentage values based on device width/height"""
|
||||
self.driver.info("*Swiping based on custom coordinates relative to device height/width*")
|
||||
self.driver.info("## Swiping based on custom coordinates relative to device height/width")
|
||||
size = self.driver.get_window_size()
|
||||
self.driver.swipe(size["width"] * x_start, size["height"] * y_start, size["width"] * x_end, size["height"] * y_end)
|
||||
|
||||
def swipe_up(self):
|
||||
self.driver.info("*Swiping up*")
|
||||
self.driver.info("## Swiping up")
|
||||
size = self.driver.get_window_size()
|
||||
self.driver.swipe(size["width"]*0.5, size["height"]*0.8, size["width"]*0.5, size["height"]*0.2)
|
||||
|
||||
def swipe_down(self):
|
||||
self.driver.info("*Swiping down*")
|
||||
self.driver.info("## Swiping down")
|
||||
size = self.driver.get_window_size()
|
||||
self.driver.swipe(size["width"]*0.5, size["height"]*0.2, size["width"]*0.5, size["height"]*0.8)
|
||||
|
||||
def swipe_left(self):
|
||||
self.driver.info("*Swiping left*")
|
||||
self.driver.info("## Swiping left")
|
||||
size = self.driver.get_window_size()
|
||||
self.driver.swipe(size["width"]*0.8, size["height"]*0.8, size["width"]*0.2, size["height"]*0.8)
|
||||
|
||||
def swipe_right(self):
|
||||
self.driver.info("*Swiping right*")
|
||||
self.driver.info("## Swiping right")
|
||||
size = self.driver.get_window_size()
|
||||
self.driver.swipe(size["width"]*0.2, size["height"]*0.8, size["width"]*0.8, size["height"]*0.8)
|
||||
|
||||
def switch_to_mobile(self, before_login=False, sync=False):
|
||||
self.driver.info("*Turning on mobile data, syncing is %s*" % str(sync))
|
||||
self.driver.info("## Turning on mobile data, syncing is %s" % str(sync))
|
||||
self.driver.set_network_connection(4)
|
||||
if before_login is False:
|
||||
from views.home_view import HomeView
|
||||
@ -540,7 +540,7 @@ class BaseView(object):
|
||||
|
||||
|
||||
def get_public_key_and_username(self, return_username=False):
|
||||
self.driver.info("**Get public key and username**")
|
||||
self.driver.info("## Get public key and username")
|
||||
profile_view = self.profile_button.click()
|
||||
default_username = profile_view.default_username_text.text
|
||||
profile_view.share_my_profile_button.click()
|
||||
@ -551,7 +551,7 @@ class BaseView(object):
|
||||
return user_data
|
||||
|
||||
def share_via_messenger(self):
|
||||
self.driver.info("**Sharing via messenger**")
|
||||
self.driver.info("## Sharing via messenger")
|
||||
self.element_by_text_part("Direct share").wait_for_element()
|
||||
self.element_by_text('Messages').wait_and_click()
|
||||
self.element_by_text('New message').wait_and_click()
|
||||
@ -559,7 +559,7 @@ class BaseView(object):
|
||||
self.confirm()
|
||||
|
||||
def click_upon_push_notification_by_text(self, text):
|
||||
self.driver.info("**Click on PN with text:** `%s`" % text)
|
||||
self.driver.info("## Click on PN with text:** `%s`" % text)
|
||||
self.element_by_text_part(text).click()
|
||||
return self.get_chat_view()
|
||||
|
||||
@ -568,7 +568,7 @@ class BaseView(object):
|
||||
logcat = self.logcat
|
||||
items_in_logcat = list()
|
||||
for key, value in kwargs.items():
|
||||
self.driver.info("**Checking in logcat for:** `%s`" % value)
|
||||
self.driver.info("**Checking in logcat for: `%s`" % value)
|
||||
escaped_value = re.escape(value)
|
||||
if re.findall(r'\W%s$|\W%s\W' % (escaped_value, escaped_value), logcat):
|
||||
items_in_logcat.append('%s in logcat!!!' % key.capitalize())
|
||||
@ -579,7 +579,7 @@ class BaseView(object):
|
||||
file = base64.b64decode(b64_log)
|
||||
result = False
|
||||
for value in args:
|
||||
self.driver.info('**Checking in geth for:** `%s`' % value)
|
||||
self.driver.info('## Checking in geth for: `%s`' % value)
|
||||
if re.findall('%s*' % value, file.decode("utf-8")):
|
||||
self.driver.info('%s was found in geth.log' % value)
|
||||
result = True
|
||||
@ -593,7 +593,7 @@ class BaseView(object):
|
||||
self.driver.open_notifications()
|
||||
|
||||
def toggle_airplane_mode(self):
|
||||
self.driver.info("**Toggling airplane mode**")
|
||||
self.driver.info("## Toggling airplane mode")
|
||||
self.airplane_mode_button.click()
|
||||
self.close_native_device_dialog("MmsService")
|
||||
|
||||
@ -606,7 +606,7 @@ class BaseView(object):
|
||||
self.driver.set_network_connection(4)
|
||||
|
||||
def toggle_mobile_data(self):
|
||||
self.driver.info("**Toggling mobile data**")
|
||||
self.driver.info("## Toggling mobile data")
|
||||
self.driver.start_activity(app_package='com.android.settings', app_activity='.Settings')
|
||||
network_and_internet = self.element_by_text('Network & internet')
|
||||
network_and_internet.wait_for_visibility_of_element()
|
||||
@ -619,21 +619,21 @@ class BaseView(object):
|
||||
|
||||
def open_universal_web_link(self, deep_link):
|
||||
start_web_browser(self.driver)
|
||||
self.driver.info('**Open web link via web browser:** `%s`' % deep_link)
|
||||
self.driver.info('## Open web link via web browser: `%s`' % deep_link)
|
||||
self.driver.get(deep_link)
|
||||
|
||||
def upgrade_app(self):
|
||||
self.driver.info("**Upgrading apk to apk_upgrade**")
|
||||
self.driver.info("## Upgrading apk to apk_upgrade")
|
||||
self.driver.install_app(pytest_config_global['apk_upgrade'], replace=True)
|
||||
self.app = self.driver.launch_app()
|
||||
|
||||
def search_by_keyword(self, keyword):
|
||||
self.driver.info('**Search for** `%s`' % keyword)
|
||||
self.driver.info('## Search for `%s`' % keyword)
|
||||
self.search_input.click()
|
||||
self.search_input.send_keys(keyword)
|
||||
|
||||
def set_up_wallet_when_sending_tx(self):
|
||||
self.driver.info("**Setting up wallet**")
|
||||
self.driver.info("## Setting up wallet")
|
||||
phrase = self.sign_in_phrase.text
|
||||
self.ok_got_it_button.wait_and_click(20)
|
||||
return phrase
|
||||
|
@ -88,7 +88,8 @@ class ViewProfileButton(Button):
|
||||
|
||||
class ChatOptionsButton(Button):
|
||||
def __init__(self, driver):
|
||||
super().__init__(driver, xpath="(//android.widget.TextView[@content-desc='chat-name-text']/../..//android.widget.TextView)[last()]")
|
||||
super().__init__(driver, xpath="//androidx.appcompat.widget.LinearLayoutCompat")
|
||||
|
||||
|
||||
def click(self):
|
||||
self.click_until_presence_of_element(HomeView(self.driver).mark_all_messages_as_read_button)
|
||||
@ -575,6 +576,8 @@ class ChatView(BaseView):
|
||||
self.image_from_gallery_button = Button(self.driver, accessibility_id="open-gallery")
|
||||
self.first_image_from_gallery = Button(self.driver,
|
||||
xpath="//*[@content-desc='open-gallery']/following-sibling::android.view.ViewGroup[1]")
|
||||
self.images_area_in_gallery = Button(self.driver,
|
||||
xpath="//*[@content-desc='open-gallery']/following-sibling::android.view.ViewGroup[1]")
|
||||
self.image_message_in_chat = Button(self.driver, accessibility_id="image-message")
|
||||
self.save_image_button = Button(self.driver, translation_id="save")
|
||||
self.recent_image_in_gallery = Button(self.driver,
|
||||
@ -582,6 +585,9 @@ class ChatView(BaseView):
|
||||
self.cancel_send_image_button = Button(self.driver, accessibility_id="cancel-send-image")
|
||||
self.view_image_options = Button(self.driver,
|
||||
xpath="//*[@content-desc='icon']/android.widget.ImageView")
|
||||
self.share_image_icon_button = Button(self.driver, accessibility_id="share-button")
|
||||
self.save_image_icon_button = Button(self.driver, accessibility_id="save-button")
|
||||
self.image_in_android_messenger = Button(self.driver, accessibility_id="Image")
|
||||
|
||||
#Audio
|
||||
self.audio_message_in_chat = Button(self.driver, accessibility_id="audio-message")
|
||||
@ -662,41 +668,41 @@ class ChatView(BaseView):
|
||||
return IncomingTransaction(self.driver, account, transaction_value)
|
||||
|
||||
def get_preview_message_by_text(self, text=None) -> object:
|
||||
self.driver.info('**Getting preview message for link:** %s' % text)
|
||||
self.driver.info('## Getting preview message for link: %s' % text)
|
||||
return PreviewMessage(self.driver, text)
|
||||
|
||||
def get_community_link_preview_by_text(self, text=None) -> object:
|
||||
self.driver.info('**Getting community preview message for link:** %s' % text)
|
||||
self.driver.info('## Getting community preview message for link: %s' % text)
|
||||
return CommunityLinkPreviewMessage(self.driver, text)
|
||||
|
||||
def delete_chat(self):
|
||||
self.driver.info("**Delete chat via options**")
|
||||
self.driver.info("## Delete chat via options")
|
||||
self.chat_options.click()
|
||||
self.delete_chat_button.click()
|
||||
self.delete_button.click()
|
||||
|
||||
def leave_chat(self):
|
||||
self.driver.info("**Leave chat via options**")
|
||||
self.driver.info("## Leave chat via options")
|
||||
self.chat_options.click()
|
||||
self.leave_chat_button.click()
|
||||
self.leave_button.click()
|
||||
|
||||
def clear_history(self):
|
||||
self.driver.info("**Clear chat history via options**")
|
||||
self.driver.info("## Clear chat history via options")
|
||||
self.chat_options.click()
|
||||
self.clear_history_button.click()
|
||||
self.clear_button.click()
|
||||
|
||||
|
||||
def leave_chat_via_group_info(self):
|
||||
self.driver.info("**Leave group chat via group info**")
|
||||
self.driver.info("## Leave group chat via group info")
|
||||
self.chat_options.click()
|
||||
self.group_info.click()
|
||||
self.leave_chat_button.click()
|
||||
self.leave_button.click()
|
||||
|
||||
def rename_chat_via_group_info(self, new_chat_name):
|
||||
self.driver.info("**Rename group chat to %s**" % new_chat_name)
|
||||
self.driver.info("## Rename group chat to: %s" % new_chat_name)
|
||||
self.chat_options.click()
|
||||
self.group_info.click()
|
||||
self.edit_group_chat_name_button.click()
|
||||
@ -704,30 +710,30 @@ class ChatView(BaseView):
|
||||
self.done_button.click()
|
||||
|
||||
def get_group_invite_via_group_info(self):
|
||||
self.driver.info("**Copy group invite link**")
|
||||
self.driver.info("## Copy group invite link")
|
||||
self.chat_options.click()
|
||||
self.group_info.click()
|
||||
self.group_invite_button.click()
|
||||
return self.group_invite_link_text.text
|
||||
|
||||
def request_membership_for_group_chat(self, intro_message):
|
||||
self.driver.info("**Requesting membership to group chat**")
|
||||
self.driver.info("## Requesting membership to group chat")
|
||||
self.introduce_yourself_edit_box.set_value(intro_message)
|
||||
self.request_membership_button.click_until_presence_of_element(self.element_by_text('Request pending…'))
|
||||
|
||||
def get_username_checkbox(self, username: str):
|
||||
self.driver.info("**Getting %s checkbox**" % username)
|
||||
self.driver.info("## Getting %s checkbox" % username)
|
||||
return UsernameCheckbox(self.driver, username)
|
||||
|
||||
def accept_membership_for_group_chat_via_chat_view(self, username, accept=True):
|
||||
info = "%s membership to group chat" % username
|
||||
self.driver.info("**Accept %s**" % info) if accept else self.driver.info("**Decline %s**" % info)
|
||||
self.driver.info("## Accept %s" % info) if accept else self.driver.info("## Decline %s" % info)
|
||||
self.group_membership_request_button.click()
|
||||
self.element_by_text(username).click()
|
||||
self.accept_group_invitation_button.click() if accept else self.decline_group_invitation_button.click()
|
||||
|
||||
def add_members_to_group_chat(self, user_names_to_add: list):
|
||||
self.driver.info("**Add %s to group chat**" % ', '.join(map(str, user_names_to_add)))
|
||||
self.driver.info("## Add %s to group chat" % ', '.join(map(str, user_names_to_add)))
|
||||
self.chat_options.click()
|
||||
group_info_view = self.group_info.click()
|
||||
group_info_view.add_members.click()
|
||||
@ -738,18 +744,18 @@ class ChatView(BaseView):
|
||||
self.add_button.click()
|
||||
|
||||
def get_user_options(self, username: str):
|
||||
self.driver.info("**Get user options for** %s" % username)
|
||||
self.driver.info("## Get user options for: %s" % username)
|
||||
self.chat_options.click()
|
||||
group_info_view = self.group_info.click()
|
||||
group_info_view.get_username_options(username).click()
|
||||
return self
|
||||
|
||||
def chat_element_by_text(self, text):
|
||||
self.driver.info("**Looking for a message by text:** %s" % text)
|
||||
self.driver.info("## Looking for a message by text: %s" % text)
|
||||
return ChatElementByText(self.driver, text)
|
||||
|
||||
def verify_message_is_under_today_text(self, text, errors):
|
||||
self.driver.info("**Verifying that '%s' is under today**" % text)
|
||||
self.driver.info("## Verifying that '%s' is under today" % text)
|
||||
message_element = self.chat_element_by_text(text)
|
||||
message_element.wait_for_visibility_of_element()
|
||||
message_location = message_element.find_element().location['y']
|
||||
@ -760,18 +766,18 @@ class ChatView(BaseView):
|
||||
errors.append("Message '%s' is not under 'Today' text" % text)
|
||||
|
||||
def send_message(self, message: str = 'test message'):
|
||||
self.driver.info("**Sending message '%s'**" % BaseElement(self.driver).exclude_emoji(message))
|
||||
self.driver.info("## Sending message '%s'" % BaseElement(self.driver).exclude_emoji(message))
|
||||
self.chat_message_input.wait_for_element(5)
|
||||
self.chat_message_input.send_keys(message)
|
||||
self.send_message_button.click()
|
||||
|
||||
def pin_message(self, message, action="pin"):
|
||||
self.driver.info("**Looking for message '%s' pin**" % message)
|
||||
self.driver.info("## Looking for message '%s' pin**" % message)
|
||||
self.element_by_text_part(message).long_press_element()
|
||||
self.element_by_translation_id(action).click()
|
||||
|
||||
def edit_message_in_chat(self, message_to_edit, message_to_update):
|
||||
self.driver.info("**Looking for message '%s' to edit it**" % message_to_edit)
|
||||
self.driver.info("## Looking for message '%s' to edit it" % message_to_edit)
|
||||
self.element_by_text_part(message_to_edit).long_press_element()
|
||||
self.element_by_translation_id("edit").click()
|
||||
self.chat_message_input.clear()
|
||||
@ -779,22 +785,22 @@ class ChatView(BaseView):
|
||||
self.send_message_button.click()
|
||||
|
||||
def delete_message_in_chat(self, message):
|
||||
self.driver.info("**Looking for message '%s' to delete it**" % message)
|
||||
self.driver.info("## Looking for message '%s' to delete it" % message)
|
||||
self.element_by_text_part(message).long_press_element()
|
||||
self.element_by_translation_id("delete").click()
|
||||
|
||||
def copy_message_text(self, message_text):
|
||||
self.driver.info("**Copying '%s' message via long press**" % message_text)
|
||||
self.driver.info("## Copying '%s' message via long press" % message_text)
|
||||
self.element_by_text_part(message_text).long_press_element()
|
||||
self.element_by_translation_id("copy-to-clipboard").click()
|
||||
|
||||
def quote_message(self, message = str):
|
||||
self.driver.info("**Quote '%s' message**" % message)
|
||||
self.driver.info("## Quoting '%s' message" % message)
|
||||
self.element_by_text_part(message).long_press_element()
|
||||
self.reply_message_button.click()
|
||||
|
||||
def set_reaction(self, message: str, emoji: str = 'thumbs-up', emoji_message=False):
|
||||
self.driver.info("**Setting '%s' reaction**" % emoji)
|
||||
self.driver.info("## Setting '%s' reaction" % emoji)
|
||||
key = emojis[emoji]
|
||||
# Audio message is obvious should be tapped not on audio-scroll-line
|
||||
# so we tap on its below element as exception here (not the case for link/tag message!)
|
||||
@ -815,7 +821,7 @@ class ChatView(BaseView):
|
||||
self.profile_block_contact.wait_for_visibility_of_element(5)
|
||||
|
||||
def wait_ens_name_resolved_in_chat(self, message = str, username_value = str):
|
||||
self.driver.info("**Waiting ENS name '%s' is resolved in chat**" % username_value)
|
||||
self.driver.info("## Waiting ENS name '%s' is resolved in chat" % username_value)
|
||||
counter = 0
|
||||
while True:
|
||||
if counter >= 120:
|
||||
@ -827,11 +833,11 @@ class ChatView(BaseView):
|
||||
return
|
||||
|
||||
def move_to_messages_by_time_marker(self, marker='Today'):
|
||||
self.driver.info("**Moving to messages by time marker: '%s'**" % marker)
|
||||
self.driver.info("## Moving to messages by time marker: '%s'" % marker)
|
||||
Button(self.driver, xpath="//*[@text='%s'']" % marker).scroll_to_element(depth=50, direction='up')
|
||||
|
||||
def install_sticker_pack_by_name(self, pack_name='Status Cat'):
|
||||
self.driver.info("**Installing '%s' stickerpack**" % pack_name)
|
||||
self.driver.info("## Installing '%s' stickerpack" % pack_name)
|
||||
self.show_stickers_button.click()
|
||||
self.get_stickers.click()
|
||||
element = Button(self.driver,
|
||||
@ -844,7 +850,7 @@ class ChatView(BaseView):
|
||||
self.swipe_left()
|
||||
|
||||
def scroll_to_start_of_history(self, depth=20):
|
||||
self.driver.info('*Scrolling th the start of chat history*')
|
||||
self.driver.info('## Scrolling th the start of chat history')
|
||||
for _ in range(depth):
|
||||
try:
|
||||
return self.history_start_icon.find_element()
|
||||
@ -862,26 +868,26 @@ class ChatView(BaseView):
|
||||
return Button(self.driver, xpath="//*[@content-desc='suggestions-list']//*[@text='%s']" % username)
|
||||
|
||||
def select_mention_from_suggestion_list(self, username_in_list, typed_search_pattern = ''):
|
||||
self.driver.info("**Selecting '%s' from suggestion list by '%s'**" % (username_in_list, typed_search_pattern))
|
||||
self.driver.info("## Selecting '%s' from suggestion list by '%s'" % (username_in_list, typed_search_pattern))
|
||||
self.chat_message_input.set_value('@' + typed_search_pattern)
|
||||
self.chat_message_input.click()
|
||||
self.search_user_in_mention_suggestion_list(username_in_list).wait_for_visibility_of_element(10).click()
|
||||
|
||||
def record_audio_message(self, message_length_in_seconds=5):
|
||||
self.driver.info("**Recording audiomessage %ss**" % message_length_in_seconds)
|
||||
self.driver.info("## Recording audiomessage %ss" % message_length_in_seconds)
|
||||
self.audio_message_button.click()
|
||||
self.allow_button.click()
|
||||
self.record_audio_button.click()
|
||||
sleep(message_length_in_seconds)
|
||||
|
||||
def play_audio_message(self, listen_time=5):
|
||||
self.driver.info("**Playing audiomessage during %ss**" % listen_time)
|
||||
self.driver.info("## Playing audiomessage during %ss" % listen_time)
|
||||
self.play_pause_audio_message_button.click()
|
||||
sleep(listen_time)
|
||||
self.play_pause_audio_message_button.click()
|
||||
|
||||
def block_contact(self):
|
||||
self.driver.info("**Block contact from other user profile**")
|
||||
self.driver.info("## Block contact from other user profile")
|
||||
self.profile_block_contact.click()
|
||||
self.confirm_block_contact_button.click()
|
||||
|
||||
@ -892,7 +898,7 @@ class ChatView(BaseView):
|
||||
|
||||
|
||||
def set_nickname(self, nickname, close_profile=True):
|
||||
self.driver.info("**Setting nickname:%s**" % nickname)
|
||||
self.driver.info("## Setting nickname:%s" % nickname)
|
||||
self.profile_nickname_button.click()
|
||||
self.nickname_input_field.send_keys(nickname)
|
||||
self.element_by_text('Done').click()
|
||||
@ -910,7 +916,7 @@ class ChatView(BaseView):
|
||||
|
||||
|
||||
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)))
|
||||
self.driver.info("## Setting new status:'%s', image set is: '%s'" % (BaseElement(self.driver).exclude_emoji(status), str(image)))
|
||||
self.timeline_add_new_status_button.click_until_presence_of_element(self.timeline_my_status_editbox)
|
||||
self.timeline_my_status_editbox.set_value(status)
|
||||
|
||||
|
@ -52,7 +52,7 @@ class DappsView(BaseView):
|
||||
self.select_account_button = Button(self.driver, accessibility_id="select-account")
|
||||
|
||||
def open_url(self, url):
|
||||
self.driver.info("**Open url '%s'**" % url)
|
||||
self.driver.info("## Open url '%s'" % url)
|
||||
self.enter_url_editbox.wait_for_visibility_of_element(10)
|
||||
self.enter_url_editbox.click()
|
||||
self.enter_url_editbox.send_keys(url)
|
||||
@ -65,7 +65,7 @@ class DappsView(BaseView):
|
||||
return BrowserEntry(self.driver, name)
|
||||
|
||||
def browser_entry_long_press(self, name):
|
||||
self.driver.info("**Long press on '%s' browser entry**" % name)
|
||||
self.driver.info("## Long press on '%s' browser entry" % name)
|
||||
entry = self.get_browser_entry(name)
|
||||
entry.scroll_to_element()
|
||||
entry.long_press_element()
|
||||
@ -73,10 +73,10 @@ class DappsView(BaseView):
|
||||
|
||||
def select_account_by_name(self, account_name=''):
|
||||
account_name = self.status_account_name if not account_name else account_name
|
||||
self.driver.info("**Select account by '%s'**" % account_name)
|
||||
self.driver.info("## Select account by '%s'" % account_name)
|
||||
return Button(self.driver,
|
||||
xpath="//*[@text='%s']/../../android.view.ViewGroup/android.view.ViewGroup[2]" % account_name)
|
||||
|
||||
def set_primary_ens_username(self, ens_name):
|
||||
self.driver.info("**Set {} as primary ENS name**".format(ens_name))
|
||||
self.driver.info("## Set '%s' as primary ENS name" % ens_name)
|
||||
return Button(self.driver, accessibility_id="not-primary-username")
|
||||
|
BIN
test/appium/views/elements_templates/saved.png
Normal file
BIN
test/appium/views/elements_templates/saved.png
Normal file
Binary file not shown.
After Width: | Height: | Size: 204 KiB |
@ -81,7 +81,6 @@ class ChatElement(SilentButton):
|
||||
|
||||
return ChatImage(self.driver)
|
||||
|
||||
|
||||
class ActivityCenterChatElement(SilentButton):
|
||||
def __init__(self, driver, chat_name):
|
||||
self.chat_name = chat_name
|
||||
@ -124,6 +123,38 @@ class ActivityCenterChatElement(SilentButton):
|
||||
except NoSuchElementException:
|
||||
return ''
|
||||
|
||||
class PushNotificationElement(SilentButton):
|
||||
def __init__(self, driver, pn_text):
|
||||
self.pn_text = pn_text
|
||||
super().__init__(driver, xpath="//*[@text='%s']" % pn_text)
|
||||
|
||||
@property
|
||||
def icon(self):
|
||||
class PnIconElement(BaseElement):
|
||||
def __init__(self, driver, parent_locator):
|
||||
super().__init__(driver,
|
||||
xpath="%s/../../../../*/*[@resource-id='android:id/message_icon']" % parent_locator)
|
||||
|
||||
return PnIconElement(self.driver, self.locator)
|
||||
|
||||
@property
|
||||
def username(self):
|
||||
class PnUsername(BaseElement):
|
||||
def __init__(self, driver, parent_locator):
|
||||
super().__init__(driver,
|
||||
xpath="%s/../../*[@resource-id='android:id/message_name']" % parent_locator)
|
||||
|
||||
return PnUsername(self.driver, self.locator).text
|
||||
|
||||
@property
|
||||
def group_chat_icon(self):
|
||||
class GroupChatIconElement(BaseElement):
|
||||
def __init__(self, driver, parent_locator):
|
||||
super().__init__(driver, xpath="%s/../../../*[@resource-id='android:id/right_icon_container']" % parent_locator)
|
||||
|
||||
return GroupChatIconElement(self.driver, self.locator)
|
||||
|
||||
|
||||
|
||||
class HomeView(BaseView):
|
||||
def __init__(self, driver):
|
||||
@ -177,7 +208,7 @@ class HomeView(BaseView):
|
||||
self.not_connected_to_peers_text = Text(self.driver, accessibility_id="not-connected-to-peers")
|
||||
|
||||
def wait_for_syncing_complete(self):
|
||||
self.driver.info('**Waiting for syncing complete:**')
|
||||
self.driver.info('## Waiting for syncing to complete')
|
||||
while True:
|
||||
try:
|
||||
sync = self.element_by_text_part('Syncing').wait_for_element(10)
|
||||
@ -186,7 +217,7 @@ class HomeView(BaseView):
|
||||
break
|
||||
|
||||
def get_chat(self, username, community=False):
|
||||
self.driver.info("**Looking for chat:** '%s'" % username)
|
||||
self.driver.info("## Looking for chat: '%s'" % username)
|
||||
chat_element = ChatElement(self.driver, username[:25], community=community)
|
||||
if not chat_element.is_element_displayed():
|
||||
self.notifications_unread_badge.wait_and_click(30)
|
||||
@ -197,12 +228,12 @@ class HomeView(BaseView):
|
||||
return chat_element
|
||||
|
||||
def get_chat_from_home_view(self, username):
|
||||
self.driver.info("**Looking for chat:** '%s'" % username)
|
||||
self.driver.info("## Looking for chat: '%s'" % username)
|
||||
chat_element = ChatElement(self.driver, username[:25])
|
||||
return chat_element
|
||||
|
||||
def get_chat_from_activity_center_view(self, chat_name):
|
||||
self.driver.info("**Looking for chat:** '%s'" % chat_name)
|
||||
self.driver.info("## Looking for chat: '%s'" % chat_name)
|
||||
chat_element = ActivityCenterChatElement(self.driver, chat_name[:25])
|
||||
return chat_element
|
||||
|
||||
@ -210,7 +241,7 @@ class HomeView(BaseView):
|
||||
return Text(self.driver, xpath="//*[@content-desc='enter-contact-code-input']/../..//*[starts-with(@text,'%s')]" % username_part)
|
||||
|
||||
def add_contact(self, public_key, add_in_contacts=True, nickname=''):
|
||||
self.driver.info("**Starting 1-1 chat, add in contacts:%s**" % str(add_in_contacts))
|
||||
self.driver.info("## Starting 1-1 chat, add in contacts:%s" % str(add_in_contacts))
|
||||
self.plus_button.click_until_presence_of_element(self.start_new_chat_button)
|
||||
chat = self.start_new_chat_button.click()
|
||||
chat.public_key_edit_box.click()
|
||||
@ -227,7 +258,7 @@ class HomeView(BaseView):
|
||||
return one_to_one_chat
|
||||
|
||||
def create_group_chat(self, user_names_to_add: list, group_chat_name: str = 'new_group_chat'):
|
||||
self.driver.info("**Creating group chat '%s'**" % group_chat_name)
|
||||
self.driver.info("## Creating group chat '%s'" % group_chat_name)
|
||||
self.plus_button.click()
|
||||
chat_view = self.new_group_chat_button.click()
|
||||
if user_names_to_add:
|
||||
@ -241,11 +272,11 @@ class HomeView(BaseView):
|
||||
chat_view.next_button.click()
|
||||
chat_view.chat_name_editbox.send_keys(group_chat_name)
|
||||
chat_view.create_button.click()
|
||||
self.driver.info("**Group chat %s is created successfully!**" % group_chat_name)
|
||||
self.driver.info("## Group chat %s is created successfully!" % group_chat_name)
|
||||
return chat_view
|
||||
|
||||
def create_community(self, name: str, description="some_description", users_to_add=[],
|
||||
set_image=False, file_name='sauce_logo.png'):
|
||||
def create_community(self, name: str, description="some_description", set_image=False, file_name='sauce_logo.png'):
|
||||
self.driver.info("## Creating community '%s', set image is set to '%s'" % (name, str(set_image)))
|
||||
self.plus_button.click()
|
||||
chat_view = self.communities_button.click()
|
||||
chat_view.create_community_button.click()
|
||||
@ -260,10 +291,11 @@ class HomeView(BaseView):
|
||||
set_picture_view.crop_photo_button.click()
|
||||
|
||||
chat_view.confirm_create_in_community_button.click()
|
||||
self.driver.info("## Community is created successfully!")
|
||||
return chat_view.get_community_by_name(name)
|
||||
|
||||
def join_public_chat(self, chat_name: str):
|
||||
self.driver.info("**Creating public chat %s**" % chat_name)
|
||||
self.driver.info("## Creating public chat %s" % chat_name)
|
||||
self.plus_button.click_until_presence_of_element(self.join_public_chat_button, attempts=5)
|
||||
self.join_public_chat_button.wait_for_visibility_of_element(5)
|
||||
chat_view = self.join_public_chat_button.click()
|
||||
@ -275,7 +307,7 @@ class HomeView(BaseView):
|
||||
return self.get_chat_view()
|
||||
|
||||
def open_status_test_dapp(self, url=test_dapp_url, allow_all=True):
|
||||
self.driver.info("**Open dapp '%s', allow all:%s**" % (test_dapp_url, str(allow_all)))
|
||||
self.driver.info("## Open dapp '%s', allow all:'%s'" % (test_dapp_url, str(allow_all)))
|
||||
dapp_view = self.dapp_tab_button.click()
|
||||
dapp_view.open_url(url)
|
||||
status_test_dapp = dapp_view.get_status_test_dapp_view()
|
||||
@ -284,29 +316,30 @@ class HomeView(BaseView):
|
||||
status_test_dapp.allow_button.click_until_absense_of_element(status_test_dapp.allow_button)
|
||||
else:
|
||||
status_test_dapp.deny_button.click_until_absense_of_element(status_test_dapp.deny_button)
|
||||
self.driver.info("**Dapp is opened!**")
|
||||
self.driver.info("## Dapp is opened!")
|
||||
return status_test_dapp
|
||||
|
||||
def delete_chat_long_press(self, username):
|
||||
self.driver.info("**Deleting chat %s by long press**" % username)
|
||||
self.driver.info("## Deleting chat '%s' by long press" % username)
|
||||
self.get_chat(username).long_press_element()
|
||||
self.delete_chat_button.click()
|
||||
self.delete_button.click()
|
||||
|
||||
def leave_chat_long_press(self, username):
|
||||
self.driver.info("**Leaving chat %s by long press**" % username)
|
||||
self.driver.info("## Leaving chat '%s' by long press" % username)
|
||||
self.get_chat(username).long_press_element()
|
||||
from views.chat_view import ChatView
|
||||
ChatView(self.driver).leave_chat_button.click()
|
||||
ChatView(self.driver).leave_button.click()
|
||||
|
||||
def clear_chat_long_press(self, username):
|
||||
self.driver.info("**Clearing history in chat %s by long press**" % username)
|
||||
self.driver.info("## Clearing history in chat '%s' by long press**" % username)
|
||||
self.get_chat(username).long_press_element()
|
||||
self.clear_history_button.click()
|
||||
from views.chat_view import ChatView
|
||||
ChatView(self.driver).clear_button.click()
|
||||
|
||||
def pn_group_chat_invite_icon(self, pn_text):
|
||||
self.driver.info("**Getting PN icon for group chat invite: %s**" % pn_text)
|
||||
return SilentButton(self.driver, xpath="//*[@text='%s']/../../../*[@resource-id='android:id/right_icon_container']" % pn_text)
|
||||
def get_pn(self, pn_text: str):
|
||||
self.driver.info("## Getting PN by '%s'" % pn_text)
|
||||
PushNotificationElement(self.driver, pn_text).wait_for_element(60)
|
||||
return PushNotificationElement(self.driver, pn_text)
|
@ -54,7 +54,7 @@ class KeycardView(BaseView):
|
||||
return recovery_phrase
|
||||
|
||||
def backup_seed_phrase(self):
|
||||
self.driver.info("**Backing up seed phrase for keycard**")
|
||||
self.driver.info("## Backing up seed phrase for keycard")
|
||||
recovery_phrase = self.get_seed_phrase()
|
||||
self.confirm_button.click()
|
||||
self.yes_button.click()
|
||||
|
@ -320,7 +320,7 @@ class ProfileView(BaseView):
|
||||
self.confirm_logout_button = Button(self.driver, translation_id="logout", uppercase=True)
|
||||
|
||||
def switch_network(self, network='Mainnet with upstream RPC'):
|
||||
self.driver.info("**Switching network to '%s'**" % network)
|
||||
self.driver.info("## Switching network to '%s'" % network)
|
||||
self.advanced_button.click()
|
||||
self.network_settings_button.click()
|
||||
network_button = Button(self.driver, xpath="//*[@text='%s']" % network)
|
||||
@ -331,14 +331,14 @@ class ProfileView(BaseView):
|
||||
SignInView(self.driver).sign_in()
|
||||
|
||||
def open_contact_from_profile(self, username):
|
||||
self.driver.info("**Open profile of '%s' via Contacts**" % username)
|
||||
self.driver.info("## Open profile of '%s' via Contacts" % username)
|
||||
self.contacts_button.wait_and_click(30)
|
||||
self.element_by_text(username).click()
|
||||
from views.chat_view import ChatView
|
||||
return ChatView(self.driver)
|
||||
|
||||
def add_custom_network(self):
|
||||
self.driver.info("**Adding predefined custom network**")
|
||||
self.driver.info("## Adding predefined custom network")
|
||||
self.advanced_button.click()
|
||||
self.network_settings_button.scroll_to_element()
|
||||
self.network_settings_button.click()
|
||||
@ -360,7 +360,7 @@ class ProfileView(BaseView):
|
||||
return dict(zip(map(int, text[::2]), text[1::2]))
|
||||
|
||||
def backup_recovery_phrase(self):
|
||||
self.driver.info("**Backing up seed phrase**")
|
||||
self.driver.info("## Back up seed phrase")
|
||||
self.ok_continue_button.click()
|
||||
recovery_phrase = self.get_recovery_phrase()
|
||||
self.next_button.click()
|
||||
@ -372,11 +372,11 @@ class ProfileView(BaseView):
|
||||
self.done_button.click()
|
||||
self.yes_button.click()
|
||||
self.ok_got_it_button.click()
|
||||
self.driver.info("**Seed phrase is backed up!**")
|
||||
self.driver.info("## Seed phrase is backed up!")
|
||||
return recovery_phrase
|
||||
|
||||
def edit_profile_picture(self, file_name: str, update_by = "Gallery"):
|
||||
self.driver.info("**Setting custom profile image**")
|
||||
self.driver.info("## Setting custom profile image")
|
||||
if not AbstractTestCase().environment == 'sauce':
|
||||
raise NotImplementedError('Test case is implemented to run on SauceLabs only')
|
||||
self.profile_picture.click()
|
||||
@ -417,7 +417,7 @@ class ProfileView(BaseView):
|
||||
|
||||
|
||||
def logout(self):
|
||||
self.driver.info("**Logging out**")
|
||||
self.driver.info("## Logging out")
|
||||
self.logout_button.click()
|
||||
self.logout_dialog.logout_button.click()
|
||||
self.logout_button.wait_for_invisibility_of_element(30)
|
||||
@ -429,11 +429,11 @@ class ProfileView(BaseView):
|
||||
return SilentButton(self.driver, xpath="//*[contains(@content-desc,'%s')]" % image_name)
|
||||
|
||||
def get_toggle_device_by_name(self, device_name):
|
||||
self.driver.info("**Selecting device %s for sync**" % device_name)
|
||||
self.driver.info("## Selecting device '%s' for sync" % device_name)
|
||||
return SilentButton(self.driver, xpath="//android.widget.TextView[contains(@text,'%s')]/..//android.widget.CheckBox" % device_name)
|
||||
|
||||
def discover_and_advertise_device(self, device_name):
|
||||
self.driver.info("**Discover and advertise %s**" % device_name)
|
||||
self.driver.info("## Discover and advertise '%s'" % device_name)
|
||||
self.sync_settings_button.click()
|
||||
self.devices_button.scroll_to_element()
|
||||
self.devices_button.click()
|
||||
@ -442,7 +442,7 @@ class ProfileView(BaseView):
|
||||
self.advertise_device_button.click()
|
||||
|
||||
def retry_to_connect_to_mailserver(self):
|
||||
self.driver.info("**Retrying to connect to mailserver 5 times**")
|
||||
self.driver.info("## Retrying to connect to mailserver 5 times")
|
||||
i = 0
|
||||
while self.element_by_translation_id("mailserver-error-title").is_element_present(20) and i < 5:
|
||||
self.element_by_translation_id("mailserver-retry", uppercase=True).click()
|
||||
|
@ -118,14 +118,14 @@ class SendTransactionView(BaseView):
|
||||
|
||||
|
||||
def set_recipient_address(self, address):
|
||||
self.driver.info("**Setting recipient address to %s**" % address)
|
||||
self.driver.info("## Setting recipient address to '%s'" % address)
|
||||
self.chose_recipient_button.click()
|
||||
self.enter_recipient_address_input.set_value(address)
|
||||
self.enter_recipient_address_input.click()
|
||||
self.done_button.click_until_absense_of_element(self.done_button)
|
||||
|
||||
def sign_transaction(self, sender_password: str = common_password, keycard=False):
|
||||
self.driver.info("**Signing transaction (keycard:%s)**" % str(keycard))
|
||||
self.driver.info("## Signing transaction, (keycard: %s)" % str(keycard))
|
||||
if self.sign_in_phrase.is_element_displayed(30):
|
||||
self.set_up_wallet_when_sending_tx()
|
||||
if keycard:
|
||||
@ -138,7 +138,7 @@ class SendTransactionView(BaseView):
|
||||
self.ok_button.wait_for_element(120)
|
||||
if self.element_by_text_part('Transaction failed').is_element_displayed():
|
||||
self.driver.fail('Transaction failed')
|
||||
self.driver.info("**Transaction is signed!**")
|
||||
self.driver.info("## Transaction is signed!")
|
||||
self.ok_button.click()
|
||||
|
||||
|
||||
@ -147,18 +147,18 @@ class SendTransactionView(BaseView):
|
||||
return address[:6] + '…' + address[-4:]
|
||||
|
||||
def get_username_in_transaction_bottom_sheet_button(self, username_part):
|
||||
self.driver.info("**Getting username by '%s' in transaction fee bottom sheet**" % username_part)
|
||||
self.driver.info("## Getting username by '%s' in transaction fee bottom sheet" % username_part)
|
||||
return SilentButton(self.driver, xpath="//*[@content-desc='amount-input']/..//*[starts-with(@text,'%s')]" % username_part)
|
||||
|
||||
def get_account_in_select_account_bottom_sheet_button(self, account_name):
|
||||
self.driver.info("**Getting account by '%s' in transaction fee bottom sheet**" % account_name)
|
||||
self.driver.info("## Getting account by '%s' in transaction fee bottom sheet" % account_name)
|
||||
return SilentButton(self.driver, translation_id="select-account", suffix="/..//*[starts-with(@text,'%s')]" % account_name)
|
||||
|
||||
def get_validation_icon(self, field='Network fee'):
|
||||
return ValidationErrorOnSendTransaction(self.driver, field)
|
||||
|
||||
def get_values_from_send_transaction_bottom_sheet(self):
|
||||
self.driver.info("**Getting values from send transaction bottom sheet**")
|
||||
self.driver.info("## Getting values from send transaction bottom sheet")
|
||||
data = {
|
||||
'amount': self.amount_edit_box.text,
|
||||
'asset': self.asset_text.text,
|
||||
@ -167,12 +167,12 @@ class SendTransactionView(BaseView):
|
||||
return data
|
||||
|
||||
def get_network_fee_from_bottom_sheet(self):
|
||||
self.driver.info("**Getting network fee from send transaction bottom sheet**")
|
||||
self.driver.info("## Getting network fee from send transaction bottom sheet")
|
||||
return Text(self.driver, xpath="//*[@content-desc='custom-gas-fee']/android.widget.TextView[1]").text[0:-9]
|
||||
|
||||
|
||||
def add_to_favorites(self, name):
|
||||
self.driver.info("**Adding '%s' to favorite recipients**" % name)
|
||||
self.driver.info("## Adding '%s' to favorite recipients" % name)
|
||||
self.recipient_add_to_favorites.click()
|
||||
self.new_favorite_name_input.set_value(name)
|
||||
self.new_favorite_add_favorite.click()
|
@ -75,12 +75,12 @@ class TransactionTable(BaseElement):
|
||||
return self.TransactionDetailsView(self.driver)
|
||||
|
||||
def transaction_by_index(self, index: int):
|
||||
self.driver.info('**Finding transaction by index %s**' % index)
|
||||
self.driver.info('## Finding transaction by index %s' % index)
|
||||
return self.TransactionElement.by_index(self.driver, index=index)
|
||||
|
||||
|
||||
def transaction_by_amount(self, amount: str, asset):
|
||||
self.driver.info('**Finding transaction by amount %s**' % amount)
|
||||
self.driver.info('## Finding transaction by amount %s' % amount)
|
||||
return self.TransactionElement.by_amount(self.driver, amount=amount.replace(',', '.'), asset=asset)
|
||||
|
||||
def find_transaction(self, amount: str, asset='ETH') -> TransactionElement:
|
||||
|
@ -243,16 +243,16 @@ class WalletView(BaseView):
|
||||
|
||||
|
||||
def select_asset(self, *args):
|
||||
self.driver.info("**Selecting asset(s)**")
|
||||
self.driver.info("## Selecting asset(s)")
|
||||
self.multiaccount_more_options.click()
|
||||
self.manage_assets_button.click()
|
||||
for asset in args:
|
||||
self.asset_checkbox_by_name(asset).click()
|
||||
self.cross_icon.click()
|
||||
self.driver.info("**Assets are selected!**")
|
||||
self.driver.info("## Assets are selected!")
|
||||
|
||||
def scan_tokens(self, *args):
|
||||
self.driver.info("**Scanning tokens**")
|
||||
self.driver.info("## Scanning tokens")
|
||||
self.multiaccount_more_options.click()
|
||||
self.scan_tokens_button.click()
|
||||
counter = 0
|
||||
@ -273,7 +273,7 @@ class WalletView(BaseView):
|
||||
return self
|
||||
|
||||
def send_transaction(self, **kwargs):
|
||||
self.driver.info("**Sending transaction**")
|
||||
self.driver.info("## Sending transaction")
|
||||
send_transaction_view = self.send_transaction_button.click()
|
||||
send_transaction_view.select_asset_button.click()
|
||||
asset_name = kwargs.get('asset_name', 'ETH').upper()
|
||||
@ -302,7 +302,7 @@ class WalletView(BaseView):
|
||||
def find_transaction_in_history(self, amount, asset='ETH', account_name=None, return_hash=False):
|
||||
if account_name is None:
|
||||
account_name = self.status_account_name
|
||||
self.driver.info('**Finding %s %s transaction for %s**' % (amount, asset, account_name))
|
||||
self.driver.info("Finding '%s %s' transaction for '%s'" % (amount, asset, account_name))
|
||||
if not self.transaction_history_button.is_element_displayed():
|
||||
self.get_account_by_name(account_name).click()
|
||||
self.transaction_history_button.wait_for_element()
|
||||
@ -317,7 +317,7 @@ class WalletView(BaseView):
|
||||
|
||||
|
||||
def set_currency(self, desired_currency='EUR'):
|
||||
self.driver.info("**Setting '%s' currency**" % desired_currency)
|
||||
self.driver.info("## Setting '%s' currency" % desired_currency)
|
||||
self.multiaccount_more_options.click_until_presence_of_element(self.set_currency_button)
|
||||
self.set_currency_button.click()
|
||||
desired_currency = self.element_by_text_part(desired_currency)
|
||||
@ -325,11 +325,11 @@ class WalletView(BaseView):
|
||||
desired_currency.click()
|
||||
|
||||
def get_account_by_name(self, account_name: str):
|
||||
self.driver.info("**Getting account:** %s'" % account_name)
|
||||
self.driver.info("## Getting account: '%s'" % account_name)
|
||||
return AccountElementButton(self.driver, account_name)
|
||||
|
||||
def add_account(self, account_name: str, password: str = common_password, keycard=False):
|
||||
self.driver.info("**Adding account:** '%s'" % account_name)
|
||||
self.driver.info("## Adding account: '%s'" % account_name)
|
||||
self.add_account_button.click()
|
||||
self.generate_an_account_button.click()
|
||||
self.account_name_input.send_keys(account_name)
|
||||
|
Loading…
x
Reference in New Issue
Block a user