Test can cancel quote message

Signed-off-by: Serhy <sergii@status.im>
This commit is contained in:
Serhy 2019-11-08 20:24:55 +02:00
parent 0c6cd948ad
commit 6aa225192f
No known key found for this signature in database
GPG Key ID: 5D7C4B9E2B6F500B
7 changed files with 75 additions and 8 deletions

View File

@ -159,6 +159,7 @@
[react/scroll-view {:style style/reply-message-content} [react/scroll-view {:style style/reply-message-content}
[react/view {:style style/reply-message-to-container} [react/view {:style style/reply-message-to-container}
[vector-icons/tiny-icon :tiny-icons/tiny-reply {:container-style style/reply-icon [vector-icons/tiny-icon :tiny-icons/tiny-reply {:container-style style/reply-icon
:accessibility-label :tiny-reply-icon
:width 20 :width 20
:color colors/gray}] :color colors/gray}]
(chat-utils/format-reply-author from alias ens-name current-public-key style/reply-message-author)] (chat-utils/format-reply-author from alias ens-name current-public-key style/reply-message-author)]

View File

@ -2,7 +2,7 @@ import pytest
import time import time
from tests import marks, camera_access_error_text, get_current_time from tests import marks, camera_access_error_text, get_current_time
from tests.users import basic_user from tests.users import basic_user, dummy_user
from tests.base_test_case import SingleDeviceTestCase, MultipleDeviceTestCase from tests.base_test_case import SingleDeviceTestCase, MultipleDeviceTestCase
from views.sign_in_view import SignInView from views.sign_in_view import SignInView
@ -211,6 +211,39 @@ class TestChatManagement(SingleDeviceTestCase):
if home.element_by_text(basic_user["username"]).is_element_displayed(): if home.element_by_text(basic_user["username"]).is_element_displayed():
self.driver.fail("Unblocked user not added previously in contact list added in contacts!") self.driver.fail("Unblocked user not added previously in contact list added in contacts!")
@marks.testrail_id(5496)
@marks.low
def test_can_remove_quote_snippet_from_inputs(self):
sign_in = SignInView(self.driver)
home = sign_in.create_user()
chat_view = home.add_contact(dummy_user["public_key"], add_in_contacts=False)
message_to_quote_1_to_1 = "This is a message to quote in 1-1"
message_to_quote_public = "This is a message to quote in public"
chat_view.just_fyi("Send and quote message in 1-1 chat")
chat_view.send_message(message_to_quote_1_to_1)
chat_view.quote_message(message_to_quote_1_to_1)
chat_view.get_back_to_home_view(times_to_click_on_back_btn=1)
chat_view.just_fyi("Send and quote message in public chat")
public_chat_name = home.get_public_chat_name()
home.join_public_chat(public_chat_name)
chat_view.send_message(message_to_quote_public)
chat_view.quote_message(message_to_quote_public)
chat_view.just_fyi("Clear quotes from both chats")
chat_view.cancel_reply_button.click()
if chat_view.tiny_reply_icon_in_message_input.is_element_displayed():
self.errors.append("Message quote kept in public chat input after it's cancelation")
chat_view.get_back_to_home_view(times_to_click_on_back_btn=1)
home.get_chat_with_user(dummy_user["username"]).click()
chat_view.cancel_reply_button.click()
if chat_view.tiny_reply_icon_in_message_input.is_element_displayed():
self.errors.append("Message quote kept in 1-1 chat input after it's cancelation")
self.errors.verify_no_errors()
@marks.chat @marks.chat
class TestChatManagementMultipleDevice(MultipleDeviceTestCase): class TestChatManagementMultipleDevice(MultipleDeviceTestCase):
@ -301,9 +334,8 @@ class TestChatManagementMultipleDevice(MultipleDeviceTestCase):
"'%s' from blocked user %s are shown in public chat" % (message, device_2.driver.number)) "'%s' from blocked user %s are shown in public chat" % (message, device_2.driver.number))
@marks.testrail_id(5763) @marks.testrail_id(5763)
@marks.high @marks.medium
def test_block_user_from_one_to_one_header(self): def test_block_user_from_one_to_one_header(self):
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])
message_before_block_1 = "Before block from %s" % device_1.driver.number message_before_block_1 = "Before block from %s" % device_1.driver.number

View File

@ -138,8 +138,7 @@ class TestPublicChatMultipleDevice(MultipleDeviceTestCase):
if not chat_element_2.is_element_displayed(sec=10): if not chat_element_2.is_element_displayed(sec=10):
self.errors.append('Message with emoji was not received in public chat by the recipient') self.errors.append('Message with emoji was not received in public chat by the recipient')
chat_element_2.long_press_element() chat_2.quote_message(emoji_unicode)
chat_2.element_by_text('Reply').click()
message_text = 'test message' message_text = 'test message'
chat_2.chat_message_input.send_keys(message_text) chat_2.chat_message_input.send_keys(message_text)
chat_2.send_message_button.click() chat_2.send_message_button.click()

View File

@ -393,7 +393,7 @@ class TestTransactionWalletSingleDevice(SingleDeviceTestCase):
send_transaction.sign_with_password.click_until_presence_of_element(send_transaction.enter_password_input) send_transaction.sign_with_password.click_until_presence_of_element(send_transaction.enter_password_input)
send_transaction.enter_password_input.send_keys(common_password) send_transaction.enter_password_input.send_keys(common_password)
send_transaction.sign_button.click() send_transaction.sign_button.click()
send_transaction.element_by_text('intrinsic gas too low', 'text').wait_for_visibility_of_element(40) send_transaction.element_by_text('intrinsic gas too low', 'text').wait_for_visibility_of_element(80)
send_transaction.ok_button.click() send_transaction.ok_button.click()
send_transaction.sign_transaction_button.click() send_transaction.sign_transaction_button.click()
@ -409,6 +409,7 @@ class TestTransactionWalletSingleDevice(SingleDeviceTestCase):
self.network_api.find_transaction_by_unique_amount(sender['address'], amount) self.network_api.find_transaction_by_unique_amount(sender['address'], amount)
@marks.testrail_id(5314) @marks.testrail_id(5314)
@marks.critical
def test_can_see_all_transactions_in_history(self): def test_can_see_all_transactions_in_history(self):
address = wallet_users['D']['address'] address = wallet_users['D']['address']
passphrase = wallet_users['D']['passphrase'] passphrase = wallet_users['D']['passphrase']

View File

@ -18,6 +18,14 @@ ens_user_other_domain = dict()
ens_user_other_domain['ens'] = 'tanyatest1.eth' ens_user_other_domain['ens'] = 'tanyatest1.eth'
ens_user_other_domain['address'] = '0xcf2272205cc0cf96Cfbb9Dd740BD681D1E86901E' ens_user_other_domain['address'] = '0xcf2272205cc0cf96Cfbb9Dd740BD681D1E86901E'
dummy_user = dict()
dummy_user['username'] = "Vain Wordy Hagfish"
dummy_user['passphrase'] = "near broom kiss excess sad switch slab melt trade crash spare dinner"
dummy_user['public_key'] = "0x04596348471aa19d31c8503fa00f95abd0fc3ca908668817284b52b7ced95f966cc13457254aa908aa8e64" \
"a2748453accf9d358b8d7a1448597201c664dc280e37"
dummy_user['address'] = "0xdF6Bc71206d7ea89ec905a7f5ce8Ff34C85eB04e"
wallet_users = dict() wallet_users = dict()
wallet_users['A'] = dict() wallet_users['A'] = dict()

View File

@ -541,12 +541,12 @@ class BaseView(object):
raw_public_key = bytearray.fromhex(public_key.replace('0x04', '')) raw_public_key = bytearray.fromhex(public_key.replace('0x04', ''))
return datatypes.PublicKey(raw_public_key).to_address()[2:] return datatypes.PublicKey(raw_public_key).to_address()[2:]
def get_back_to_home_view(self): def get_back_to_home_view(self, times_to_click_on_back_btn=5):
counter = 0 counter = 0
from views.home_view import PlusButton from views.home_view import PlusButton
while not PlusButton(self.driver).is_element_displayed(2): while not PlusButton(self.driver).is_element_displayed(2):
try: try:
if counter >= 5: if counter >= times_to_click_on_back_btn:
break break
self.back_button.click() self.back_button.click()
except (NoSuchElementException, TimeoutException): except (NoSuchElementException, TimeoutException):

View File

@ -14,11 +14,24 @@ class ChatMessageInput(BaseEditBox):
self.locator = self.Locator.accessibility_id('chat-message-input') self.locator = self.Locator.accessibility_id('chat-message-input')
class TinyReplyIconInMessageInput(BaseElement):
def __init__(self, driver):
super(TinyReplyIconInMessageInput, self).__init__(driver)
self.locator = self.Locator.accessibility_id('tiny-reply-icon')
class CancelReplyButton(BaseEditBox):
def __init__(self, driver):
super(CancelReplyButton, self).__init__(driver)
self.locator = self.Locator.accessibility_id('cancel-message-reply')
class AddToContacts(BaseButton): class AddToContacts(BaseButton):
def __init__(self, driver): def __init__(self, driver):
super(AddToContacts, self).__init__(driver) super(AddToContacts, self).__init__(driver)
self.locator = self.Locator.accessibility_id('add-to-contacts-button') self.locator = self.Locator.accessibility_id('add-to-contacts-button')
class RemoveFromContactsButton(BaseButton): class RemoveFromContactsButton(BaseButton):
def __init__(self, driver): def __init__(self, driver):
super(RemoveFromContactsButton, self).__init__(driver) super(RemoveFromContactsButton, self).__init__(driver)
@ -100,6 +113,12 @@ class ClearHistoryButton(BaseButton):
self.locator = self.Locator.xpath_selector('//*[@text="Clear history"]') self.locator = self.Locator.xpath_selector('//*[@text="Clear history"]')
class ReplyMessageButton(BaseButton):
def __init__(self, driver):
super(ReplyMessageButton, self).__init__(driver)
self.locator = self.Locator.text_selector("Reply")
class GroupInfoButton(BaseButton): class GroupInfoButton(BaseButton):
def __init__(self, driver): def __init__(self, driver):
@ -380,6 +399,8 @@ class ChatView(BaseView):
super(ChatView, self).__init__(driver) super(ChatView, self).__init__(driver)
self.chat_message_input = ChatMessageInput(self.driver) self.chat_message_input = ChatMessageInput(self.driver)
self.tiny_reply_icon_in_message_input = TinyReplyIconInMessageInput(self.driver)
self.cancel_reply_button = CancelReplyButton(self.driver)
self.add_to_contacts = AddToContacts(self.driver) self.add_to_contacts = AddToContacts(self.driver)
self.remove_from_contacts = RemoveFromContactsButton(self.driver) self.remove_from_contacts = RemoveFromContactsButton(self.driver)
self.user_name_text = UserNameText(self.driver) self.user_name_text = UserNameText(self.driver)
@ -399,6 +420,7 @@ class ChatView(BaseView):
self.members_button = MembersButton(self.driver) self.members_button = MembersButton(self.driver)
self.delete_chat_button = DeleteChatButton(self.driver) self.delete_chat_button = DeleteChatButton(self.driver)
self.clear_history_button = ClearHistoryButton(self.driver) self.clear_history_button = ClearHistoryButton(self.driver)
self.reply_message_button = ReplyMessageButton(self.driver)
self.clear_button = ClearButton(self.driver) self.clear_button = ClearButton(self.driver)
self.block_contact_button = BlockContactButton(self.driver) self.block_contact_button = BlockContactButton(self.driver)
self.unblock_contact_button = UnblockContactButton(self.driver) self.unblock_contact_button = UnblockContactButton(self.driver)
@ -568,6 +590,10 @@ 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 quote_message(self, message = str):
self.chat_element_by_text(message).long_press_element()
self.reply_message_button.click()
def move_to_messages_by_time_marker(self, marker='Today'): 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)
HistoryTimeMarker(self.driver, marker).scroll_to_element(depth=50, direction='up') HistoryTimeMarker(self.driver, marker).scroll_to_element(depth=50, direction='up')