e2e: some fixes and moved old ui tests to a separate dir

This commit is contained in:
Yevheniia Berdnyk 2023-10-06 17:48:13 +03:00
parent b88dcf1072
commit 7c1850b901
No known key found for this signature in database
GPG Key ID: 0642C73C66214825
23 changed files with 1276 additions and 1253 deletions

View File

@ -131,7 +131,7 @@ class TestrailReport(BaseTestReport):
test_cases['pr']['activity_centre_other'] = 51005 test_cases['pr']['activity_centre_other'] = 51005
## Nightly e2e ## Nightly e2e
# test_cases['nightly']['medium'] = 736 # test_cases['nightly']['activity_center'] = 736
# test_cases['nightly']['chat'] = 50811 # test_cases['nightly']['chat'] = 50811
# test_cases['nightly']['browser'] = 50826 # test_cases['nightly']['browser'] = 50826
# test_cases['nightly']['profile'] = 50828 # test_cases['nightly']['profile'] = 50828

View File

@ -1,831 +1,15 @@
import random import random
import time
import emoji import emoji
import pytest import pytest
from _pytest.outcomes import Failed from _pytest.outcomes import Failed
from selenium.common.exceptions import TimeoutException, NoSuchElementException from selenium.common.exceptions import TimeoutException, NoSuchElementException
from tests import marks, common_password, run_in_parallel, transl from tests import marks, run_in_parallel, transl
from tests.base_test_case import MultipleSharedDeviceTestCase, create_shared_drivers from tests.base_test_case import MultipleSharedDeviceTestCase, create_shared_drivers
from tests.users import transaction_senders, basic_user, ens_user, ens_user_message_sender
from views.sign_in_view import SignInView from views.sign_in_view import SignInView
@pytest.mark.xdist_group(name="four_2")
@marks.critical
class TestCommandsMultipleDevicesMerged(MultipleSharedDeviceTestCase):
def prepare_devices(self):
self.drivers, self.loop = create_shared_drivers(2)
self.device_1, self.device_2 = SignInView(self.drivers[0]), SignInView(self.drivers[1])
self.sender = transaction_senders['ETH_STT_3']
self.home_1 = self.device_1.recover_access(passphrase=self.sender['passphrase'], enable_notifications=True)
self.home_2 = self.device_2.create_user()
for home in self.home_1, self.home_2:
profile = home.profile_button.click()
profile.profile_notifications_button.scroll_and_click()
profile.wallet_push_notifications.click()
self.recipient_public_key, self.recipient_username = self.home_2.get_public_key(
return_username=True)
self.wallet_1, self.wallet_2 = self.home_1.wallet_button.click(), self.home_2.wallet_button.click()
[wallet.home_button.click() for wallet in (self.wallet_1, self.wallet_2)]
self.chat_1 = self.home_1.add_contact(self.recipient_public_key)
self.chat_1.send_message("hello!")
self.account_name_1 = self.wallet_1.status_account_name
@marks.testrail_id(6253)
def test_1_1_chat_command_send_tx_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.send_keys(amount)
send_transaction.confirm()
send_transaction.sign_transaction_button.click()
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 = 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)
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(
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)
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()
send_bottom_sheet.sign_transaction()
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")
self.chat_1.wallet_button.click()
self.wallet_1.find_transaction_in_history(amount=amount)
[wallet.put_app_to_background() for wallet in (self.wallet_1, self.wallet_2)]
self.device_1.open_notification_bar()
self.network_api.wait_for_confirmation_of_transaction(self.sender['address'], amount)
pn = self.home_1.get_pn('You sent %s ETH' % amount)
if pn:
pn.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')
else:
self.home_1.click_system_back_button()
self.home_1.status_in_background_button.click_if_shown()
self.wallet_1.home_button.click(desired_view="chat")
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()
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 04.10.22, valid)
self.errors.verify_no_errors()
@marks.testrail_id(6265)
def test_1_1_chat_command_decline_eth_push_changing_state(self):
[home.driver.background_app(3) for home in (self.home_1, self.home_2)]
self.home_1.home_button.double_click()
self.home_1.get_chat(username=self.recipient_username).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.send_keys(amount)
send_transaction.confirm()
send_transaction.sign_transaction_button.click()
chat_1_sender_message = self.chat_1.get_outgoing_transaction()
self.home_1.click_system_home_button()
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()
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)]
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.send_keys(request_amount)
request_transaction.confirm()
request_transaction.request_transaction_button.click()
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
(chat_2_sender_message, chat_1_request_message)]
self.errors.verify_no_errors()
@marks.testrail_id(6263)
def test_1_1_chat_command_request_and_send_tx_stt_in_1_1_chat_offline(self):
[home.driver.background_app(2) for home in (self.home_1, self.home_2)]
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.double_click()
initial_amount_stt = self.wallet_1.get_asset_amount_by_name('STT')
app_package = self.home_1.driver.current_package
self.home_1.driver.terminate_app(app_package)
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.send_keys(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.driver.activate_app(app_package)
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()
@pytest.mark.xdist_group(name="one_2")
@marks.critical
class TestOneToOneChatMultipleSharedDevices(MultipleSharedDeviceTestCase):
def prepare_devices(self):
self.drivers, self.loop = create_shared_drivers(2)
self.device_1, self.device_2 = SignInView(self.drivers[0]), SignInView(self.drivers[1])
self.home_1 = self.device_1.create_user(enable_notifications=True)
self.home_2 = self.device_2.create_user(enable_notifications=True)
self.profile_1 = self.home_1.profile_button.click()
self.default_username_1 = self.profile_1.default_username_text.text
self.profile_1.home_button.click()
self.public_key_2, self.default_username_2 = self.home_2.get_public_key()
self.chat_1 = self.home_1.add_contact(self.public_key_2)
self.chat_1.send_message('hey')
self.home_2.home_button.double_click()
self.chat_2 = self.home_2.get_chat(self.default_username_1).click()
@marks.testrail_id(6316)
def test_1_1_chat_audio_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()
self.home_2.just_fyi("Sending audio message to device who is on background")
self.chat_1.record_audio_message(message_length_in_seconds=65)
if not self.chat_1.element_by_text("Maximum recording time reached").is_element_displayed():
self.drivers[0].fail("Exceeded 1 min limit of recording time.")
self.chat_1.ok_button.click()
if self.chat_1.audio_message_recorded_time.text != "0:59":
self.errors.append("Timer exceed 2 minutes")
self.chat_1.send_message_button.click()
self.device_2.open_notification_bar()
chat_2 = self.home_2.click_upon_push_notification_by_text("Audio")
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(5387)
# think about priority of this
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()
@pytest.mark.xdist_group(name="two_2")
@marks.critical
class TestContactBlockMigrateKeycardMultipleSharedDevices(MultipleSharedDeviceTestCase):
def prepare_devices(self):
self.drivers, self.loop = create_shared_drivers(2)
self.device_1, self.device_2 = SignInView(self.drivers[0]), SignInView(self.drivers[1])
self.sender = transaction_senders['ETH_2']
self.nick = "FFOO_brak!1234"
self.message = self.device_1.get_random_message()
self.pub_chat_name = self.device_1.get_random_chat_name()
self.home_1 = self.device_1.recover_access(self.sender['passphrase'], keycard=True)
self.home_2 = self.device_2.create_user()
self.profile_2 = self.home_2.profile_button.click()
self.profile_2.privacy_and_security_button.click()
self.profile_2.backup_recovery_phrase_button.click()
recovery_phrase = self.profile_2.backup_recovery_phrase()
self.recovery_phrase = ' '.join(recovery_phrase.values())
self.public_key_2, self.default_username_2 = self.home_2.get_public_key()
self.chat_1 = self.home_1.add_contact(self.public_key_2, add_in_contacts=False)
self.chat_1.chat_options.click()
self.chat_1.view_profile_button.click()
self.chat_1.set_nickname(self.nick)
[home.home_button.click() for home in [self.home_1, self.home_2]]
self.home_2.add_contact(self.sender['public_key'])
self.home_2.home_button.click()
[home.join_public_chat(self.pub_chat_name) for home in [self.home_1, self.home_2]]
self.chat_2 = self.home_2.get_chat_view()
self.chat_2.send_message(self.message)
[home.home_button.click() for home in [self.home_1, self.home_2]]
@marks.testrail_id(702186)
def test_keycard_command_send_tx_eth_1_1_chat(self):
self.home_2.get_chat(self.sender['username']).click()
self.chat_2.send_message("hey on kk!")
self.chat_2.home_button.click()
amount = self.chat_1.get_unique_amount()
account_name = self.chat_1.status_account_name
self.chat_1.just_fyi('Send %s ETH in 1-1 chat and check it for sender and receiver: Address requested' % amount)
self.home_1.get_chat(self.nick).click()
self.chat_1.send_message("hello again!")
self.chat_1.commands_button.click()
send_transaction = self.chat_1.send_command.click()
send_transaction.get_username_in_transaction_bottom_sheet_button(self.default_username_2).click()
if send_transaction.scan_qr_code_button.is_element_displayed():
self.chat_1.driver.fail('Recipient is editable in bottom sheet when send ETH from 1-1 chat')
send_transaction.amount_edit_box.send_keys(amount)
send_transaction.confirm()
send_transaction.sign_transaction_button.click()
sender_message = self.chat_1.get_outgoing_transaction()
if not sender_message.is_element_displayed():
self.chat_1.driver.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)
self.home_2.get_chat(self.sender['username']).click()
receiver_message = self.chat_2.get_incoming_transaction()
timestamp_sender = sender_message.timestamp_command_message.text
if not receiver_message.is_element_displayed(30):
self.chat_2.driver.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)
self.chat_1.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.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)
self.chat_1.just_fyi("Sign and send transaction and check that timestamp on message is updated")
time.sleep(20)
send_message = sender_message.sign_and_send.click()
send_message.next_button.click()
send_message.sign_transaction(keycard=True)
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")
wallet_1 = self.chat_1.wallet_button.click()
wallet_1.find_transaction_in_history(amount=amount)
self.home_2.put_app_to_background_and_back()
self.network_api.wait_for_confirmation_of_transaction(self.sender['address'], amount, confirmations=3)
wallet_1.home_button.click(desired_view='chat')
self.home_1.just_fyi("Check 'Confirmed' state for sender and receiver(use pull-to-refresh to update history)")
wallet_2 = self.chat_2.wallet_button.click()
wallet_2.find_transaction_in_history(amount=amount)
sender_message.transaction_status.wait_for_element_text(sender_message.confirmed, 120)
self.errors.verify_no_errors()
@marks.testrail_id(702175)
def test_contact_add_remove_mention_default_username_nickname_public_chat(self):
[home.home_button.double_click() for home in [self.home_1, self.home_2]]
self.chat_1.just_fyi('check that can mention user with 3-random name in public chat')
self.home_1.get_chat('#%s' % self.pub_chat_name).click()
self.chat_1.just_fyi('Set nickname for user without adding him to contacts, check it in public chat')
chat_element = self.chat_1.chat_element_by_text(self.message)
expected_username = '%s %s' % (self.nick, self.default_username_2)
if chat_element.username.text != expected_username:
self.errors.append('Username %s in public chat does not match expected %s' % (
chat_element.username.text, expected_username))
self.chat_1.just_fyi('Add user to contacts, mention it by nickname check contact list in Profile')
chat_element.member_photo.click()
self.chat_1.profile_add_to_contacts_button.click()
if not self.chat_1.remove_from_contacts.is_element_displayed():
self.errors.append("'Add to contacts' is not changed to 'Remove from contacts'")
self.chat_1.close_button.click()
self.chat_1.just_fyi('check that can mention user with nickname or default username in public chat')
self.chat_1.select_mention_from_suggestion_list(username_in_list=self.nick + ' ' + self.default_username_2,
typed_search_pattern=self.nick[0:2])
if self.chat_1.chat_message_input.text != '@' + self.default_username_2 + ' ':
self.errors.append('Username is not resolved in chat input after selecting it in mention '
'suggestions list by nickname!')
self.chat_1.chat_message_input.clear()
for pattern in (self.nick[0:2], self.default_username_2[0:4]):
self.chat_1.select_mention_from_suggestion_list(username_in_list=self.nick + ' ' + self.default_username_2,
typed_search_pattern=pattern)
if self.chat_1.chat_message_input.text != '@' + self.default_username_2 + ' ':
self.errors.append('Username is not resolved in chat input after selecting it in mention suggestions '
'list by default username!')
additional_text = 'and more'
self.chat_1.send_as_keyevent(additional_text)
self.chat_1.send_message_button.click()
if not self.chat_1.chat_element_by_text('%s %s' % (self.nick, additional_text)).is_element_displayed():
self.errors.append("Nickname is not resolved on send message")
self.chat_1.get_back_to_home_view()
self.chat_1.just_fyi('check contact list in Profile after setting nickname')
profile_1 = self.chat_1.profile_button.click()
userprofile = profile_1.open_contact_from_profile(self.nick)
if not userprofile.remove_from_contacts.is_element_displayed():
self.errors.append("'Add to contacts' is not changed to 'Remove from contacts' in profile contacts")
profile_1.close_button.click()
profile_1.home_button.double_click()
self.chat_1.just_fyi(
'Check that user is added to contacts below "Start new chat" and you redirected to 1-1 on tap')
self.home_1.plus_button.click()
self.home_1.start_new_chat_button.click()
if not self.home_1.element_by_text(self.nick).is_element_displayed():
self.home_1.driver.fail('List of contacts below "Start new chat" does not contain added user')
self.home_1.element_by_text(self.nick).click()
if not self.chat_1.chat_message_input.is_element_displayed():
self.chat_1.driver.fail('No redirect to 1-1 chat if tap on Contact below "Start new chat"')
for element in (self.chat_1.chat_message_input, self.chat_1.element_by_text(self.nick)):
if not element.is_element_displayed():
self.errors.append('Expected element is not found in 1-1 after adding user to contacts from profile')
if self.chat_1.add_to_contacts.is_element_displayed():
self.errors.append('"Add to contacts" button is shown in 1-1 after adding user to contacts from profile')
self.chat_1.just_fyi('Remove user from contacts')
self.chat_1.chat_options.click()
self.chat_1.view_profile_button.click()
self.chat_1.remove_from_contacts.click_until_absense_of_element(self.chat_1.remove_from_contacts)
if self.chat_1.profile_nickname.text != self.nick:
self.errors.append("Nickname is changed after removing user from contacts")
self.chat_1.just_fyi('Check that user is removed from contact list in profile')
self.chat_1.close_button.click()
if not self.chat_1.add_to_contacts.is_element_displayed():
self.errors.append('"Add to contacts" button is not shown in 1-1 after removing user from contacts')
self.chat_1.profile_button.double_click()
profile_1.contacts_button.click()
if profile_1.element_by_text(self.nick).is_element_displayed():
self.errors.append('Contact is shown in Profile after removing user from contacts')
self.errors.verify_no_errors()
@marks.testrail_id(702188)
@marks.xfail(
reason="flaky; issue when sometimes history is not fetched from offline for public chat, needs investigation")
def test_cellular_settings_on_off_public_chat_fetching_history(self):
[home.home_button.double_click() for home in [self.home_1, self.home_2]]
public_chat_name, public_chat_message = 'e2e-started-before', 'message to pub chat'
public_1 = self.home_1.join_public_chat(public_chat_name)
public_1.send_message(public_chat_message)
self.home_2.just_fyi('set mobile data to "OFF" and check that peer-to-peer connection is still working')
self.home_2.set_network_to_cellular_only()
self.home_2.mobile_connection_off_icon.wait_for_visibility_of_element(20)
for element in (self.home_2.continue_syncing_button, self.home_2.stop_syncing_button,
self.home_2.remember_my_choice_checkbox):
if not element.is_element_displayed(10):
self.drivers[0].fail(
'Element %s is not not shown in "Syncing mobile" bottom sheet' % element.locator)
self.home_2.stop_syncing_button.click()
if not self.home_2.mobile_connection_off_icon.is_element_displayed():
self.drivers[0].fail('No mobile connection OFF icon is shown')
self.home_2.mobile_connection_off_icon.click()
for element in self.home_2.connected_to_n_peers_text, self.home_2.waiting_for_wi_fi:
if not element.is_element_displayed():
self.errors.append("Element '%s' is not shown in Connection status bottom sheet" % element.locator)
self.home_2.click_system_back_button()
public_2 = self.home_2.join_public_chat(public_chat_name)
if public_2.chat_element_by_text(public_chat_message).is_element_displayed(30):
self.errors.append("Chat history was fetched with mobile data fetching off")
public_chat_new_message = 'new message'
public_1.send_message(public_chat_new_message)
if not public_2.chat_element_by_text(public_chat_new_message).is_element_displayed(30):
self.errors.append("Peer-to-peer connection is not working when mobile data fetching is off")
self.home_2.just_fyi('set mobile data to "ON"')
self.home_2.home_button.click()
self.home_2.mobile_connection_off_icon.click()
self.home_2.use_mobile_data_switch.wait_and_click(30)
if not self.home_2.connected_to_node_text.is_element_displayed(10):
self.errors.append("Not connected to history node after enabling fetching on mobile data")
self.home_2.click_system_back_button()
self.home_2.mobile_connection_on_icon.wait_for_visibility_of_element(10)
self.home_2.get_chat('#%s' % public_chat_name).click()
if not public_2.chat_element_by_text(public_chat_message).is_element_displayed(180):
self.errors.append("Chat history was not fetched with mobile data fetching ON")
self.home_2.just_fyi('check redirect to sync settings by tapping on "Sync" in connection status bottom sheet')
self.home_2.home_button.click()
self.home_2.mobile_connection_on_icon.click()
self.home_2.connection_settings_button.click()
if not self.home_2.element_by_translation_id("mobile-network-use-mobile").is_element_displayed():
self.errors.append(
"Was not redirected to sync settings after tapping on Settings in connection bottom sheet")
self.home_2.just_fyi("Check default preferences in Sync settings")
profile_1 = self.home_1.get_profile_view()
self.home_1.profile_button.double_click()
profile_1.sync_settings_button.click()
if not profile_1.element_by_translation_id("mobile-network-use-wifi").is_element_displayed():
self.errors.append("Mobile data is enabled by default")
profile_1.element_by_translation_id("mobile-network-use-wifi").click()
if profile_1.ask_me_when_on_mobile_network.text != "ON":
self.errors.append("'Ask me when on mobile network' is not enabled by default")
profile_1.just_fyi("Disable 'ask me when on mobile network' and check that it is not shown")
profile_1.ask_me_when_on_mobile_network.click()
profile_1.set_network_to_cellular_only()
if profile_1.element_by_translation_id("mobile-network-start-syncing").is_element_displayed(20):
self.errors.append("Popup is shown, but 'ask me when on mobile network' is disabled")
profile_1.just_fyi("Check 'Restore default' setting")
profile_1.element_by_text('Restore Defaults').click()
if profile_1.use_mobile_data.attribute_value("checked"):
self.errors.append("Mobile data is enabled by default")
if not profile_1.ask_me_when_on_mobile_network.attribute_value("checked"):
self.errors.append("'Ask me when on mobile network' is not enabled by default")
self.errors.verify_no_errors()
@marks.testrail_id(702177)
def test_restore_account_migrate_multiaccount_to_keycard_db_saved(self):
self.home_1.driver.quit()
self.home_2.profile_button.double_click()
self.profile_2.logout()
self.device_2.just_fyi("Checking migration to keycard: db saved (1-1 chat, nickname, messages)")
self.device_2.options_button.click()
self.device_2.manage_keys_and_storage_button.click()
self.device_2.move_keystore_file_option.click()
self.device_2.enter_seed_phrase_next_button.click()
self.device_2.seedphrase_input.send_keys(self.recovery_phrase)
self.device_2.choose_storage_button.click()
self.device_2.keycard_required_option.click()
self.device_2.confirm_button.click()
self.device_2.migration_password_input.send_keys(common_password)
self.device_2.confirm_button.click()
from views.keycard_view import KeycardView
keycard = KeycardView(self.device_2.driver)
keycard.begin_setup_button.click()
keycard.connect_card_button.wait_and_click()
keycard.enter_default_pin()
keycard.enter_default_pin()
if not self.device_2.element_by_translation_id("migration-successful").is_element_displayed(30):
self.driver.fail("No popup about successfull migration is shown!")
self.device_2.ok_button.click()
self.home_2.home_button.wait_for_element(30)
if not self.home_2.element_by_text_part(self.pub_chat_name).is_element_displayed():
self.errors.append("Public chat was removed from home after migration to kk")
self.home_2.get_chat(self.sender['username']).click()
if self.chat_2.add_to_contacts.is_element_displayed():
self.errors.append("User was removed from contacts after migration to kk")
self.errors.verify_no_errors()
@pytest.mark.xdist_group(name="three_2")
@marks.critical
class TestEnsStickersMultipleDevicesMerged(MultipleSharedDeviceTestCase):
def prepare_devices(self):
self.drivers, self.loop = create_shared_drivers(2)
self.device_1, self.device_2 = SignInView(self.drivers[0]), SignInView(self.drivers[1])
self.sender, self.reciever = transaction_senders['ETH_3'], ens_user
self.home_1 = self.device_1.recover_access(passphrase=self.sender['passphrase'])
self.home_2 = self.device_2.recover_access(ens_user['passphrase'], enable_notifications=True)
self.ens = '@%s' % self.reciever['ens']
self.pub_chat_name = self.home_1.get_random_chat_name()
self.chat_1 = self.home_1.join_public_chat(self.pub_chat_name)
self.chat_2 = self.home_2.join_public_chat(self.pub_chat_name)
[home.home_button.double_click() for home in (self.home_1, self.home_2)]
self.profile_2 = self.home_2.profile_button.click()
self.profile_2.connect_existing_ens(self.reciever['ens'])
self.home_1.add_contact(self.reciever['ens'])
self.home_2.home_button.click()
self.home_2.add_contact(self.sender['public_key'])
# To avoid activity centre for restored users
[chat.send_message("hey!") for chat in (self.chat_1, self.chat_2)]
self.home_1.just_fyi("Close the ENS banner")
[home.home_button.double_click() for home in (self.home_1, self.home_2)]
[home.ens_banner_close_button.click_if_shown() for home in (self.home_1, self.home_2)]
@marks.testrail_id(702152)
def test_ens_purchased_in_profile(self):
self.home_2.profile_button.double_click()
ens_name_after_adding = self.profile_2.default_username_text.text
if ens_name_after_adding != '@%s' % ens_user['ens']:
self.errors.append('ENS name is not shown as default in user profile after adding, "%s" instead' %
ens_name_after_adding)
self.home_2.just_fyi('check ENS name wallet address and public key')
self.home_2.element_by_text(self.reciever['ens']).click()
self.home_2.element_by_text(self.reciever['ens']).click()
for text in (self.reciever['address'].lower(), self.reciever['public_key']):
if not self.home_2.element_by_text_part(text).is_element_displayed(40):
self.errors.append('%s text is not shown' % text)
self.home_2.profile_button.double_click()
self.home_2.just_fyi('check ENS name is shown on share my profile window')
self.profile_2.share_my_profile_button.click()
if self.profile_2.ens_name_in_share_chat_key_text.text != '%s' % ens_user['ens']:
self.errors.append('No ENS name is shown on tapping on share icon in Profile')
self.profile_2.close_share_popup()
self.errors.verify_no_errors()
@marks.testrail_id(702153)
def test_ens_command_send_tx_eth_1_1_chat(self):
[home.home_button.double_click() for home in (self.home_1, self.home_2)]
wallet_1 = self.home_1.wallet_button.click()
wallet_1.wait_balance_is_changed()
wallet_1.home_button.click()
self.home_1.get_chat(self.ens).click()
self.chat_1.commands_button.click()
amount = self.chat_1.get_unique_amount()
self.chat_1.just_fyi("Check sending assets to ENS name from sender side")
send_message = self.chat_1.send_command.click()
send_message.amount_edit_box.send_keys(amount)
send_message.confirm()
send_message.next_button.click()
from views.send_transaction_view import SendTransactionView
send_transaction = SendTransactionView(self.drivers[0])
send_transaction.ok_got_it_button.click()
send_transaction.sign_transaction()
chat_1_sender_message = self.chat_1.get_outgoing_transaction(transaction_value=amount)
self.home_2.put_app_to_background_and_back()
self.network_api.wait_for_confirmation_of_transaction(self.sender['address'], amount, confirmations=3)
chat_1_sender_message.transaction_status.wait_for_element_text(chat_1_sender_message.confirmed)
self.chat_2.just_fyi("Check that message is fetched for receiver")
self.home_2.get_chat(self.sender['username']).click()
chat_2_reciever_message = self.chat_2.get_incoming_transaction(transaction_value=amount)
chat_2_reciever_message.transaction_status.wait_for_element_text(chat_2_reciever_message.confirmed,
wait_time=60)
@marks.testrail_id(702155)
def test_ens_mention_nickname_1_1_chat(self):
[home.home_button.double_click() for home in (self.home_1, self.home_2)]
self.home_1.just_fyi('Mention user by ENS in 1-1 chat')
message, message_ens_owner = '%s hey!' % self.ens, '%s hey!' % self.reciever['ens']
self.home_1.get_chat(self.ens).click()
self.chat_1.send_message(message)
self.home_1.just_fyi('Set nickname and mention user by nickname in 1-1 chat')
russian_nickname = 'МОЙ дорогой ДРУх'
self.chat_1.chat_options.click()
self.chat_1.view_profile_button.click()
self.chat_1.set_nickname(russian_nickname)
self.chat_1.select_mention_from_suggestion_list(russian_nickname + ' ' + self.ens)
self.chat_1.just_fyi('Check that nickname is shown in preview for 1-1 chat')
updated_message = '%s hey!' % russian_nickname
self.chat_1.home_button.double_click()
if not self.chat_1.element_by_text(updated_message).is_element_displayed():
self.errors.append('"%s" is not show in chat preview on home screen!' % message)
self.home_1.get_chat(russian_nickname).click()
self.chat_1.just_fyi('Check redirect to user profile on mention by nickname tap')
self.chat_1.chat_element_by_text(updated_message).click()
if not self.chat_1.profile_block_contact_button.is_element_displayed():
self.errors.append(
'No redirect to user profile after tapping on message with mention (nickname) in 1-1 chat')
else:
self.chat_1.profile_send_message_button.click()
self.chat_2.just_fyi("Check message with mention for ENS owner")
self.home_2.get_chat(self.sender['username']).click()
if not self.chat_2.chat_element_by_text(message_ens_owner).is_element_displayed():
self.errors.append('Expected %s message is not shown for ENS owner' % message_ens_owner)
self.chat_1.just_fyi('Check if after deleting nickname ENS is shown again')
self.chat_1.chat_options.click()
self.chat_1.view_profile_button.click()
self.chat_1.profile_nickname_button.click()
self.chat_1.nickname_input_field.clear()
self.chat_1.element_by_text('Done').click()
self.chat_1.close_button.click()
if self.chat_1.user_name_text.text != self.ens:
self.errors.append("Username '%s' is not updated to ENS '%s' after deleting nickname" %
(self.chat_1.user_name_text.text, self.ens))
self.errors.verify_no_errors()
@marks.testrail_id(702156)
def test_ens_mention_push_highlighted_public_chat(self):
[home.home_button.double_click() for home in (self.home_1, self.home_2)]
self.home_2.get_chat('#%s' % self.pub_chat_name).click()
text = "From ENS name user!"
self.chat_2.send_message(text)
self.chat_2.home_button.click()
self.home_2.put_app_to_background()
self.home_2.open_notification_bar()
self.home_1.just_fyi('check that can mention user with ENS name')
self.home_1.get_chat('#%s' % self.pub_chat_name).click()
self.chat_1.wait_ens_name_resolved_in_chat(message=text, username_value='@%s' % self.reciever['ens'])
self.chat_1.select_mention_from_suggestion_list(self.reciever['ens'])
if self.chat_1.chat_message_input.text != self.ens + ' ':
self.errors.append(
'ENS username is not resolved in chat input after selecting it in mention suggestions list!')
self.chat_1.send_message_button.click()
self.home_2.just_fyi(
'check that PN is received and after tap you are redirected to chat, mention is highligted')
pn = self.home_2.get_pn(self.reciever['username'])
if pn:
pn.click()
else:
self.errors.append('No PN on mention in public chat! ')
self.home_2.click_system_back_button(2)
if self.home_2.element_starts_with_text(self.reciever['ens']).is_element_differs_from_template('ment_new_1.png',
2):
self.errors.append('Mention is not highlighted!')
self.errors.verify_no_errors()
@marks.testrail_id(702157)
def test_sticker_1_1_public_chat_mainnet(self):
self.home_2.status_in_background_button.click_if_shown()
[home.home_button.double_click() for home in (self.home_1, self.home_2)]
profile_2 = self.home_2.profile_button.click()
profile_2.switch_network()
self.home_2.just_fyi('Check that can use purchased stickerpack on Mainnet')
self.home_2.get_chat('#%s' % self.pub_chat_name).click()
self.chat_2.install_sticker_pack_by_name('Tozemoon')
self.chat_2.sticker_icon.click()
if not self.chat_2.chat_item.is_element_displayed():
self.errors.append('Cannot use purchased stickers')
self.home_2.profile_button.click()
profile_2.switch_network('Goerli with upstream RPC')
self.home_1.just_fyi('Install free sticker pack and use it in 1-1 chat on Goerli')
self.home_1.get_chat(self.ens).click()
self.chat_1.chat_message_input.clear()
self.chat_1.install_sticker_pack_by_name()
self.chat_1.sticker_icon.click()
if not self.chat_1.sticker_message.is_element_displayed():
self.errors.append('Sticker was not sent')
self.chat_1.swipe_right()
if not self.chat_1.sticker_icon.is_element_displayed():
self.errors.append('Sticker is not shown in recently used list')
self.chat_1.get_back_to_home_view()
self.home_1.just_fyi('Send stickers in public chat from Recent')
self.home_1.join_public_chat(self.home_1.get_random_chat_name())
self.chat_1.show_stickers_button.click()
self.chat_1.sticker_icon.click()
if not self.chat_1.chat_item.is_element_displayed():
self.errors.append('Sticker was not sent from Recent')
# self.home_2.just_fyi('Check that can install stickers by tapping on sticker message')
# TODO: disabled because of #13683 (rechecked 04.10.22, valid)
self.home_2.home_button.double_click()
self.home_2.get_chat(self.sender['username']).click()
# self.chat_2.chat_item.click()
# self.chat_2.element_by_text_part('Free').wait_and_click(40)
# if self.chat_2.element_by_text_part('Free').is_element_displayed():
# self.errors.append('Stickerpack was not installed')
self.chat_2.just_fyi('Check that can navigate to another user profile via long tap on sticker message')
# self.chat_2.close_sticker_view_icon.click()
self.chat_2.chat_item.long_press_element()
self.chat_2.element_by_text('View Details').click()
self.chat_2.profile_send_message_button.wait_and_click()
self.errors.verify_no_errors()
@marks.testrail_id(702158)
def test_start_new_chat_public_key_validation(self):
[home.get_back_to_home_view() for home in (self.home_1, self.home_2)]
self.home_2.driver.quit()
public_key = basic_user['public_key']
self.home_1.plus_button.click()
chat = self.home_1.start_new_chat_button.click()
self.home_1.just_fyi("Validation: invalid public key and invalid ENS")
for invalid_chat_key in (basic_user['public_key'][:-1], ens_user_message_sender['ens'][:-2]):
chat.public_key_edit_box.clear()
chat.public_key_edit_box.send_keys(invalid_chat_key)
chat.confirm()
if not self.home_1.element_by_translation_id("profile-not-found").is_element_displayed():
self.errors.append('Error is not shown for invalid public key')
self.home_1.just_fyi("Check that valid ENS is resolved")
chat.public_key_edit_box.clear()
chat.public_key_edit_box.send_keys(ens_user_message_sender['ens'])
resolved_ens = '%s.stateofus.eth' % ens_user_message_sender['ens']
if not chat.element_by_text(resolved_ens).is_element_displayed(10):
self.errors.append('ENS name is not resolved after pasting chat key')
self.home_1.close_button.click()
self.home_1.just_fyi("Check that can paste public key from keyboard and start chat")
self.home_1.get_chat('#%s' % self.pub_chat_name).click()
chat.send_message(public_key)
chat.copy_message_text(public_key)
chat.back_button.click()
self.home_1.plus_button.click()
self.home_1.start_new_chat_button.click()
chat.public_key_edit_box.paste_text_from_clipboard()
if chat.public_key_edit_box.text != public_key:
self.errors.append('Public key is not pasted from clipboard')
if not chat.element_by_text(basic_user['username']).is_element_displayed():
self.errors.append('3 random-name is not resolved after pasting chat key')
self.home_1.just_fyi('My_profile button at Start new chat view opens own QR code with public key pop-up')
self.home_1.my_profile_on_start_new_chat_button.click()
account = self.home_1.get_profile_view()
if not (account.public_key_text.is_element_displayed() and account.share_button.is_element_displayed()
and account.qr_code_image.is_element_displayed()):
self.errors.append('No self profile pop-up data displayed after My_profile button tap')
self.errors.verify_no_errors()
@pytest.mark.xdist_group(name="new_one_2") @pytest.mark.xdist_group(name="new_one_2")
@marks.new_ui_critical @marks.new_ui_critical
class TestOneToOneChatMultipleSharedDevicesNewUi(MultipleSharedDeviceTestCase): class TestOneToOneChatMultipleSharedDevicesNewUi(MultipleSharedDeviceTestCase):

View File

@ -10,140 +10,6 @@ from views.chat_view import ChatView
from views.sign_in_view import SignInView from views.sign_in_view import SignInView
@pytest.mark.xdist_group(name="one_3")
@marks.critical
class TestGroupChatMultipleDeviceMerged(MultipleSharedDeviceTestCase):
def prepare_devices(self):
self.drivers, self.loop = create_shared_drivers(3)
self.message_before_adding = 'message before adding new user'
self.message_to_admin = 'Hey, admin!'
self.homes, self.public_keys, self.usernames, self.chats = {}, {}, {}, {}
for key in self.drivers:
sign_in = SignInView(self.drivers[key])
self.homes[key] = sign_in.create_user(enable_notifications=True)
SignInView(self.drivers[2]).put_app_to_background_and_back()
self.public_keys[key], self.usernames[key] = sign_in.get_public_key(True)
sign_in.home_button.click()
SignInView(self.drivers[0]).put_app_to_background_and_back()
self.chat_name = self.homes[0].get_random_chat_name()
self.homes[0].just_fyi('Admin adds future members to contacts')
for i in range(1, 3):
self.homes[0].add_contact(self.public_keys[i])
self.homes[0].home_button.double_click()
self.homes[0].just_fyi('Members add admin to contacts to see PNs and put app in background')
for i in range(1, 3):
self.homes[i].handle_contact_request(self.usernames[0])
self.homes[i].home_button.double_click()
self.homes[0].just_fyi('Admin creates group chat')
self.chats[0] = self.homes[0].create_group_chat([self.usernames[1]], self.chat_name)
for i in range(1, 3):
self.chats[i] = ChatView(self.drivers[i])
self.chats[0].send_message(self.message_before_adding)
@marks.testrail_id(3994)
def test_group_chat_push_system_messages_when_invited(self):
self.homes[1].just_fyi("Check system messages in PNs")
self.homes[2].put_app_to_background_and_back()
self.homes[1].put_app_to_background()
self.homes[1].open_notification_bar()
pns = [self.chats[0].pn_invited_to_group_chat(self.usernames[0], self.chat_name),
self.chats[0].pn_wants_you_to_join_to_group_chat(self.usernames[0], self.chat_name)]
for pn in pns:
if not self.homes[1].get_pn(pn):
self.errors.append('%s is not shown after invite to group chat' % pn)
if self.homes[1].get_pn(pns[0]):
group_invite_pn = self.homes[1].get_pn(pns[0])
group_invite_pn.click()
else:
self.homes[1].click_system_back_button(2)
self.homes[1].get_chat(self.chat_name).click()
self.homes[1].just_fyi("Check system messages in group chat for admin and member")
create_system_message = self.chats[0].create_system_message(self.usernames[0], self.chat_name)
has_added_system_message = self.chats[0].has_added_system_message(self.usernames[0], self.usernames[1])
create_for_admin_system_message = 'You created the group %s' % self.chat_name
joined_message = "You've joined %s from invitation by %s" % (self.chat_name, self.usernames[0])
for message in [create_for_admin_system_message, create_system_message, has_added_system_message]:
if not self.chats[0].element_by_text(message).is_element_displayed():
self.errors.append('%s system message is not shown' % message)
for message in [joined_message, create_system_message, has_added_system_message]:
if not self.chats[1].element_by_text(message).is_element_displayed():
self.errors.append('%s system message is not shown' % message)
self.errors.verify_no_errors()
@marks.testrail_id(700732)
def test_group_chat_add_new_member(self):
[self.homes[i].home_button.double_click() for i in range(3)]
self.homes[0].get_chat(self.chat_name).click()
self.chats[0].add_members_to_group_chat([self.usernames[2]])
self.chats[2].just_fyi("Check there will be PN and no unread in AC for a new member")
if self.homes[2].notifications_unread_badge.is_element_displayed(60):
self.drivers[2].fail("Group chat appeared in AC!")
self.homes[2].open_notification_bar()
if not self.homes[2].element_by_text_part(self.usernames[0]).is_element_displayed():
self.errors.append("PN about group chat invite is not shown when invited by mutual contact")
self.homes[2].click_system_back_button()
self.homes[2].just_fyi("Check new group appeared in chat list for a new member")
if not self.homes[2].get_chat(self.chat_name).is_element_displayed(60):
self.drivers[2].fail("New group chat hasn't appeared in chat list")
self.homes[2].get_chat(self.chat_name).click()
for message in (self.message_to_admin, self.message_before_adding):
if self.chats[2].chat_element_by_text(message).is_element_displayed():
self.errors.append('%s is shown for new user' % message)
self.errors.verify_no_errors()
@marks.testrail_id(5756)
def test_group_chat_highligted(self):
chat_name = 'for_invited'
[self.homes[i].home_button.double_click() for i in range(3)]
self.homes[0].create_group_chat([self.usernames[1]], chat_name)
self.homes[1].just_fyi("Check that new group chat from contact is highlited")
chat_2_element = self.homes[1].get_chat(chat_name)
if chat_2_element.no_message_preview.is_element_differs_from_template('highligted_preview_group.png', 0):
self.errors.append("Preview message is not hightligted or text is not shown! ")
chat_2 = self.homes[1].get_chat(chat_name).click()
chat_2.home_button.click()
if not chat_2_element.no_message_preview.is_element_differs_from_template('highligted_preview_group.png', 0):
self.errors.append("Preview message is still hightligted after opening! ")
@marks.testrail_id(3997)
def test_group_chat_leave_relogin(self):
left_system_message = self.chats[1].leave_system_message(self.usernames[0])
self.drivers[2].quit()
[self.homes[i].home_button.double_click() for i in range(2)]
self.homes[0].home_button.double_click()
self.homes[1].get_chat(self.chat_name).click()
self.homes[0].just_fyi("Admin deleted chat via long press")
self.homes[0].leave_chat_long_press(self.chat_name)
self.homes[1].just_fyi('Check that leave system message is presented after user left the group chat')
if not self.chats[1].chat_element_by_text(left_system_message).is_element_displayed():
self.errors.append('System message when user leaves the chat is not shown')
self.homes[0].just_fyi("Member sends some message, admin relogins and check chat does not reappear")
self.chats[1].send_message(self.message_to_admin)
self.homes[0].relogin()
if self.homes[0].get_chat_from_home_view(self.chat_name).is_element_displayed():
self.drivers[0].fail('Deleted %s is present after relaunch app' % self.chat_name)
@pytest.mark.xdist_group(name="new_one_3") @pytest.mark.xdist_group(name="new_one_3")
@marks.new_ui_critical @marks.new_ui_critical
class TestGroupChatMultipleDeviceMergedNewUI(MultipleSharedDeviceTestCase): class TestGroupChatMultipleDeviceMergedNewUI(MultipleSharedDeviceTestCase):

View File

@ -1,306 +1,18 @@
import datetime import datetime
import random import random
from datetime import timedelta
import emoji import emoji
import pytest import pytest
from _pytest.outcomes import Failed from _pytest.outcomes import Failed
from dateutil import parser
from selenium.common.exceptions import NoSuchElementException, TimeoutException from selenium.common.exceptions import NoSuchElementException, TimeoutException
from tests import marks, test_dapp_name, test_dapp_url, run_in_parallel, pytest_config_global, transl from tests import marks, run_in_parallel, pytest_config_global, transl
from tests.base_test_case import create_shared_drivers, MultipleSharedDeviceTestCase from tests.base_test_case import create_shared_drivers, MultipleSharedDeviceTestCase
from views.chat_view import CommunityView from views.chat_view import CommunityView
from views.dbs.waku_backup import user as waku_user from views.dbs.waku_backup import user as waku_user
from views.sign_in_view import SignInView from views.sign_in_view import SignInView
@pytest.mark.xdist_group(name="three_1")
@marks.critical
class TestPublicChatBrowserOneDeviceMerged(MultipleSharedDeviceTestCase):
def prepare_devices(self):
self.drivers, self.loop = create_shared_drivers(1)
self.sign_in = SignInView(self.drivers[0])
self.home = self.sign_in.create_user()
self.public_chat_name = self.home.get_random_chat_name()
self.chat = self.home.join_public_chat(self.public_chat_name)
@marks.testrail_id(5675)
def test_public_chat_fetch_more_history(self):
self.home.just_fyi("Check that can fetch previous history for several days")
device_time = parser.parse(self.drivers[0].device_time)
yesterday = (device_time - timedelta(days=1)).strftime("%b %-d, %Y")
before_yesterday = (device_time - timedelta(days=2)).strftime("%b %-d, %Y")
quiet_time_yesterday, quiet_time_before_yesterday = '24 hours', '2 days'
fetch_more = self.home.get_translation_by_key("load-more-messages")
for message in (yesterday, quiet_time_yesterday):
if not self.chat.element_by_text_part(message).is_element_displayed(120):
self.drivers[0].fail('"%s" is not shown' % message)
self.chat.element_by_text_part(fetch_more).wait_and_click(120)
self.chat.element_by_text_part(fetch_more).wait_for_visibility_of_element(180)
for message in (before_yesterday, quiet_time_before_yesterday):
if not self.chat.element_by_text_part(message).is_element_displayed():
self.drivers[0].fail('"%s" is not shown' % message)
self.home.just_fyi("Check that can fetch previous history for month")
times = {
"three-days": '5 days',
"one-week": '12 days',
"one-month": ['43 days', '42 days', '41 days', '40 days'],
}
profile = self.home.profile_button.click()
profile.sync_settings_button.click()
profile.sync_history_for_button.click()
for period in times:
profile.just_fyi("Checking %s period" % period)
profile.element_by_translation_id(period).click()
profile.home_button.click(desired_view='chat')
self.chat.element_by_text_part(fetch_more).wait_and_click(120)
if period != "one-month":
if not profile.element_by_text_part(times[period]).is_element_displayed(30):
self.errors.append("'Quiet here for %s' is not shown after fetching more history" % times[period])
else:
variants = times[period]
self.chat.element_by_text_part(fetch_more).wait_for_invisibility_of_element(120)
res = any(profile.element_by_text_part(variant).is_element_displayed(30) for variant in variants)
if not res:
self.errors.append("History is not fetched for one month!")
self.home.profile_button.click(desired_element_text=profile.get_translation_by_key("default-sync-period"))
self.errors.verify_no_errors()
@marks.testrail_id(5396)
def test_public_chat_navigate_to_chat_when_relaunch(self):
text_message = 'some_text'
self.home.home_button.double_click()
self.home.get_chat('#%s' % self.public_chat_name).click()
self.chat.send_message(text_message)
self.chat.reopen_app()
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 04.10.22, 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'
self.home.home_button.double_click()
self.home.get_chat('#%s' % self.public_chat_name).click()
self.home.just_fyi("Check that will be redirected to chat view on tap on tag message")
self.chat.send_message(tag_message)
self.chat.element_starts_with_text(tag_message).click()
self.chat.element_by_text_part(self.public_chat_name).wait_for_invisibility_of_element()
if not self.chat.user_name_text.text == tag_message:
self.errors.append('Could not redirect a user to a public chat tapping the tag message.')
self.home.just_fyi("Check that chat is added to home view")
self.chat.home_button.double_click()
if not self.home.element_by_text(tag_message).is_element_displayed():
self.errors.append('Could not find the public chat in user chat list.')
self.errors.verify_no_errors()
@marks.testrail_id(700739)
def test_public_chat_open_using_deep_link(self):
self.drivers[0].terminate_app(self.drivers[0].current_package)
chat_name = self.home.get_random_chat_name()
deep_link = 'status-im://%s' % chat_name
self.sign_in.open_weblink_and_login(deep_link)
try:
assert self.chat.user_name_text.text == '#' + chat_name
except (AssertionError, NoSuchElementException):
self.drivers[0].fail("Public chat '%s' is not opened" % chat_name)
@marks.testrail_id(702072)
def test_browser_blocked_url(self):
dapp = self.home.dapp_tab_button.click()
for url in ('metamask.site', 'cryptokitties.domainname'):
dapp.just_fyi('Checking blocked website %s' % url)
dapp_detail = dapp.open_url(url)
dapp_detail.element_by_translation_id('browsing-site-blocked-title')
if dapp_detail.browser_refresh_page_button.is_element_displayed():
self.errors.append("Refresh button is present in blocked site")
dapp_detail.go_back_button.click()
dapp_detail.open_tabs_button.click()
dapp.element_by_text_part(url[:8]).click()
dapp_detail.continue_anyway_button.click()
if dapp_detail.element_by_text('This site is blocked').is_element_displayed():
self.errors.append("Failed to open Dapp after 'Continue anyway' tapped for %s" % url)
dapp_detail.open_tabs_button.click()
dapp_detail.empty_tab_button.click()
self.errors.verify_no_errors()
@marks.testrail_id(702073)
def test_browser_connection_is_secure_not_secure_warning(self):
dapp = self.home.dapp_tab_button.click()
web_page = dapp.open_url('http://www.dvwa.co.uk')
web_page.url_edit_box_lock_icon.click_until_presence_of_element(
web_page.element_by_translation_id("browser-not-secure"))
web_page.open_tabs_button.click()
web_page.empty_tab_button.click()
dapp.just_fyi('Checking connection is secure for Airswap')
web_page = dapp.open_url('https://instant.airswap.io')
web_page.wait_for_d_aap_to_load()
web_page.url_edit_box_lock_icon.click_until_presence_of_element(
web_page.element_by_translation_id("browser-secure"))
web_page.open_tabs_button.click()
web_page.empty_tab_button.click()
@marks.testrail_id(702074)
def test_browser_invalid_url(self):
dapp = self.home.dapp_tab_button.click()
browsing_view = dapp.open_url('invalid.takoe')
browsing_view.element_by_translation_id("web-view-error").wait_for_element(20)
@marks.testrail_id(702075)
def test_browser_offline(self):
dapp = self.home.dapp_tab_button.click()
self.home.toggle_airplane_mode()
browsing_view = dapp.open_url('status.im')
offline_texts = ['Unable to load page', 'ERR_INTERNET_DISCONNECTED']
for text in offline_texts:
browsing_view.element_by_text_part(text).wait_for_element(15)
self.home.toggle_airplane_mode()
browsing_view.browser_refresh_page_button.click_until_presence_of_element(
browsing_view.element_by_text_part('An Open Source Community'))
@marks.testrail_id(702076)
def test_browser_delete_close_tabs(self):
dapp = self.home.dapp_tab_button.click()
urls = {
'google.com': 'Google',
'status.im': 'Status - Private',
'bbc.com': 'bbc.com'
}
for url in urls:
web_page = dapp.open_url(url)
web_page.open_tabs_button.click()
web_page.empty_tab_button.click()
self.home.just_fyi('Delete one tab')
web_page.remove_tab(name=urls['bbc.com'])
web_page.open_tabs_button.wait_for_invisibility_of_element()
web_page.element_by_text_part(urls['bbc.com']).wait_for_invisibility_of_element()
self.home.just_fyi('Close all tabs via "Close all", relogin and check that it is not reappearing')
web_page.close_all_button.click()
self.home.reopen_app()
web_page.dapp_tab_button.click()
web_page.open_tabs_button.click()
if web_page.element_by_text_part(urls['status.im']).is_element_displayed():
self.errors.append('Tabs are not closed or reappeared after re-login!')
self.errors.verify_no_errors()
@marks.testrail_id(702077)
def test_browser_bookmarks_create_edit_remove(self):
dapp = self.home.dapp_tab_button.click()
self.home.just_fyi('Add some url to bookmarks with default name')
web_page = dapp.open_url('status.im')
default_bookmark_name = web_page.add_to_bookmarks()
web_page.browser_previous_page_button.click()
if not web_page.element_by_text(default_bookmark_name).is_element_displayed():
self.errors.append("Bookmark with default name is not added!")
self.home.just_fyi('Add some url to bookmarks with custom name')
custom_name = 'Custom BBC'
dapp.open_url('bbc.com')
web_page.add_to_bookmarks(custom_name)
web_page.open_tabs_button.click()
web_page.empty_tab_button.click()
if not web_page.element_by_text(custom_name).is_element_displayed():
self.driver.fail("Bookmark with custom name is not added!")
self.home.just_fyi('Checking "Open in new tab"')
dapp.browser_entry_long_press(custom_name)
dapp.open_in_new_tab_button.click()
web_page.options_button.click()
if not web_page.element_by_translation_id('remove-favourite').is_element_displayed():
self.errors.append("Remove favourite is not shown on added bookmark!")
dapp.click_system_back_button()
self.home.just_fyi('Check deleting bookmark')
web_page.open_tabs_button.click()
web_page.empty_tab_button.click()
dapp.browser_entry_long_press(custom_name)
dapp.delete_bookmark_button.click()
if web_page.element_by_text(custom_name).is_element_displayed():
self.errors.append("Bookmark with custom name is not deleted!")
self.home.just_fyi('Check "Edit bookmark" and "Open in new tab"')
edited_name = 'My Fav Status'
dapp.browser_entry_long_press(default_bookmark_name)
dapp.edit_bookmark_button.click()
web_page.edit_bookmark_name(edited_name)
if not web_page.element_by_text(edited_name).is_element_displayed():
self.driver.fail("Edited bookmark name is not shown!")
self.errors.verify_no_errors()
@marks.testrail_id(702078)
def test_browser_web3_permissions_testdapp(self):
self.home.home_button.double_click()
self.home.just_fyi('open Status Test Dapp, allow all and check permissions in Profile')
web_view = self.home.open_status_test_dapp()
dapp = self.home.dapp_tab_button.click()
profile = self.home.profile_button.click()
profile.privacy_and_security_button.click()
profile.dapp_permissions_button.click()
profile.element_by_text(test_dapp_name).click()
if not profile.element_by_text(self.home.status_account_name).is_element_displayed():
self.errors.append('Wallet permission was not granted')
if not profile.element_by_translation_id("chat-key").is_element_displayed():
self.errors.append('Contact code permission was not granted')
profile.just_fyi('revoke access and check that they are asked second time')
profile.revoke_access_button.click()
profile.get_back_to_home_view()
profile.dapp_tab_button.click()
web_view.open_tabs_button.click()
web_view.empty_tab_button.click()
dapp.open_url(test_dapp_url)
if not dapp.element_by_text_part(self.home.status_account_name).is_element_displayed():
self.errors.append('Wallet permission is not asked')
if dapp.allow_button.is_element_displayed():
dapp.allow_button.click(times_to_click=1)
if not dapp.element_by_translation_id("your-contact-code").is_element_displayed():
self.errors.append('Profile permission is not asked')
self.errors.verify_no_errors()
@pytest.mark.xdist_group(name="new_one_1") @pytest.mark.xdist_group(name="new_one_1")
@marks.new_ui_critical @marks.new_ui_critical
class TestCommunityOneDeviceMerged(MultipleSharedDeviceTestCase): class TestCommunityOneDeviceMerged(MultipleSharedDeviceTestCase):
@ -321,8 +33,6 @@ class TestCommunityOneDeviceMerged(MultipleSharedDeviceTestCase):
self.channel = self.community_view.get_channel(self.channel_name).click() self.channel = self.community_view.get_channel(self.channel_name).click()
@marks.testrail_id(703503) @marks.testrail_id(703503)
@marks.xfail(
reason="Request to Join Community button color issue:17295")
def test_community_discovery(self): def test_community_discovery(self):
self.home.navigate_back_to_home_view() self.home.navigate_back_to_home_view()
self.home.communities_tab.click() self.home.communities_tab.click()
@ -330,8 +40,7 @@ class TestCommunityOneDeviceMerged(MultipleSharedDeviceTestCase):
self.home.community_card_item.wait_for_visibility_of_element(30) self.home.community_card_item.wait_for_visibility_of_element(30)
if len(self.home.community_card_item.find_elements()) > 1: if len(self.home.community_card_item.find_elements()) > 1:
contributors_test_community_attributes = "Contributors' test community", 'test anything here', \ contributors_test_community_attributes = "Test Community", 'Open for anyone', 'Web3', 'Software dev'
'Web3', 'Software dev'
for text in contributors_test_community_attributes: for text in contributors_test_community_attributes:
if not self.home.element_by_text(text).is_element_displayed(10): if not self.home.element_by_text(text).is_element_displayed(10):
self.errors.append("'%s' text is not in Discovery!" % text) self.errors.append("'%s' text is not in Discovery!" % text)
@ -1056,9 +765,10 @@ class TestCommunityMultipleDeviceMergedTwo(MultipleSharedDeviceTestCase):
self.username_1, self.username_2 = "user_1", "user_2" self.username_1, self.username_2 = "user_1", "user_2"
self.loop.run_until_complete(run_in_parallel(((self.device_1.create_user, {'enable_notifications': True, self.loop.run_until_complete(run_in_parallel(((self.device_1.create_user, {'enable_notifications': True,
'username': self.username_1}), 'username': self.username_1}),
(self.device_2.create_user, {'username': self.username_2})))) (self.device_2.create_user, {'enable_notifications': True,
'username': self.username_2}))))
self.homes = self.home_1, self.home_2 = self.device_1.get_home_view(), self.device_2.get_home_view() self.homes = self.home_1, self.home_2 = self.device_1.get_home_view(), self.device_2.get_home_view()
self.public_key_2 = self.home_2.get_public_key_via_share_profile_tab() self.public_key_2 = self.home_2.get_public_key()
self.profile_1 = self.home_1.get_profile_view() self.profile_1 = self.home_1.get_profile_view()
[home.navigate_back_to_home_view() for home in self.homes] [home.navigate_back_to_home_view() for home in self.homes]
[home.chats_tab.click() for home in self.homes] [home.chats_tab.click() for home in self.homes]
@ -1076,12 +786,10 @@ class TestCommunityMultipleDeviceMergedTwo(MultipleSharedDeviceTestCase):
self.community_name = "open community" self.community_name = "open community"
self.channel_name = 'general' self.channel_name = 'general'
self.home_1.create_community(community_type="open") self.home_1.create_community(community_type="open")
self.channel_1 = self.home_1.get_to_community_channel_from_home(self.community_name)
self.channel_1.send_message(self.text_message)
self.community_1, self.community_2 = self.home_1.get_community_view(), self.home_2.get_community_view() self.community_1, self.community_2 = self.home_1.get_community_view(), self.home_2.get_community_view()
self.community_1.share_community(self.community_name, self.username_2) self.community_1.share_community(self.community_name, self.username_2)
self.home_1.get_to_community_channel_from_home(self.community_name) self.channel_1 = self.home_1.get_to_community_channel_from_home(self.community_name)
self.home_2.just_fyi("Send message to contact (need for blocking contact) test") self.home_2.just_fyi("Send message to contact (need for blocking contact) test")
self.chat_2.send_message(self.text_message) self.chat_2.send_message(self.text_message)
@ -1090,7 +798,6 @@ class TestCommunityMultipleDeviceMergedTwo(MultipleSharedDeviceTestCase):
self.channel_2 = self.community_2.get_channel(self.channel_name).click() self.channel_2 = self.community_2.get_channel(self.channel_name).click()
@marks.testrail_id(702786) @marks.testrail_id(702786)
@marks.xfail(reason="Issue with username in PN 17396")
def test_community_mentions_push_notification(self): def test_community_mentions_push_notification(self):
self.home_1.navigate_back_to_home_view() self.home_1.navigate_back_to_home_view()
self.device_1.open_notification_bar() self.device_1.open_notification_bar()

View File

@ -0,0 +1,822 @@
import time
import pytest
from tests import marks, common_password
from tests.base_test_case import MultipleSharedDeviceTestCase, create_shared_drivers
from tests.users import transaction_senders, basic_user, ens_user, ens_user_message_sender
from views.sign_in_view import SignInView
@pytest.mark.xdist_group(name="four_2")
@marks.critical
class TestCommandsMultipleDevicesMerged(MultipleSharedDeviceTestCase):
def prepare_devices(self):
self.drivers, self.loop = create_shared_drivers(2)
self.device_1, self.device_2 = SignInView(self.drivers[0]), SignInView(self.drivers[1])
self.sender = transaction_senders['ETH_STT_3']
self.home_1 = self.device_1.recover_access(passphrase=self.sender['passphrase'], enable_notifications=True)
self.home_2 = self.device_2.create_user()
for home in self.home_1, self.home_2:
profile = home.profile_button.click()
profile.profile_notifications_button.scroll_and_click()
profile.wallet_push_notifications.click()
self.recipient_public_key, self.recipient_username = self.home_2.get_public_key(
return_username=True)
self.wallet_1, self.wallet_2 = self.home_1.wallet_button.click(), self.home_2.wallet_button.click()
[wallet.home_button.click() for wallet in (self.wallet_1, self.wallet_2)]
self.chat_1 = self.home_1.add_contact(self.recipient_public_key)
self.chat_1.send_message("hello!")
self.account_name_1 = self.wallet_1.status_account_name
@marks.testrail_id(6253)
def test_1_1_chat_command_send_tx_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.send_keys(amount)
send_transaction.confirm()
send_transaction.sign_transaction_button.click()
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 = 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)
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(
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)
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()
send_bottom_sheet.sign_transaction()
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")
self.chat_1.wallet_button.click()
self.wallet_1.find_transaction_in_history(amount=amount)
[wallet.put_app_to_background() for wallet in (self.wallet_1, self.wallet_2)]
self.device_1.open_notification_bar()
self.network_api.wait_for_confirmation_of_transaction(self.sender['address'], amount)
pn = self.home_1.get_pn('You sent %s ETH' % amount)
if pn:
pn.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')
else:
self.home_1.click_system_back_button()
self.home_1.status_in_background_button.click_if_shown()
self.wallet_1.home_button.click(desired_view="chat")
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()
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 04.10.22, valid)
self.errors.verify_no_errors()
@marks.testrail_id(6265)
def test_1_1_chat_command_decline_eth_push_changing_state(self):
[home.driver.background_app(3) for home in (self.home_1, self.home_2)]
self.home_1.home_button.double_click()
self.home_1.get_chat(username=self.recipient_username).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.send_keys(amount)
send_transaction.confirm()
send_transaction.sign_transaction_button.click()
chat_1_sender_message = self.chat_1.get_outgoing_transaction()
self.home_1.click_system_home_button()
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()
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)]
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.send_keys(request_amount)
request_transaction.confirm()
request_transaction.request_transaction_button.click()
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
(chat_2_sender_message, chat_1_request_message)]
self.errors.verify_no_errors()
@marks.testrail_id(6263)
def test_1_1_chat_command_request_and_send_tx_stt_in_1_1_chat_offline(self):
[home.driver.background_app(2) for home in (self.home_1, self.home_2)]
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.double_click()
initial_amount_stt = self.wallet_1.get_asset_amount_by_name('STT')
app_package = self.home_1.driver.current_package
self.home_1.driver.terminate_app(app_package)
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.send_keys(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.driver.activate_app(app_package)
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()
@pytest.mark.xdist_group(name="one_2")
@marks.critical
class TestOneToOneChatMultipleSharedDevices(MultipleSharedDeviceTestCase):
def prepare_devices(self):
self.drivers, self.loop = create_shared_drivers(2)
self.device_1, self.device_2 = SignInView(self.drivers[0]), SignInView(self.drivers[1])
self.home_1 = self.device_1.create_user(enable_notifications=True)
self.home_2 = self.device_2.create_user(enable_notifications=True)
self.profile_1 = self.home_1.profile_button.click()
self.default_username_1 = self.profile_1.default_username_text.text
self.profile_1.home_button.click()
self.public_key_2, self.default_username_2 = self.home_2.get_public_key()
self.chat_1 = self.home_1.add_contact(self.public_key_2)
self.chat_1.send_message('hey')
self.home_2.home_button.double_click()
self.chat_2 = self.home_2.get_chat(self.default_username_1).click()
@marks.testrail_id(6316)
def test_1_1_chat_audio_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()
self.home_2.just_fyi("Sending audio message to device who is on background")
self.chat_1.record_audio_message(message_length_in_seconds=65)
if not self.chat_1.element_by_text("Maximum recording time reached").is_element_displayed():
self.drivers[0].fail("Exceeded 1 min limit of recording time.")
self.chat_1.ok_button.click()
if self.chat_1.audio_message_recorded_time.text != "0:59":
self.errors.append("Timer exceed 2 minutes")
self.chat_1.send_message_button.click()
self.device_2.open_notification_bar()
chat_2 = self.home_2.click_upon_push_notification_by_text("Audio")
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(5387)
# think about priority of this
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()
@pytest.mark.xdist_group(name="two_2")
@marks.critical
class TestContactBlockMigrateKeycardMultipleSharedDevices(MultipleSharedDeviceTestCase):
def prepare_devices(self):
self.drivers, self.loop = create_shared_drivers(2)
self.device_1, self.device_2 = SignInView(self.drivers[0]), SignInView(self.drivers[1])
self.sender = transaction_senders['ETH_2']
self.nick = "FFOO_brak!1234"
self.message = self.device_1.get_random_message()
self.pub_chat_name = self.device_1.get_random_chat_name()
self.home_1 = self.device_1.recover_access(self.sender['passphrase'], keycard=True)
self.home_2 = self.device_2.create_user()
self.profile_2 = self.home_2.profile_button.click()
self.profile_2.privacy_and_security_button.click()
self.profile_2.backup_recovery_phrase_button.click()
recovery_phrase = self.profile_2.backup_recovery_phrase()
self.recovery_phrase = ' '.join(recovery_phrase.values())
self.public_key_2, self.default_username_2 = self.home_2.get_public_key()
self.chat_1 = self.home_1.add_contact(self.public_key_2, add_in_contacts=False)
self.chat_1.chat_options.click()
self.chat_1.view_profile_button.click()
self.chat_1.set_nickname(self.nick)
[home.home_button.click() for home in [self.home_1, self.home_2]]
self.home_2.add_contact(self.sender['public_key'])
self.home_2.home_button.click()
[home.join_public_chat(self.pub_chat_name) for home in [self.home_1, self.home_2]]
self.chat_2 = self.home_2.get_chat_view()
self.chat_2.send_message(self.message)
[home.home_button.click() for home in [self.home_1, self.home_2]]
@marks.testrail_id(702186)
def test_keycard_command_send_tx_eth_1_1_chat(self):
self.home_2.get_chat(self.sender['username']).click()
self.chat_2.send_message("hey on kk!")
self.chat_2.home_button.click()
amount = self.chat_1.get_unique_amount()
account_name = self.chat_1.status_account_name
self.chat_1.just_fyi('Send %s ETH in 1-1 chat and check it for sender and receiver: Address requested' % amount)
self.home_1.get_chat(self.nick).click()
self.chat_1.send_message("hello again!")
self.chat_1.commands_button.click()
send_transaction = self.chat_1.send_command.click()
send_transaction.get_username_in_transaction_bottom_sheet_button(self.default_username_2).click()
if send_transaction.scan_qr_code_button.is_element_displayed():
self.chat_1.driver.fail('Recipient is editable in bottom sheet when send ETH from 1-1 chat')
send_transaction.amount_edit_box.send_keys(amount)
send_transaction.confirm()
send_transaction.sign_transaction_button.click()
sender_message = self.chat_1.get_outgoing_transaction()
if not sender_message.is_element_displayed():
self.chat_1.driver.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)
self.home_2.get_chat(self.sender['username']).click()
receiver_message = self.chat_2.get_incoming_transaction()
timestamp_sender = sender_message.timestamp_command_message.text
if not receiver_message.is_element_displayed(30):
self.chat_2.driver.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)
self.chat_1.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.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)
self.chat_1.just_fyi("Sign and send transaction and check that timestamp on message is updated")
time.sleep(20)
send_message = sender_message.sign_and_send.click()
send_message.next_button.click()
send_message.sign_transaction(keycard=True)
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")
wallet_1 = self.chat_1.wallet_button.click()
wallet_1.find_transaction_in_history(amount=amount)
self.home_2.put_app_to_background_and_back()
self.network_api.wait_for_confirmation_of_transaction(self.sender['address'], amount, confirmations=3)
wallet_1.home_button.click(desired_view='chat')
self.home_1.just_fyi("Check 'Confirmed' state for sender and receiver(use pull-to-refresh to update history)")
wallet_2 = self.chat_2.wallet_button.click()
wallet_2.find_transaction_in_history(amount=amount)
sender_message.transaction_status.wait_for_element_text(sender_message.confirmed, 120)
self.errors.verify_no_errors()
@marks.testrail_id(702175)
def test_contact_add_remove_mention_default_username_nickname_public_chat(self):
[home.home_button.double_click() for home in [self.home_1, self.home_2]]
self.chat_1.just_fyi('check that can mention user with 3-random name in public chat')
self.home_1.get_chat('#%s' % self.pub_chat_name).click()
self.chat_1.just_fyi('Set nickname for user without adding him to contacts, check it in public chat')
chat_element = self.chat_1.chat_element_by_text(self.message)
expected_username = '%s %s' % (self.nick, self.default_username_2)
if chat_element.username.text != expected_username:
self.errors.append('Username %s in public chat does not match expected %s' % (
chat_element.username.text, expected_username))
self.chat_1.just_fyi('Add user to contacts, mention it by nickname check contact list in Profile')
chat_element.member_photo.click()
self.chat_1.profile_add_to_contacts_button.click()
if not self.chat_1.remove_from_contacts.is_element_displayed():
self.errors.append("'Add to contacts' is not changed to 'Remove from contacts'")
self.chat_1.close_button.click()
self.chat_1.just_fyi('check that can mention user with nickname or default username in public chat')
self.chat_1.select_mention_from_suggestion_list(username_in_list=self.nick + ' ' + self.default_username_2,
typed_search_pattern=self.nick[0:2])
if self.chat_1.chat_message_input.text != '@' + self.default_username_2 + ' ':
self.errors.append('Username is not resolved in chat input after selecting it in mention '
'suggestions list by nickname!')
self.chat_1.chat_message_input.clear()
for pattern in (self.nick[0:2], self.default_username_2[0:4]):
self.chat_1.select_mention_from_suggestion_list(username_in_list=self.nick + ' ' + self.default_username_2,
typed_search_pattern=pattern)
if self.chat_1.chat_message_input.text != '@' + self.default_username_2 + ' ':
self.errors.append('Username is not resolved in chat input after selecting it in mention suggestions '
'list by default username!')
additional_text = 'and more'
self.chat_1.send_as_keyevent(additional_text)
self.chat_1.send_message_button.click()
if not self.chat_1.chat_element_by_text('%s %s' % (self.nick, additional_text)).is_element_displayed():
self.errors.append("Nickname is not resolved on send message")
self.chat_1.get_back_to_home_view()
self.chat_1.just_fyi('check contact list in Profile after setting nickname')
profile_1 = self.chat_1.profile_button.click()
userprofile = profile_1.open_contact_from_profile(self.nick)
if not userprofile.remove_from_contacts.is_element_displayed():
self.errors.append("'Add to contacts' is not changed to 'Remove from contacts' in profile contacts")
profile_1.close_button.click()
profile_1.home_button.double_click()
self.chat_1.just_fyi(
'Check that user is added to contacts below "Start new chat" and you redirected to 1-1 on tap')
self.home_1.plus_button.click()
self.home_1.start_new_chat_button.click()
if not self.home_1.element_by_text(self.nick).is_element_displayed():
self.home_1.driver.fail('List of contacts below "Start new chat" does not contain added user')
self.home_1.element_by_text(self.nick).click()
if not self.chat_1.chat_message_input.is_element_displayed():
self.chat_1.driver.fail('No redirect to 1-1 chat if tap on Contact below "Start new chat"')
for element in (self.chat_1.chat_message_input, self.chat_1.element_by_text(self.nick)):
if not element.is_element_displayed():
self.errors.append('Expected element is not found in 1-1 after adding user to contacts from profile')
if self.chat_1.add_to_contacts.is_element_displayed():
self.errors.append('"Add to contacts" button is shown in 1-1 after adding user to contacts from profile')
self.chat_1.just_fyi('Remove user from contacts')
self.chat_1.chat_options.click()
self.chat_1.view_profile_button.click()
self.chat_1.remove_from_contacts.click_until_absense_of_element(self.chat_1.remove_from_contacts)
if self.chat_1.profile_nickname.text != self.nick:
self.errors.append("Nickname is changed after removing user from contacts")
self.chat_1.just_fyi('Check that user is removed from contact list in profile')
self.chat_1.close_button.click()
if not self.chat_1.add_to_contacts.is_element_displayed():
self.errors.append('"Add to contacts" button is not shown in 1-1 after removing user from contacts')
self.chat_1.profile_button.double_click()
profile_1.contacts_button.click()
if profile_1.element_by_text(self.nick).is_element_displayed():
self.errors.append('Contact is shown in Profile after removing user from contacts')
self.errors.verify_no_errors()
@marks.testrail_id(702188)
@marks.xfail(
reason="flaky; issue when sometimes history is not fetched from offline for public chat, needs investigation")
def test_cellular_settings_on_off_public_chat_fetching_history(self):
[home.home_button.double_click() for home in [self.home_1, self.home_2]]
public_chat_name, public_chat_message = 'e2e-started-before', 'message to pub chat'
public_1 = self.home_1.join_public_chat(public_chat_name)
public_1.send_message(public_chat_message)
self.home_2.just_fyi('set mobile data to "OFF" and check that peer-to-peer connection is still working')
self.home_2.set_network_to_cellular_only()
self.home_2.mobile_connection_off_icon.wait_for_visibility_of_element(20)
for element in (self.home_2.continue_syncing_button, self.home_2.stop_syncing_button,
self.home_2.remember_my_choice_checkbox):
if not element.is_element_displayed(10):
self.drivers[0].fail(
'Element %s is not not shown in "Syncing mobile" bottom sheet' % element.locator)
self.home_2.stop_syncing_button.click()
if not self.home_2.mobile_connection_off_icon.is_element_displayed():
self.drivers[0].fail('No mobile connection OFF icon is shown')
self.home_2.mobile_connection_off_icon.click()
for element in self.home_2.connected_to_n_peers_text, self.home_2.waiting_for_wi_fi:
if not element.is_element_displayed():
self.errors.append("Element '%s' is not shown in Connection status bottom sheet" % element.locator)
self.home_2.click_system_back_button()
public_2 = self.home_2.join_public_chat(public_chat_name)
if public_2.chat_element_by_text(public_chat_message).is_element_displayed(30):
self.errors.append("Chat history was fetched with mobile data fetching off")
public_chat_new_message = 'new message'
public_1.send_message(public_chat_new_message)
if not public_2.chat_element_by_text(public_chat_new_message).is_element_displayed(30):
self.errors.append("Peer-to-peer connection is not working when mobile data fetching is off")
self.home_2.just_fyi('set mobile data to "ON"')
self.home_2.home_button.click()
self.home_2.mobile_connection_off_icon.click()
self.home_2.use_mobile_data_switch.wait_and_click(30)
if not self.home_2.connected_to_node_text.is_element_displayed(10):
self.errors.append("Not connected to history node after enabling fetching on mobile data")
self.home_2.click_system_back_button()
self.home_2.mobile_connection_on_icon.wait_for_visibility_of_element(10)
self.home_2.get_chat('#%s' % public_chat_name).click()
if not public_2.chat_element_by_text(public_chat_message).is_element_displayed(180):
self.errors.append("Chat history was not fetched with mobile data fetching ON")
self.home_2.just_fyi('check redirect to sync settings by tapping on "Sync" in connection status bottom sheet')
self.home_2.home_button.click()
self.home_2.mobile_connection_on_icon.click()
self.home_2.connection_settings_button.click()
if not self.home_2.element_by_translation_id("mobile-network-use-mobile").is_element_displayed():
self.errors.append(
"Was not redirected to sync settings after tapping on Settings in connection bottom sheet")
self.home_2.just_fyi("Check default preferences in Sync settings")
profile_1 = self.home_1.get_profile_view()
self.home_1.profile_button.double_click()
profile_1.sync_settings_button.click()
if not profile_1.element_by_translation_id("mobile-network-use-wifi").is_element_displayed():
self.errors.append("Mobile data is enabled by default")
profile_1.element_by_translation_id("mobile-network-use-wifi").click()
if profile_1.ask_me_when_on_mobile_network.text != "ON":
self.errors.append("'Ask me when on mobile network' is not enabled by default")
profile_1.just_fyi("Disable 'ask me when on mobile network' and check that it is not shown")
profile_1.ask_me_when_on_mobile_network.click()
profile_1.set_network_to_cellular_only()
if profile_1.element_by_translation_id("mobile-network-start-syncing").is_element_displayed(20):
self.errors.append("Popup is shown, but 'ask me when on mobile network' is disabled")
profile_1.just_fyi("Check 'Restore default' setting")
profile_1.element_by_text('Restore Defaults').click()
if profile_1.use_mobile_data.attribute_value("checked"):
self.errors.append("Mobile data is enabled by default")
if not profile_1.ask_me_when_on_mobile_network.attribute_value("checked"):
self.errors.append("'Ask me when on mobile network' is not enabled by default")
self.errors.verify_no_errors()
@marks.testrail_id(702177)
def test_restore_account_migrate_multiaccount_to_keycard_db_saved(self):
self.home_1.driver.quit()
self.home_2.profile_button.double_click()
self.profile_2.logout()
self.device_2.just_fyi("Checking migration to keycard: db saved (1-1 chat, nickname, messages)")
self.device_2.options_button.click()
self.device_2.manage_keys_and_storage_button.click()
self.device_2.move_keystore_file_option.click()
self.device_2.enter_seed_phrase_next_button.click()
self.device_2.seedphrase_input.send_keys(self.recovery_phrase)
self.device_2.choose_storage_button.click()
self.device_2.keycard_required_option.click()
self.device_2.confirm_button.click()
self.device_2.migration_password_input.send_keys(common_password)
self.device_2.confirm_button.click()
from views.keycard_view import KeycardView
keycard = KeycardView(self.device_2.driver)
keycard.begin_setup_button.click()
keycard.connect_card_button.wait_and_click()
keycard.enter_default_pin()
keycard.enter_default_pin()
if not self.device_2.element_by_translation_id("migration-successful").is_element_displayed(30):
self.driver.fail("No popup about successfull migration is shown!")
self.device_2.ok_button.click()
self.home_2.home_button.wait_for_element(30)
if not self.home_2.element_by_text_part(self.pub_chat_name).is_element_displayed():
self.errors.append("Public chat was removed from home after migration to kk")
self.home_2.get_chat(self.sender['username']).click()
if self.chat_2.add_to_contacts.is_element_displayed():
self.errors.append("User was removed from contacts after migration to kk")
self.errors.verify_no_errors()
@pytest.mark.xdist_group(name="three_2")
@marks.critical
class TestEnsStickersMultipleDevicesMerged(MultipleSharedDeviceTestCase):
def prepare_devices(self):
self.drivers, self.loop = create_shared_drivers(2)
self.device_1, self.device_2 = SignInView(self.drivers[0]), SignInView(self.drivers[1])
self.sender, self.reciever = transaction_senders['ETH_3'], ens_user
self.home_1 = self.device_1.recover_access(passphrase=self.sender['passphrase'])
self.home_2 = self.device_2.recover_access(ens_user['passphrase'], enable_notifications=True)
self.ens = '@%s' % self.reciever['ens']
self.pub_chat_name = self.home_1.get_random_chat_name()
self.chat_1 = self.home_1.join_public_chat(self.pub_chat_name)
self.chat_2 = self.home_2.join_public_chat(self.pub_chat_name)
[home.home_button.double_click() for home in (self.home_1, self.home_2)]
self.profile_2 = self.home_2.profile_button.click()
self.profile_2.connect_existing_ens(self.reciever['ens'])
self.home_1.add_contact(self.reciever['ens'])
self.home_2.home_button.click()
self.home_2.add_contact(self.sender['public_key'])
# To avoid activity centre for restored users
[chat.send_message("hey!") for chat in (self.chat_1, self.chat_2)]
self.home_1.just_fyi("Close the ENS banner")
[home.home_button.double_click() for home in (self.home_1, self.home_2)]
[home.ens_banner_close_button.click_if_shown() for home in (self.home_1, self.home_2)]
@marks.testrail_id(702152)
def test_ens_purchased_in_profile(self):
self.home_2.profile_button.double_click()
ens_name_after_adding = self.profile_2.default_username_text.text
if ens_name_after_adding != '@%s' % ens_user['ens']:
self.errors.append('ENS name is not shown as default in user profile after adding, "%s" instead' %
ens_name_after_adding)
self.home_2.just_fyi('check ENS name wallet address and public key')
self.home_2.element_by_text(self.reciever['ens']).click()
self.home_2.element_by_text(self.reciever['ens']).click()
for text in (self.reciever['address'].lower(), self.reciever['public_key']):
if not self.home_2.element_by_text_part(text).is_element_displayed(40):
self.errors.append('%s text is not shown' % text)
self.home_2.profile_button.double_click()
self.home_2.just_fyi('check ENS name is shown on share my profile window')
self.profile_2.share_my_profile_button.click()
if self.profile_2.ens_name_in_share_chat_key_text.text != '%s' % ens_user['ens']:
self.errors.append('No ENS name is shown on tapping on share icon in Profile')
self.profile_2.close_share_popup()
self.errors.verify_no_errors()
@marks.testrail_id(702153)
def test_ens_command_send_tx_eth_1_1_chat(self):
[home.home_button.double_click() for home in (self.home_1, self.home_2)]
wallet_1 = self.home_1.wallet_button.click()
wallet_1.wait_balance_is_changed()
wallet_1.home_button.click()
self.home_1.get_chat(self.ens).click()
self.chat_1.commands_button.click()
amount = self.chat_1.get_unique_amount()
self.chat_1.just_fyi("Check sending assets to ENS name from sender side")
send_message = self.chat_1.send_command.click()
send_message.amount_edit_box.send_keys(amount)
send_message.confirm()
send_message.next_button.click()
from views.send_transaction_view import SendTransactionView
send_transaction = SendTransactionView(self.drivers[0])
send_transaction.ok_got_it_button.click()
send_transaction.sign_transaction()
chat_1_sender_message = self.chat_1.get_outgoing_transaction(transaction_value=amount)
self.home_2.put_app_to_background_and_back()
self.network_api.wait_for_confirmation_of_transaction(self.sender['address'], amount, confirmations=3)
chat_1_sender_message.transaction_status.wait_for_element_text(chat_1_sender_message.confirmed)
self.chat_2.just_fyi("Check that message is fetched for receiver")
self.home_2.get_chat(self.sender['username']).click()
chat_2_reciever_message = self.chat_2.get_incoming_transaction(transaction_value=amount)
chat_2_reciever_message.transaction_status.wait_for_element_text(chat_2_reciever_message.confirmed,
wait_time=60)
@marks.testrail_id(702155)
def test_ens_mention_nickname_1_1_chat(self):
[home.home_button.double_click() for home in (self.home_1, self.home_2)]
self.home_1.just_fyi('Mention user by ENS in 1-1 chat')
message, message_ens_owner = '%s hey!' % self.ens, '%s hey!' % self.reciever['ens']
self.home_1.get_chat(self.ens).click()
self.chat_1.send_message(message)
self.home_1.just_fyi('Set nickname and mention user by nickname in 1-1 chat')
russian_nickname = 'МОЙ дорогой ДРУх'
self.chat_1.chat_options.click()
self.chat_1.view_profile_button.click()
self.chat_1.set_nickname(russian_nickname)
self.chat_1.select_mention_from_suggestion_list(russian_nickname + ' ' + self.ens)
self.chat_1.just_fyi('Check that nickname is shown in preview for 1-1 chat')
updated_message = '%s hey!' % russian_nickname
self.chat_1.home_button.double_click()
if not self.chat_1.element_by_text(updated_message).is_element_displayed():
self.errors.append('"%s" is not show in chat preview on home screen!' % message)
self.home_1.get_chat(russian_nickname).click()
self.chat_1.just_fyi('Check redirect to user profile on mention by nickname tap')
self.chat_1.chat_element_by_text(updated_message).click()
if not self.chat_1.profile_block_contact_button.is_element_displayed():
self.errors.append(
'No redirect to user profile after tapping on message with mention (nickname) in 1-1 chat')
else:
self.chat_1.profile_send_message_button.click()
self.chat_2.just_fyi("Check message with mention for ENS owner")
self.home_2.get_chat(self.sender['username']).click()
if not self.chat_2.chat_element_by_text(message_ens_owner).is_element_displayed():
self.errors.append('Expected %s message is not shown for ENS owner' % message_ens_owner)
self.chat_1.just_fyi('Check if after deleting nickname ENS is shown again')
self.chat_1.chat_options.click()
self.chat_1.view_profile_button.click()
self.chat_1.profile_nickname_button.click()
self.chat_1.nickname_input_field.clear()
self.chat_1.element_by_text('Done').click()
self.chat_1.close_button.click()
if self.chat_1.user_name_text.text != self.ens:
self.errors.append("Username '%s' is not updated to ENS '%s' after deleting nickname" %
(self.chat_1.user_name_text.text, self.ens))
self.errors.verify_no_errors()
@marks.testrail_id(702156)
def test_ens_mention_push_highlighted_public_chat(self):
[home.home_button.double_click() for home in (self.home_1, self.home_2)]
self.home_2.get_chat('#%s' % self.pub_chat_name).click()
text = "From ENS name user!"
self.chat_2.send_message(text)
self.chat_2.home_button.click()
self.home_2.put_app_to_background()
self.home_2.open_notification_bar()
self.home_1.just_fyi('check that can mention user with ENS name')
self.home_1.get_chat('#%s' % self.pub_chat_name).click()
self.chat_1.wait_ens_name_resolved_in_chat(message=text, username_value='@%s' % self.reciever['ens'])
self.chat_1.select_mention_from_suggestion_list(self.reciever['ens'])
if self.chat_1.chat_message_input.text != self.ens + ' ':
self.errors.append(
'ENS username is not resolved in chat input after selecting it in mention suggestions list!')
self.chat_1.send_message_button.click()
self.home_2.just_fyi(
'check that PN is received and after tap you are redirected to chat, mention is highligted')
pn = self.home_2.get_pn(self.reciever['username'])
if pn:
pn.click()
else:
self.errors.append('No PN on mention in public chat! ')
self.home_2.click_system_back_button(2)
if self.home_2.element_starts_with_text(self.reciever['ens']).is_element_differs_from_template('ment_new_1.png',
2):
self.errors.append('Mention is not highlighted!')
self.errors.verify_no_errors()
@marks.testrail_id(702157)
def test_sticker_1_1_public_chat_mainnet(self):
self.home_2.status_in_background_button.click_if_shown()
[home.home_button.double_click() for home in (self.home_1, self.home_2)]
profile_2 = self.home_2.profile_button.click()
profile_2.switch_network()
self.home_2.just_fyi('Check that can use purchased stickerpack on Mainnet')
self.home_2.get_chat('#%s' % self.pub_chat_name).click()
self.chat_2.install_sticker_pack_by_name('Tozemoon')
self.chat_2.sticker_icon.click()
if not self.chat_2.chat_item.is_element_displayed():
self.errors.append('Cannot use purchased stickers')
self.home_2.profile_button.click()
profile_2.switch_network('Goerli with upstream RPC')
self.home_1.just_fyi('Install free sticker pack and use it in 1-1 chat on Goerli')
self.home_1.get_chat(self.ens).click()
self.chat_1.chat_message_input.clear()
self.chat_1.install_sticker_pack_by_name()
self.chat_1.sticker_icon.click()
if not self.chat_1.sticker_message.is_element_displayed():
self.errors.append('Sticker was not sent')
self.chat_1.swipe_right()
if not self.chat_1.sticker_icon.is_element_displayed():
self.errors.append('Sticker is not shown in recently used list')
self.chat_1.get_back_to_home_view()
self.home_1.just_fyi('Send stickers in public chat from Recent')
self.home_1.join_public_chat(self.home_1.get_random_chat_name())
self.chat_1.show_stickers_button.click()
self.chat_1.sticker_icon.click()
if not self.chat_1.chat_item.is_element_displayed():
self.errors.append('Sticker was not sent from Recent')
# self.home_2.just_fyi('Check that can install stickers by tapping on sticker message')
# TODO: disabled because of #13683 (rechecked 04.10.22, valid)
self.home_2.home_button.double_click()
self.home_2.get_chat(self.sender['username']).click()
# self.chat_2.chat_item.click()
# self.chat_2.element_by_text_part('Free').wait_and_click(40)
# if self.chat_2.element_by_text_part('Free').is_element_displayed():
# self.errors.append('Stickerpack was not installed')
self.chat_2.just_fyi('Check that can navigate to another user profile via long tap on sticker message')
# self.chat_2.close_sticker_view_icon.click()
self.chat_2.chat_item.long_press_element()
self.chat_2.element_by_text('View Details').click()
self.chat_2.profile_send_message_button.wait_and_click()
self.errors.verify_no_errors()
@marks.testrail_id(702158)
def test_start_new_chat_public_key_validation(self):
[home.get_back_to_home_view() for home in (self.home_1, self.home_2)]
self.home_2.driver.quit()
public_key = basic_user['public_key']
self.home_1.plus_button.click()
chat = self.home_1.start_new_chat_button.click()
self.home_1.just_fyi("Validation: invalid public key and invalid ENS")
for invalid_chat_key in (basic_user['public_key'][:-1], ens_user_message_sender['ens'][:-2]):
chat.public_key_edit_box.clear()
chat.public_key_edit_box.send_keys(invalid_chat_key)
chat.confirm()
if not self.home_1.element_by_translation_id("profile-not-found").is_element_displayed():
self.errors.append('Error is not shown for invalid public key')
self.home_1.just_fyi("Check that valid ENS is resolved")
chat.public_key_edit_box.clear()
chat.public_key_edit_box.send_keys(ens_user_message_sender['ens'])
resolved_ens = '%s.stateofus.eth' % ens_user_message_sender['ens']
if not chat.element_by_text(resolved_ens).is_element_displayed(10):
self.errors.append('ENS name is not resolved after pasting chat key')
self.home_1.close_button.click()
self.home_1.just_fyi("Check that can paste public key from keyboard and start chat")
self.home_1.get_chat('#%s' % self.pub_chat_name).click()
chat.send_message(public_key)
chat.copy_message_text(public_key)
chat.back_button.click()
self.home_1.plus_button.click()
self.home_1.start_new_chat_button.click()
chat.public_key_edit_box.paste_text_from_clipboard()
if chat.public_key_edit_box.text != public_key:
self.errors.append('Public key is not pasted from clipboard')
if not chat.element_by_text(basic_user['username']).is_element_displayed():
self.errors.append('3 random-name is not resolved after pasting chat key')
self.home_1.just_fyi('My_profile button at Start new chat view opens own QR code with public key pop-up')
self.home_1.my_profile_on_start_new_chat_button.click()
account = self.home_1.get_profile_view()
if not (account.public_key_text.is_element_displayed() and account.share_button.is_element_displayed()
and account.qr_code_image.is_element_displayed()):
self.errors.append('No self profile pop-up data displayed after My_profile button tap')
self.errors.verify_no_errors()

View File

@ -0,0 +1,140 @@
import pytest
from tests import marks
from tests.base_test_case import MultipleSharedDeviceTestCase, create_shared_drivers
from views.chat_view import ChatView
from views.sign_in_view import SignInView
@pytest.mark.xdist_group(name="one_3")
@marks.critical
class TestGroupChatMultipleDeviceMerged(MultipleSharedDeviceTestCase):
def prepare_devices(self):
self.drivers, self.loop = create_shared_drivers(3)
self.message_before_adding = 'message before adding new user'
self.message_to_admin = 'Hey, admin!'
self.homes, self.public_keys, self.usernames, self.chats = {}, {}, {}, {}
for key in self.drivers:
sign_in = SignInView(self.drivers[key])
self.homes[key] = sign_in.create_user(enable_notifications=True)
SignInView(self.drivers[2]).put_app_to_background_and_back()
self.public_keys[key], self.usernames[key] = sign_in.get_public_key(True)
sign_in.home_button.click()
SignInView(self.drivers[0]).put_app_to_background_and_back()
self.chat_name = self.homes[0].get_random_chat_name()
self.homes[0].just_fyi('Admin adds future members to contacts')
for i in range(1, 3):
self.homes[0].add_contact(self.public_keys[i])
self.homes[0].home_button.double_click()
self.homes[0].just_fyi('Members add admin to contacts to see PNs and put app in background')
for i in range(1, 3):
self.homes[i].handle_contact_request(self.usernames[0])
self.homes[i].home_button.double_click()
self.homes[0].just_fyi('Admin creates group chat')
self.chats[0] = self.homes[0].create_group_chat([self.usernames[1]], self.chat_name)
for i in range(1, 3):
self.chats[i] = ChatView(self.drivers[i])
self.chats[0].send_message(self.message_before_adding)
@marks.testrail_id(3994)
def test_group_chat_push_system_messages_when_invited(self):
self.homes[1].just_fyi("Check system messages in PNs")
self.homes[2].put_app_to_background_and_back()
self.homes[1].put_app_to_background()
self.homes[1].open_notification_bar()
pns = [self.chats[0].pn_invited_to_group_chat(self.usernames[0], self.chat_name),
self.chats[0].pn_wants_you_to_join_to_group_chat(self.usernames[0], self.chat_name)]
for pn in pns:
if not self.homes[1].get_pn(pn):
self.errors.append('%s is not shown after invite to group chat' % pn)
if self.homes[1].get_pn(pns[0]):
group_invite_pn = self.homes[1].get_pn(pns[0])
group_invite_pn.click()
else:
self.homes[1].click_system_back_button(2)
self.homes[1].get_chat(self.chat_name).click()
self.homes[1].just_fyi("Check system messages in group chat for admin and member")
create_system_message = self.chats[0].create_system_message(self.usernames[0], self.chat_name)
has_added_system_message = self.chats[0].has_added_system_message(self.usernames[0], self.usernames[1])
create_for_admin_system_message = 'You created the group %s' % self.chat_name
joined_message = "You've joined %s from invitation by %s" % (self.chat_name, self.usernames[0])
for message in [create_for_admin_system_message, create_system_message, has_added_system_message]:
if not self.chats[0].element_by_text(message).is_element_displayed():
self.errors.append('%s system message is not shown' % message)
for message in [joined_message, create_system_message, has_added_system_message]:
if not self.chats[1].element_by_text(message).is_element_displayed():
self.errors.append('%s system message is not shown' % message)
self.errors.verify_no_errors()
@marks.testrail_id(700732)
def test_group_chat_add_new_member(self):
[self.homes[i].home_button.double_click() for i in range(3)]
self.homes[0].get_chat(self.chat_name).click()
self.chats[0].add_members_to_group_chat([self.usernames[2]])
self.chats[2].just_fyi("Check there will be PN and no unread in AC for a new member")
if self.homes[2].notifications_unread_badge.is_element_displayed(60):
self.drivers[2].fail("Group chat appeared in AC!")
self.homes[2].open_notification_bar()
if not self.homes[2].element_by_text_part(self.usernames[0]).is_element_displayed():
self.errors.append("PN about group chat invite is not shown when invited by mutual contact")
self.homes[2].click_system_back_button()
self.homes[2].just_fyi("Check new group appeared in chat list for a new member")
if not self.homes[2].get_chat(self.chat_name).is_element_displayed(60):
self.drivers[2].fail("New group chat hasn't appeared in chat list")
self.homes[2].get_chat(self.chat_name).click()
for message in (self.message_to_admin, self.message_before_adding):
if self.chats[2].chat_element_by_text(message).is_element_displayed():
self.errors.append('%s is shown for new user' % message)
self.errors.verify_no_errors()
@marks.testrail_id(5756)
def test_group_chat_highligted(self):
chat_name = 'for_invited'
[self.homes[i].home_button.double_click() for i in range(3)]
self.homes[0].create_group_chat([self.usernames[1]], chat_name)
self.homes[1].just_fyi("Check that new group chat from contact is highlited")
chat_2_element = self.homes[1].get_chat(chat_name)
if chat_2_element.no_message_preview.is_element_differs_from_template('highligted_preview_group.png', 0):
self.errors.append("Preview message is not hightligted or text is not shown! ")
chat_2 = self.homes[1].get_chat(chat_name).click()
chat_2.home_button.click()
if not chat_2_element.no_message_preview.is_element_differs_from_template('highligted_preview_group.png', 0):
self.errors.append("Preview message is still hightligted after opening! ")
@marks.testrail_id(3997)
def test_group_chat_leave_relogin(self):
left_system_message = self.chats[1].leave_system_message(self.usernames[0])
self.drivers[2].quit()
[self.homes[i].home_button.double_click() for i in range(2)]
self.homes[0].home_button.double_click()
self.homes[1].get_chat(self.chat_name).click()
self.homes[0].just_fyi("Admin deleted chat via long press")
self.homes[0].leave_chat_long_press(self.chat_name)
self.homes[1].just_fyi('Check that leave system message is presented after user left the group chat')
if not self.chats[1].chat_element_by_text(left_system_message).is_element_displayed():
self.errors.append('System message when user leaves the chat is not shown')
self.homes[0].just_fyi("Member sends some message, admin relogins and check chat does not reappear")
self.chats[1].send_message(self.message_to_admin)
self.homes[0].relogin()
if self.homes[0].get_chat_from_home_view(self.chat_name).is_element_displayed():
self.drivers[0].fail('Deleted %s is present after relaunch app' % self.chat_name)

View File

@ -0,0 +1,295 @@
from datetime import timedelta
import pytest
from dateutil import parser
from selenium.common.exceptions import NoSuchElementException
from tests import marks, test_dapp_name, test_dapp_url
from tests.base_test_case import create_shared_drivers, MultipleSharedDeviceTestCase
from views.sign_in_view import SignInView
@pytest.mark.xdist_group(name="three_1")
@marks.critical
class TestPublicChatBrowserOneDeviceMerged(MultipleSharedDeviceTestCase):
def prepare_devices(self):
self.drivers, self.loop = create_shared_drivers(1)
self.sign_in = SignInView(self.drivers[0])
self.home = self.sign_in.create_user()
self.public_chat_name = self.home.get_random_chat_name()
self.chat = self.home.join_public_chat(self.public_chat_name)
@marks.testrail_id(5675)
def test_public_chat_fetch_more_history(self):
self.home.just_fyi("Check that can fetch previous history for several days")
device_time = parser.parse(self.drivers[0].device_time)
yesterday = (device_time - timedelta(days=1)).strftime("%b %-d, %Y")
before_yesterday = (device_time - timedelta(days=2)).strftime("%b %-d, %Y")
quiet_time_yesterday, quiet_time_before_yesterday = '24 hours', '2 days'
fetch_more = self.home.get_translation_by_key("load-more-messages")
for message in (yesterday, quiet_time_yesterday):
if not self.chat.element_by_text_part(message).is_element_displayed(120):
self.drivers[0].fail('"%s" is not shown' % message)
self.chat.element_by_text_part(fetch_more).wait_and_click(120)
self.chat.element_by_text_part(fetch_more).wait_for_visibility_of_element(180)
for message in (before_yesterday, quiet_time_before_yesterday):
if not self.chat.element_by_text_part(message).is_element_displayed():
self.drivers[0].fail('"%s" is not shown' % message)
self.home.just_fyi("Check that can fetch previous history for month")
times = {
"three-days": '5 days',
"one-week": '12 days',
"one-month": ['43 days', '42 days', '41 days', '40 days'],
}
profile = self.home.profile_button.click()
profile.sync_settings_button.click()
profile.sync_history_for_button.click()
for period in times:
profile.just_fyi("Checking %s period" % period)
profile.element_by_translation_id(period).click()
profile.home_button.click(desired_view='chat')
self.chat.element_by_text_part(fetch_more).wait_and_click(120)
if period != "one-month":
if not profile.element_by_text_part(times[period]).is_element_displayed(30):
self.errors.append("'Quiet here for %s' is not shown after fetching more history" % times[period])
else:
variants = times[period]
self.chat.element_by_text_part(fetch_more).wait_for_invisibility_of_element(120)
res = any(profile.element_by_text_part(variant).is_element_displayed(30) for variant in variants)
if not res:
self.errors.append("History is not fetched for one month!")
self.home.profile_button.click(desired_element_text=profile.get_translation_by_key("default-sync-period"))
self.errors.verify_no_errors()
@marks.testrail_id(5396)
def test_public_chat_navigate_to_chat_when_relaunch(self):
text_message = 'some_text'
self.home.home_button.double_click()
self.home.get_chat('#%s' % self.public_chat_name).click()
self.chat.send_message(text_message)
self.chat.reopen_app()
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 04.10.22, 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'
self.home.home_button.double_click()
self.home.get_chat('#%s' % self.public_chat_name).click()
self.home.just_fyi("Check that will be redirected to chat view on tap on tag message")
self.chat.send_message(tag_message)
self.chat.element_starts_with_text(tag_message).click()
self.chat.element_by_text_part(self.public_chat_name).wait_for_invisibility_of_element()
if not self.chat.user_name_text.text == tag_message:
self.errors.append('Could not redirect a user to a public chat tapping the tag message.')
self.home.just_fyi("Check that chat is added to home view")
self.chat.home_button.double_click()
if not self.home.element_by_text(tag_message).is_element_displayed():
self.errors.append('Could not find the public chat in user chat list.')
self.errors.verify_no_errors()
@marks.testrail_id(700739)
def test_public_chat_open_using_deep_link(self):
self.drivers[0].terminate_app(self.drivers[0].current_package)
chat_name = self.home.get_random_chat_name()
deep_link = 'status-im://%s' % chat_name
self.sign_in.open_weblink_and_login(deep_link)
try:
assert self.chat.user_name_text.text == '#' + chat_name
except (AssertionError, NoSuchElementException):
self.drivers[0].fail("Public chat '%s' is not opened" % chat_name)
@marks.testrail_id(702072)
def test_browser_blocked_url(self):
dapp = self.home.dapp_tab_button.click()
for url in ('metamask.site', 'cryptokitties.domainname'):
dapp.just_fyi('Checking blocked website %s' % url)
dapp_detail = dapp.open_url(url)
dapp_detail.element_by_translation_id('browsing-site-blocked-title')
if dapp_detail.browser_refresh_page_button.is_element_displayed():
self.errors.append("Refresh button is present in blocked site")
dapp_detail.go_back_button.click()
dapp_detail.open_tabs_button.click()
dapp.element_by_text_part(url[:8]).click()
dapp_detail.continue_anyway_button.click()
if dapp_detail.element_by_text('This site is blocked').is_element_displayed():
self.errors.append("Failed to open Dapp after 'Continue anyway' tapped for %s" % url)
dapp_detail.open_tabs_button.click()
dapp_detail.empty_tab_button.click()
self.errors.verify_no_errors()
@marks.testrail_id(702073)
def test_browser_connection_is_secure_not_secure_warning(self):
dapp = self.home.dapp_tab_button.click()
web_page = dapp.open_url('http://www.dvwa.co.uk')
web_page.url_edit_box_lock_icon.click_until_presence_of_element(
web_page.element_by_translation_id("browser-not-secure"))
web_page.open_tabs_button.click()
web_page.empty_tab_button.click()
dapp.just_fyi('Checking connection is secure for Airswap')
web_page = dapp.open_url('https://instant.airswap.io')
web_page.wait_for_d_aap_to_load()
web_page.url_edit_box_lock_icon.click_until_presence_of_element(
web_page.element_by_translation_id("browser-secure"))
web_page.open_tabs_button.click()
web_page.empty_tab_button.click()
@marks.testrail_id(702074)
def test_browser_invalid_url(self):
dapp = self.home.dapp_tab_button.click()
browsing_view = dapp.open_url('invalid.takoe')
browsing_view.element_by_translation_id("web-view-error").wait_for_element(20)
@marks.testrail_id(702075)
def test_browser_offline(self):
dapp = self.home.dapp_tab_button.click()
self.home.toggle_airplane_mode()
browsing_view = dapp.open_url('status.im')
offline_texts = ['Unable to load page', 'ERR_INTERNET_DISCONNECTED']
for text in offline_texts:
browsing_view.element_by_text_part(text).wait_for_element(15)
self.home.toggle_airplane_mode()
browsing_view.browser_refresh_page_button.click_until_presence_of_element(
browsing_view.element_by_text_part('An Open Source Community'))
@marks.testrail_id(702076)
def test_browser_delete_close_tabs(self):
dapp = self.home.dapp_tab_button.click()
urls = {
'google.com': 'Google',
'status.im': 'Status - Private',
'bbc.com': 'bbc.com'
}
for url in urls:
web_page = dapp.open_url(url)
web_page.open_tabs_button.click()
web_page.empty_tab_button.click()
self.home.just_fyi('Delete one tab')
web_page.remove_tab(name=urls['bbc.com'])
web_page.open_tabs_button.wait_for_invisibility_of_element()
web_page.element_by_text_part(urls['bbc.com']).wait_for_invisibility_of_element()
self.home.just_fyi('Close all tabs via "Close all", relogin and check that it is not reappearing')
web_page.close_all_button.click()
self.home.reopen_app()
web_page.dapp_tab_button.click()
web_page.open_tabs_button.click()
if web_page.element_by_text_part(urls['status.im']).is_element_displayed():
self.errors.append('Tabs are not closed or reappeared after re-login!')
self.errors.verify_no_errors()
@marks.testrail_id(702077)
def test_browser_bookmarks_create_edit_remove(self):
dapp = self.home.dapp_tab_button.click()
self.home.just_fyi('Add some url to bookmarks with default name')
web_page = dapp.open_url('status.im')
default_bookmark_name = web_page.add_to_bookmarks()
web_page.browser_previous_page_button.click()
if not web_page.element_by_text(default_bookmark_name).is_element_displayed():
self.errors.append("Bookmark with default name is not added!")
self.home.just_fyi('Add some url to bookmarks with custom name')
custom_name = 'Custom BBC'
dapp.open_url('bbc.com')
web_page.add_to_bookmarks(custom_name)
web_page.open_tabs_button.click()
web_page.empty_tab_button.click()
if not web_page.element_by_text(custom_name).is_element_displayed():
self.driver.fail("Bookmark with custom name is not added!")
self.home.just_fyi('Checking "Open in new tab"')
dapp.browser_entry_long_press(custom_name)
dapp.open_in_new_tab_button.click()
web_page.options_button.click()
if not web_page.element_by_translation_id('remove-favourite').is_element_displayed():
self.errors.append("Remove favourite is not shown on added bookmark!")
dapp.click_system_back_button()
self.home.just_fyi('Check deleting bookmark')
web_page.open_tabs_button.click()
web_page.empty_tab_button.click()
dapp.browser_entry_long_press(custom_name)
dapp.delete_bookmark_button.click()
if web_page.element_by_text(custom_name).is_element_displayed():
self.errors.append("Bookmark with custom name is not deleted!")
self.home.just_fyi('Check "Edit bookmark" and "Open in new tab"')
edited_name = 'My Fav Status'
dapp.browser_entry_long_press(default_bookmark_name)
dapp.edit_bookmark_button.click()
web_page.edit_bookmark_name(edited_name)
if not web_page.element_by_text(edited_name).is_element_displayed():
self.driver.fail("Edited bookmark name is not shown!")
self.errors.verify_no_errors()
@marks.testrail_id(702078)
def test_browser_web3_permissions_testdapp(self):
self.home.home_button.double_click()
self.home.just_fyi('open Status Test Dapp, allow all and check permissions in Profile')
web_view = self.home.open_status_test_dapp()
dapp = self.home.dapp_tab_button.click()
profile = self.home.profile_button.click()
profile.privacy_and_security_button.click()
profile.dapp_permissions_button.click()
profile.element_by_text(test_dapp_name).click()
if not profile.element_by_text(self.home.status_account_name).is_element_displayed():
self.errors.append('Wallet permission was not granted')
if not profile.element_by_translation_id("chat-key").is_element_displayed():
self.errors.append('Contact code permission was not granted')
profile.just_fyi('revoke access and check that they are asked second time')
profile.revoke_access_button.click()
profile.get_back_to_home_view()
profile.dapp_tab_button.click()
web_view.open_tabs_button.click()
web_view.empty_tab_button.click()
dapp.open_url(test_dapp_url)
if not dapp.element_by_text_part(self.home.status_account_name).is_element_displayed():
self.errors.append('Wallet permission is not asked')
if dapp.allow_button.is_element_displayed():
dapp.allow_button.click(times_to_click=1)
if not dapp.element_by_translation_id("your-contact-code").is_element_displayed():
self.errors.append('Profile permission is not asked')
self.errors.verify_no_errors()

View File

@ -645,6 +645,10 @@ class BaseView(object):
def reopen_app(self, password=common_password, sign_in=True): def reopen_app(self, password=common_password, sign_in=True):
app_package = self.driver.current_package app_package = self.driver.current_package
self.driver.terminate_app(app_package) self.driver.terminate_app(app_package)
for _ in range(3):
if self.driver.query_app_state(app_package) == 1:
break
time.sleep(1)
self.driver.activate_app(app_package) self.driver.activate_app(app_package)
if sign_in: if sign_in:
sign_in_view = self.get_sign_in_view() sign_in_view = self.get_sign_in_view()

Binary file not shown.

Before

Width:  |  Height:  |  Size: 5.0 KiB

After

Width:  |  Height:  |  Size: 6.3 KiB

View File

@ -361,7 +361,10 @@ class HomeView(BaseView):
def handle_contact_request(self, username: str, action='accept'): def handle_contact_request(self, username: str, action='accept'):
if self.toast_content_element.is_element_displayed(10): if self.toast_content_element.is_element_displayed(10):
self.toast_content_element.wait_for_invisibility_of_element() self.toast_content_element.wait_for_invisibility_of_element()
if self.notifications_unread_badge.is_element_displayed(30): try:
self.notifications_unread_badge.wait_for_visibility_of_element(30)
except TimeoutException:
pass
self.open_activity_center_button.click_until_presence_of_element(self.close_activity_centre) self.open_activity_center_button.click_until_presence_of_element(self.close_activity_centre)
chat_element = ActivityCenterElement(self.driver, username[:25]) chat_element = ActivityCenterElement(self.driver, username[:25])
try: try:
@ -376,6 +379,8 @@ class HomeView(BaseView):
chat_element.cancel_contact_request() chat_element.cancel_contact_request()
else: else:
self.driver.fail("Illegal option for CR!") self.driver.fail("Illegal option for CR!")
except NoSuchElementException:
self.driver.fail("No contact request received from %s" % username)
finally: finally:
self.close_activity_centre.wait_for_rendering_ended_and_click() self.close_activity_centre.wait_for_rendering_ended_and_click()
self.chats_tab.wait_for_visibility_of_element() self.chats_tab.wait_for_visibility_of_element()