Edit message in chat test

Signed-off-by: Serhy <sergii@status.im>
This commit is contained in:
Serhy 2021-07-07 11:02:54 +03:00
parent a35d5f9d15
commit ab01093a6e
No known key found for this signature in database
GPG Key ID: 5D7C4B9E2B6F500B
4 changed files with 65 additions and 3 deletions

View File

@ -96,7 +96,7 @@ class TestCreateAccount(SingleDeviceTestCase):
if sign_in.generate_key_button.is_element_displayed(): if sign_in.generate_key_button.is_element_displayed():
self.errors.append("Agree with ToS is not mandatory to proceed onboarding!") self.errors.append("Agree with ToS is not mandatory to proceed onboarding!")
sign_in.accept_tos_checkbox.click() sign_in.accept_tos_checkbox.click()
sign_in.generate_key_button.click() sign_in.get_started_button.click()
from views.sign_in_view import MultiAccountButton from views.sign_in_view import MultiAccountButton
account_button = sign_in.get_multiaccount_by_position(position=random.randint(1, 4), element_class=MultiAccountButton) account_button = sign_in.get_multiaccount_by_position(position=random.randint(1, 4), element_class=MultiAccountButton)
username = account_button.username.text username = account_button.username.text

View File

@ -99,7 +99,7 @@ class TestCommandsMultipleDevices(MultipleDeviceTestCase):
@marks.testrail_id(6263) @marks.testrail_id(6263)
@marks.critical @marks.critical
def test_request_and_receive_stt_in_1_1_chat_offline(self): def test_request_and_receive_stt_in_1_1_chat_offline(self):
sender = transaction_senders['C'] sender = transaction_senders['L']
self.create_drivers(2) self.create_drivers(2)
device_1, device_2 = SignInView(self.drivers[0]), SignInView(self.drivers[1]) device_1, device_2 = SignInView(self.drivers[0]), SignInView(self.drivers[1])
asset_name = 'STT' asset_name = 'STT'

View File

@ -196,6 +196,60 @@ class TestMessagesOneToOneChatMultiple(MultipleDeviceTestCase):
# self.errors.append("Updated profile picture is not shown in one-to-one chat") # self.errors.append("Updated profile picture is not shown in one-to-one chat")
self.errors.verify_no_errors() self.errors.verify_no_errors()
@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()
@marks.testrail_id(5782) @marks.testrail_id(5782)
@marks.critical @marks.critical
def test_install_pack_and_send_sticker(self): def test_install_pack_and_send_sticker(self):
@ -786,7 +840,7 @@ class TestMessagesOneToOneChatSingle(SingleDeviceTestCase):
@marks.testrail_id(6322) @marks.testrail_id(6322)
@marks.medium @marks.medium
def test_can_scan_different_links_with_universal_qr_scanner(self): def test_can_scan_different_links_with_universal_qr_scanner(self):
user = transaction_senders['C'] user = transaction_senders['L']
home_view = SignInView(self.driver).recover_access(user['passphrase']) home_view = SignInView(self.driver).recover_access(user['passphrase'])
wallet_view = home_view.wallet_button.click() wallet_view = home_view.wallet_button.click()
wallet_view.set_up_wallet() wallet_view.set_up_wallet()

View File

@ -603,6 +603,14 @@ class ChatView(BaseView):
self.chat_message_input.send_keys(message) self.chat_message_input.send_keys(message)
self.send_message_button.click() self.send_message_button.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.element_by_text_part(message_to_edit).long_press_element()
self.element_by_translation_id("edit").click()
self.chat_message_input.clear()
self.chat_message_input.send_keys(message_to_update)
self.send_message_button.click()
def copy_message_text(self, message_text): 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_text_part(message_text).long_press_element()