e2e: 1-1 chat groups

This commit is contained in:
Churikova Tetiana 2022-03-31 17:34:34 +02:00
parent 7a964fde29
commit 092b0ed427
No known key found for this signature in database
GPG Key ID: 0D4EA7B33B47E6D8
10 changed files with 670 additions and 798 deletions

View File

@ -7,10 +7,12 @@ import time
from json import JSONDecodeError
from decimal import Decimal
from os import environ
from web3.exceptions import TransactionNotFound
import tests
import support.api.web3_api as w3
class NetworkApi(object):
def __init__(self):
@ -79,7 +81,7 @@ class NetworkApi(object):
counter = 0
while True:
if counter >= wait_time:
for entry in range(0,5):
for entry in range(0, 5):
self.log('Transaction #%s, amount is %s' %(entry+1, float(int(transactions[entry]['value']) / 10 ** decimals)))
self.log(str(transactions[entry]))
pytest.fail(
@ -100,6 +102,13 @@ class NetworkApi(object):
try:
for transaction in transactions:
if float(int(transaction['value']) / 10 ** decimals) == float(amount):
self.log("Tx is found: %s (etherscan API)" % transaction['hash'])
try:
w3.transaction_status(transaction['hash'])
self.log("Tx is found (web3 API)")
except TransactionNotFound:
self.log("Tx is not found (web3 API)")
continue
return transaction
except TypeError as e:
self.log("Failed iterate transactions(Etherscan unexpected error): " + str(e))

View File

@ -110,6 +110,7 @@ class TestrailReport(BaseTestReport):
test_cases['pr']['wallet'] = 50661
test_cases['pr']['send_tx'] = 50662
test_cases['pr']['keycard_tx'] = 50663
test_cases['pr']['1_1_chat_commands'] = 50825
## Nightly e2e
test_cases['nightly']['medium'] = 736
test_cases['nightly']['chat'] = 50811

View File

@ -11,50 +11,6 @@ from views.chat_view import ChatView
class TestChatManagement(SingleDeviceTestCase):
@marks.testrail_id(5387)
@marks.high
def test_delete_chats_via_delete_button_rejoin(self):
sign_in = SignInView(self.driver)
home = sign_in.create_user()
messages = [home.get_random_message() for _ in range(3)]
home.just_fyi("Creating 3 types of chats")
chat = home.add_contact(basic_user['public_key'])
one_to_one, public, group = basic_user['username'], '#public-delete-long-press', 'group'
chat.get_back_to_home_view()
home.create_group_chat([basic_user['username']], group)
chat.get_back_to_home_view()
home.join_public_chat(public[1:])
chat.get_back_to_home_view()
home.join_public_chat(public[1:])
chat.get_back_to_home_view()
home.just_fyi("Deleting 3 chats via delete button and check they will not reappear after relaunching app")
i = 0
for chat_name in one_to_one, public, group:
message = messages[i]
chat = home.get_chat(chat_name).click()
chat.send_message(message)
chat.leave_chat() if chat_name == group else chat.delete_chat()
i += 1
chat.get_back_to_home_view()
for chat_name in one_to_one, public, group:
if home.get_chat_from_home_view(chat_name).is_element_displayed():
self.errors.append('Deleted %s chat is shown, but the chat has been deleted' % chat_name)
self.driver.close_app()
self.driver.launch_app()
sign_in.sign_in()
for chat_name in one_to_one, public, group:
if home.get_chat_from_home_view(chat_name).is_element_displayed():
self.errors.append('Deleted %s is shown after re-login, but the chat has been deleted' % chat_name)
sign_in.just_fyi('Rejoin public chat and check that messages are fetched again')
public_chat = home.join_public_chat(public[1:])
if not public_chat.chat_element_by_text(messages[1]).is_element_displayed(20):
self.errors.append('Messages are not fetched when rejoining public chat after deleting')
self.errors.verify_no_errors()
@marks.testrail_id(5304)
@marks.high
def test_open_chat_by_pasting_chat_key_check_invalid_chat_key_cases(self):
@ -792,82 +748,6 @@ class TestChatManagementMultipleDevice(MultipleDeviceTestCase):
self.errors.verify_no_errors()
@marks.testrail_id(6315)
@marks.critical
def test_reactions_to_message_in_chats(self):
self.create_drivers(2)
device_1, device_2 = SignInView(self.drivers[0]), SignInView(self.drivers[1])
message_from_sender = "Message sender"
home_1, home_2 = device_1.create_user(), device_2.create_user()
device_1.just_fyi('Both devices join to 1-1 chat')
device_2_public_key = home_2.get_public_key_and_username()
device_1_profile = home_1.profile_button.click()
device_1_username = device_1_profile.default_username_text.text
home_1.home_button.click()
device_1.just_fyi("Sender start 1-1 chat, set emoji and check counter")
device_1_chat = home_1.add_contact(device_2_public_key)
device_1_chat.send_message(message_from_sender)
device_1_chat.set_reaction(message_from_sender)
message_sender = device_1_chat.chat_element_by_text(message_from_sender)
if message_sender.emojis_below_message() != 1:
self.errors.append("Counter of reaction is not updated on your own message!")
device_2.just_fyi("Receiver set own emoji and verifies counter on received message in 1-1 chat")
home_2.home_button.click()
device_2_chat_item = home_2.get_chat(device_1_username)
device_2_chat_item.wait_for_visibility_of_element(20)
device_2_chat = device_2_chat_item.click()
message_receiver = device_2_chat.chat_element_by_text(message_from_sender)
if message_receiver.emojis_below_message(own=False) != 1:
self.errors.append("Counter of reaction is not updated on received message!")
device_2_chat.set_reaction(message_from_sender)
for counter in message_sender.emojis_below_message(), message_receiver.emojis_below_message():
if counter != 2:
self.errors.append('Counter is not updated after setting emoji from receiver!')
device_2.just_fyi("Receiver pick the same emoji and verify that counter will decrease for both users")
device_2_chat.set_reaction(message_from_sender)
for counter in message_sender.emojis_below_message(), message_receiver.emojis_below_message(own=False):
if counter != 1:
self.errors.append('Counter is not decreased after re-tapping emoji from receiver!')
[chat.get_back_to_home_view() for chat in (device_2_chat, device_1_chat)]
device_1.just_fyi('Both devices joining the same public chat, send messages and check counters')
chat_name = device_1.get_random_chat_name()
[home.join_public_chat(chat_name) for home in (home_1, home_2)]
chat_public_1, chat_public_2 = home_1.get_chat_view(), home_2.get_chat_view()
chat_public_1.send_message(message_from_sender)
device_1_chat.just_fyi('Set several emojis as sender and receiver and check counters in public chat')
message_sender = chat_public_1.chat_element_by_text(message_from_sender)
emojis_from_sender = ['thumbs-down', 'love', 'laugh']
[chat_public_1.set_reaction(message_from_sender, reaction) for reaction in emojis_from_sender]
emojis_from_receiver = ['angry', 'sad']
[chat_public_2.set_reaction(message_from_sender, reaction) for reaction in emojis_from_receiver]
message_receiver = chat_public_2.chat_element_by_text(message_from_sender)
for reaction in emojis_from_sender:
if message_sender.emojis_below_message(reaction) != 1:
self.errors.append(
'Counter is not updated on own message after tapping %s for sender in pub chat' % reaction)
if message_receiver.emojis_below_message(reaction, own=False) != 1:
self.errors.append(
'Counter is not updated on received message after tapping %s for receiver in pub chat' % reaction)
for reaction in emojis_from_receiver:
if message_sender.emojis_below_message(reaction, own=False) != 1:
self.errors.append(
'Counter is not updated on own message after tapping %s for receiver in pub chat' % emoji)
if message_receiver.emojis_below_message(reaction) != 1:
self.errors.append(
'Counter is not updated on received message after tapping %s for sender in pub chat' % emoji)
device_1_chat.just_fyi('Unset emoji and check that it is not shown anymore')
chat_public_1.set_reaction(message_from_sender, 'love')
if message_sender.emojis_below_message('love') != 0:
self.errors.append('Emoji is still shown on message after re-tapping last reaction')
self.errors.verify_no_errors()
@marks.testrail_id(6326)
@marks.medium

View File

@ -1,69 +1,71 @@
import time
import pytest
from tests import marks
from tests.users import transaction_senders, ens_user
from tests.base_test_case import MultipleDeviceTestCase
from tests.base_test_case import MultipleDeviceTestCase, MultipleSharedDeviceTestCase, create_shared_drivers
from views.sign_in_view import SignInView
class TestCommandsMultipleDevices(MultipleDeviceTestCase):
@marks.testrail_id(6253)
@marks.critical
@marks.transaction
def test_send_eth_in_1_1_chat_transaction_push(self):
sender = transaction_senders['ETH_7']
self.create_drivers(2)
device_1, device_2 = SignInView(self.drivers[0]), SignInView(self.drivers[1])
home_1 = device_1.recover_access(passphrase=sender['passphrase'], enable_notifications=True)
home_2 = device_2.create_user(enable_notifications=True)
for home in home_1, home_2:
@pytest.mark.xdist_group(name="commands_2")
@marks.critical
class TestCommandsMultipleDevicesMerged(MultipleSharedDeviceTestCase):
@classmethod
def setup_class(cls):
cls.drivers, cls.loop = create_shared_drivers(2)
cls.device_1, cls.device_2 = SignInView(cls.drivers[0]), SignInView(cls.drivers[1])
cls.sender = transaction_senders['ETH_STT_3']
cls.home_1 = cls.device_1.recover_access(passphrase=cls.sender['passphrase'], enable_notifications=True)
cls.home_2 = cls.device_2.create_user()
for home in cls.home_1, cls.home_2:
profile = home.profile_button.click()
profile.profile_notifications_button.scroll_and_click()
profile.wallet_push_notifications.click()
cls.recipient_public_key, cls.recipient_username = cls.home_2.get_public_key_and_username(return_username=True)
cls.wallet_1, cls.wallet_2 = cls.home_1.wallet_button.click(), cls.home_2.wallet_button.click()
[wallet.home_button.click() for wallet in (cls.wallet_1, cls.wallet_2)]
cls.chat_1 = cls.home_1.add_contact(cls.recipient_public_key)
cls.account_name_1 = cls.wallet_1.status_account_name
recipient_public_key, recipient_username = home_2.get_public_key_and_username(return_username=True)
wallet_1, wallet_2 = home_1.wallet_button.click(), home_2.wallet_button.click()
[wallet.home_button.click() for wallet in (wallet_1, wallet_2)]
chat_1 = home_1.add_contact(recipient_public_key)
amount = chat_1.get_unique_amount()
account_name = wallet_1.status_account_name
home_1.just_fyi('Send %s ETH in 1-1 chat and check it for sender and receiver: Address requested' % amount)
chat_1.commands_button.click()
send_transaction = chat_1.send_command.click()
send_transaction.get_username_in_transaction_bottom_sheet_button(recipient_username).click()
@marks.testrail_id(6253)
@marks.transaction
def test_1_1_chat_command_send_eth_outgoing_tx_push(self):
amount = self.chat_1.get_unique_amount()
self.home_1.just_fyi('Send %s ETH in 1-1 chat and check it for sender and receiver: Address requested' % amount)
self.chat_1.commands_button.click()
send_transaction = self.chat_1.send_command.click()
send_transaction.get_username_in_transaction_bottom_sheet_button(self.recipient_username).click()
if send_transaction.scan_qr_code_button.is_element_displayed():
self.drivers[0].fail('Recipient is editable in bottom sheet when send ETH from 1-1 chat')
send_transaction.amount_edit_box.set_value(amount)
send_transaction.confirm()
send_transaction.sign_transaction_button.click()
sender_message = chat_1.get_outgoing_transaction(account_name)
sender_message = self.chat_1.get_outgoing_transaction(self.account_name_1)
if not sender_message.is_element_displayed():
self.drivers[0].fail('No message is shown after sending ETH in 1-1 chat for sender')
sender_message.transaction_status.wait_for_element_text(sender_message.address_requested)
chat_2 = home_2.get_chat(sender['username']).click()
receiver_message = chat_2.get_incoming_transaction(account_name)
chat_2 = self.home_2.get_chat(self.sender['username']).click()
receiver_message = chat_2.get_incoming_transaction(self.account_name_1)
timestamp_sender = sender_message.timestamp_command_message.text
if not receiver_message.is_element_displayed():
self.drivers[0].fail('No message about incoming transaction in 1-1 chat is shown for receiver')
receiver_message.transaction_status.wait_for_element_text(receiver_message.address_requested)
home_2.just_fyi('Accept and share address for sender and receiver')
self.home_2.just_fyi('Accept and share address for sender and receiver')
for option in (receiver_message.decline_transaction, receiver_message.accept_and_share_address):
if not option.is_element_displayed():
self.drivers[0].fail("Required options accept or share are not shown")
select_account_bottom_sheet = receiver_message.accept_and_share_address.click()
if not select_account_bottom_sheet.get_account_in_select_account_bottom_sheet_button(
account_name).is_element_displayed():
self.account_name_1).is_element_displayed():
self.errors.append('Not expected value in "From" in "Select account": "Status" is expected')
select_account_bottom_sheet.select_button.click()
receiver_message.transaction_status.wait_for_element_text(receiver_message.shared_account)
sender_message.transaction_status.wait_for_element_text(sender_message.address_request_accepted)
home_1.just_fyi("Sign and send transaction and check that timestamp on message is updated")
self.home_1.just_fyi("Sign and send transaction and check that timestamp on message is updated")
time.sleep(20)
send_bottom_sheet = sender_message.sign_and_send.click()
send_bottom_sheet.next_button.click()
@ -71,146 +73,64 @@ class TestCommandsMultipleDevices(MultipleDeviceTestCase):
updated_timestamp_sender = sender_message.timestamp_command_message.text
if updated_timestamp_sender == timestamp_sender:
self.errors.append("Timestamp of message is not updated after signing transaction")
chat_1.wallet_button.click()
wallet_1.find_transaction_in_history(amount=amount)
self.chat_1.wallet_button.click()
self.wallet_1.find_transaction_in_history(amount=amount)
[wallet.put_app_to_background() for wallet in (wallet_1, wallet_2)]
self.network_api.wait_for_confirmation_of_transaction(sender['address'], amount)
device_1.open_notification_bar()
device_1.element_by_text_part('You sent %s ETH' % amount).click()
if not wallet_1.transaction_history_button.is_element_displayed():
[wallet.put_app_to_background() for wallet in (self.wallet_1, self.wallet_2)]
self.network_api.wait_for_confirmation_of_transaction(self.sender['address'], amount)
self.device_1.open_notification_bar()
self.device_1.element_by_text_part('You sent %s ETH' % amount).click()
if not self.wallet_1.transaction_history_button.is_element_displayed():
self.errors.append('Was not redirected to transaction history after tapping on PN')
wallet_1.home_button.click(desired_view="chat")
self.wallet_1.home_button.click(desired_view="chat")
home_1.just_fyi("Check 'Confirmed' state for sender and receiver(use pull-to-refresh to update history)")
self.home_1.just_fyi("Check 'Confirmed' state for sender and receiver(use pull-to-refresh to update history)")
chat_2.status_in_background_button.click()
chat_2.wallet_button.click()
wallet_2.wait_balance_is_changed()
wallet_2.find_transaction_in_history(amount=amount)
wallet_2.home_button.click()
home_2.get_chat(sender['username']).click()
self.wallet_2.wait_balance_is_changed()
self.wallet_2.find_transaction_in_history(amount=amount)
self.wallet_2.home_button.click()
self.home_2.get_chat(self.sender['username']).click()
[message.transaction_status.wait_for_element_text(message.confirmed, 60) for message in
(sender_message, receiver_message)]
# TODO: should be added PNs for receiver after getting more stable feature (rechecked 23.11.21, valid)
self.errors.verify_no_errors()
@marks.testrail_id(6263)
@marks.critical
@marks.transaction
def test_request_and_receive_stt_in_1_1_chat_offline(self):
sender = transaction_senders['ETH_STT_3']
self.create_drivers(2)
device_1, device_2 = SignInView(self.drivers[0]), SignInView(self.drivers[1])
asset_name = 'STT'
amount = device_1.get_unique_amount()
device_1.just_fyi('Grab user data for transactions and public chat, set up wallets')
home_1 = device_1.create_user()
recipient_public_key, recipient_username = home_1.get_public_key_and_username(return_username=True)
wallet_1 = home_1.wallet_button.click()
wallet_1.select_asset(asset_name)
wallet_1.home_button.click()
home_2 = device_2.recover_access(passphrase=sender['passphrase'])
wallet_2 = home_2.wallet_button.click()
initial_amount_stt = wallet_2.get_asset_amount_by_name('STT')
wallet_2.home_button.click()
device_2.just_fyi('Add recipient to contact and send 1 message')
chat_2 = home_2.add_contact(recipient_public_key)
chat_2.send_message("Hey there!")
profile_2 = wallet_2.profile_button.click()
profile_2.logout()
chat_1 = home_1.get_chat(sender['username']).click()
home_1.just_fyi('Request %s STT in 1-1 chat and check it is visible for sender and receiver' % amount)
chat_1.commands_button.click()
request_transaction = chat_1.request_command.click()
request_transaction.amount_edit_box.set_value(amount)
request_transaction.confirm()
asset_button = request_transaction.asset_by_name(asset_name)
request_transaction.select_asset_button.click_until_presence_of_element(asset_button)
asset_button.click()
request_transaction.request_transaction_button.click()
chat_1_request_message = chat_1.get_incoming_transaction()
if not chat_1_request_message.is_element_displayed():
self.drivers[0].fail('No incoming transaction in 1-1 chat is shown for recipient after requesting STT')
home_2.just_fyi('Check that transaction message is fetched from offline and sign transaction')
device_2.sign_in()
home_2.connection_offline_icon.wait_for_invisibility_of_element(30)
home_2.get_chat(recipient_username).click()
chat_2_sender_message = chat_2.get_outgoing_transaction()
if not chat_2_sender_message.is_element_displayed():
self.drivers[0].fail('No outgoing transaction in 1-1 chat is shown for sender after requesting STT')
chat_2_sender_message.transaction_status.wait_for_element_text(chat_2_sender_message.address_received)
send_message = chat_2_sender_message.sign_and_send.click()
send_message.next_button.click()
send_message.sign_transaction()
home_2.just_fyi('Check that transaction message is updated with new status after offline')
[chat.toggle_airplane_mode() for chat in (chat_1, chat_2)]
self.network_api.wait_for_confirmation_of_transaction(sender['address'], amount, token=True)
for home in (home_1, home_2):
home.toggle_airplane_mode()
home.home_button.double_click()
home.connection_offline_icon.wait_for_invisibility_of_element(100)
home_1.get_chat(sender['username']).click()
home_2.get_chat(recipient_username).click()
[message.transaction_status.wait_for_element_text(message.confirmed, wait_time=120) for message in
(chat_2_sender_message, chat_1_request_message)]
home_1.just_fyi('Check that can find tx in history and balance is updated after offline')
home_2.wallet_button.click()
wallet_2.wait_balance_is_changed('STT', initial_amount_stt)
wallet_2.find_transaction_in_history(amount=amount, asset='STT')
self.errors.verify_no_errors()
@marks.testrail_id(6265)
@marks.critical
@marks.transaction
def test_decline_transactions_in_1_1_chat_push_notification_changing_state(self):
sender = transaction_senders['ETH_8']
self.create_drivers(2)
device_1, device_2 = SignInView(self.drivers[0]), SignInView(self.drivers[1])
home_1 = device_1.recover_access(passphrase=sender['passphrase'], enable_notifications=True)
home_2 = device_2.create_user()
profile_2 = home_2.profile_button.click()
recipient_chat_key = profile_2.get_public_key_and_username()
wallet_1, wallet_2 = home_1.wallet_button.click(), home_2.wallet_button.click()
[wallet.home_button.click() for wallet in (wallet_1, wallet_2)]
def test_1_1_chat_command_decline_eth_push_changing_state(self):
[chat.status_in_background_button.click_if_shown() for chat in (self.home_1, self.home_2)]
self.home_1.home_button.double_click()
self.home_1.get_chat(username=self.recipient_username).click()
chat_1 = home_1.add_contact(recipient_chat_key)
amount = chat_1.get_unique_amount()
chat_1.send_message('To start conversation')
home_1.just_fyi('Decline transaction before sharing address and check that state is changed')
chat_1.commands_button.click()
send_transaction = chat_1.send_command.click()
self.home_1.just_fyi('Decline transaction before sharing address and check that state is changed')
self.chat_1.commands_button.click()
send_transaction = self.chat_1.send_command.click()
amount = self.chat_1.get_unique_amount()
send_transaction.amount_edit_box.set_value(amount)
send_transaction.confirm()
send_transaction.sign_transaction_button.click()
chat_1_sender_message = chat_1.get_outgoing_transaction()
home_1.click_system_home_button()
chat_1_sender_message = self.chat_1.get_outgoing_transaction()
self.home_1.click_system_home_button()
chat_2 = home_2.get_chat(sender['username']).click()
self.home_2.home_button.double_click()
chat_2 = self.home_2.get_chat(self.sender['username']).click()
chat_2_receiver_message = chat_2.get_incoming_transaction()
chat_2_receiver_message.decline_transaction.click()
home_1.open_notification_bar()
home_1.element_by_text_part('Request address for transaction declined').wait_and_click()
self.home_1.open_notification_bar()
self.home_1.element_by_text_part('Request address for transaction declined').wait_and_click()
[message.transaction_status.wait_for_element_text(message.declined) for message in
(chat_1_sender_message, chat_2_receiver_message)]
home_1.just_fyi('Decline transaction request and check that state is changed')
request_amount = chat_1.get_unique_amount()
chat_1.commands_button.click()
request_transaction = chat_1.request_command.click()
self.home_1.just_fyi('Decline transaction request and check that state is changed')
request_amount = self.chat_1.get_unique_amount()
self.chat_1.commands_button.click()
request_transaction = self.chat_1.request_command.click()
request_transaction.amount_edit_box.set_value(request_amount)
request_transaction.confirm()
request_transaction.request_transaction_button.click()
chat_1_request_message = chat_1.get_incoming_transaction()
chat_1_request_message = self.chat_1.get_incoming_transaction()
chat_2_sender_message = chat_2.get_outgoing_transaction()
chat_2_sender_message.decline_transaction.click()
[message.transaction_status.wait_for_element_text(message.declined) for message in
@ -218,6 +138,74 @@ class TestCommandsMultipleDevices(MultipleDeviceTestCase):
self.errors.verify_no_errors()
@marks.testrail_id(6263)
@marks.transaction
def test_1_1_chat_command_request_and_receive_stt_in_1_1_chat_offline(self):
for home in self.home_1, self.home_2:
home.status_in_background_button.click_if_shown()
asset_name = 'STT'
amount = self.device_1.get_unique_amount()
self.device_1.just_fyi('Grab user data for transactions and public chat, set up wallets')
self.home_2.get_back_to_home_view()
self.home_2.wallet_button.click()
self.wallet_2.select_asset(asset_name)
self.wallet_2.home_button.click()
self.home_1.wallet_button.click()
initial_amount_stt = self.wallet_1.get_asset_amount_by_name('STT')
self.wallet_1.home_button.click()
profile_1 = self.home_1.profile_button.click()
profile_1.logout()
self.home_2.just_fyi('Request %s STT in 1-1 chat and check it is visible for sender and receiver' % amount)
chat_2 = self.home_2.get_chat(username=self.sender['username']).click()
chat_2.commands_button.click()
request_transaction = chat_2.request_command.click()
request_transaction.amount_edit_box.set_value(amount)
request_transaction.confirm()
asset_button = request_transaction.asset_by_name(asset_name)
request_transaction.select_asset_button.click_until_presence_of_element(asset_button)
asset_button.click()
request_transaction.request_transaction_button.click()
chat_2_request_message = chat_2.get_incoming_transaction()
if not chat_2_request_message.is_element_displayed():
self.drivers[1].fail('No incoming transaction in 1-1 chat is shown for recipient after requesting STT')
self.home_1.just_fyi('Check that transaction message is fetched from offline and sign transaction')
self.device_1.sign_in()
self.home_1.connection_offline_icon.wait_for_invisibility_of_element(30)
self.home_1.get_chat(self.recipient_username).click()
chat_1_sender_message = self.chat_1.get_outgoing_transaction()
if not chat_1_sender_message.is_element_displayed():
self.drivers[0].fail('No outgoing transaction in 1-1 chat is shown for sender after requesting STT')
chat_1_sender_message.transaction_status.wait_for_element_text(chat_1_sender_message.address_received)
send_message = chat_1_sender_message.sign_and_send.click()
send_message.next_button.click()
send_message.sign_transaction()
self.home_2.just_fyi('Check that transaction message is updated with new status after offline')
[chat.toggle_airplane_mode() for chat in (self.chat_1, chat_2)]
self.network_api.wait_for_confirmation_of_transaction(self.sender['address'], amount, token=True)
for home in (self.home_1, self.home_2):
home.toggle_airplane_mode()
home.home_button.double_click()
home.connection_offline_icon.wait_for_invisibility_of_element(100)
self.home_2.get_chat(self.sender['username']).click()
self.home_1.get_chat(self.recipient_username).click()
[message.transaction_status.wait_for_element_text(message.confirmed, wait_time=120) for message in
(chat_1_sender_message, chat_2_request_message)]
self.home_1.just_fyi('Check that can find tx in history and balance is updated after offline')
self.home_1.wallet_button.click()
self.wallet_1.wait_balance_is_changed('STT', initial_amount_stt)
self.wallet_1.find_transaction_in_history(amount=amount, asset=asset_name)
self.errors.verify_no_errors()
class TestCommandsMultipleDevices(MultipleDeviceTestCase):
@marks.testrail_id(6257)
@marks.medium
@marks.transaction

View File

@ -1,165 +1,183 @@
import emoji
import random
import string
import pytest
from tests import marks
from tests.base_test_case import MultipleDeviceTestCase, SingleDeviceTestCase
from tests.base_test_case import MultipleDeviceTestCase, SingleDeviceTestCase, MultipleSharedDeviceTestCase, create_shared_drivers
from tests.users import transaction_senders, basic_user, ens_user, ens_user_ropsten
from views.sign_in_view import SignInView
from views.send_transaction_view import SendTransactionView
class TestMessagesOneToOneChatMultiple(MultipleDeviceTestCase):
@pytest.mark.xdist_group(name="1_1_chat_2")
@marks.critical
class TestOneToOneChatMultipleSharedDevices(MultipleSharedDeviceTestCase):
@marks.testrail_id(6283)
@marks.high
def test_push_notification_1_1_chat_no_pn_activity_center(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)
device_2.just_fyi("Device_1 = Enables Notifications from Profile; Device_2 - from onboarding")
@classmethod
def setup_class(cls):
cls.drivers, cls.loop = create_shared_drivers(2)
cls.device_1, cls.device_2 = SignInView(cls.drivers[0]), SignInView(cls.drivers[1])
cls.home_1 = cls.device_1.create_user(enable_notifications=True)
cls.home_2 = cls.device_2.create_user(enable_notifications=True)
cls.profile_1 = cls.home_1.profile_button.click()
cls.default_username_1 = cls.profile_1.default_username_text.text
cls.profile_1.home_button.click()
cls.public_key_2, cls.default_username_2 = cls.home_2.get_public_key_and_username(return_username=True)
cls.chat_1 = cls.home_1.add_contact(cls.public_key_2)
cls.chat_1.send_message('hey')
cls.home_2.home_button.double_click()
cls.chat_2 = cls.home_2.get_chat(cls.default_username_1).click()
profile_1 = home_1.profile_button.click()
default_username_1 = profile_1.default_username_text.text
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()
message_no_pn, message = 'No PN', 'Text push notification'
@marks.testrail_id(6315)
def test_1_1_chat_message_reaction(self):
message_from_sender = "Message sender"
self.device_1.just_fyi("Sender start 1-1 chat, set emoji and check counter")
self.chat_1.send_message(message_from_sender)
self.chat_1.set_reaction(message_from_sender)
message_sender = self.chat_1.chat_element_by_text(message_from_sender)
if message_sender.emojis_below_message() != 1:
self.errors.append("Counter of reaction is not updated on your own message!")
device_2.just_fyi("Device 2 check there is no PN when receiving new message to activity centre")
device_2.put_app_to_background()
chat_1 = home_1.add_contact(public_key_2)
chat_1.send_message(message_no_pn)
device_2.open_notification_bar()
if home_2.element_by_text(message_no_pn).is_element_displayed():
self.errors.append("Push notification with text was received for new message in activity centre")
device_2.get_app_from_background()
device_2.home_button.click()
home_2.get_chat(default_username_1).click()
home_2.profile_button.click()
self.device_2.just_fyi("Receiver set own emoji and verifies counter on received message in 1-1 chat")
message_receiver = self.chat_2.chat_element_by_text(message_from_sender)
if message_receiver.emojis_below_message(own=False) != 1:
self.errors.append("Counter of reaction is not updated on received message!")
self.chat_2.set_reaction(message_from_sender)
for counter in message_sender.emojis_below_message(), message_receiver.emojis_below_message():
if counter != 2:
self.errors.append('Counter is not updated after setting emoji from receiver!')
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()
chat_1.send_message(message)
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()
pn = home_2.get_pn(message)
if not pn.icon.is_element_displayed():
device_2.driver.fail("Push notification with text was not received")
chat_2 = device_2.click_upon_push_notification_by_text(message)
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_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_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_1.element_by_text_part(message).is_element_displayed()
and chat_1.element_by_text_part(emoji_unicode).is_element_displayed()):
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")
[device.click_system_home_button() for device in (device_1, device_2)]
[device.open_notification_bar() for device in (device_1, device_2)]
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.device_2.just_fyi("Receiver pick the same emoji and verify that counter will decrease for both users")
self.chat_2.set_reaction(message_from_sender)
for counter in message_sender.emojis_below_message(), message_receiver.emojis_below_message(own=False):
if counter != 1:
self.errors.append('Counter is not decreased after re-tapping emoji from receiver!')
self.errors.verify_no_errors()
@marks.testrail_id(5310)
@marks.critical
def test_offline_is_shown_messaging_1_1_chat_sent_delivered(self):
self.create_drivers(2)
home_1, home_2 = SignInView(self.drivers[0]).create_user(), SignInView(self.drivers[1]).create_user()
public_key_1 = home_1.get_public_key_and_username()
home_1.home_button.click()
@marks.testrail_id(6316)
def test_1_1_chat_text_message_with_push(self):
self.home_2.just_fyi("Put app on background (to check Push notification received for audio message)")
self.home_2.click_system_home_button()
home_1.just_fyi('turn on airplane mode and check that offline status is shown on home view')
home_1.toggle_airplane_mode()
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():
self.errors.append(
'Element "%s" is not shown in Connection status screen if device is offline' % element.locator)
home_1.click_system_back_button()
self.home_2.just_fyi("Sending audio message to device who is on background")
self.chat_1.record_audio_message(message_length_in_seconds=125)
if not self.chat_1.element_by_text("Maximum recording time reached").is_element_displayed():
self.drivers[0].fail("Exceeded 2 mins limit of recording time.")
profile_2 = home_2.profile_button.click()
username_2 = profile_2.default_username_text.text
profile_2.home_button.click()
chat_2 = home_2.add_contact(public_key_1)
message_1 = 'test message'
self.chat_1.ok_button.click()
if self.chat_1.audio_message_recorded_time.text != "1:59":
self.errors.append("Timer exceed 2 minutes")
self.chat_1.send_message_button.click()
home_2.just_fyi("check sent status")
chat_2.send_message(message_1)
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)
chat_2.toggle_airplane_mode()
self.device_2.open_notification_bar()
chat_2 = self.home_2.click_upon_push_notification_by_text("Audio")
home_1.just_fyi('go back online and check that 1-1 chat will be fetched')
home_1.toggle_airplane_mode()
chat_element = home_1.get_chat(username_2, wait_time=120)
chat_1 = chat_element.click()
chat_1.chat_element_by_text(message_1).wait_for_visibility_of_element(2)
listen_time = 5
self.device_2.home_button.click()
self.home_2.get_chat(self.default_username_1).click()
chat_2.play_audio_message(listen_time)
if chat_2.audio_message_in_chat_timer.text not in ("00:05", "00:06", "00:07", "00:08"):
self.errors.append("Listened 5 seconds but timer shows different listened time in audio message")
self.errors.verify_no_errors()
@marks.testrail_id(5373)
def test_1_1_chat_emoji_and_link_send_and_open(self):
self.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]
self.chat_1.send_message(emoji.emojize(emoji_name))
for chat in self.chat_1, self.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')
self.home_1.just_fyi("Check that link can be opened from 1-1 chat")
url_message = 'http://status.im'
self.chat_1.send_message(url_message)
self.chat_2.element_starts_with_text(url_message, 'button').click()
web_view = self.chat_2.open_in_status_button.click()
if not web_view.element_by_text('Private, Secure Communication').is_element_displayed(60):
self.errors.append('URL was not opened from 1-1 chat')
self.errors.verify_no_errors()
@marks.testrail_id(695843)
def test_1_1_chat_text_message_edit_delete_push_disappear(self):
self.device_2.just_fyi(
"Device 1 sends text message and edits it in 1-1 chat. Device2 checks edited message is shown")
message_before_edit_1_1, message_after_edit_1_1 = "Message before edit 1-1", "AFTER"
self.chat_1.home_button.click()
self.chat_2.home_button.click()
self.home_2.get_chat(self.default_username_1).click()
self.chat_2.send_message(message_before_edit_1_1)
self.chat_2.edit_message_in_chat(message_before_edit_1_1, message_after_edit_1_1)
if not self.home_1.element_by_text_part(message_after_edit_1_1).is_element_present():
self.errors.append('UNedited message version displayed on preview')
self.home_1.get_chat(self.default_username_2).click()
chat_element = self.chat_1.chat_element_by_text(message_after_edit_1_1)
if not chat_element.is_element_present(30):
self.errors.append('No edited message in 1-1 chat displayed')
if not self.chat_1.element_by_text_part("⌫ Edited").is_element_present(30):
self.errors.append('No mark in message bubble about this message was edited on receiver side')
self.device_2.just_fyi("Verify Device1 can not edit and delete received message from Device2")
chat_element.long_press_element()
for action in ("edit", "delete"):
if self.chat_1.element_by_translation_id(action).is_element_present():
self.errors.append('Option to %s someone else message available!' % action)
self.home_1.click_system_back_button()
self.device_2.just_fyi("Delete message and check it is not shown in chat preview on home")
self.chat_2.delete_message_in_chat(message_after_edit_1_1)
for chat in (self.chat_2, self.chat_1):
if chat.chat_element_by_text(message_after_edit_1_1).is_element_displayed(30):
self.errors.append("Deleted message is shown in chat view for 1-1 chat")
self.chat_1.home_button.double_click()
if self.home_1.element_by_text(message_after_edit_1_1).is_element_displayed(30):
self.errors.append("Deleted message is shown on chat element on home screen")
self.device_2.just_fyi("Send one more message and check that PN will be deleted with message deletion")
message_to_delete = 'DELETE ME'
self.home_1.put_app_to_background()
self.chat_2.send_message(message_to_delete)
self.home_1.open_notification_bar()
if not self.home_1.get_pn(message_to_delete):
self.errors.append("Push notification doesn't appear")
self.chat_2.delete_message_in_chat(message_to_delete)
pn_to_disappear = self.home_1.get_pn(message_to_delete)
if pn_to_disappear:
if not pn_to_disappear.is_element_disappeared(30):
self.errors.append("Push notification was not removed after initial message deletion")
home_1.just_fyi('checking offline fetching for another message, check delivered status for first message')
chat_2.toggle_airplane_mode()
if chat_2.chat_element_by_text(message_1).status != 'delivered':
self.errors.append(
'Message status is not delivered, it is %s!' % chat_2.chat_element_by_text(message_1).status)
home_1.toggle_airplane_mode()
message_2 = 'one more message'
chat_2.send_message(message_2)
home_1.toggle_airplane_mode()
chat_1 = chat_element.click()
chat_1.chat_element_by_text(message_2).wait_for_visibility_of_element(180)
self.errors.verify_no_errors()
@marks.testrail_id(5315)
@marks.high
def test_send_non_english_message_to_newly_added_contact_on_different_networks(self):
self.create_drivers(2)
device_1_home, device_2_home = SignInView(self.drivers[0]).create_user(), SignInView(
self.drivers[1]).create_user()
profile_1 = device_1_home.profile_button.click()
profile_1.switch_network()
def test_1_1_chat_non_latin_message_to_newly_added_contact_with_profile_picture_on_different_networks(self):
self.home_1.get_app_from_background()
self.home_2.get_app_from_background()
self.home_1.profile_button.click()
self.profile_1.edit_profile_picture('sauce_logo.png')
self.profile_1.switch_network()
self.profile_1.home_button.click()
self.home_1.get_chat(self.default_username_2).click()
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()
profile_1 = device_1_home.profile_button.click()
profile_1.edit_profile_picture('sauce_logo.png')
profile_1.home_button.click()
device_2_public_key, default_username_2 = device_2_home.get_public_key_and_username(return_username=True)
device_2_home.home_button.click()
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 + ' ')
self.profile_1.just_fyi("Send messages on different languages")
messages = ['hello', '¿Cómo estás tu año?', 'ё, доброго вечерочка', '® æ ç ♥']
timestamp_message = messages[3]
for message in messages:
device_1_chat.send_message(message)
device_2_chat = device_2_home.get_chat(default_username_1).click()
sent_time_variants = device_1_chat.convert_device_time_to_chat_timestamp()
self.chat_1.send_message(message)
if not self.chat_2.chat_message_input.is_element_displayed():
self.chat_2.home_button.click()
self.home_2.get_chat(self.default_username_1).click()
sent_time_variants = self.chat_1.convert_device_time_to_chat_timestamp()
for message in messages:
if not device_2_chat.chat_element_by_text(message).is_element_displayed():
if not self.chat_2.chat_element_by_text(message).is_element_displayed():
self.errors.append("Message with test '%s' was not received" % message)
if not device_2_chat.add_to_contacts.is_element_displayed():
if not self.chat_2.add_to_contacts.is_element_displayed():
self.errors.append('Add to contacts button is not shown')
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)
if self.chat_2.user_name_text.text != self.default_username_1:
self.errors.append("Default username '%s' is not shown in one-to-one chat" % self.default_username_1)
# TODO: disabled until https://github.com/status-im/status-react/issues/12936 fix
# profile_1.just_fyi("Check timestamps for sender and receiver")
@ -170,85 +188,220 @@ class TestMessagesOneToOneChatMultiple(MultipleDeviceTestCase):
# self.errors.append(
# "Timestamp is not shown, expected '%s', in fact '%s'" % (sent_time_variants.join(","), timestamp))
device_2_home.just_fyi("Add user to contact and verify his default username")
device_2_chat.add_to_contacts.click()
device_2_chat.chat_options.click()
device_2_chat.view_profile_button.click()
if not device_2_chat.remove_from_contacts.is_element_displayed():
self.chat_2.just_fyi("Add user to contact and verify his default username")
self.chat_2.add_to_contacts.click()
self.chat_2.chat_options.click()
self.chat_2.view_profile_button.click()
if not self.chat_2.remove_from_contacts.is_element_displayed():
self.errors.append("Remove from contacts in not shown after adding contact from 1-1 chat bar")
device_2_chat.close_button.click()
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()
self.chat_2.close_button.click()
self.chat_2.home_button.double_click()
self.home_2.plus_button.click()
device_2_contacts = self.home_2.start_new_chat_button.click()
if not device_2_contacts.element_by_text(self.default_username_1).is_element_displayed():
self.errors.append('%s is not added to contacts' % self.default_username_1)
if self.chat_1.user_name_text.text != self.default_username_2:
self.errors.append("Default username '%s' is not shown in one-to-one chat" % self.default_username_2)
if not device_2_chat.contact_profile_picture.is_element_image_equals_template('sauce_logo_profile_2.png'):
if not self.chat_2.contact_profile_picture.is_element_image_equals_template('sauce_logo_profile_2.png'):
self.errors.append("Updated profile picture is not shown in one-to-one chat")
self.errors.verify_no_errors()
@marks.testrail_id(695843)
@marks.high
def test_edit_delete_message_in_one_to_one_(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(enable_notifications=True), device_2.create_user()
@marks.testrail_id(6283)
def test_1_1_chat_push_emoji(self):
message_no_pn, message = 'No PN', 'Text push notification'
device_2.just_fyi("Create public chat on Device1, send message and edit it then")
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.home_button.click() for home in (home_1, home_2)]
# TODO: Should be moved to group or test where no contact is added in prerequisites
# self.device_2.just_fyi("Device 2: check there is no PN when receiving new message to activity centre")
# self.device_2.put_app_to_background()
# if not self.chat_1.chat_message_input.is_element_displayed():
# self.home_1.get_chat(username=self.default_username_2).click()
# self.chat_1.send_message(message_no_pn)
# self.device_2.open_notification_bar()
# if self.home_2.element_by_text(message_no_pn).is_element_displayed():
# self.errors.append("Push notification with text was received for new message in activity centre")
# self.device_2.get_app_from_background()
self.device_2.home_button.click()
self.home_2.get_chat(self.default_username_1).click()
self.home_2.profile_button.click()
device_2.just_fyi(
"Device 1 sends text message and edits it in 1-1 chat. Device2 checks edited message is shown")
chat_private_2 = home_2.add_contact(public_key_1)
message_before_edit_1_1, message_after_edit_1_1 = "Message before edit 1-1", "AFTER"
chat_private_2.send_message(message_before_edit_1_1)
home_1.home_button.click()
self.device_2.just_fyi("Device 2 puts app on background being on Profile view to receive PN with text")
self.device_2.click_system_home_button()
self.chat_1.send_message(message)
device_1_one_to_one_chat_element = home_1.get_chat(username_2)
chat_private_2.edit_message_in_chat(message_before_edit_1_1, message_after_edit_1_1)
if not home_1.element_by_text_part(message_after_edit_1_1).is_element_displayed(30):
self.errors.append('UNedited message version displayed on preview')
chat_private_1 = device_1_one_to_one_chat_element.click()
if not home_1.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 home_1.element_by_text_part("⌫ Edited").is_element_present(30):
self.errors.append('No mark in message bubble about this message was edited on receiver side')
self.device_1.just_fyi("Device 1 puts app on background to receive emoji push notification")
self.device_1.profile_button.click()
self.device_1.click_system_home_button()
device_2.just_fyi("Verify Device1 can not edit and delete received message from Device2")
home_1.element_by_text_part(message_after_edit_1_1).long_press_element()
for action in ("edit", "delete"):
if home_1.element_by_translation_id(action).is_element_present():
self.errors.append('Option to %s someone else message available!' % action)
home_1.click_system_back_button()
self.device_2.just_fyi("Check text push notification and tap it")
self.device_2.open_notification_bar()
if not self.home_2.get_pn(message):
self.device_2.driver.fail("Push notification with text was not received")
chat_2 = self.device_2.click_upon_push_notification_by_text(message)
device_2.just_fyi("Delete message and check it is not shown in chat preview on home")
chat_private_2.delete_message_in_chat(message_after_edit_1_1)
for chat in (chat_private_2, chat_private_1):
if chat.chat_element_by_text(message_after_edit_1_1).is_element_displayed(30):
self.errors.append("Deleted message is shown in chat view for 1-1 chat")
chat_private_1.home_button.double_click()
if home_1.element_by_text(message_after_edit_1_1).is_element_displayed(30):
self.errors.append("Deleted message is shown on chat element on home screen")
self.device_2.just_fyi("Send emoji message to Device 1 while it's on background")
emoji_message = random.choice(list(emoji.EMOJI_UNICODE))
emoji_unicode = emoji.EMOJI_UNICODE[emoji_message]
chat_2.send_message(emoji.emojize(emoji_message))
device_2.just_fyi("Send one more message and check that PN will be deleted with message deletion")
message_to_delete = 'DELETE ME'
home_1.put_app_to_background()
chat_private_2.send_message(message_to_delete)
home_1.open_notification_bar()
home_1.get_pn(message_to_delete).wait_for_element(30)
chat_private_2.delete_message_in_chat(message_to_delete)
if not home_1.get_pn(message_to_delete).is_element_disappeared(30):
self.errors.append("Push notification was not removed after initial message deletion")
home_1.click_system_back_button(2)
self.device_1.just_fyi("Device 1 checks PN with emoji")
self.device_1.open_notification_bar()
if not self.device_1.element_by_text_part(emoji_unicode).is_element_displayed(10):
self.device_1.driver.fail("Push notification with emoji was not received")
chat_1 = self.device_1.click_upon_push_notification_by_text(emoji_unicode)
self.device_1.just_fyi("Check Device 1 is actually on chat")
if not (chat_1.element_by_text_part(message).is_element_displayed()
and chat_1.element_by_text_part(emoji_unicode).is_element_displayed()):
self.device_1.driver.fail("Failed to open chat view after tap on PN")
self.device_1.just_fyi("Checks there are no PN after message was seen")
[device.click_system_home_button() for device in (self.device_1, self.device_2)]
[device.open_notification_bar() for device in (self.device_1, self.device_2)]
if (self.device_2.element_by_text_part(message).is_element_displayed()
or self.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()
@marks.testrail_id(6305)
def test_1_1_chat_image_send_save_reply(self):
self.home_1.get_app_from_background()
self.home_2.get_app_from_background()
self.home_1.home_button.click()
self.home_1.get_chat(username=self.default_username_2).click()
self.home_1.just_fyi('send image in 1-1 chat from Gallery, check options for sender')
image_description = 'description'
self.chat_1.show_images_button.click()
self.chat_1.allow_button.click_if_shown()
self.chat_1.first_image_from_gallery.click()
if not self.chat_1.cancel_send_image_button.is_element_displayed():
self.errors.append("Can't cancel sending images, expected image preview is not shown!")
self.chat_1.chat_message_input.set_value(image_description)
self.chat_1.send_message_button.click()
self.chat_1.chat_message_input.click()
for message in self.chat_1.image_message_in_chat, self.chat_1.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')
self.chat_1.image_message_in_chat.long_press_element()
for element in self.chat_1.reply_message_button, self.chat_1.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 self.chat_1.view_profile_button.is_element_displayed():
self.errors.append('"View profile" is shown on long-press on own message')
self.home_2.just_fyi('check image, description and options for receiver')
self.home_2.get_chat(self.default_username_1).click()
for message in self.chat_2.image_message_in_chat, self.chat_2.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')
self.home_2.just_fyi('check options on long-press image for receiver')
self.chat_2.image_message_in_chat.long_press_element()
for element in (self.chat_2.reply_message_button, self.chat_2.save_image_button):
if not element.is_element_displayed():
self.errors.append('Save and reply are not available on long-press on received image messages')
self.home_1.just_fyi('save image')
self.chat_1.save_image_button.click_until_presence_of_element(self.chat_1.show_images_button)
self.chat_1.show_images_button.click_until_presence_of_element(self.chat_1.image_from_gallery_button)
self.chat_1.image_from_gallery_button.click_until_presence_of_element(self.chat_1.recent_image_in_gallery)
if not self.chat_1.recent_image_in_gallery.is_element_displayed():
self.errors.append('Saved image is not shown in Recent')
self.home_1.click_system_back_button(2)
self.home_2.just_fyi('reply to image message')
self.chat_2.reply_message_button.click()
if self.chat_2.quote_username_in_message_input.text != "↪ Replying to %s" % self.default_username_1:
self.errors.append("Username is not displayed in reply quote snippet replying to image message")
reply_to_message_from_receiver = "image reply"
self.chat_2.send_message(reply_to_message_from_receiver)
reply_message = self.chat_2.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.home_2.just_fyi('check share and save options on opened image')
self.chat_2.image_message_in_chat.scroll_to_element(direction='up')
self.chat_2.image_message_in_chat.click()
self.chat_2.share_image_icon_button.click()
self.chat_2.share_via_messenger()
if not self.chat_2.image_in_android_messenger.is_element_present():
self.errors.append("Can't share image")
self.chat_2.click_system_back_button()
self.chat_2.save_image_icon_button.click()
self.chat_2.show_images_button.click()
self.chat_2.allow_button.wait_and_click()
if not self.chat_2.first_image_from_gallery.is_element_image_similar_to_template('saved.png'):
self.errors.append("New picture was not saved!")
self.errors.verify_no_errors()
@marks.testrail_id(5310)
def test_1_1_chat_is_shown_message_sent_delivered_from_offline(self):
self.home_1.home_button.click()
self.home_2.home_button.click()
self.home_1.just_fyi('turn on airplane mode and check that offline status is shown on home view')
self.home_1.toggle_airplane_mode()
self.home_1.connection_offline_icon.wait_and_click(20)
for element in self.home_1.not_connected_to_node_text, self.home_1.not_connected_to_peers_text:
if not element.is_element_displayed():
self.errors.append(
'Element "%s" is not shown in Connection status screen if device is offline' % element.locator)
self.home_1.click_system_back_button()
message_1 = 'test message'
self.home_2.just_fyi("check sent status")
self.home_2.get_chat(username=self.default_username_1).click()
self.chat_2.send_message(message_1)
chat_element = self.chat_2.chat_element_by_text(message_1)
if chat_element.status != 'sent':
self.errors.append('Message status is not sent, it is %s!' % chat_element.status)
self.chat_2.toggle_airplane_mode()
self.home_1.just_fyi('go back online and check that 1-1 chat will be fetched')
self.home_1.toggle_airplane_mode()
chat_element = self.home_1.get_chat(self.default_username_2, wait_time=60)
chat_element.click()
self.chat_1.chat_element_by_text(message_1).wait_for_visibility_of_element(20)
self.home_1.just_fyi('checking offline fetching for another message, check delivered status for first message')
self.chat_2.toggle_airplane_mode()
if self.chat_2.chat_element_by_text(message_1).status != 'delivered':
self.errors.append(
'Message status is not delivered, it is %s!' % self.chat_2.chat_element_by_text(message_1).status)
self.home_1.toggle_airplane_mode()
message_2 = 'one more message'
self.chat_2.send_message(message_2)
self.home_1.toggle_airplane_mode()
chat_1 = chat_element.click()
chat_1.chat_element_by_text(message_2).wait_for_visibility_of_element(180)
self.errors.verify_no_errors()
@marks.testrail_id(5387)
def test_1_1_chat_delete_via_delete_button_relogin(self):
self.home_1.driver.quit()
self.home_2.home_button.click()
self.home_2.get_chat(username=self.default_username_1).click()
self.home_2.just_fyi("Deleting chat via delete button and check it will not reappear after relaunching app")
self.chat_2.delete_chat()
self.chat_2.get_back_to_home_view()
if self.home_2.get_chat_from_home_view(self.default_username_1).is_element_displayed():
self.errors.append('Deleted %s chat is shown, but the chat has been deleted' % self.default_username_1)
self.home_2.reopen_app()
if self.home_2.get_chat_from_home_view(self.default_username_1).is_element_displayed():
self.errors.append(
'Deleted chat %s is shown after re-login, but the chat has been deleted' % self.default_username_1)
self.errors.verify_no_errors()
class TestMessagesOneToOneChatMultiple(MultipleDeviceTestCase):
@marks.testrail_id(5782)
@marks.critical
def test_install_pack_and_send_sticker(self):
@ -306,180 +459,6 @@ class TestMessagesOneToOneChatMultiple(MultipleDeviceTestCase):
self.errors.verify_no_errors()
@marks.testrail_id(6305)
@marks.critical
def test_image_in_one_to_one_send_save_reply_timeline(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()
profile_1, profile_2 = home_1.profile_button.click(), home_2.profile_button.click()
device_2_public_key = profile_2.get_public_key_and_username()
home_1.just_fyi('set status in profile')
status_1 = 'Hey hey hey'
timeline = device_1.status_button.click()
timeline.set_new_status(status_1, image=True)
for element in timeline.element_by_text(status_1), timeline.image_message_in_chat:
if not element.is_element_displayed():
self.drivers[0].fail('Status is not set')
public_key_1, username_1 = profile_1.get_public_key_and_username(return_username=True)
[home.click() for home in [profile_1.home_button, profile_2.home_button]]
home_1.just_fyi('start 1-1 chat')
private_chat_1 = home_1.add_contact(device_2_public_key)
home_1.just_fyi('send image in 1-1 chat from Gallery, check options for sender')
image_description = 'description'
private_chat_1.show_images_button.click()
private_chat_1.first_image_from_gallery.click()
if not private_chat_1.cancel_send_image_button.is_element_displayed():
self.errors.append("Can't cancel sending images, expected image preview is not shown!")
private_chat_1.chat_message_input.set_value(image_description)
private_chat_1.send_message_button.click()
private_chat_1.chat_message_input.click()
for message in private_chat_1.image_message_in_chat, private_chat_1.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')
private_chat_1.show_images_button.click()
private_chat_1.image_from_gallery_button.click()
private_chat_1.click_system_back_button()
private_chat_1.image_message_in_chat.long_press_element()
for element in private_chat_1.reply_message_button, private_chat_1.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 private_chat_1.view_profile_button.is_element_displayed():
self.errors.append('"View profile" is shown on long-press on own message')
home_2.just_fyi('check image, description and options for receiver')
private_chat_2 = home_2.get_chat(username_1).click()
for message in private_chat_2.image_message_in_chat, private_chat_2.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')
home_2.just_fyi('View user profile and check status')
private_chat_2.chat_options.click()
timeline_device_1 = private_chat_2.view_profile_button.click()
for element in timeline_device_1.element_by_text(status_1), timeline_device_1.image_message_in_chat:
if not element.is_element_displayed(40):
self.errors.append('Status of another user not shown when open another user profile')
private_chat_2.close_button.click()
home_2.just_fyi('check options on long-press image for receiver')
private_chat_2.image_message_in_chat.long_press_element()
for element in (private_chat_2.reply_message_button, private_chat_2.save_image_button):
if not element.is_element_displayed():
self.errors.append('Save and reply are not available on long-press on received image messages')
home_1.just_fyi('save image')
private_chat_1.save_image_button.click()
private_chat_1.show_images_button.click_until_presence_of_element(private_chat_1.image_from_gallery_button)
private_chat_1.image_from_gallery_button.click()
private_chat_1.wait_for_element_starts_with_text('Recent')
if not private_chat_1.recent_image_in_gallery.is_element_displayed():
self.errors.append('Saved image is not shown in Recent')
home_2.just_fyi('reply to image message')
private_chat_2.reply_message_button.click()
if private_chat_2.quote_username_in_message_input.text != "↪ Replying to %s" % username_1:
self.errors.append("Username is not displayed in reply quote snippet replying to image message")
reply_to_message_from_receiver = "image reply"
private_chat_2.send_message(reply_to_message_from_receiver)
reply_message = private_chat_2.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")
home_2.just_fyi('check share and save options on opened image')
private_chat_2.image_message_in_chat.scroll_to_element(direction='up')
private_chat_2.image_message_in_chat.click()
private_chat_2.share_image_icon_button.click()
private_chat_2.share_via_messenger()
if not private_chat_2.image_in_android_messenger.is_element_present():
self.errors.append("Can't share image")
private_chat_2.click_system_back_button()
private_chat_2.save_image_icon_button.click()
private_chat_2.show_images_button.click()
private_chat_2.allow_button.wait_and_click()
if not private_chat_2.first_image_from_gallery.is_element_image_similar_to_template('saved.png'):
self.errors.append("New picture was not saved!")
self.errors.verify_no_errors()
@marks.testrail_id(6316)
@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
home_1 = profile_1.home_button.click()
public_key_2 = home_2.get_public_key_and_username()
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()
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()
chat_2 = home_2.click_upon_push_notification_by_text("Audio")
listen_time = 5
device_2.home_button.click()
home_2.get_chat(default_username_1).click()
chat_2.play_audio_message(listen_time)
if chat_2.audio_message_in_chat_timer.text not in ("00:05", "00:06", "00:07", "00:08"):
self.errors.append("Listened 5 seconds but timer shows different listened time in audio message")
self.errors.verify_no_errors()
@marks.testrail_id(5373)
@marks.high
def test_send_and_open_emoji_link_in_one_to_one(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()
profile_1 = home_1.profile_button.click()
default_username_1 = profile_1.default_username_text.text
home_1 = profile_1.home_button.click()
public_key_2 = home_2.get_public_key_and_username()
home_2.home_button.click()
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')
home_1.just_fyi("Check that link can be opened from 1-1 chat")
url_message = 'http://status.im'
chat_1.send_message(url_message)
chat_1.home_button.double_click()
chat_2.element_starts_with_text(url_message, 'button').click()
web_view = chat_2.open_in_status_button.click()
if not web_view.element_by_text('Private, Secure Communication').is_element_displayed(60):
self.errors.append('URL was not opened from 1-1 chat')
self.errors.verify_no_errors()
@marks.testrail_id(5362)
@marks.medium
def test_unread_messages_counter_preview_highlited_1_1_chat(self):
@ -529,45 +508,6 @@ class TestMessagesOneToOneChatMultiple(MultipleDeviceTestCase):
class TestMessagesOneToOneChatSingle(SingleDeviceTestCase):
@marks.testrail_id(5317)
@marks.critical
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()
message_text = {'text_message': 'mmmeowesage_text'}
formatted_message = {'message_with_link': 'https://status.im',
# TODO: blocked with 11161 (rechecked 23.11.21, valid)
# 'message_with_tag': '#successishere'
}
message_input = chat.chat_message_input
message_input.send_keys(message_text['text_message'])
chat.send_message_button.click()
chat.copy_message_text(message_text['text_message'])
message_input.paste_text_from_clipboard()
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()
for message in formatted_message:
message_input.send_keys(formatted_message[message])
chat.send_message_button.click()
message_bubble = chat.chat_element_by_text(formatted_message[message])
message_bubble.sent_status_checkmark.long_press_element()
chat.element_by_text('Copy').click()
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()
self.errors.verify_no_errors()
@marks.testrail_id(5322)
@marks.medium
def test_delete_cut_and_paste_messages(self):

View File

@ -287,6 +287,41 @@ class TestPublicChatBrowserOneDeviceMerged(MultipleSharedDeviceTestCase):
if not self.chat.chat_element_by_text(text_message).is_element_displayed(30):
self.drivers[0].fail("Not navigated to chat view after reopening app")
@marks.testrail_id(5317)
def test_public_chat_copy_and_paste_message_in_chat_input(self):
message_text = {'text_message': 'mmmeowesage_text'}
formatted_message = {'message_with_link': 'https://status.im',
# TODO: blocked with 11161 (rechecked 23.11.21, valid)
# 'message_with_tag': '#successishere'
}
message_input = self.chat.chat_message_input
if not message_input.is_element_displayed():
self.home.get_chat('#%s' % self.public_chat_name).click()
message_input.send_keys(message_text['text_message'])
self.chat.send_message_button.click()
self.chat.copy_message_text(message_text['text_message'])
message_input.paste_text_from_clipboard()
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()
for message in formatted_message:
message_input.send_keys(formatted_message[message])
self.chat.send_message_button.click()
message_bubble = self.chat.chat_element_by_text(formatted_message[message])
message_bubble.sent_status_checkmark.long_press_element()
self.chat.element_by_text('Copy').click()
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()
self.errors.verify_no_errors()
@marks.testrail_id(700738)
def test_public_chat_tag_message(self):
tag_message = '#wuuut'
@ -313,7 +348,7 @@ class TestPublicChatBrowserOneDeviceMerged(MultipleSharedDeviceTestCase):
try:
assert self.chat.user_name_text.text == '#' + chat_name
except (AssertionError, NoSuchElementException):
self.driver.fail("Public chat '%s' is not opened" % chat_name)
self.drivers[0].fail("Public chat '%s' is not opened" % chat_name)
@marks.testrail_id(702072)
def test_browser_blocked_url(self):
@ -474,6 +509,131 @@ class TestPublicChatBrowserOneDeviceMerged(MultipleSharedDeviceTestCase):
self.errors.verify_no_errors()
@pytest.mark.xdist_group(name="public_chat_medium_2")
@marks.medium
class TestPublicChatMultipleDeviceMergedMedium(MultipleSharedDeviceTestCase):
@classmethod
def setup_class(cls):
cls.drivers, cls.loop = create_shared_drivers(2)
device_1, device_2 = SignInView(cls.drivers[0]), SignInView(cls.drivers[1])
cls.home_1, cls.home_2 = device_1.create_user(), device_2.create_user()
profile_1 = cls.home_1.profile_button.click()
cls.public_key_1, cls.username_1 = profile_1.get_public_key_and_username(return_username=True)
profile_1.home_button.click()
cls.text_message = 'hello'
[home.home_button.click() for home in (cls.home_1, cls.home_2)]
cls.public_chat_name = cls.home_1.get_random_chat_name()
cls.chat_1, cls.chat_2 = cls.home_1.join_public_chat(cls.public_chat_name), cls.home_2.join_public_chat(
cls.public_chat_name)
cls.chat_1.send_message(cls.text_message)
@marks.testrail_id(6342)
def test_public_chat_timeline_different_statuses_reaction(self):
emoji_message = random.choice(list(emoji.EMOJI_UNICODE))
emoji_unicode = emoji.EMOJI_UNICODE[emoji_message]
self.home_1.just_fyi('Set status in profile')
statuses = {
'*formatted text*': 'formatted text',
'https://www.youtube.com/watch?v=JjPWmEh2KhA': 'Status Town Hall',
emoji.emojize(emoji_message): emoji_unicode,
}
timeline_1 = self.home_1.status_button.click()
for status in statuses.keys():
timeline_1.set_new_status(status)
sleep(60)
timeline_1.element_by_translation_id("enable").wait_and_click()
timeline_1.element_by_translation_id("enable-all").wait_and_click()
timeline_1.close_modal_view_from_chat_button.click()
for status in statuses:
expected_value = statuses[status]
if not timeline_1.element_by_text_part(expected_value).is_element_displayed():
self.errors.append("Expected value %s is not shown" % expected_value)
text_status = 'some text'
timeline_1.set_new_status(status=text_status, image=True)
for timestamp in ('Now', '1M', '2M'):
if not timeline_1.element_by_text(timestamp).is_element_displayed():
self.errors.append("Expected timestamp %s is not shown in timeline_1" % timestamp)
if not timeline_1.image_message_in_chat.is_element_displayed():
self.errors.append("Timeline image is not shown in timeline_1")
self.home_2.just_fyi('Check that can see user status without adding him as contact')
self.home_2.home_button.click()
chat_2 = self.home_2.add_contact(self.public_key_1, add_in_contacts=False)
chat_2.chat_options.click()
timeline_2 = chat_2.view_profile_button.click()
if not timeline_2.image_message_in_chat.is_element_displayed(40):
self.errors.append(
'Timeline image of another user is not shown when open another user profile before adding to contacts')
chat_2.chat_element_by_text(text_status).wait_for_element(30)
chat_2.element_by_translation_id("enable").scroll_and_click()
chat_2.element_by_translation_id("enable-all").wait_and_click()
chat_2.close_modal_view_from_chat_button.click()
for status in statuses:
chat_2.element_by_text_part(statuses['*formatted text*']).scroll_to_element()
expected_value = statuses[status]
if not chat_2.element_by_text_part(expected_value).is_element_displayed():
self.errors.append(
"Expected value %s is not shown in other user profile without adding to contacts" % expected_value)
self.home_2.just_fyi('Add device1 to contacts and check that status will be shown in timeline_1')
chat_2.close_button.scroll_and_click(direction='up')
chat_2.add_to_contacts.click()
timeline_2 = chat_2.status_button.click()
for status in statuses:
expected_value = statuses[status]
if not timeline_2.element_by_text_part(expected_value).is_element_displayed():
self.errors.append(
"Expected value %s is not shown in timeline_1 after adding user to contacts" % expected_value)
if not timeline_2.image_message_in_chat.is_element_displayed(40):
self.errors.append(
'Timeline image of another user is not shown when open another user profile after adding to contacts')
self.home_2.just_fyi('Checking message tag and reactions on statuses')
tag_status = '#public-chat-to-redirect-long-name'
timeline_1.set_new_status(tag_status)
public_chat_2 = self.home_2.get_chat_view()
public_chat_2.element_by_text(tag_status).wait_and_click()
public_chat_2.user_name_text.wait_for_element(30)
if not public_chat_2.user_name_text.text == tag_status:
self.errors.append('Could not redirect a user to a public chat tapping the tag message from timeline_1')
public_chat_2.back_button.click()
timeline_1.set_reaction(text_status)
status_with_reaction_1 = timeline_1.chat_element_by_text(text_status)
if status_with_reaction_1.emojis_below_message() != 1:
self.errors.append("Counter of reaction is not updated on your own status in timeline_1!")
self.home_2.home_button.double_click()
self.home_2.get_chat(self.username_1).click()
chat_2.chat_options.click()
chat_2.view_profile_button.click()
status_with_reaction_2 = chat_2.chat_element_by_text(text_status)
if status_with_reaction_2.emojis_below_message(own=False) != 1:
self.errors.append("Counter of reaction is not updated on status of another user in profile!")
self.home_1.just_fyi("Remove reaction and check it is updated for both users")
timeline_1.set_reaction(text_status)
status_with_reaction_1 = timeline_1.chat_element_by_text(text_status)
if status_with_reaction_1.emojis_below_message() != 0:
self.errors.append(
"Counter of reaction is not updated after removing reaction on your own status in timeline_1!")
status_with_reaction_2 = chat_2.chat_element_by_text(text_status)
if status_with_reaction_2.emojis_below_message(own=False) != 0:
self.errors.append(
"Counter of reaction is not updated after removing on status of another user in profile!")
self.home_1.just_fyi("Remove user from contacts and check there is no his status in timeline_1 anymore")
chat_2.remove_from_contacts.click()
chat_2.close_button.click()
chat_2.status_button.click()
if public_chat_2.chat_element_by_text(text_status).is_element_displayed(10):
self.errors.append("Statuses of removed user are still shown in profile")
self.errors.verify_no_errors()
@pytest.mark.xdist_group(name="chat_medium_2")
@marks.medium
class TestChatMultipleDevice(MultipleSharedDeviceTestCase):
@ -515,7 +675,7 @@ class TestChatMultipleDevice(MultipleSharedDeviceTestCase):
cls.message_1, cls.message_2, cls.message_3, cls.message_4 = "Message1", "Message2", "Message3", "Message4"
@marks.testrail_id(702066)
def test_chat_push_notifications_reaction_for_messages_sticker_audio_image(self):
def test_chat_1_1_push_and_reaction_for_messages_sticker_audio_image(self):
# methods with steps to use later in loop
def navigate_to_start_state_of_both_devices():
@ -593,7 +753,7 @@ class TestChatMultipleDevice(MultipleSharedDeviceTestCase):
self.errors.verify_no_errors()
@marks.testrail_id(702069)
def test_chat_can_pin_messages_in_1_1(self):
def test_chat_1_1_pin_messages(self):
self.home_1.just_fyi("Check that Device1 can pin own message in 1-1 chat")
self.chat_1.send_message(self.message_1)
@ -655,7 +815,7 @@ class TestChatMultipleDevice(MultipleSharedDeviceTestCase):
self.drivers[0].fail("Message_4 is not unpinned!")
@marks.testrail_id(702065)
def test_chat_markdown_support_in_public(self):
def test_chat_public_markdown_support(self):
markdown = {
'bold text in asterics': '**',
'bold text in underscores': '__',
@ -781,110 +941,6 @@ class TestChatMultipleDevice(MultipleSharedDeviceTestCase):
class TestPublicChatMultipleDevice(MultipleDeviceTestCase):
@marks.testrail_id(6342)
@marks.medium
def test_different_status_in_timeline(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()
profile_1, profile_2 = home_1.profile_button.click(), home_2.profile_button.click()
public_key_1, username_1 = profile_1.get_public_key_and_username(return_username=True)
emoji_message = random.choice(list(emoji.EMOJI_UNICODE))
emoji_unicode = emoji.EMOJI_UNICODE[emoji_message]
home_1.just_fyi('Set status in profile')
statuses = {
'*formatted text*': 'formatted text',
'https://www.youtube.com/watch?v=JjPWmEh2KhA': 'Status Town Hall',
emoji.emojize(emoji_message): emoji_unicode,
}
timeline_1 = device_1.status_button.click()
for status in statuses.keys():
timeline_1.set_new_status(status)
sleep(60)
timeline_1.element_by_translation_id("enable").wait_and_click()
timeline_1.element_by_translation_id("enable-all").wait_and_click()
timeline_1.close_modal_view_from_chat_button.click()
for status in statuses:
expected_value = statuses[status]
if not timeline_1.element_by_text_part(expected_value).is_element_displayed():
self.errors.append("Expected value %s is not shown" % expected_value)
text_status = 'some text'
timeline_1.set_new_status(status=text_status)
for timestamp in ('Now', '1M', '2M'):
if not timeline_1.element_by_text(timestamp).is_element_displayed():
self.errors.append("Expected timestamp %s is not shown in timeline_1" % timestamp)
home_2.just_fyi('Check that can see user status without adding him as contact')
profile_2.home_button.click()
chat_2 = home_2.add_contact(public_key_1, add_in_contacts=False)
chat_2.chat_options.click()
chat_2.view_profile_button.click()
chat_2.chat_element_by_text(text_status).wait_for_element(30)
chat_2.element_by_translation_id("enable").scroll_and_click()
chat_2.element_by_translation_id("enable-all").wait_and_click()
chat_2.close_modal_view_from_chat_button.click()
for status in statuses:
chat_2.element_by_text_part(statuses['*formatted text*']).scroll_to_element()
expected_value = statuses[status]
if not chat_2.element_by_text_part(expected_value).is_element_displayed():
self.errors.append(
"Expected value %s is not shown in other user profile without adding to contacts" % expected_value)
home_2.just_fyi('Add device1 to contacts and check that status will be shown in timeline_1')
chat_2.close_button.scroll_and_click(direction='up')
chat_2.add_to_contacts.click()
timeline_2 = chat_2.status_button.click()
for status in statuses:
expected_value = statuses[status]
if not timeline_2.element_by_text_part(expected_value).is_element_displayed():
self.errors.append(
"Expected value %s is not shown in timeline_1 after adding user to contacts" % expected_value)
profile_1.just_fyi('Checking message tag and reactions on statuses')
tag_status = '#public-chat-to-redirect-long-name'
timeline_1.set_new_status(tag_status)
public_chat_2 = home_2.get_chat_view()
public_chat_2.element_by_text(tag_status).wait_and_click()
public_chat_2.user_name_text.wait_for_element(30)
if not public_chat_2.user_name_text.text == tag_status:
self.errors.append('Could not redirect a user to a public chat tapping the tag message from timeline_1')
public_chat_2.back_button.click()
timeline_1.set_reaction(text_status)
status_with_reaction_1 = timeline_1.chat_element_by_text(text_status)
if status_with_reaction_1.emojis_below_message() != 1:
self.errors.append("Counter of reaction is not updated on your own status in timeline_1!")
device_2.home_button.double_click()
home_2.get_chat(username_1).click()
chat_2.chat_options.click()
chat_2.view_profile_button.click()
status_with_reaction_2 = chat_2.chat_element_by_text(text_status)
if status_with_reaction_2.emojis_below_message(own=False) != 1:
self.errors.append("Counter of reaction is not updated on status of another user in profile!")
profile_1.just_fyi("Remove reaction and check it is updated for both users")
timeline_1.set_reaction(text_status)
status_with_reaction_1 = timeline_1.chat_element_by_text(text_status)
if status_with_reaction_1.emojis_below_message() != 0:
self.errors.append(
"Counter of reaction is not updated after removing reaction on your own status in timeline_1!")
status_with_reaction_2 = chat_2.chat_element_by_text(text_status)
if status_with_reaction_2.emojis_below_message(own=False) != 0:
self.errors.append(
"Counter of reaction is not updated after removing on status of another user in profile!")
profile_1.just_fyi("Remove user from contacts and check there is no his status in timeline_1 anymore")
chat_2.remove_from_contacts.click()
chat_2.close_button.click()
chat_2.status_button.click()
if public_chat_2.chat_element_by_text(text_status).is_element_displayed(10):
self.errors.append("Statuses of removed user are still shown in profile")
self.errors.verify_no_errors()
@marks.testrail_id(700727)
@marks.medium
def test_gap_in_public_chat_and_no_gap_in_1_1_and_group_chats(self):

View File

@ -98,7 +98,7 @@ class BaseElement(object):
while not desired_element.is_element_present(1) and counter <= attempts:
try:
self.find_element().click()
desired_element.wait_for_element(5)
desired_element.is_element_present(5)
return self.navigate()
except (NoSuchElementException, TimeoutException):
counter += 1
@ -115,7 +115,7 @@ class BaseElement(object):
.until(expected_conditions.presence_of_element_located((self.by, self.locator)))
except TimeoutException:
raise TimeoutException(
"Device `%s`: `%s` by` %s`: `%s` is not found on the screen" % (
"Device `%s`: `%s` by` %s`: `%s` is not found on the screen after wait_for_element" % (
self.driver.number, self.name, self.by, self.locator)) from None
def wait_for_elements(self, seconds=10):
@ -124,7 +124,7 @@ class BaseElement(object):
.until(expected_conditions.presence_of_all_elements_located((self.by, self.locator)))
except TimeoutException:
raise TimeoutException(
"Device %s: %s by %s:`%s` is not found on the screen" % (
"Device %s: %s by %s:`%s` is not found on the screen after wait_for_elements" % (
self.driver.number, self.name, self.by, self.locator)) from None
def wait_for_visibility_of_element(self, seconds=10, ignored_exceptions=None):
@ -133,7 +133,7 @@ class BaseElement(object):
.until(expected_conditions.visibility_of_element_located((self.by, self.locator)))
except TimeoutException:
raise TimeoutException(
"Device %s: %s by %s:`%s` is not found on the screen" % (
"Device %s: %s by %s:`%s` is not found on the screen after wait_for_visibility_of_element" % (
self.driver.number, self.name, self.by, self.locator)) from None
def wait_for_invisibility_of_element(self, seconds=10):
@ -141,7 +141,7 @@ class BaseElement(object):
return WebDriverWait(self.driver, seconds) \
.until(expected_conditions.invisibility_of_element_located((self.by, self.locator)))
except TimeoutException:
raise TimeoutException("Device %s: %s by %s:* `%s` is still visible on the screen after %s seconds" % (
raise TimeoutException("Device %s: %s by %s: `%s` is still visible on the screen after %s seconds after wait_for_invisibility_of_element" % (
self.driver.number, self.name, self.by, self.locator, seconds)) from None
def wait_for_element_text(self, text, wait_time=30):

View File

@ -565,8 +565,7 @@ class BaseView(object):
def share_via_messenger(self):
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('Messages').wait_and_click(40)
self.element_by_text('New message').wait_and_click()
self.send_as_keyevent('+0100100101')
self.confirm()

View File

@ -3,7 +3,7 @@ import dateutil.parser
import time
import re
from selenium.common.exceptions import NoSuchElementException
from selenium.common.exceptions import NoSuchElementException, TimeoutException
from tests import emojis
from time import sleep
@ -156,11 +156,10 @@ class ChatElementByText(Text):
timestamp_element = Text(self.driver, xpath="//*[@content-desc='message-timestamp']")
try:
self.sent_status_checkmark.wait_for_element(30)
except NoSuchElementException:
return ''
self.sent_status_checkmark.click_until_presence_of_element(timestamp_element)
return timestamp_element.text
self.sent_status_checkmark.click_until_presence_of_element(timestamp_element)
return timestamp_element.text
except (NoSuchElementException, TimeoutException):
return None
@property
def member_photo(self):

View File

@ -275,7 +275,7 @@ class WalletView(BaseView):
self.manage_assets_button.click()
for asset in args:
self.element_by_text(asset).scroll_to_element()
self.element_by_text(asset).click()
self.element_by_text(asset).scroll_and_click()
self.cross_icon.click()
def scan_tokens(self, *args):