2019-07-29 00:35:36 +00:00
|
|
|
|
import time
|
|
|
|
|
|
|
|
|
|
import emoji
|
2018-06-21 16:40:27 +00:00
|
|
|
|
import random
|
|
|
|
|
import string
|
2018-06-28 18:46:51 +00:00
|
|
|
|
from selenium.common.exceptions import TimeoutException
|
2019-07-29 00:35:36 +00:00
|
|
|
|
|
2020-08-19 15:04:21 +00:00
|
|
|
|
from tests import marks
|
2018-06-28 18:46:51 +00:00
|
|
|
|
from tests.base_test_case import MultipleDeviceTestCase, SingleDeviceTestCase
|
2020-08-19 15:04:21 +00:00
|
|
|
|
from tests.users import transaction_senders, basic_user, ens_user, ens_user_ropsten
|
2018-06-21 16:40:27 +00:00
|
|
|
|
from views.sign_in_view import SignInView
|
2021-05-25 16:42:58 +00:00
|
|
|
|
from views.send_transaction_view import SendTransactionView
|
2018-06-21 16:40:27 +00:00
|
|
|
|
|
|
|
|
|
|
2018-06-28 18:46:51 +00:00
|
|
|
|
class TestMessagesOneToOneChatMultiple(MultipleDeviceTestCase):
|
2018-06-21 16:40:27 +00:00
|
|
|
|
|
2020-07-20 15:13:09 +00:00
|
|
|
|
@marks.testrail_id(6283)
|
|
|
|
|
@marks.high
|
2021-04-23 12:36:38 +00:00
|
|
|
|
def test_push_notification_1_1_chat_no_pn_activity_center(self):
|
2020-07-20 15:13:09 +00:00
|
|
|
|
self.create_drivers(2)
|
|
|
|
|
device_1, device_2 = SignInView(self.drivers[0]), SignInView(self.drivers[1])
|
|
|
|
|
device_1_home, device_2_home = device_1.create_user(), device_2.create_user(enable_notifications=True)
|
|
|
|
|
device_2.just_fyi("Device_1 = Enables Notifications from Profile; Device_2 - from onboarding")
|
|
|
|
|
|
|
|
|
|
profile_1 = device_1_home.profile_button.click()
|
|
|
|
|
default_username_1 = profile_1.default_username_text.text
|
|
|
|
|
profile_1.profile_notifications_button.click()
|
2020-09-25 12:35:10 +00:00
|
|
|
|
profile_1.profile_notifications_toggle_button.click()
|
2021-06-23 15:12:42 +00:00
|
|
|
|
device_1_home = profile_1.home_button.click()
|
2020-07-20 15:13:09 +00:00
|
|
|
|
device_2_public_key = device_2_home.get_public_key_and_username()
|
2021-04-23 12:36:38 +00:00
|
|
|
|
message_no_pn, message = 'No PN', 'Text push notification'
|
|
|
|
|
|
|
|
|
|
device_2.just_fyi("Device 2 check there is no PN when receiving new message to activity centre")
|
|
|
|
|
device_2.put_app_to_background()
|
|
|
|
|
device_1_chat = device_1_home.add_contact(device_2_public_key)
|
|
|
|
|
device_1_chat.send_message(message_no_pn)
|
|
|
|
|
device_2.open_notification_bar()
|
|
|
|
|
if device_2.element_by_text_part(message_no_pn).is_element_displayed():
|
2021-05-25 16:42:58 +00:00
|
|
|
|
self.errors.append("Push notification with text was received for new message in activity centre")
|
2021-04-23 12:36:38 +00:00
|
|
|
|
device_2.get_app_from_background()
|
|
|
|
|
device_2.home_button.click()
|
|
|
|
|
device_2_home.get_chat(default_username_1).click()
|
|
|
|
|
device_2_home.profile_button.click()
|
2020-07-20 15:13:09 +00:00
|
|
|
|
|
|
|
|
|
device_2.just_fyi("Device 2 puts app on background being on Profile view to receive PN with text")
|
|
|
|
|
device_2.click_system_home_button()
|
2021-04-23 12:36:38 +00:00
|
|
|
|
device_1_chat.send_message(message)
|
2020-07-20 15:13:09 +00:00
|
|
|
|
|
|
|
|
|
device_1.just_fyi("Device 1 puts app on background to receive emoji push notification")
|
|
|
|
|
device_1.profile_button.click()
|
|
|
|
|
device_1.click_system_home_button()
|
|
|
|
|
|
|
|
|
|
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()):
|
2021-05-25 16:42:58 +00:00
|
|
|
|
device_2.driver.fail("Push notification with text was not received")
|
2020-07-20 15:13:09 +00:00
|
|
|
|
chat_view_device_2 = device_2.click_upon_push_notification_by_text(message)
|
|
|
|
|
|
|
|
|
|
device_2.just_fyi("Send emoji message to Device 1 while it's on backround")
|
|
|
|
|
emoji_message = random.choice(list(emoji.EMOJI_UNICODE))
|
|
|
|
|
emoji_unicode = emoji.EMOJI_UNICODE[emoji_message]
|
|
|
|
|
chat_view_device_2.send_message(emoji.emojize(emoji_message))
|
|
|
|
|
|
|
|
|
|
device_1.just_fyi("Device 1 checks PN with emoji")
|
|
|
|
|
device_1.open_notification_bar()
|
|
|
|
|
if not device_1.element_by_text_part(emoji_unicode).is_element_displayed(10):
|
|
|
|
|
device_1.driver.fail("Push notification with emoji was not received")
|
|
|
|
|
chat_view_device_1 = device_1.click_upon_push_notification_by_text(emoji_unicode)
|
|
|
|
|
device_1.just_fyi("Check Device 1 is actually on chat")
|
|
|
|
|
if not (chat_view_device_1.element_by_text_part(message).is_element_displayed()
|
2021-05-25 16:42:58 +00:00
|
|
|
|
and chat_view_device_1.element_by_text_part(emoji_unicode).is_element_displayed()):
|
2020-07-20 15:13:09 +00:00
|
|
|
|
device_1.driver.fail("Failed to open chat view after tap on PN")
|
|
|
|
|
|
|
|
|
|
device_1.just_fyi("Checks there are no PN after message was seen")
|
2020-07-29 15:54:45 +00:00
|
|
|
|
[device.click_system_home_button() for device in (device_1, device_2)]
|
|
|
|
|
[device.open_notification_bar() for device in (device_1, device_2)]
|
2020-07-20 15:13:09 +00:00
|
|
|
|
if (device_2.element_by_text_part(message).is_element_displayed()
|
|
|
|
|
or device_1.element_by_text_part(emoji_unicode).is_element_displayed()):
|
|
|
|
|
self.errors.append("PN are keep staying after message was seen by user")
|
|
|
|
|
self.errors.verify_no_errors()
|
|
|
|
|
|
2018-09-28 15:30:06 +00:00
|
|
|
|
@marks.testrail_id(5310)
|
|
|
|
|
@marks.critical
|
2021-02-26 15:27:20 +00:00
|
|
|
|
def test_offline_is_shown_messaging_1_1_chat_sent_delivered(self):
|
2019-07-29 00:35:36 +00:00
|
|
|
|
self.create_drivers(2)
|
2020-10-30 14:40:14 +00:00
|
|
|
|
home_1, home_2 = SignInView(self.drivers[0]).create_user(), SignInView(self.drivers[1]).create_user()
|
2020-04-10 10:25:46 +00:00
|
|
|
|
public_key_1 = home_1.get_public_key_and_username()
|
2018-06-21 16:40:27 +00:00
|
|
|
|
home_1.home_button.click()
|
|
|
|
|
|
2020-10-30 14:40:14 +00:00
|
|
|
|
home_1.just_fyi('turn on airplane mode and check that offline status is shown on home view')
|
|
|
|
|
home_1.toggle_airplane_mode()
|
2021-02-16 14:57:20 +00:00
|
|
|
|
home_1.connection_offline_icon.wait_and_click(20)
|
|
|
|
|
for element in home_1.not_connected_to_node_text, home_1.not_connected_to_peers_text:
|
|
|
|
|
if not element.is_element_displayed():
|
2021-05-25 16:42:58 +00:00
|
|
|
|
self.errors.append(
|
|
|
|
|
'Element "%s" is not shown in Connection status screen if device is offline' % element.locator)
|
2021-02-16 14:57:20 +00:00
|
|
|
|
home_1.click_system_back_button()
|
|
|
|
|
|
2019-07-29 00:35:36 +00:00
|
|
|
|
profile_2 = home_2.profile_button.click()
|
|
|
|
|
username_2 = profile_2.default_username_text.text
|
2021-06-23 15:12:42 +00:00
|
|
|
|
profile_2.home_button.click()
|
2018-06-21 16:40:27 +00:00
|
|
|
|
chat_2 = home_2.add_contact(public_key_1)
|
|
|
|
|
message_1 = 'test message'
|
2021-02-26 15:27:20 +00:00
|
|
|
|
|
|
|
|
|
home_2.just_fyi("check sent status")
|
2020-10-30 14:40:14 +00:00
|
|
|
|
chat_2.send_message(message_1)
|
2021-02-26 15:27:20 +00:00
|
|
|
|
if chat_2.chat_element_by_text(message_1).status != 'sent':
|
|
|
|
|
self.errors.append('Message status is not sent, it is %s!' % chat_2.chat_element_by_text(message_1).status)
|
2020-10-30 14:40:14 +00:00
|
|
|
|
chat_2.toggle_airplane_mode()
|
2018-06-21 16:40:27 +00:00
|
|
|
|
|
2020-10-30 14:40:14 +00:00
|
|
|
|
home_1.just_fyi('go back online and check that 1-1 chat will be fetched')
|
|
|
|
|
home_1.toggle_airplane_mode()
|
2020-03-17 17:27:10 +00:00
|
|
|
|
chat_element = home_1.get_chat(username_2)
|
2019-10-30 18:21:21 +00:00
|
|
|
|
chat_element.wait_for_visibility_of_element(30)
|
2018-06-21 16:40:27 +00:00
|
|
|
|
chat_1 = chat_element.click()
|
|
|
|
|
chat_1.chat_element_by_text(message_1).wait_for_visibility_of_element(2)
|
|
|
|
|
|
2021-02-26 15:27:20 +00:00
|
|
|
|
home_1.just_fyi('checking offline fetching for another message, check delivered stutus for first message')
|
2020-10-30 14:40:14 +00:00
|
|
|
|
chat_2.toggle_airplane_mode()
|
2021-02-26 15:27:20 +00:00
|
|
|
|
if chat_2.chat_element_by_text(message_1).status != 'delivered':
|
2021-05-25 16:42:58 +00:00
|
|
|
|
self.errors.append(
|
|
|
|
|
'Message status is not delivered, it is %s!' % chat_2.chat_element_by_text(message_1).status)
|
2020-10-30 14:40:14 +00:00
|
|
|
|
home_1.toggle_airplane_mode()
|
2018-06-21 16:40:27 +00:00
|
|
|
|
message_2 = 'one more message'
|
2020-10-30 14:40:14 +00:00
|
|
|
|
chat_2.send_message(message_2)
|
|
|
|
|
home_1.toggle_airplane_mode()
|
2018-06-21 16:40:27 +00:00
|
|
|
|
chat_1 = chat_element.click()
|
|
|
|
|
chat_1.chat_element_by_text(message_2).wait_for_visibility_of_element(180)
|
2021-02-26 15:27:20 +00:00
|
|
|
|
self.errors.verify_no_errors()
|
2018-06-21 16:40:27 +00:00
|
|
|
|
|
2018-09-28 15:30:06 +00:00
|
|
|
|
@marks.testrail_id(5315)
|
2019-03-05 16:43:30 +00:00
|
|
|
|
@marks.high
|
2021-02-18 15:12:54 +00:00
|
|
|
|
def test_send_non_english_message_to_newly_added_contact_on_different_networks(self):
|
2018-06-28 18:46:51 +00:00
|
|
|
|
self.create_drivers(2)
|
2021-05-25 16:42:58 +00:00
|
|
|
|
device_1_home, device_2_home = SignInView(self.drivers[0]).create_user(), SignInView(
|
|
|
|
|
self.drivers[1]).create_user()
|
2019-06-28 14:36:24 +00:00
|
|
|
|
profile_1 = device_1_home.profile_button.click()
|
2021-02-18 15:12:54 +00:00
|
|
|
|
profile_1.switch_network()
|
2018-06-28 18:46:51 +00:00
|
|
|
|
|
2021-02-18 15:12:54 +00:00
|
|
|
|
profile_1.just_fyi("Getting public keys and usernames for both users")
|
|
|
|
|
device_1_home.profile_button.click()
|
|
|
|
|
default_username_1 = profile_1.default_username_text.text
|
|
|
|
|
profile_1.home_button.double_click()
|
2020-01-28 13:55:28 +00:00
|
|
|
|
# Skip until edit-profile feature returned
|
|
|
|
|
# profile_1 = device_1_home.profile_button.click()
|
|
|
|
|
# profile_1.edit_profile_picture('sauce_logo.png')
|
|
|
|
|
# profile_1.home_button.click()
|
2021-02-18 15:12:54 +00:00
|
|
|
|
device_2_public_key, default_username_2 = device_2_home.get_public_key_and_username(return_username=True)
|
2018-06-28 18:46:51 +00:00
|
|
|
|
device_2_home.home_button.click()
|
|
|
|
|
|
2021-02-18 15:12:54 +00:00
|
|
|
|
profile_1.just_fyi("Add user to contacts and send messages on different language")
|
|
|
|
|
device_1_chat = device_1_home.add_contact(device_2_public_key + ' ')
|
2020-05-20 15:43:29 +00:00
|
|
|
|
messages = ['hello', '¿Cómo estás tu año?', 'ё, доброго вечерочка', '® æ ç ♥']
|
2021-02-18 15:12:54 +00:00
|
|
|
|
timestamp_message = messages[3]
|
2020-05-20 15:43:29 +00:00
|
|
|
|
for message in messages:
|
|
|
|
|
device_1_chat.send_message(message)
|
2021-02-18 15:12:54 +00:00
|
|
|
|
device_2_chat = device_2_home.get_chat(default_username_1).click()
|
2021-02-19 13:46:29 +00:00
|
|
|
|
sent_time_variants = device_1_chat.convert_device_time_to_chat_timestamp()
|
2020-05-20 15:43:29 +00:00
|
|
|
|
for message in messages:
|
|
|
|
|
if not device_2_chat.chat_element_by_text(message).is_element_displayed():
|
|
|
|
|
self.errors.append("Message with test '%s' was not received" % message)
|
2018-06-28 18:46:51 +00:00
|
|
|
|
if not device_2_chat.add_to_contacts.is_element_displayed():
|
|
|
|
|
self.errors.append('Add to contacts button is not shown')
|
2019-06-28 14:36:24 +00:00
|
|
|
|
if device_2_chat.user_name_text.text != default_username_1:
|
|
|
|
|
self.errors.append("Default username '%s' is not shown in one-to-one chat" % default_username_1)
|
2021-02-18 15:12:54 +00:00
|
|
|
|
|
|
|
|
|
profile_1.just_fyi("Check timestamps for sender and receiver")
|
|
|
|
|
for chat in device_1_chat, device_2_chat:
|
|
|
|
|
chat.verify_message_is_under_today_text(timestamp_message, self.errors)
|
|
|
|
|
timestamp = chat.chat_element_by_text(timestamp_message).timestamp_message.text
|
2021-02-19 13:46:29 +00:00
|
|
|
|
if timestamp not in sent_time_variants:
|
2021-05-25 16:42:58 +00:00
|
|
|
|
self.errors.append(
|
|
|
|
|
"Timestamp is not shown, expected '%s', in fact '%s'" % (sent_time_variants.join(","), timestamp))
|
2021-02-18 15:12:54 +00:00
|
|
|
|
|
|
|
|
|
device_2_home.just_fyi("Add user to contact and verify his default username")
|
|
|
|
|
device_2_chat.add_to_contacts.click()
|
2018-06-28 18:46:51 +00:00
|
|
|
|
device_2_chat.chat_options.click()
|
|
|
|
|
device_2_chat.view_profile_button.click()
|
2021-02-18 15:12:54 +00:00
|
|
|
|
if not device_2_chat.remove_from_contacts.is_element_displayed():
|
|
|
|
|
self.errors.append("Remove from contacts in not shown after adding contact from 1-1 chat bar")
|
2021-06-14 17:52:58 +00:00
|
|
|
|
device_2_chat.close_button.click()
|
2021-02-18 15:12:54 +00:00
|
|
|
|
device_2_chat.home_button.double_click()
|
|
|
|
|
device_2_home.plus_button.click()
|
|
|
|
|
device_2_contacts = device_2_home.start_new_chat_button.click()
|
|
|
|
|
if not device_2_contacts.element_by_text(default_username_1).is_element_displayed():
|
|
|
|
|
self.errors.append('%s is not added to contacts' % default_username_1)
|
|
|
|
|
if device_1_chat.user_name_text.text != default_username_2:
|
|
|
|
|
self.errors.append("Default username '%s' is not shown in one-to-one chat" % default_username_2)
|
|
|
|
|
device_1_chat.chat_options.click()
|
|
|
|
|
device_1_chat.view_profile_button.click()
|
2020-01-28 13:55:28 +00:00
|
|
|
|
|
2020-08-25 14:37:32 +00:00
|
|
|
|
# TODO: skip until edit-profile feature returned
|
2020-01-28 13:55:28 +00:00
|
|
|
|
|
|
|
|
|
# if not device_2_chat.contact_profile_picture.is_element_image_equals_template('sauce_logo.png'):
|
|
|
|
|
# self.errors.append("Updated profile picture is not shown in one-to-one chat")
|
2019-10-29 08:25:57 +00:00
|
|
|
|
self.errors.verify_no_errors()
|
2018-06-28 18:46:51 +00:00
|
|
|
|
|
2021-07-07 08:02:54 +00:00
|
|
|
|
@marks.testrail_id(695843)
|
|
|
|
|
@marks.high
|
|
|
|
|
def test_edit_message_in_one_to_one_and_public_chats(self):
|
|
|
|
|
self.create_drivers(2)
|
|
|
|
|
device_1, device_2 = SignInView(self.drivers[0]), SignInView(self.drivers[1])
|
|
|
|
|
device_1_home, device_2_home = device_1.create_user(), device_2.create_user()
|
|
|
|
|
|
|
|
|
|
device_2.just_fyi("Create public chat on Device1, send message and edit it then")
|
|
|
|
|
public_key_1, username_1 = device_1_home.get_public_key_and_username(return_username=True)
|
|
|
|
|
public_key_2, username_2 = device_2_home.get_public_key_and_username(return_username=True)
|
|
|
|
|
device_1_home.home_button.click()
|
|
|
|
|
device_2_home.home_button.click()
|
|
|
|
|
chat_name = device_1_home.get_random_chat_name()
|
|
|
|
|
device_1_home.join_public_chat(chat_name)
|
|
|
|
|
device_1_public_chat = device_1_home.get_chat_view()
|
|
|
|
|
message_before_edit = "Message BEFORE edit 1"
|
|
|
|
|
message_after_edit = "Message AFTER edit 2"
|
|
|
|
|
device_1_public_chat.send_message(message_before_edit)
|
|
|
|
|
device_1_public_chat.edit_message_in_chat(message_before_edit, message_after_edit)
|
|
|
|
|
if not device_1_public_chat.element_by_text_part("⌫ Edited").is_element_displayed():
|
|
|
|
|
self.errors.append('No mark in message bubble about this message was edited')
|
|
|
|
|
|
|
|
|
|
device_2.just_fyi("Device 1 sends text message and edits it in 1-1 chat. Device2 checks edited message is shown")
|
|
|
|
|
device_2_chat = device_2_home.add_contact(public_key_1)
|
|
|
|
|
message_before_edit_1_1 = "Message before edit 1-1"
|
|
|
|
|
message_after_edit_1_1 = "AFTER"
|
|
|
|
|
device_2_chat.send_message(message_before_edit_1_1)
|
|
|
|
|
device_1_home.home_button.click()
|
|
|
|
|
|
|
|
|
|
device_1_one_to_one_chat_element = device_1_home.get_chat(username_2)
|
|
|
|
|
device_2_chat.edit_message_in_chat(message_before_edit_1_1, message_after_edit_1_1)
|
|
|
|
|
device_2_home.home_button.click()
|
|
|
|
|
if not device_1_home.element_by_text_part(message_after_edit_1_1).is_element_present():
|
|
|
|
|
self.errors.append('UNedited message version displayed on preview')
|
|
|
|
|
device_1_one_to_one_chat_element.click()
|
|
|
|
|
if not device_1_home.element_by_text_part(message_after_edit_1_1).is_element_present():
|
|
|
|
|
self.errors.append('No edited message in 1-1 chat displayed')
|
|
|
|
|
if not device_1_home.element_by_text_part("⌫ Edited").is_element_present():
|
|
|
|
|
self.errors.append('No mark in message bubble about this message was edited on receiver side')
|
|
|
|
|
|
|
|
|
|
device_2.just_fyi("Verify Device1 can not edit received message from Device2")
|
|
|
|
|
device_1_home.element_by_text_part(message_after_edit_1_1).long_press_element()
|
|
|
|
|
if device_1_home.element_by_translation_id("edit").is_element_present():
|
|
|
|
|
self.errors.append('Option to edit someone else message available!')
|
|
|
|
|
|
|
|
|
|
device_2_home.home_button.click()
|
|
|
|
|
device_2_public_chat = device_2_home.join_public_chat(chat_name)
|
|
|
|
|
if not device_2_public_chat.element_by_text_part("⌫ Edited").is_element_displayed():
|
|
|
|
|
self.errors.append('No mark in message bubble about this message was edited')
|
|
|
|
|
if not device_2_public_chat.element_by_text_part(message_after_edit).is_element_displayed():
|
|
|
|
|
self.errors.append('Message is not edited.')
|
|
|
|
|
|
|
|
|
|
self.errors.verify_no_errors()
|
|
|
|
|
|
2020-05-20 15:43:29 +00:00
|
|
|
|
@marks.testrail_id(5782)
|
|
|
|
|
@marks.critical
|
|
|
|
|
def test_install_pack_and_send_sticker(self):
|
|
|
|
|
self.create_drivers(2)
|
|
|
|
|
device_1, device_2 = SignInView(self.drivers[0]), SignInView(self.drivers[1])
|
|
|
|
|
device_1_home, device_2_home = device_1.create_user(), device_2.create_user()
|
|
|
|
|
|
|
|
|
|
device_1_home.just_fyi('join public chat and check that stickers are not available on Ropsten')
|
|
|
|
|
chat_name = device_1_home.get_random_chat_name()
|
|
|
|
|
device_1_home.join_public_chat(chat_name)
|
|
|
|
|
device_1_public_chat = device_1_home.get_chat_view()
|
|
|
|
|
if device_1_public_chat.show_stickers_button.is_element_displayed():
|
|
|
|
|
self.errors.append('Sticker button is shown while on Ropsten')
|
|
|
|
|
|
|
|
|
|
device_1_home.just_fyi('switch to mainnet')
|
|
|
|
|
device_1_public_chat.get_back_to_home_view()
|
|
|
|
|
device_1_profile, device_2_profile = device_1_home.profile_button.click(), device_2_home.profile_button.click()
|
|
|
|
|
device_2_public_key = device_2_profile.get_public_key_and_username()
|
|
|
|
|
device_1_public_key, device_1_username = device_1_profile.get_public_key_and_username(return_username=True)
|
|
|
|
|
|
|
|
|
|
for device in device_2_profile, device_1_profile:
|
|
|
|
|
device.switch_network('Mainnet with upstream RPC')
|
|
|
|
|
device_1_home.get_chat('#' + chat_name).click()
|
|
|
|
|
|
|
|
|
|
device_1_home.just_fyi('install free sticker pack and use it in public chat')
|
|
|
|
|
device_1_public_chat.show_stickers_button.click()
|
|
|
|
|
device_1_public_chat.get_stickers.click()
|
|
|
|
|
device_1_public_chat.install_sticker_pack_by_name('Status Cat')
|
|
|
|
|
device_1_public_chat.back_button.click()
|
|
|
|
|
time.sleep(2)
|
|
|
|
|
device_1_public_chat.swipe_left()
|
|
|
|
|
device_1_public_chat.sticker_icon.click()
|
2020-08-25 14:37:32 +00:00
|
|
|
|
if not device_1_public_chat.sticker_message.is_element_displayed():
|
2020-05-20 15:43:29 +00:00
|
|
|
|
self.errors.append('Sticker was not sent')
|
|
|
|
|
device_1_public_chat.swipe_right()
|
|
|
|
|
if not device_1_public_chat.sticker_icon.is_element_displayed():
|
|
|
|
|
self.errors.append('Sticker is not shown in recently used list')
|
|
|
|
|
device_1_public_chat.get_back_to_home_view()
|
|
|
|
|
|
|
|
|
|
device_1_home.just_fyi('send stickers in 1-1 chat from Recent')
|
|
|
|
|
device_1_one_to_one_chat = device_1_home.add_contact(device_2_public_key)
|
|
|
|
|
device_1_one_to_one_chat.show_stickers_button.click()
|
|
|
|
|
device_1_one_to_one_chat.sticker_icon.click()
|
|
|
|
|
if not device_1_one_to_one_chat.chat_item.is_element_displayed():
|
|
|
|
|
self.errors.append('Sticker was not sent from Recent')
|
|
|
|
|
|
|
|
|
|
device_2_home.just_fyi('check that can install stickers by tapping on sticker message')
|
|
|
|
|
device2_one_to_one_chat = device_2_home.get_chat(device_1_username).click()
|
|
|
|
|
device2_one_to_one_chat.chat_item.click()
|
|
|
|
|
if not device2_one_to_one_chat.element_by_text_part('Status Cat').is_element_displayed():
|
|
|
|
|
self.errors.append('Stickerpack is not available for installation after tapping on sticker message')
|
|
|
|
|
device2_one_to_one_chat.element_by_text_part('Free').click()
|
|
|
|
|
if device2_one_to_one_chat.element_by_text_part('Free').is_element_displayed():
|
|
|
|
|
self.errors.append('Stickerpack was not installed')
|
|
|
|
|
|
2020-07-30 14:35:34 +00:00
|
|
|
|
device_2_home.just_fyi('check that can navigate to another user profile via long tap on sticker message')
|
2021-06-14 17:52:58 +00:00
|
|
|
|
device2_one_to_one_chat.close_sticker_view_icon.click()
|
2020-07-30 14:35:34 +00:00
|
|
|
|
device2_one_to_one_chat.chat_item.long_press_element()
|
|
|
|
|
device2_one_to_one_chat.element_by_text('View Details').click()
|
2020-10-28 08:46:17 +00:00
|
|
|
|
if not device2_one_to_one_chat.profile_add_to_contacts.is_element_displayed():
|
2020-07-30 14:35:34 +00:00
|
|
|
|
self.errors.append('No navigate to user profile after tapping View Details on sticker message')
|
|
|
|
|
|
2020-05-20 15:43:29 +00:00
|
|
|
|
self.errors.verify_no_errors()
|
|
|
|
|
|
2020-06-12 15:32:06 +00:00
|
|
|
|
@marks.testrail_id(6305)
|
|
|
|
|
@marks.critical
|
2020-11-12 17:28:34 +00:00
|
|
|
|
def test_image_in_one_to_one_send_save_reply_timeline(self):
|
2020-06-12 15:32:06 +00:00
|
|
|
|
self.create_drivers(2)
|
|
|
|
|
device_1, device_2 = SignInView(self.drivers[0]), SignInView(self.drivers[1])
|
|
|
|
|
device_1_home, device_2_home = device_1.create_user(), device_2.create_user()
|
|
|
|
|
device_1_profile, device_2_profile = device_1_home.profile_button.click(), device_2_home.profile_button.click()
|
|
|
|
|
device_2_public_key = device_2_profile.get_public_key_and_username()
|
2020-11-12 17:28:34 +00:00
|
|
|
|
|
|
|
|
|
device_1_home.just_fyi('set status in profile')
|
|
|
|
|
device_1_status = 'Hey hey hey'
|
|
|
|
|
timeline = device_1.status_button.click()
|
2020-12-03 12:59:20 +00:00
|
|
|
|
timeline.set_new_status(device_1_status, image=True)
|
|
|
|
|
for element in timeline.element_by_text(device_1_status), timeline.image_chat_item:
|
|
|
|
|
if not element.is_element_displayed():
|
|
|
|
|
self.drivers[0].fail('Status is not set')
|
|
|
|
|
|
2020-06-12 15:32:06 +00:00
|
|
|
|
device_1_public_key, device_1_username = device_1_profile.get_public_key_and_username(return_username=True)
|
|
|
|
|
[home.click() for home in [device_1_profile.home_button, device_2_profile.home_button]]
|
2020-11-12 17:28:34 +00:00
|
|
|
|
|
|
|
|
|
device_1_home.just_fyi('start 1-1 chat')
|
2020-06-12 15:32:06 +00:00
|
|
|
|
device_1_chat = device_1_home.add_contact(device_2_public_key)
|
|
|
|
|
|
|
|
|
|
device_1_home.just_fyi('send image in 1-1 chat from Gallery, check options for sender')
|
2020-12-03 12:59:20 +00:00
|
|
|
|
image_description = 'description'
|
2020-06-12 15:32:06 +00:00
|
|
|
|
device_1_chat.show_images_button.click()
|
|
|
|
|
device_1_chat.first_image_from_gallery.click()
|
2020-06-23 07:02:44 +00:00
|
|
|
|
if not device_1_chat.cancel_send_image_button.is_element_displayed():
|
2020-06-12 15:32:06 +00:00
|
|
|
|
self.errors.append("Can't cancel sending images, expected image preview is not shown!")
|
|
|
|
|
device_1_chat.chat_message_input.set_value(image_description)
|
|
|
|
|
device_1_chat.send_message_button.click()
|
|
|
|
|
device_1_chat.chat_message_input.click()
|
|
|
|
|
for message in device_1_chat.image_chat_item, device_1_chat.chat_element_by_text(image_description):
|
|
|
|
|
if not message.is_element_displayed():
|
|
|
|
|
self.errors.append('Image or description is not shown in chat after sending for sender')
|
|
|
|
|
device_1_chat.show_images_button.click()
|
|
|
|
|
device_1_chat.image_from_gallery_button.click()
|
|
|
|
|
device_1_chat.click_system_back_button()
|
|
|
|
|
device_1_chat.image_chat_item.long_press_element()
|
|
|
|
|
for element in device_1_chat.reply_message_button, device_1_chat.save_image_button:
|
|
|
|
|
if not element.is_element_displayed():
|
|
|
|
|
self.errors.append('Save and reply are not available on long-press on own image messages')
|
|
|
|
|
if device_1_chat.view_profile_button.is_element_displayed():
|
2020-11-12 17:28:34 +00:00
|
|
|
|
self.errors.append('"View profile" is shown on long-press on own message')
|
2020-06-12 15:32:06 +00:00
|
|
|
|
|
|
|
|
|
device_2_home.just_fyi('check image, description and options for receiver')
|
|
|
|
|
device_2_chat = device_2_home.get_chat(device_1_username).click()
|
|
|
|
|
for message in device_2_chat.image_chat_item, device_2_chat.chat_element_by_text(image_description):
|
|
|
|
|
if not message.is_element_displayed():
|
|
|
|
|
self.errors.append('Image or description is not shown in chat after sending for receiver')
|
2020-11-12 17:28:34 +00:00
|
|
|
|
|
2020-11-16 13:51:11 +00:00
|
|
|
|
device_2_home.just_fyi('View user profile and check status')
|
|
|
|
|
device_2_chat.chat_options.click()
|
2020-12-03 12:59:20 +00:00
|
|
|
|
timeline_device_1 = device_2_chat.view_profile_button.click()
|
|
|
|
|
for element in timeline_device_1.element_by_text(device_1_status), timeline_device_1.image_chat_item:
|
|
|
|
|
element.scroll_to_element()
|
|
|
|
|
if not element.is_element_displayed():
|
|
|
|
|
self.drivers[0].fail('Status of another user not shown when open another user profile')
|
2021-06-14 17:52:58 +00:00
|
|
|
|
device_2_chat.close_button.click()
|
2020-11-12 17:28:34 +00:00
|
|
|
|
|
|
|
|
|
device_2_home.just_fyi('check options on long-press image for receiver')
|
2020-06-12 15:32:06 +00:00
|
|
|
|
device_2_chat.image_chat_item.long_press_element()
|
2020-11-12 17:28:34 +00:00
|
|
|
|
for element in (device_2_chat.reply_message_button, device_2_chat.save_image_button):
|
2020-06-12 15:32:06 +00:00
|
|
|
|
if not element.is_element_displayed():
|
2020-07-30 14:35:34 +00:00
|
|
|
|
self.errors.append('Save and reply are not available on long-press on received image messages')
|
2020-06-12 15:32:06 +00:00
|
|
|
|
|
|
|
|
|
device_1_home.just_fyi('save image')
|
|
|
|
|
device_1_chat.save_image_button.click()
|
|
|
|
|
device_1_chat.show_images_button.click_until_presence_of_element(device_1_chat.image_from_gallery_button)
|
|
|
|
|
device_1_chat.image_from_gallery_button.click()
|
|
|
|
|
device_1_chat.wait_for_element_starts_with_text('Recent')
|
|
|
|
|
if not device_1_chat.recent_image_in_gallery.is_element_displayed():
|
|
|
|
|
self.errors.append('Saved image is not shown in Recent')
|
|
|
|
|
|
|
|
|
|
device_2_home.just_fyi('reply to image message')
|
|
|
|
|
device_2_chat.reply_message_button.click()
|
2021-06-29 15:55:55 +00:00
|
|
|
|
if device_2_chat.quote_username_in_message_input.text != "↪ Replying to %s" % device_1_username:
|
2020-06-12 15:32:06 +00:00
|
|
|
|
self.errors.append("Username is not displayed in reply quote snippet replying to image message")
|
|
|
|
|
reply_to_message_from_receiver = "image reply"
|
|
|
|
|
device_2_chat.send_message(reply_to_message_from_receiver)
|
|
|
|
|
reply_message = device_2_chat.chat_element_by_text(reply_to_message_from_receiver)
|
|
|
|
|
if not reply_message.image_in_reply.is_element_displayed():
|
|
|
|
|
self.errors.append("Image is not displayed in reply")
|
|
|
|
|
|
|
|
|
|
self.errors.verify_no_errors()
|
|
|
|
|
|
2020-09-04 13:26:14 +00:00
|
|
|
|
@marks.testrail_id(6316)
|
|
|
|
|
@marks.critical
|
|
|
|
|
def test_send_audio_message_with_push_notification_check(self):
|
|
|
|
|
self.create_drivers(2)
|
|
|
|
|
device_1, device_2 = SignInView(self.drivers[0]), SignInView(self.drivers[1])
|
|
|
|
|
home_1, home_2 = device_1.create_user(), device_2.create_user(enable_notifications=True)
|
|
|
|
|
profile_1 = home_1.profile_button.click()
|
|
|
|
|
default_username_1 = profile_1.default_username_text.text
|
2021-06-23 15:12:42 +00:00
|
|
|
|
home_1 = profile_1.home_button.click()
|
2020-09-04 13:26:14 +00:00
|
|
|
|
public_key_2 = home_2.get_public_key_and_username()
|
2021-04-23 12:36:38 +00:00
|
|
|
|
chat_1 = home_1.add_contact(public_key_2)
|
|
|
|
|
chat_1.send_message('hey')
|
|
|
|
|
home_2.home_button.double_click()
|
|
|
|
|
home_2.get_chat(default_username_1).click()
|
2020-09-04 13:26:14 +00:00
|
|
|
|
|
|
|
|
|
home_2.just_fyi("Put app on background (to check Push notification received for audio message)")
|
|
|
|
|
home_2.click_system_home_button()
|
|
|
|
|
|
|
|
|
|
home_2.just_fyi("Sending audio message to device who is on background")
|
|
|
|
|
chat_1.record_audio_message(message_length_in_seconds=125)
|
|
|
|
|
if not chat_1.element_by_text("Maximum recording time reached").is_element_displayed():
|
|
|
|
|
self.drivers[0].fail("Exceeded 2 mins limit of recording time.")
|
|
|
|
|
else:
|
|
|
|
|
chat_1.ok_button.click()
|
|
|
|
|
if chat_1.audio_message_recorded_time.text != "1:59":
|
|
|
|
|
self.errors.append("Timer exceed 2 minutes")
|
|
|
|
|
chat_1.send_message_button.click()
|
|
|
|
|
|
|
|
|
|
device_2.open_notification_bar()
|
Add community notifications on android & IOS
[Fixes: #11806]
[Fixes: #11877]
Features added
An admin should receive a notification on android if a community request is made
Clicking on the push notification will take you to the list of requests
Changes to push notifications
Push notification for messages are grouped by chat, similarly to discord. Only the first notification in a chat will alert, the next will be "silent" notification. Meaning you will see the message but it will not alert. This is consistent with discord/whatsapp.
Clicking on a transaction notification will take you to wallet (not sure it was doing that before, but it might have)
Changed the behavior of the notification toggle, before Notifications and wallet transactions were separate, meaning you could have wallet transaction and Notifications disabled and you'd still receive transactions notifications. Now you need to have Notifications enabled to receive wallet transactions. Eventually we will have an option to toggle message notifications.
Technical details
Removes headless tasks, they were not used
Message notifications are passed unchanged to java, we still check if the chat is in the foreground, but no modifications are made to the notification object. This should get us closer to avoid clojure completely.
Merged the two notifications implementation (NewMessageSignalHandler and PushNotificationHelper). We should split maybe off in more meaningful classes, but there's less code duplication now, and it can be re-used for non-chat (communities) notifications.
Parsing of text for message notifications is done in status-go
Signal is not passed to status-react if notifications are not enabled
Next step
To completely remove notification code from status-react the following are required:
Java needs to be alerted of which chat is in the foreground and whether the app is in the foreground
Transaction notification body message need to be created in status-go
Notification signal needs to be stopped in Java
Limitations
If the name of a contact changes, the notification will not change, once is displayed, it won't be modified
2021-03-04 09:27:55 +00:00
|
|
|
|
chat_2 = home_2.click_upon_push_notification_by_text("Audio")
|
2020-09-04 13:26:14 +00:00
|
|
|
|
|
|
|
|
|
listen_time = 5
|
|
|
|
|
|
|
|
|
|
device_2.home_button.click()
|
|
|
|
|
home_2.get_chat(default_username_1).click()
|
|
|
|
|
chat_2.play_audio_message(listen_time)
|
2020-10-20 15:34:52 +00:00
|
|
|
|
if chat_2.audio_message_in_chat_timer.text not in ("00:05", "00:06", "00:07", "00:08"):
|
2020-09-04 13:26:14 +00:00
|
|
|
|
self.errors.append("Listened 5 seconds but timer shows different listened time in audio message")
|
|
|
|
|
|
|
|
|
|
self.errors.verify_no_errors()
|
|
|
|
|
|
2021-07-20 08:34:10 +00:00
|
|
|
|
@marks.testrail_id(695847)
|
|
|
|
|
@marks.medium
|
|
|
|
|
def test_can_pin_messages_in_ono_to_one_and_group_chats(self):
|
|
|
|
|
self.create_drivers(2)
|
|
|
|
|
device_1, device_2 = SignInView(self.drivers[0]), SignInView(self.drivers[1])
|
|
|
|
|
|
|
|
|
|
home_1, home_2 = device_1.create_user(), device_2.create_user()
|
|
|
|
|
public_key_1, username_1 = home_1.get_public_key_and_username(return_username=True)
|
|
|
|
|
public_key_2, username_2 = home_2.get_public_key_and_username(return_username=True)
|
|
|
|
|
home_1.home_button.click()
|
|
|
|
|
chat_1 = home_1.add_contact(public_key_2)
|
|
|
|
|
|
|
|
|
|
home_1.just_fyi("Check that Device1 can pin own message in 1-1 chat")
|
|
|
|
|
message_1,message_2,message_3,message_4 = "Message1","Message2","Message3","Message4",
|
|
|
|
|
chat_1.send_message(message_1)
|
|
|
|
|
chat_1.send_message(message_2)
|
|
|
|
|
chat_1.pin_message(message_1)
|
|
|
|
|
if not chat_1.chat_element_by_text(message_1).pinned_by_label.is_element_present():
|
|
|
|
|
self.drivers[0].fail("Message is not pinned!")
|
|
|
|
|
|
|
|
|
|
home_1.just_fyi("Check that Device2 can pin Device1 message in 1-1 chat and two pinned "
|
|
|
|
|
"messages are in Device1 profile")
|
|
|
|
|
home_2.home_button.click()
|
|
|
|
|
chat_2 = home_2.get_chat(username_1).click()
|
|
|
|
|
chat_2.pin_message(message_2)
|
|
|
|
|
chat_2.chat_options.click()
|
|
|
|
|
chat_2.view_profile_button.click()
|
|
|
|
|
if not chat_2.pinned_messages_button.count == "2":
|
|
|
|
|
self.drivers[0].fail("Pinned message count is not 2 as expected!")
|
|
|
|
|
|
|
|
|
|
home_1.just_fyi("Check pinned message are visible in Pinned panel for both users")
|
|
|
|
|
chat_1.chat_options.click()
|
|
|
|
|
chat_1.view_profile_button.click()
|
|
|
|
|
chat_1.pinned_messages_button.click()
|
|
|
|
|
if not (chat_1.chat_element_by_text(message_1).pinned_by_label.is_element_present() and
|
|
|
|
|
chat_1.chat_element_by_text(message_2).pinned_by_label.is_element_present() and
|
|
|
|
|
chat_1.chat_element_by_text(message_1).is_element_present() and
|
|
|
|
|
chat_1.chat_element_by_text(message_2).is_element_present()):
|
|
|
|
|
self.drivers[0].fail("Something missed on Pinned messaged on Device 1!")
|
|
|
|
|
chat_2.pinned_messages_button.click()
|
|
|
|
|
if not (chat_1.chat_element_by_text(message_1).pinned_by_label.is_element_present() and
|
|
|
|
|
chat_2.chat_element_by_text(message_2).pinned_by_label.is_element_present() and
|
|
|
|
|
chat_2.chat_element_by_text(message_1).is_element_present() and
|
|
|
|
|
chat_2.chat_element_by_text(message_2).is_element_present()):
|
|
|
|
|
self.drivers[0].fail("Something missed on Pinned messaged on Device 2!")
|
|
|
|
|
chat_1.close_button.click()
|
|
|
|
|
|
|
|
|
|
home_1.just_fyi("Check that Device1 can not pin more than 3 messages and 'Unpin' dialog appears"
|
|
|
|
|
"messages are in Device1 profile")
|
|
|
|
|
chat_1.send_message(message_3)
|
|
|
|
|
chat_1.send_message(message_4)
|
|
|
|
|
chat_1.pin_message(message_3)
|
|
|
|
|
chat_1.pin_message(message_4)
|
|
|
|
|
if not chat_1.unpin_message_popup.is_element_present():
|
|
|
|
|
self.drivers[0].fail("No 'Unpin' dialog appears when pining 4th message")
|
|
|
|
|
|
|
|
|
|
home_1.just_fyi("Unpin one message so that another could be pinned")
|
|
|
|
|
chat_1.unpin_message_popup.message_text(message_1).click()
|
|
|
|
|
chat_1.unpin_message_popup.click_unpin_message_button()
|
|
|
|
|
|
|
|
|
|
if chat_1.unpin_message_popup.is_element_present():
|
|
|
|
|
self.drivers[0].fail("Unpin message pop up keep staying after Unpin button pressed")
|
|
|
|
|
if chat_1.chat_element_by_text(message_1).pinned_by_label.is_element_present():
|
|
|
|
|
self.drivers[0].fail("Message is not unpinned!")
|
|
|
|
|
if not chat_1.chat_element_by_text(message_4).pinned_by_label.is_element_present():
|
|
|
|
|
self.drivers[0].fail("Message is not pinned!")
|
|
|
|
|
|
|
|
|
|
home_1.just_fyi("Unpin another message and check it's unpinned for another user")
|
|
|
|
|
chat_2.close_button.click()
|
|
|
|
|
chat_2.pin_message(message_4, action="unpin")
|
|
|
|
|
chat_1.chat_element_by_text(message_4).pinned_by_label.wait_for_invisibility_of_element()
|
|
|
|
|
if chat_1.chat_element_by_text(message_4).pinned_by_label.is_element_present():
|
|
|
|
|
self.drivers[0].fail("Message_4 is not unpinned!")
|
|
|
|
|
|
|
|
|
|
home_1.just_fyi("Create group chat and pin message there. It's pinned for both members.")
|
|
|
|
|
chat_2.home_button.click()
|
|
|
|
|
chat_1.home_button.click()
|
|
|
|
|
group_chat_name = "GroupChat"
|
|
|
|
|
group_chat_1 = home_1.create_group_chat(user_names_to_add=[username_2], group_chat_name=group_chat_name)
|
|
|
|
|
home_2.get_chat(group_chat_name).click()
|
|
|
|
|
group_chat_2 = home_2.get_chat_view()
|
|
|
|
|
group_chat_2.join_chat_button.click()
|
|
|
|
|
group_chat_1.send_message(message_1)
|
|
|
|
|
group_chat_1.pin_message(message_1)
|
|
|
|
|
if not (group_chat_1.chat_element_by_text(message_1).pinned_by_label.is_element_present() and
|
|
|
|
|
group_chat_2.chat_element_by_text(message_1).pinned_by_label.is_element_present()):
|
|
|
|
|
self.errors.append("Message is not pinned in group chat!")
|
|
|
|
|
|
|
|
|
|
home_1.just_fyi("Check that non admin user can not unpin messages")
|
|
|
|
|
group_chat_2.chat_element_by_text(message_1).long_press_element()
|
|
|
|
|
if group_chat_2.element_by_translation_id("unpin").is_element_present():
|
|
|
|
|
self.errors.append("Unpin option is available for non-admin user")
|
|
|
|
|
|
|
|
|
|
home_1.just_fyi("Grant another user with admin rights and check he can unpin message now")
|
|
|
|
|
group_chat_1.chat_options.click()
|
|
|
|
|
group_info_view = group_chat_1.group_info.click()
|
|
|
|
|
options = group_info_view.get_username_options(username_2).click()
|
|
|
|
|
options.make_admin_button.click()
|
|
|
|
|
group_chat_2.click_system_back_button()
|
|
|
|
|
group_chat_2.pin_message(message_1, action="unpin")
|
|
|
|
|
if (group_chat_1.chat_element_by_text(message_1).pinned_by_label.is_element_present() and
|
|
|
|
|
group_chat_2.chat_element_by_text(message_1).pinned_by_label.is_element_present()):
|
|
|
|
|
self.errors.append("Message failed be unpinned by user who granted admin permissions!")
|
|
|
|
|
|
|
|
|
|
self.errors.verify_no_errors()
|
|
|
|
|
|
2018-09-28 15:30:06 +00:00
|
|
|
|
@marks.testrail_id(5373)
|
|
|
|
|
@marks.high
|
2021-02-23 14:38:17 +00:00
|
|
|
|
def test_send_and_open_links_with_previews(self):
|
2018-06-28 18:46:51 +00:00
|
|
|
|
self.create_drivers(2)
|
|
|
|
|
device_1, device_2 = SignInView(self.drivers[0]), SignInView(self.drivers[1])
|
|
|
|
|
|
2019-07-18 15:44:06 +00:00
|
|
|
|
home_1, home_2 = device_1.create_user(), device_2.create_user()
|
2019-06-28 14:36:24 +00:00
|
|
|
|
profile_1 = home_1.profile_button.click()
|
|
|
|
|
default_username_1 = profile_1.default_username_text.text
|
2021-06-23 15:12:42 +00:00
|
|
|
|
home_1 = profile_1.home_button.click()
|
2020-04-10 10:25:46 +00:00
|
|
|
|
public_key_2 = home_2.get_public_key_and_username()
|
2018-06-28 18:46:51 +00:00
|
|
|
|
home_2.home_button.click()
|
2021-05-13 16:03:01 +00:00
|
|
|
|
chat_1 = home_1.add_contact(public_key_2)
|
|
|
|
|
|
|
|
|
|
home_1.just_fyi("Check that can send emoji in 1-1 chat")
|
|
|
|
|
emoji_name = random.choice(list(emoji.EMOJI_UNICODE))
|
|
|
|
|
emoji_unicode = emoji.EMOJI_UNICODE[emoji_name]
|
|
|
|
|
chat_1.send_message(emoji.emojize(emoji_name))
|
|
|
|
|
chat_2 = home_2.get_chat(default_username_1).click()
|
|
|
|
|
for chat in chat_1, chat_2:
|
|
|
|
|
if not chat.chat_element_by_text(emoji_unicode).is_element_displayed():
|
|
|
|
|
self.errors.append('Message with emoji was not sent or received in 1-1 chat')
|
2018-06-28 18:46:51 +00:00
|
|
|
|
|
2021-02-23 14:38:17 +00:00
|
|
|
|
home_1.just_fyi("Check that link can be opened from 1-1 chat")
|
Render markdown
Fixes: https://github.com/status-im/trailofbits-audit/issues/47
Fixes: https://github.com/status-im/trailofbits-audit/issues/46
Fixes: https://github.com/status-im/trailofbits-audit/issues/44
Fixes: https://github.com/status-im/security-reports/issues/13
Fixes: https://github.com/status-im/security-reports/issues/5
Fixes: https://github.com/status-im/status-react/issues/8995
This commits re-introduce rendering of markdown text and implent a few
changes:
1) Parsing of the message content is now in status-go, this includes
markdown, line-count, and rtl. Parsing is not nested, as there's some
rendering degradation involved as we nest components, unclear exactly if
it's react-native or clojure, haven't looked too deeply into it.
2) Emojii type messages are not parsed on the sending side, not the
receiving one, using the appropriate content-type
3) Fixes a few issues with chat input rendering, currrently we use
`chats/current-chat` subscription which is very heavy and should not be
used unless necessary, and means that
any change to chat will trigger a re-render, which caused re-rendering
of input container on each received message. Also to note that
input-container is fairly heavy to render, and it's rendered twice at
each keypress on input.
The inline markdow supported is:
*italic* or _italic_
**bold** or __bold__
`inline code`
http://test.com links
\#status-tag
The block markdown supported is:
\# Headers
```
code blocks
```
> Quotereply
The styling is very basic at the moment, but can be improved.
Adding other markdown (photo,mentions) is straightforward and should
come at little performance cost (unless the component to render is
heavy, i.e a photo for example).
There are some behavioral changes with this commit:
1) Links are only parsed if starting with http:// or https://, meaning that
blah.com won't be parsed, nor www.test.com. This behavior is consistent
with discord for example and allows faster parsing at little expense to
ser experience imo. Fixes a few security issues as well.
2) Content is not anymore capped (regression), that's due to the fact that
before we only rendered text and react-native allowed us easily to limit
the number of lines, but adding markdown support means that this
strategy is not viable anymore. Performance of rendering don't see to be
very much impacted by this, I would re-introduce it if necessary, but
I'd rather do that in a separate PR.
Signed-off-by: Andrea Maria Piana <andrea.maria.piana@gmail.com>
2019-11-07 13:41:37 +00:00
|
|
|
|
url_message = 'http://status.im'
|
2021-02-23 14:38:17 +00:00
|
|
|
|
chat_1.send_message(url_message)
|
2021-04-19 15:55:25 +00:00
|
|
|
|
chat_1.home_button.double_click()
|
2018-06-28 18:46:51 +00:00
|
|
|
|
chat_2.element_starts_with_text(url_message, 'button').click()
|
2018-07-12 19:41:50 +00:00
|
|
|
|
web_view = chat_2.open_in_status_button.click()
|
2018-06-28 18:46:51 +00:00
|
|
|
|
try:
|
2021-02-01 16:09:04 +00:00
|
|
|
|
web_view.element_by_text('Private, Secure Communication').find_element()
|
2018-06-28 18:46:51 +00:00
|
|
|
|
except TimeoutException:
|
2018-11-07 15:50:08 +00:00
|
|
|
|
self.errors.append('Device 2: URL was not opened from 1-1 chat')
|
2021-04-19 15:55:25 +00:00
|
|
|
|
home_2.dapp_tab_button.double_click()
|
2019-03-19 12:35:15 +00:00
|
|
|
|
chat_2.home_button.click()
|
2018-06-28 18:46:51 +00:00
|
|
|
|
|
2021-02-23 14:38:17 +00:00
|
|
|
|
home_1.just_fyi("Check that link can be opened from public chat")
|
2018-06-28 18:46:51 +00:00
|
|
|
|
chat_name = ''.join(random.choice(string.ascii_lowercase) for _ in range(7))
|
2021-02-23 14:38:17 +00:00
|
|
|
|
chat_1 = home_1.join_public_chat(chat_name)
|
|
|
|
|
chat_2 = home_2.join_public_chat(chat_name)
|
|
|
|
|
chat_2.send_message(url_message)
|
2018-06-28 18:46:51 +00:00
|
|
|
|
chat_1.element_starts_with_text(url_message, 'button').click()
|
2018-07-12 19:41:50 +00:00
|
|
|
|
web_view = chat_1.open_in_status_button.click()
|
2018-06-28 18:46:51 +00:00
|
|
|
|
try:
|
2021-02-01 16:09:04 +00:00
|
|
|
|
web_view.element_by_text('Private, Secure Communication').find_element()
|
2018-06-28 18:46:51 +00:00
|
|
|
|
except TimeoutException:
|
2018-11-07 15:50:08 +00:00
|
|
|
|
self.errors.append('Device 1: URL was not opened from 1-1 chat')
|
2021-02-23 14:38:17 +00:00
|
|
|
|
home_1.home_button.click(desired_view='chat')
|
|
|
|
|
|
2021-05-25 16:42:58 +00:00
|
|
|
|
preview_urls = {'github_pr': {'url': 'https://github.com/status-im/status-react/pull/11707',
|
|
|
|
|
'txt': 'Update translations by jinhojang6 · Pull Request #11707 · status-im/status-react',
|
|
|
|
|
'subtitle': 'GitHub'},
|
|
|
|
|
'yotube': {
|
|
|
|
|
'url': 'https://www.youtube.com/watch?v=XN-SVmuJH2g&list=PLbrz7IuP1hrgNtYe9g6YHwHO6F3OqNMao',
|
|
|
|
|
'txt': 'Status & Keycard – Hardware-Enforced Security',
|
|
|
|
|
'subtitle': 'YouTube'}}
|
2021-02-23 14:38:17 +00:00
|
|
|
|
|
|
|
|
|
home_1.just_fyi("Check enabling and sending first gif")
|
|
|
|
|
giphy_url = 'https://giphy.com/gifs/this-is-fine-QMHoU66sBXqqLqYvGO'
|
|
|
|
|
chat_2.send_message(giphy_url)
|
|
|
|
|
chat_2.element_by_translation_id("dont-ask").click()
|
|
|
|
|
chat_1.element_by_translation_id("enable").wait_and_click()
|
|
|
|
|
chat_1.element_by_translation_id("enable-all").wait_and_click()
|
2021-06-18 11:09:03 +00:00
|
|
|
|
chat_1.close_modal_view_from_chat_button.click()
|
2021-02-23 14:38:17 +00:00
|
|
|
|
if not chat_1.get_preview_message_by_text(giphy_url).preview_image:
|
|
|
|
|
self.errors.append("No preview is shown for %s" % giphy_url)
|
|
|
|
|
for key in preview_urls:
|
|
|
|
|
home_2.just_fyi("Checking %s preview case" % key)
|
|
|
|
|
data = preview_urls[key]
|
|
|
|
|
chat_2.send_message(data['url'])
|
|
|
|
|
message = chat_1.get_preview_message_by_text(data['url'])
|
|
|
|
|
if message.preview_title.text != data['txt']:
|
2021-05-25 16:42:58 +00:00
|
|
|
|
self.errors.append("Title '%s' does not match expected" % message.preview_title.text)
|
2021-02-23 14:38:17 +00:00
|
|
|
|
if message.preview_subtitle.text != data['subtitle']:
|
2021-05-25 16:42:58 +00:00
|
|
|
|
self.errors.append("Subtitle '%s' does not match expected" % message.preview_subtitle.text)
|
2021-02-23 14:38:17 +00:00
|
|
|
|
|
|
|
|
|
home_2.just_fyi("Check if after do not ask again previews are not shown and no enable button appear")
|
|
|
|
|
if chat_2.element_by_translation_id("enable").is_element_displayed():
|
|
|
|
|
self.errors.append("Enable button is still shown after clicking on 'Den't ask again'")
|
|
|
|
|
if chat_2.get_preview_message_by_text(giphy_url).preview_image:
|
|
|
|
|
self.errors.append("Preview is shown for sender without permission")
|
2019-10-29 08:25:57 +00:00
|
|
|
|
self.errors.verify_no_errors()
|
2018-06-28 18:46:51 +00:00
|
|
|
|
|
2018-09-28 15:30:06 +00:00
|
|
|
|
@marks.testrail_id(5362)
|
2020-02-05 18:20:24 +00:00
|
|
|
|
@marks.medium
|
2018-07-19 09:57:45 +00:00
|
|
|
|
def test_unread_messages_counter_1_1_chat(self):
|
|
|
|
|
self.create_drivers(2)
|
|
|
|
|
device_1, device_2 = SignInView(self.drivers[0]), SignInView(self.drivers[1])
|
2019-07-18 15:44:06 +00:00
|
|
|
|
device_1_home, device_2_home = device_1.create_user(), device_2.create_user()
|
2019-06-26 14:57:46 +00:00
|
|
|
|
profile_2 = device_2_home.profile_button.click()
|
|
|
|
|
default_username_2 = profile_2.default_username_text.text
|
2021-06-23 15:12:42 +00:00
|
|
|
|
device_2_home = profile_2.home_button.click()
|
2020-04-10 10:25:46 +00:00
|
|
|
|
device_1_public_key = device_1_home.get_public_key_and_username()
|
2018-07-19 09:57:45 +00:00
|
|
|
|
device_1_home.home_button.click()
|
|
|
|
|
|
|
|
|
|
device_2_chat = device_2_home.add_contact(device_1_public_key)
|
|
|
|
|
|
2021-05-25 16:42:58 +00:00
|
|
|
|
message, message_2 = 'test message', 'test message2'
|
2021-04-19 08:37:46 +00:00
|
|
|
|
device_2_chat.send_message(message)
|
|
|
|
|
chat_element = device_1_home.get_chat(default_username_2)
|
|
|
|
|
device_1.dapp_tab_button.click()
|
|
|
|
|
device_2_chat.send_message(message_2)
|
|
|
|
|
|
2018-07-19 09:57:45 +00:00
|
|
|
|
if device_1_home.home_button.counter.text != '1':
|
|
|
|
|
self.errors.append('New messages counter is not shown on Home button')
|
2021-04-19 08:37:46 +00:00
|
|
|
|
device_1.home_button.click()
|
2018-07-19 09:57:45 +00:00
|
|
|
|
if chat_element.new_messages_counter.text != '1':
|
|
|
|
|
self.errors.append('New messages counter is not shown on chat element')
|
|
|
|
|
|
|
|
|
|
chat_element.click()
|
|
|
|
|
device_1_home.get_back_to_home_view()
|
|
|
|
|
|
|
|
|
|
if device_1_home.home_button.counter.is_element_displayed():
|
|
|
|
|
self.errors.append('New messages counter is shown on Home button for already seen message')
|
|
|
|
|
|
2020-02-05 18:20:24 +00:00
|
|
|
|
if chat_element.new_messages_counter.text == '1':
|
2018-07-19 09:57:45 +00:00
|
|
|
|
self.errors.append('New messages counter is shown on chat element for already seen message')
|
2019-10-29 08:25:57 +00:00
|
|
|
|
self.errors.verify_no_errors()
|
2018-07-19 09:57:45 +00:00
|
|
|
|
|
2018-09-28 15:30:06 +00:00
|
|
|
|
@marks.testrail_id(5425)
|
|
|
|
|
@marks.medium
|
2019-11-21 10:26:53 +00:00
|
|
|
|
# TODO: should be completed with quoting after fix 9480
|
|
|
|
|
def test_markdown_support_in_messages(self):
|
2018-07-19 09:57:45 +00:00
|
|
|
|
self.create_drivers(2)
|
|
|
|
|
sign_in_1, sign_in_2 = SignInView(self.drivers[0]), SignInView(self.drivers[1])
|
2019-07-18 15:44:06 +00:00
|
|
|
|
device_1_home, device_2_home = sign_in_1.create_user(), sign_in_2.create_user()
|
2019-06-28 14:36:24 +00:00
|
|
|
|
profile_2 = device_2_home.profile_button.click()
|
|
|
|
|
default_username_2 = profile_2.default_username_text.text
|
2021-06-23 15:12:42 +00:00
|
|
|
|
device_2_home = profile_2.home_button.click()
|
2020-04-10 10:25:46 +00:00
|
|
|
|
device_1_public_key = device_1_home.get_public_key_and_username()
|
2018-07-19 09:57:45 +00:00
|
|
|
|
device_1_home.home_button.click()
|
|
|
|
|
|
|
|
|
|
device_2_chat = device_2_home.add_contact(device_1_public_key)
|
2019-11-21 10:26:53 +00:00
|
|
|
|
device_2_chat.chat_message_input.send_keys('test message')
|
2018-07-19 09:57:45 +00:00
|
|
|
|
device_2_chat.send_message_button.click()
|
2020-03-17 17:27:10 +00:00
|
|
|
|
device_1_chat = device_1_home.get_chat(default_username_2).click()
|
2018-07-19 09:57:45 +00:00
|
|
|
|
|
2019-11-21 10:26:53 +00:00
|
|
|
|
markdown = {
|
2021-05-25 16:42:58 +00:00
|
|
|
|
'bold text in asterics': '**',
|
|
|
|
|
'bold text in underscores': '__',
|
2019-11-21 10:26:53 +00:00
|
|
|
|
'italic text in asteric': '*',
|
2021-05-25 16:42:58 +00:00
|
|
|
|
'italic text in underscore': '_',
|
|
|
|
|
'inline code': '`',
|
|
|
|
|
'code blocks': '```',
|
2019-11-21 10:26:53 +00:00
|
|
|
|
# 'quote reply (one row)' : '>',
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
for message, symbol in markdown.items():
|
|
|
|
|
device_1_home.just_fyi('checking that "%s" is applied (%s) in 1-1 chat' % (message, symbol))
|
|
|
|
|
message_to_send = symbol + message + symbol if 'quote' not in message else symbol + message
|
|
|
|
|
device_2_chat.chat_message_input.send_keys(message_to_send)
|
|
|
|
|
device_2_chat.send_message_button.click()
|
|
|
|
|
if not device_2_chat.chat_element_by_text(message).is_element_displayed():
|
|
|
|
|
self.errors.append('%s is not displayed with markdown in 1-1 chat for the sender \n' % message)
|
|
|
|
|
|
|
|
|
|
if not device_1_chat.chat_element_by_text(message).is_element_displayed():
|
|
|
|
|
self.errors.append('%s is not displayed with markdown in 1-1 chat for the recipient \n' % message)
|
2018-07-19 09:57:45 +00:00
|
|
|
|
|
|
|
|
|
device_1_chat.get_back_to_home_view()
|
|
|
|
|
device_2_chat.get_back_to_home_view()
|
2020-04-10 10:25:46 +00:00
|
|
|
|
chat_name = device_1_home.get_random_chat_name()
|
2018-07-19 09:57:45 +00:00
|
|
|
|
device_1_home.join_public_chat(chat_name)
|
|
|
|
|
device_2_home.join_public_chat(chat_name)
|
|
|
|
|
|
2019-11-21 10:26:53 +00:00
|
|
|
|
for message, symbol in markdown.items():
|
|
|
|
|
device_1_home.just_fyi('checking that "%s" is applied (%s) in public chat' % (message, symbol))
|
|
|
|
|
message_to_send = symbol + message + symbol if 'quote' not in message else symbol + message
|
|
|
|
|
device_2_chat.chat_message_input.send_keys(message_to_send)
|
|
|
|
|
device_2_chat.send_message_button.click()
|
|
|
|
|
if not device_2_chat.chat_element_by_text(message).is_element_displayed():
|
|
|
|
|
self.errors.append('%s is not displayed with markdown in public chat for the sender \n' % message)
|
2018-07-19 09:57:45 +00:00
|
|
|
|
|
2019-11-21 10:26:53 +00:00
|
|
|
|
if not device_1_chat.chat_element_by_text(message).is_element_displayed():
|
|
|
|
|
self.errors.append('%s is not displayed with markdown in public chat for the recipient \n' % message)
|
2018-07-19 09:57:45 +00:00
|
|
|
|
|
2019-10-29 08:25:57 +00:00
|
|
|
|
self.errors.verify_no_errors()
|
2018-07-19 09:57:45 +00:00
|
|
|
|
|
2018-06-28 18:46:51 +00:00
|
|
|
|
|
|
|
|
|
class TestMessagesOneToOneChatSingle(SingleDeviceTestCase):
|
|
|
|
|
|
2018-09-28 15:30:06 +00:00
|
|
|
|
@marks.testrail_id(5317)
|
|
|
|
|
@marks.critical
|
2018-06-28 18:46:51 +00:00
|
|
|
|
def test_copy_and_paste_messages(self):
|
|
|
|
|
sign_in = SignInView(self.driver)
|
|
|
|
|
home = sign_in.create_user()
|
|
|
|
|
|
|
|
|
|
home.join_public_chat(''.join(random.choice(string.ascii_lowercase) for _ in range(7)))
|
|
|
|
|
chat = sign_in.get_chat_view()
|
2020-09-16 14:34:55 +00:00
|
|
|
|
message_text = {'text_message': 'mmmeowesage_text'}
|
2021-05-25 16:42:58 +00:00
|
|
|
|
formatted_message = {'message_with_link': 'https://status.im',
|
|
|
|
|
# TODO: blocked with 11161
|
|
|
|
|
# 'message_with_tag': '#successishere'
|
2020-12-03 12:59:20 +00:00
|
|
|
|
}
|
2018-06-28 18:46:51 +00:00
|
|
|
|
message_input = chat.chat_message_input
|
2020-09-16 14:34:55 +00:00
|
|
|
|
message_input.send_keys(message_text['text_message'])
|
2018-06-28 18:46:51 +00:00
|
|
|
|
chat.send_message_button.click()
|
|
|
|
|
|
2020-09-16 14:34:55 +00:00
|
|
|
|
chat.copy_message_text(message_text['text_message'])
|
2018-06-28 18:46:51 +00:00
|
|
|
|
|
|
|
|
|
message_input.paste_text_from_clipboard()
|
2020-09-16 14:34:55 +00:00
|
|
|
|
if message_input.text != message_text['text_message']:
|
|
|
|
|
self.errors.append('Message %s text was not copied in a public chat' % message_text['text_message'])
|
|
|
|
|
message_input.clear()
|
2018-06-28 18:46:51 +00:00
|
|
|
|
|
2020-12-03 12:59:20 +00:00
|
|
|
|
for message in formatted_message:
|
2021-05-25 16:42:58 +00:00
|
|
|
|
message_input.send_keys(formatted_message[message])
|
|
|
|
|
chat.send_message_button.click()
|
2018-06-28 18:46:51 +00:00
|
|
|
|
|
2021-05-25 16:42:58 +00:00
|
|
|
|
message_bubble = chat.chat_element_by_text(formatted_message[message])
|
|
|
|
|
message_bubble.timestamp_message.long_press_element()
|
|
|
|
|
chat.element_by_text('Copy').click()
|
2020-09-16 14:34:55 +00:00
|
|
|
|
|
2021-05-25 16:42:58 +00:00
|
|
|
|
message_input.paste_text_from_clipboard()
|
|
|
|
|
if message_input.text != formatted_message[message]:
|
|
|
|
|
self.errors.append('Message %s text was not copied in a public chat' % formatted_message[message])
|
|
|
|
|
message_input.clear()
|
2018-06-28 18:46:51 +00:00
|
|
|
|
|
2019-10-29 08:25:57 +00:00
|
|
|
|
self.errors.verify_no_errors()
|
2018-06-28 18:46:51 +00:00
|
|
|
|
|
2018-09-28 15:30:06 +00:00
|
|
|
|
@marks.testrail_id(5322)
|
2019-03-05 16:43:30 +00:00
|
|
|
|
@marks.medium
|
2018-06-28 18:46:51 +00:00
|
|
|
|
def test_delete_cut_and_paste_messages(self):
|
|
|
|
|
sign_in = SignInView(self.driver)
|
|
|
|
|
home = sign_in.create_user()
|
2018-09-17 08:50:01 +00:00
|
|
|
|
chat = home.add_contact(transaction_senders['N']['public_key'])
|
2018-06-28 18:46:51 +00:00
|
|
|
|
|
|
|
|
|
message_text = 'test'
|
|
|
|
|
message_input = chat.chat_message_input
|
|
|
|
|
message_input.send_keys(message_text)
|
|
|
|
|
|
|
|
|
|
message_input.delete_last_symbols(2)
|
2018-08-16 16:47:13 +00:00
|
|
|
|
current_text = message_input.text
|
|
|
|
|
if current_text != message_text[:-2]:
|
2019-10-21 12:48:45 +00:00
|
|
|
|
self.driver.fail("Message input text '%s' doesn't match expected '%s'" % (current_text, message_text[:-2]))
|
2018-06-28 18:46:51 +00:00
|
|
|
|
|
|
|
|
|
message_input.cut_text()
|
|
|
|
|
|
|
|
|
|
message_input.paste_text_from_clipboard()
|
|
|
|
|
chat.send_message_button.click()
|
|
|
|
|
|
2019-11-20 16:27:29 +00:00
|
|
|
|
chat.chat_element_by_text(message_text[:-2]).wait_for_visibility_of_element(2)
|
2018-06-28 18:46:51 +00:00
|
|
|
|
|
2019-03-12 12:18:03 +00:00
|
|
|
|
@marks.testrail_id(5783)
|
2019-10-10 09:29:22 +00:00
|
|
|
|
@marks.critical
|
|
|
|
|
def test_can_use_purchased_stickers_on_recovered_account(self):
|
2019-03-12 12:18:03 +00:00
|
|
|
|
sign_in_view = SignInView(self.driver)
|
2019-09-05 02:32:33 +00:00
|
|
|
|
home_view = sign_in_view.recover_access(ens_user['passphrase'])
|
2019-03-12 12:18:03 +00:00
|
|
|
|
|
2019-10-10 09:29:22 +00:00
|
|
|
|
sign_in_view.just_fyi('switch to Mainnet')
|
2019-09-05 02:32:33 +00:00
|
|
|
|
profile_view = home_view.profile_button.click()
|
|
|
|
|
profile_view.switch_network('Mainnet with upstream RPC')
|
2019-03-12 12:18:03 +00:00
|
|
|
|
|
2019-10-10 09:29:22 +00:00
|
|
|
|
sign_in_view.just_fyi('join to public chat, buy and install stickers')
|
2020-04-10 10:25:46 +00:00
|
|
|
|
chat = home_view.join_public_chat(home_view.get_random_chat_name())
|
2019-03-12 12:18:03 +00:00
|
|
|
|
chat.show_stickers_button.click()
|
|
|
|
|
chat.get_stickers.click()
|
2019-09-05 02:32:33 +00:00
|
|
|
|
chat.install_sticker_pack_by_name('Tozemoon')
|
|
|
|
|
chat.back_button.click()
|
2019-03-12 12:18:03 +00:00
|
|
|
|
|
2019-10-10 09:29:22 +00:00
|
|
|
|
sign_in_view.just_fyi('check that can use installed pack')
|
2019-03-12 12:18:03 +00:00
|
|
|
|
time.sleep(2)
|
|
|
|
|
chat.swipe_left()
|
|
|
|
|
chat.sticker_icon.click()
|
2019-09-05 02:32:33 +00:00
|
|
|
|
if not chat.chat_item.is_element_displayed():
|
|
|
|
|
self.driver.fail('Sticker was not sent')
|
2019-08-02 09:28:59 +00:00
|
|
|
|
|
|
|
|
|
@marks.testrail_id(5403)
|
|
|
|
|
@marks.critical
|
2020-10-30 14:40:14 +00:00
|
|
|
|
def test_start_chat_with_ens_mention_in_one_to_one(self):
|
|
|
|
|
home = SignInView(self.driver).create_user()
|
|
|
|
|
|
|
|
|
|
home.just_fyi('Start new chat with public key and check user profile from 1-1 header > options')
|
|
|
|
|
chat = home.add_contact(ens_user_ropsten['public_key'])
|
|
|
|
|
chat.chat_options.click_until_presence_of_element(chat.view_profile_button)
|
|
|
|
|
chat.view_profile_button.click()
|
|
|
|
|
for element in (chat.profile_block_contact, chat.remove_from_contacts, chat.profile_send_message):
|
|
|
|
|
if not element.is_element_displayed():
|
|
|
|
|
self.errors.append('Expected %s is not visible' % element.locator)
|
2021-06-18 11:09:03 +00:00
|
|
|
|
chat.close_button.click()
|
|
|
|
|
chat.home_button.click()
|
2020-03-17 17:27:10 +00:00
|
|
|
|
|
2020-10-30 14:40:14 +00:00
|
|
|
|
home.just_fyi('Start new chat with ENS and check that ENS is resolved')
|
|
|
|
|
ens = ens_user_ropsten['ens']
|
|
|
|
|
home.add_contact(ens, add_in_contacts=False)
|
|
|
|
|
if not chat.element_by_text("@" + ens).is_element_displayed():
|
|
|
|
|
self.driver.fail('Wrong user is resolved from username when starting 1-1 chat.')
|
|
|
|
|
|
|
|
|
|
home.just_fyi('Mention user by ENS in 1-1 chat')
|
|
|
|
|
message = '@%s hey!' % ens
|
|
|
|
|
chat.send_message(message)
|
|
|
|
|
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')
|
2020-03-17 17:27:10 +00:00
|
|
|
|
|
2020-10-30 14:40:14 +00:00
|
|
|
|
home.just_fyi('Set nickname and mention user by nickname in 1-1 chat')
|
|
|
|
|
russian_nickname = 'МОЙ дорогой ДРУх'
|
|
|
|
|
chat.set_nickname(russian_nickname)
|
2021-06-18 11:09:03 +00:00
|
|
|
|
chat.close_button.click()
|
2020-10-30 14:40:14 +00:00
|
|
|
|
chat.select_mention_from_suggestion_list(russian_nickname + ' @' + ens)
|
|
|
|
|
chat.chat_element_by_text('%s hey!' % russian_nickname).click()
|
|
|
|
|
if not chat.profile_block_contact.is_element_displayed():
|
2021-05-25 16:42:58 +00:00
|
|
|
|
self.errors.append(
|
|
|
|
|
'No redirect to user profile after tapping on message with mention (nickname) in 1-1 chat')
|
|
|
|
|
|
|
|
|
|
home.just_fyi('My_profile button at Start new chat view opens own QR code with public key pop-up')
|
2021-06-18 11:09:03 +00:00
|
|
|
|
chat.close_button.click()
|
2021-05-25 16:42:58 +00:00
|
|
|
|
home.home_button.double_click()
|
|
|
|
|
home.plus_button.click()
|
|
|
|
|
home.start_new_chat_button.click()
|
|
|
|
|
home.my_profile_on_start_new_chat_button.click()
|
|
|
|
|
account = home.get_profile_view()
|
|
|
|
|
if not (account.public_key_text.is_element_displayed() and account.share_button.is_element_displayed()
|
|
|
|
|
and account.qr_code_image.is_element_displayed()):
|
|
|
|
|
self.errors.append('No self profile pop-up data displayed after My_profile button tap')
|
|
|
|
|
|
2020-03-17 17:27:10 +00:00
|
|
|
|
self.errors.verify_no_errors()
|
|
|
|
|
|
2020-06-23 09:01:06 +00:00
|
|
|
|
@marks.testrail_id(6298)
|
|
|
|
|
@marks.medium
|
2020-10-30 14:40:14 +00:00
|
|
|
|
def test_can_scan_qr_with_chat_key_from_home_start_chat(self):
|
2020-06-23 09:01:06 +00:00
|
|
|
|
sign_in_view = SignInView(self.driver)
|
|
|
|
|
home_view = sign_in_view.recover_access(basic_user['passphrase'])
|
|
|
|
|
profile = home_view.profile_button.click()
|
|
|
|
|
profile.switch_network()
|
|
|
|
|
|
|
|
|
|
url_data = {
|
|
|
|
|
'ens_with_stateofus_domain_deep_link': {
|
|
|
|
|
'url': 'https://join.status.im/u/%s.stateofus.eth' % ens_user['ens'],
|
|
|
|
|
'username': ens_user['username']
|
|
|
|
|
},
|
|
|
|
|
'ens_without_stateofus_domain_deep_link': {
|
|
|
|
|
'url': 'https://join.status.im/u/%s' % ens_user['ens'],
|
|
|
|
|
'username': ens_user['username']
|
|
|
|
|
},
|
|
|
|
|
'ens_another_domain_deep_link': {
|
|
|
|
|
'url': 'status-im://u/%s' % ens_user['ens_another_domain'],
|
|
|
|
|
'username': ens_user['username']
|
|
|
|
|
},
|
|
|
|
|
'own_profile_key_deep_link': {
|
|
|
|
|
'url': 'https://join.status.im/u/%s' % basic_user['public_key'],
|
|
|
|
|
'error': "That's you"
|
|
|
|
|
},
|
2021-05-25 16:42:58 +00:00
|
|
|
|
'other_user_profile_key_deep_link': {
|
2020-06-23 09:01:06 +00:00
|
|
|
|
'url': 'https://join.status.im/u/%s' % ens_user['public_key'],
|
|
|
|
|
'username': ens_user['username']
|
|
|
|
|
},
|
2021-05-25 16:42:58 +00:00
|
|
|
|
'other_user_profile_key_deep_link_invalid': {
|
2020-06-23 09:01:06 +00:00
|
|
|
|
'url': 'https://join.status.im/u/%sinvalid' % ens_user['public_key'],
|
|
|
|
|
'error': 'Please enter or scan a valid chat key'
|
|
|
|
|
},
|
2020-08-14 16:05:41 +00:00
|
|
|
|
# TODO: comment until clarification case with scanning QR with ENS names only
|
|
|
|
|
# 'ens_another_domain':{
|
|
|
|
|
# 'url': ens_user['ens_another_domain'],
|
|
|
|
|
# 'username': ens_user['username']
|
|
|
|
|
# },
|
2020-06-23 09:01:06 +00:00
|
|
|
|
'own_profile_key': {
|
|
|
|
|
'url': basic_user['public_key'],
|
|
|
|
|
'error': "That's you"
|
|
|
|
|
},
|
2020-08-14 16:05:41 +00:00
|
|
|
|
# 'ens_without_stateofus_domain': {
|
|
|
|
|
# 'url': ens_user['ens'],
|
|
|
|
|
# 'username': ens_user['username']
|
|
|
|
|
# },
|
2020-06-23 09:01:06 +00:00
|
|
|
|
'other_user_profile_key': {
|
|
|
|
|
'url': ens_user['public_key'],
|
|
|
|
|
'username': ens_user['username']
|
|
|
|
|
},
|
|
|
|
|
'other_user_profile_key_invalid': {
|
2021-05-25 16:42:58 +00:00
|
|
|
|
'url': '%s123' % ens_user['public_key'],
|
|
|
|
|
'error': 'Please enter or scan a valid chat key'
|
2020-06-23 09:01:06 +00:00
|
|
|
|
},
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
for key in url_data:
|
|
|
|
|
home_view.plus_button.click_until_presence_of_element(home_view.start_new_chat_button)
|
|
|
|
|
contact_view = home_view.start_new_chat_button.click()
|
2020-10-30 14:40:14 +00:00
|
|
|
|
sign_in_view.just_fyi('Checking scanning qr for "%s" case' % key)
|
2020-06-23 09:01:06 +00:00
|
|
|
|
contact_view.scan_contact_code_button.click()
|
|
|
|
|
if contact_view.allow_button.is_element_displayed():
|
|
|
|
|
contact_view.allow_button.click()
|
2020-10-30 14:40:14 +00:00
|
|
|
|
contact_view.enter_qr_edit_box.scan_qr(url_data[key]['url'])
|
2020-06-23 09:01:06 +00:00
|
|
|
|
from views.chat_view import ChatView
|
|
|
|
|
chat_view = ChatView(self.driver)
|
|
|
|
|
if url_data[key].get('error'):
|
|
|
|
|
if not chat_view.element_by_text_part(url_data[key]['error']).is_element_displayed():
|
|
|
|
|
self.errors.append('Expected error %s is not shown' % url_data[key]['error'])
|
|
|
|
|
chat_view.ok_button.click()
|
|
|
|
|
if url_data[key].get('username'):
|
|
|
|
|
if not chat_view.chat_message_input.is_element_displayed():
|
2021-05-25 16:42:58 +00:00
|
|
|
|
self.errors.append(
|
|
|
|
|
'In "%s" case chat input is not found after scanning, so no redirect to 1-1' % key)
|
2020-06-23 09:01:06 +00:00
|
|
|
|
if not chat_view.element_by_text(url_data[key]['username']).is_element_displayed():
|
2020-10-30 14:40:14 +00:00
|
|
|
|
self.errors.append('In "%s" case "%s" not found after scanning' % (key, url_data[key]['username']))
|
2021-06-23 15:12:42 +00:00
|
|
|
|
chat_view.get_back_to_home_view()
|
2020-06-23 09:01:06 +00:00
|
|
|
|
self.errors.verify_no_errors()
|
|
|
|
|
|
2020-08-19 15:04:21 +00:00
|
|
|
|
@marks.testrail_id(6322)
|
|
|
|
|
@marks.medium
|
|
|
|
|
def test_can_scan_different_links_with_universal_qr_scanner(self):
|
2021-07-07 08:02:54 +00:00
|
|
|
|
user = transaction_senders['L']
|
2020-12-14 17:39:29 +00:00
|
|
|
|
home_view = SignInView(self.driver).recover_access(user['passphrase'])
|
2020-08-19 15:04:21 +00:00
|
|
|
|
wallet_view = home_view.wallet_button.click()
|
|
|
|
|
wallet_view.set_up_wallet()
|
|
|
|
|
wallet_view.home_button.click()
|
|
|
|
|
send_transaction_view = SendTransactionView(self.driver)
|
|
|
|
|
|
|
|
|
|
url_data = {
|
|
|
|
|
'ens_without_stateofus_domain_deep_link': {
|
|
|
|
|
'url': 'https://join.status.im/u/%s' % ens_user_ropsten['ens'],
|
|
|
|
|
'username': ens_user_ropsten['username']
|
|
|
|
|
},
|
|
|
|
|
|
|
|
|
|
'other_user_profile_key_deep_link': {
|
|
|
|
|
'url': 'status-im://u/%s' % basic_user['public_key'],
|
|
|
|
|
'username': basic_user['username']
|
|
|
|
|
},
|
|
|
|
|
'other_user_profile_key_deep_link_invalid': {
|
|
|
|
|
'url': 'https://join.status.im/u/%sinvalid' % ens_user['public_key'],
|
|
|
|
|
'error': 'Unable to read this code'
|
|
|
|
|
},
|
|
|
|
|
'own_profile_key': {
|
|
|
|
|
'url': user['public_key'],
|
|
|
|
|
},
|
|
|
|
|
'other_user_profile_key': {
|
|
|
|
|
'url': ens_user['public_key'],
|
|
|
|
|
'username': ens_user['username']
|
|
|
|
|
},
|
2021-06-23 15:12:42 +00:00
|
|
|
|
'wallet_validation_wrong_address_transaction': {
|
2020-08-19 15:04:21 +00:00
|
|
|
|
'url': 'ethereum:0x744d70fdbe2ba4cf95131626614a1763df805b9e@3/transfer?address=blablabla&uint256=1e10',
|
|
|
|
|
'error': 'Invalid address',
|
|
|
|
|
},
|
2021-06-23 15:12:42 +00:00
|
|
|
|
'wallet_eip_ens_for_receiver': {
|
2020-08-19 15:04:21 +00:00
|
|
|
|
'url': 'ethereum:0xc55cf4b03948d7ebc8b9e8bad92643703811d162@3/transfer?address=nastya.stateofus.eth&uint256=1e-1',
|
|
|
|
|
'data': {
|
|
|
|
|
'asset': 'STT',
|
|
|
|
|
'amount': '0.1',
|
|
|
|
|
'address': '0x58d8…F2ff',
|
|
|
|
|
},
|
|
|
|
|
},
|
2021-06-23 15:12:42 +00:00
|
|
|
|
'wallet_eip_payment_link': {
|
2020-08-19 15:04:21 +00:00
|
|
|
|
'url': 'ethereum:pay-0xc55cf4b03948d7ebc8b9e8bad92643703811d162@3/transfer?address=0x3d597789ea16054a084ac84ce87f50df9198f415&uint256=1e1',
|
|
|
|
|
'data': {
|
|
|
|
|
'amount': '10',
|
|
|
|
|
'asset': 'STT',
|
|
|
|
|
'address': '0x3D59…F415',
|
|
|
|
|
},
|
|
|
|
|
},
|
2020-12-14 17:39:29 +00:00
|
|
|
|
'dapp_deep_link': {
|
|
|
|
|
'url': 'https://join.status.im/b/simpledapp.eth',
|
2021-05-25 16:42:58 +00:00
|
|
|
|
},
|
2020-12-14 17:39:29 +00:00
|
|
|
|
'dapp_deep_link_https': {
|
|
|
|
|
'url': 'https://join.status.im/b/https://simpledapp.eth',
|
2021-05-25 16:42:58 +00:00
|
|
|
|
},
|
2020-08-19 15:04:21 +00:00
|
|
|
|
'public_chat_deep_link': {
|
|
|
|
|
'url': 'https://join.status.im/baga-ma-2020',
|
|
|
|
|
'chat_name': 'baga-ma-2020'
|
|
|
|
|
},
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
for key in url_data:
|
|
|
|
|
home_view.plus_button.click_until_presence_of_element(home_view.start_new_chat_button)
|
2020-12-14 17:39:29 +00:00
|
|
|
|
home_view.just_fyi('Checking %s case' % key)
|
2020-10-28 08:46:17 +00:00
|
|
|
|
if home_view.universal_qr_scanner_button.is_element_displayed():
|
|
|
|
|
home_view.universal_qr_scanner_button.click()
|
2020-08-19 15:04:21 +00:00
|
|
|
|
if home_view.allow_button.is_element_displayed():
|
|
|
|
|
home_view.allow_button.click()
|
2020-10-30 14:40:14 +00:00
|
|
|
|
home_view.enter_qr_edit_box.scan_qr(url_data[key]['url'])
|
2020-08-19 15:04:21 +00:00
|
|
|
|
from views.chat_view import ChatView
|
|
|
|
|
chat_view = ChatView(self.driver)
|
|
|
|
|
if url_data[key].get('error'):
|
|
|
|
|
if not chat_view.element_by_text_part(url_data[key]['error']).is_element_displayed():
|
|
|
|
|
self.errors.append('Expected error %s is not shown' % url_data[key]['error'])
|
|
|
|
|
chat_view.ok_button.click()
|
|
|
|
|
if url_data[key].get('username'):
|
|
|
|
|
if key == 'own_profile_key':
|
2020-09-23 11:48:20 +00:00
|
|
|
|
if chat_view.profile_nickname.is_element_displayed():
|
2020-08-19 15:04:21 +00:00
|
|
|
|
self.errors.append('In %s case was not redirected to own profile' % key)
|
|
|
|
|
else:
|
2020-09-23 11:48:20 +00:00
|
|
|
|
if not chat_view.profile_nickname.is_element_displayed():
|
2020-08-19 15:04:21 +00:00
|
|
|
|
self.errors.append('In %s case block user button is not shown' % key)
|
|
|
|
|
if not chat_view.element_by_text(url_data[key]['username']).is_element_displayed():
|
|
|
|
|
self.errors.append('In %s case username not shown' % key)
|
2021-06-23 15:12:42 +00:00
|
|
|
|
if 'wallet' in key:
|
|
|
|
|
if url_data[key].get('data'):
|
|
|
|
|
actual_data = send_transaction_view.get_values_from_send_transaction_bottom_sheet()
|
|
|
|
|
difference_in_data = url_data[key]['data'].items() - actual_data.items()
|
|
|
|
|
if difference_in_data:
|
|
|
|
|
self.errors.append(
|
|
|
|
|
'In %s case returned value does not match expected in %s' % (key, repr(difference_in_data)))
|
|
|
|
|
wallet_view.close_send_transaction_view_button.click()
|
|
|
|
|
wallet_view.home_button.click()
|
2020-08-19 15:04:21 +00:00
|
|
|
|
if 'dapp' in key:
|
|
|
|
|
home_view.open_in_status_button.click()
|
2021-07-14 14:49:27 +00:00
|
|
|
|
if not (chat_view.allow_button.is_element_displayed() or chat_view.element_by_text("Can't find web3 library").is_element_displayed()):
|
2020-08-19 15:04:21 +00:00
|
|
|
|
self.errors.append('No allow button is shown in case of navigating to Status dapp!')
|
2020-12-14 17:39:29 +00:00
|
|
|
|
chat_view.dapp_tab_button.click()
|
2021-06-23 15:12:42 +00:00
|
|
|
|
chat_view.home_button.click()
|
2020-08-19 15:04:21 +00:00
|
|
|
|
if 'public' in key:
|
|
|
|
|
if not chat_view.chat_message_input.is_element_displayed():
|
|
|
|
|
self.errors.append('No message input is shown in case of navigating to public chat via deep link!')
|
|
|
|
|
if not chat_view.element_by_text_part(url_data[key]['chat_name']).is_element_displayed():
|
|
|
|
|
self.errors.append('Chat name is not shown in case of navigating to public chat via deep link!')
|
|
|
|
|
chat_view.get_back_to_home_view()
|
|
|
|
|
|
|
|
|
|
self.errors.verify_no_errors()
|