e2e: improved logging in views

Signed-off-by: Churikova Tetiana <churikova.tm@gmail.com>
This commit is contained in:
Churikova Tetiana 2021-10-25 18:05:22 +02:00
parent 40b5c23b54
commit ed609674d3
No known key found for this signature in database
GPG Key ID: 0D4EA7B33B47E6D8
16 changed files with 146 additions and 139 deletions

View File

@ -1162,7 +1162,7 @@ class TestProfileMultipleDevice(MultipleDeviceTestCase):
profile_2 = home_2.get_profile_view()
profile_2.discover_and_advertise_device(device_2_name)
device_1.just_fyi('enable pairing of `device 2` and sync')
device_1.just_fyi('enable pairing of device 2 and sync')
profile_1.discover_and_advertise_device(device_1_name)
profile_1.get_toggle_device_by_name(device_2_name).click()
profile_1.sync_all_button.click()

View File

@ -18,7 +18,7 @@ class TestCommandsMultipleDevices(MultipleDeviceTestCase):
home_2 = device_2.create_user(enable_notifications=True)
for home in home_1, home_2:
profile = home.profile_button.click()
profile.profile_notifications_button.click()
profile.profile_notifications_button.scroll_and_click()
profile.wallet_push_notifications.click()
recipient_public_key, recipient_username = home_2.get_public_key_and_username(return_username=True)

View File

@ -24,7 +24,7 @@ class TestMessagesOneToOneChatMultiple(MultipleDeviceTestCase):
profile_1 = home_1.profile_button.click()
default_username_1 = profile_1.default_username_text.text
profile_1.profile_notifications_button.click()
profile_1.profile_notifications_button.scroll_and_click()
profile_1.profile_notifications_toggle_button.click()
home_1 = profile_1.home_button.click()
public_key_2 = home_2.get_public_key_and_username()

View File

@ -215,8 +215,8 @@ class TestGroupChatMultipleDevice(MultipleDeviceTestCase):
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)
home_1.delete_chat_long_press('#%s' % public_chat_after_sync)
home_2.element_by_text('#%s' % public_chat_after_sync).wait_for_invisibility_of_element(60)
self.errors.verify_no_errors()

View File

@ -142,11 +142,13 @@ class Driver(webdriver.Remote):
def number(self):
return test_suite_data.current_test.testruns[-1].jobs[self.session_id]
def info(self, text: str):
text = 'Device %s: %s ' % (self.number, text)
def info(self, text: str, device=True):
if device:
text = 'Device %s: %s ' % (self.number, text)
logging.info(text)
test_suite_data.current_test.testruns[-1].steps.append(text)
def fail(self, text: str):
pytest.fail('Device %s: %s' % (self.number, text))

View File

@ -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.exclude_emoji(self.locator)))
return self.driver.find_element(self.by, self.locator)
except NoSuchElementException:
raise NoSuchElementException(

View File

@ -296,7 +296,7 @@ class BaseView(object):
def close_native_device_dialog(self, alert_text_part):
element = self.element_by_text_part(alert_text_part)
if element.is_element_present(1):
self.driver.info("**Closing '%s' alert..." % alert_text_part)
self.driver.info("Closing '%s' alert..." % alert_text_part)
self.native_close_button.click()
@property
@ -307,7 +307,7 @@ class BaseView(object):
raise TimeoutError('Logcat is empty')
def confirm(self):
self.driver.info("*Tap 'Confirm' on native keyboard*")
self.driver.info("Tap 'Confirm' on native keyboard")
self.driver.press_keycode(66)
def confirm_until_presence_of_element(self, desired_element, attempts=3):
@ -315,55 +315,53 @@ class BaseView(object):
while not desired_element.is_element_present(1) and counter <= attempts:
try:
self.confirm()
self.driver.info('*Wait for %s*' % desired_element.name)
self.driver.info("Wait for '%s'" % desired_element.name)
desired_element.wait_for_element(5)
return
except TimeoutException:
counter += 1
def just_fyi(self, string):
self.driver.info('=========================================================================')
self.driver.info('# %s' % string)
self.driver.info('=========================================================================')
self.driver.info('# STEP: %s' % string, device=False)
def click_system_back_button(self, times=1):
self.driver.info('*Click system back button*')
self.driver.info('Click system back button')
for _ in range(times):
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 +404,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
@ -442,7 +440,7 @@ class BaseView(object):
home.stop_syncing_button.wait_and_click()
def pull_to_refresh(self, wait_sec=20):
self.driver.info("*Pull to refresh view*")
self.driver.info("Pull to refresh view")
self.driver.swipe(500, 500, 500, 1000)
time.sleep(wait_sec)
@ -534,13 +532,13 @@ class BaseView(object):
sign_in_view.sign_in(password)
def close_share_popup(self):
self.driver.info("*Closing share popup*")
self.driver.info("Closing share popup")
TouchAction(self.driver).tap(None, 255, 104, 1).perform()
time.sleep(3)
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 +549,7 @@ class BaseView(object):
return user_data
def share_via_messenger(self):
self.driver.info("## Sharing via messenger")
self.driver.info("Sharing via messenger", device=False)
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,8 +557,9 @@ 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.element_by_text_part(text).click()
element = self.element_by_text_part(text)
self.driver.info("Click on PN with text: '%s'" % element.exclude_emoji(text))
element.click()
return self.get_chat_view()
@ -568,7 +567,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 +578,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 +592,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 +605,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 +618,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

View File

@ -224,7 +224,7 @@ class ChatElementByText(Text):
def text(self):
try:
text = self.find_element().text
self.driver.info('%s is %s for %s where my reaction is set on message is %s' % (self.name, text, self.emoji, str(self.own)))
self.driver.info("%s is '%s' for '%s' where my reaction is set on message is '%s'" % (self.name, text, self.emoji, str(self.own)))
return text
except NoSuchElementException:
return 0
@ -311,7 +311,7 @@ class CommunityView(HomeView):
def add_channel(self, name: str, description="Some new channel"):
self.driver.info("**Adding channel**")
self.driver.info("Adding channel")
self.plus_button.click()
self.community_create_a_channel_button.wait_and_click()
self.channel_name_edit_box.set_value(name)
@ -322,7 +322,7 @@ class CommunityView(HomeView):
return chat_view
def copy_community_link(self):
self.driver.info("**Copy community link**")
self.driver.info("Copy community link")
self.community_options_button.click()
self.community_info_button.click()
self.element_starts_with_text('join.status.im/c/').click()
@ -331,7 +331,7 @@ class CommunityView(HomeView):
return 'https://%s'% community_link_text
def handle_membership_request(self, username: str, approve=True):
self.driver.info("**Handling membership request of user %s, approve=%s**" %(username, str(approve)))
self.driver.info("Handling membership request of user '%s', approve='%s'" %(username, str(approve)))
self.members_button.click()
self.membership_requests_button.click()
approve_suffix, decline_suffix = '/following-sibling::android.view.ViewGroup[1]', '/following-sibling::android.view.ViewGroup[2]'
@ -668,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()
@ -710,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()
@ -744,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']
@ -766,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()
@ -785,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("## Quoting '%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!)
@ -821,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:
@ -833,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, device=False)
self.show_stickers_button.click()
self.get_stickers.click()
element = Button(self.driver,
@ -848,9 +848,10 @@ class ChatView(BaseView):
self.back_button.click()
time.sleep(2)
self.swipe_left()
self.driver.info("## Stickerpack is installed successfully!", device=False)
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()
@ -868,26 +869,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()
@ -898,7 +899,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()
@ -916,7 +917,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)), 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)
@ -926,6 +927,7 @@ class ChatView(BaseView):
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:
if incoming:

View File

@ -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 '%s' as primary ENS name" % ens_name)
self.driver.info("Set '%s' as primary ENS name" % ens_name)
return Button(self.driver, accessibility_id="not-primary-username")

View File

@ -208,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 to complete')
self.driver.info('Waiting for syncing to complete')
while True:
try:
sync = self.element_by_text_part('Syncing').wait_for_element(10)
@ -217,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)
@ -228,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
@ -241,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), device=False)
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()
@ -254,11 +254,11 @@ class HomeView(BaseView):
one_to_one_chat.chat_options.click()
one_to_one_chat.view_profile_button.click()
one_to_one_chat.set_nickname(nickname)
self.driver.info("**1-1 chat is created successfully!**")
self.driver.info("## 1-1 chat is created successfully!", device=False)
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, device=False)
self.plus_button.click()
chat_view = self.new_group_chat_button.click()
if user_names_to_add:
@ -272,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, device=False)
return chat_view
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.driver.info("## Creating community '%s', set image is set to '%s'" % (name, str(set_image)), device=False)
self.plus_button.click()
chat_view = self.communities_button.click()
chat_view.create_community_button.click()
@ -291,11 +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!")
self.driver.info("## Community is created successfully!", device=False)
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, device=False)
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()
@ -303,11 +303,11 @@ class HomeView(BaseView):
chat_view.chat_name_editbox.send_keys(chat_name)
time.sleep(2)
self.confirm_until_presence_of_element(chat_view.chat_message_input)
self.driver.info("**Public chat %s is created successfully!**" % chat_name)
self.driver.info("## Public chat '%s' is created successfully!" % chat_name, device=False)
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("Opening 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()
@ -316,30 +316,29 @@ 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!")
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 get_pn(self, pn_text: str):
self.driver.info("## Getting PN by '%s'" % pn_text)
self.driver.info("Getting PN by '%s'" % pn_text)
PushNotificationElement(self.driver, pn_text).wait_for_element(60)
return PushNotificationElement(self.driver, pn_text)

View File

@ -24,15 +24,15 @@ class KeycardView(BaseView):
self.confirm_seed_phrase_edit_box = EditBox(self.driver, accessibility_id="enter-word")
def enter_default_pin(self):
self.driver.info("**Enter default pin 111111**")
self.driver.info("Enter default pin 111111")
[self.one_button.click() for _ in range(6)]
def enter_default_puk(self):
self.driver.info("**Enter default pin 1111 1111 1111**")
self.driver.info("Enter default pin 1111 1111 1111")
[self.one_button.click() for _ in range(12)]
def enter_another_pin(self):
self.driver.info("**Enter not-default pin 222222**")
self.driver.info("Enter not-default pin 222222")
for _ in range(6):
self.two_button.click()
@ -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()

View File

@ -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("## Switch network to '%s'" % network, device=False)
self.advanced_button.click()
self.network_settings_button.click()
network_button = Button(self.driver, xpath="//*[@text='%s']" % network)
@ -329,16 +329,17 @@ class ProfileView(BaseView):
self.confirm_button.click_until_absense_of_element(self.confirm_button)
from views.sign_in_view import SignInView
SignInView(self.driver).sign_in()
self.driver.info("## Network is switched successfully!", device=False)
def open_contact_from_profile(self, username):
self.driver.info("## Open profile of '%s' via Contacts" % username)
self.driver.info("Opening 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("## Add predefined custom network", device=False)
self.advanced_button.click()
self.network_settings_button.scroll_to_element()
self.network_settings_button.click()
@ -353,6 +354,7 @@ class ProfileView(BaseView):
self.element_by_text_part('custom_ropsten').click_until_presence_of_element(self.connect_button)
self.connect_button.click()
self.confirm_button.click()
self.driver.info("## Custom network is added succesfully!", device=False)
return self.get_sign_in_view()
def get_recovery_phrase(self):
@ -360,7 +362,7 @@ class ProfileView(BaseView):
return dict(zip(map(int, text[::2]), text[1::2]))
def backup_recovery_phrase(self):
self.driver.info("## Back up seed phrase")
self.driver.info("## Back up seed phrase", device=False)
self.ok_continue_button.click()
recovery_phrase = self.get_recovery_phrase()
self.next_button.click()
@ -372,11 +374,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!", device=False)
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", device=False)
if not AbstractTestCase().environment == 'sauce':
raise NotImplementedError('Test case is implemented to run on SauceLabs only')
self.profile_picture.click()
@ -392,7 +394,7 @@ class ProfileView(BaseView):
self.take_photo()
self.accept_photo_button.click()
self.crop_photo_button.click()
self.driver.info("**Custom profile image has been set**")
self.driver.info("## Custom profile image has been set", device=False)
def take_photo(self):
@ -417,7 +419,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 +431,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("Discovering and advertising '%s'" % device_name)
self.sync_settings_button.click()
self.devices_button.scroll_to_element()
self.devices_button.click()
@ -442,7 +444,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()
@ -453,7 +455,7 @@ class ProfileView(BaseView):
self.driver.fail("Failed to connect after %s attempts" % i)
def connect_existing_ens(self, name, is_stateofus=False):
self.driver.info("**Connect existing ENS: %s**" % name)
self.driver.info("## Connect existing ENS: %s" % name, device=False)
dapp_view = self.ens_usernames_button.click()
dapp_view.element_by_translation_id("get-started").click()
if not is_stateofus:
@ -465,6 +467,7 @@ class ProfileView(BaseView):
dapp_view.element_by_text_part(expected_text).wait_for_element(30)
dapp_view.check_ens_name.click_until_presence_of_element(dapp_view.element_by_translation_id("ens-got-it"))
dapp_view.element_by_translation_id("ens-got-it").click()
self.driver.info("## ENS name is connected successfully!", device=False)
return dapp_view
@staticmethod

View File

@ -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), device=False)
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!", device=False)
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()

View File

@ -172,7 +172,7 @@ class SignInView(BaseView):
self.cancel_custom_seed_phrase_button = Button(self.driver, accessibility_id="cancel-custom-seed-phrase")
def create_user(self, password=common_password, keycard=False, enable_notifications=False, second_user=False):
self.driver.info("**Creating new multiaccount (password:%s, keycard:%s)**" % (password, str(keycard)))
self.driver.info("## Creating new multiaccount (password:'%s', keycard:'%s')" % (password, str(keycard)), device=False)
if not second_user:
self.accept_tos_checkbox.click()
self.get_started_button.click()
@ -196,11 +196,11 @@ class SignInView(BaseView):
self.maybe_later_button.click_until_presence_of_element(self.lets_go_button)
self.lets_go_button.click_until_absense_of_element(self.lets_go_button)
self.profile_button.wait_for_visibility_of_element(30)
self.driver.info("**New multiaccount is created successfully!**")
self.driver.info("## New multiaccount is created successfully!", device=False)
return self.get_home_view()
def recover_access(self, passphrase: str, password: str = common_password, keycard=False, enable_notifications=False, second_user=False):
self.driver.info("**Recover access(password:%s, keycard:%s)**" % (password, str(keycard)))
self.driver.info("## Recover access(password:%s, keycard:%s)" % (password, str(keycard)), device=False)
if not second_user:
self.accept_tos_checkbox.click()
self.get_started_button.click_until_presence_of_element(self.access_key_button)
@ -228,11 +228,11 @@ class SignInView(BaseView):
self.maybe_later_button.click_until_presence_of_element(self.lets_go_button)
self.lets_go_button.click()
self.profile_button.wait_for_visibility_of_element(30)
self.driver.info("**Multiaccount is recovered successfully!**")
self.driver.info("## Multiaccount is recovered successfully!", device=False)
return self.get_home_view()
def sign_in(self, password=common_password, keycard=False, position=1):
self.driver.info("**Sign in** (password:%s, keycard:%s)" % (password, str(keycard)))
self.driver.info("## Sign in (password:%s, keycard:%s)" % (password, str(keycard)), device=False)
if self.multi_account_on_login_button.is_element_displayed(30):
self.get_multiaccount_by_position(position).click()
@ -246,7 +246,7 @@ class SignInView(BaseView):
else:
self.password_input.set_value(password)
self.sign_in_button.click()
self.driver.info("**Signed in successfully!**")
self.driver.info("## Signed in successfully!", device=False)
return self.get_home_view()
@ -259,12 +259,12 @@ class SignInView(BaseView):
'Device %s: Unable to find multiaccount by position %s' % (self.driver.number, position)) from None
def open_weblink_and_login(self, url_weblink):
self.driver.info("**Open weblink %s**" % url_weblink)
self.driver.info("Open weblink '%s'" % url_weblink)
self.open_universal_web_link(url_weblink)
self.sign_in()
def import_db(self, user, import_db_folder_name):
self.just_fyi('**Importing database**')
self.driver.info('## Importing database', device=False)
import_file_name = 'export.db'
home = self.recover_access(user['passphrase'])
profile = home.profile_button.click()
@ -280,5 +280,5 @@ class SignInView(BaseView):
self.element_by_text('Import unencrypted').wait_for_invisibility_of_element(40)
self.sign_in_button.click()
self.home_button.wait_for_element(40)
self.just_fyi('**Importing database is finished!**')
self.driver.info('## Importing database is finished!', device=False)
return self.get_home_view()

View File

@ -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:

View File

@ -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("## Add account: '%s'" % account_name, device=False)
self.add_account_button.click()
self.generate_an_account_button.click()
self.account_name_input.send_keys(account_name)
@ -341,6 +341,8 @@ class WalletView(BaseView):
else:
self.enter_your_password_input.send_keys(password)
self.add_account_generate_account_button.click()
self.driver.info("## Account is added!", device=False)
def get_collectibles_amount(self, collectibles='CryptoKitties'):
self.driver.info("Getting '%s' Collectibles amount" % collectibles)
return Text(self.driver,xpath="//*[@text='%s']//following-sibling::android.widget.TextView" % collectibles)