e2e: cleanup

This commit is contained in:
Churikova Tetiana 2022-04-14 10:48:34 +02:00
parent 87b87e0d95
commit b53b7b331a
No known key found for this signature in database
GPG Key ID: 0D4EA7B33B47E6D8
33 changed files with 6688 additions and 6830 deletions

View File

@ -12,7 +12,7 @@ pipeline {
string(
name: 'TEST_MARKERS',
description: 'Marker expression for matching tests to run.',
defaultValue: 'critical or high',
defaultValue: 'critical',
) */
string(
name: 'APK_NAME',

View File

@ -128,7 +128,7 @@ class TestrailReport(BaseTestReport):
key, value = arg.split('=')
case_ids = value.split(',')
if len(case_ids) == 0:
if 'critical or high' in argv:
if 'critical' in argv:
for category in test_cases['pr']:
for case in self.get_cases([test_cases['pr'][category]]):
case_ids.append(case['id'])

View File

@ -1,455 +0,0 @@
from tests import marks, pair_code, common_password
from tests.base_test_case import SingleDeviceTestCase, MultipleDeviceTestCase
from views.sign_in_view import SignInView
from tests.users import basic_user, transaction_senders
class TestCreateAccount(SingleDeviceTestCase):
@marks.testrail_id(5742)
@marks.medium
def test_keycard_interruption_creating_onboarding_flow(self):
sign_in = SignInView(self.driver)
sign_in.just_fyi('Cancel on PIN code setup stage')
sign_in.accept_tos_checkbox.enable()
sign_in.get_started_button.click()
sign_in.generate_key_button.click()
username = sign_in.first_username_on_choose_chat_name.text
sign_in.next_button.click()
keycard_flow = sign_in.keycard_storage_button.click()
keycard_flow.next_button.click()
keycard_flow.begin_setup_button.click()
keycard_flow.connect_card_button.wait_and_click()
keycard_flow.enter_another_pin()
keycard_flow.cancel_button.click()
sign_in.just_fyi('Cancel from Confirm seed phrase: initialized + 1 pairing slot is used')
keycard_flow.begin_setup_button.click()
keycard_flow.enter_default_pin()
keycard_flow.enter_default_pin()
seed_phrase = keycard_flow.get_seed_phrase()
keycard_flow.confirm_button.click()
keycard_flow.yes_button.click()
keycard_flow.cancel_button.click()
if not keycard_flow.element_by_text_part('Back up seed phrase').is_element_displayed():
self.driver.fail('On canceling setup from Confirm seed phrase was not redirected to expected screen')
sign_in.just_fyi('Cancel from Back Up seed phrase: initialized + 1 pairing slot is used')
keycard_flow.cancel_button.click()
keycard_flow.begin_setup_button.click()
keycard_flow.element_by_translation_id("back-up-seed-phrase").wait_for_element(10)
new_seed_phrase = keycard_flow.get_seed_phrase()
if new_seed_phrase != seed_phrase:
self.errors.append('Another seed phrase is shown after cancelling setup during Back up seed phrase')
keycard_flow.backup_seed_phrase()
keycard_flow.enter_default_pin()
for element in sign_in.maybe_later_button, sign_in.lets_go_button:
element.wait_for_visibility_of_element(30)
element.click()
sign_in.profile_button.wait_for_visibility_of_element(30)
sign_in.just_fyi('Check username and relogin')
profile = sign_in.get_profile_view()
public_key, real_username = profile.get_public_key_and_username(return_username=True)
if real_username != username:
self.errors.append('Username was changed after interruption of creating account')
profile.logout()
home = sign_in.sign_in(keycard=True)
if not home.wallet_button.is_element_displayed(10):
self.errors.append("Failed to login to Keycard account")
self.errors.verify_no_errors()
@marks.testrail_id(6246)
@marks.medium
@marks.flaky
def test_keycard_interruption_access_key_onboarding_flow(self):
sign_in = SignInView(self.driver)
sign_in.accept_tos_checkbox.enable()
sign_in.get_started_button.click()
sign_in.access_key_button.click()
sign_in.enter_seed_phrase_button.click()
sign_in.seedphrase_input.click()
sign_in.seedphrase_input.set_value(basic_user['passphrase'])
sign_in.next_button.click()
sign_in.reencrypt_your_key_button.click()
keycard_flow = sign_in.keycard_storage_button.click()
sign_in.just_fyi('Cancel on PIN code setup stage')
keycard_flow.next_button.click()
keycard_flow.begin_setup_button.click()
keycard_flow.connect_card_button.wait_and_click()
keycard_flow.enter_another_pin()
keycard_flow.cancel_button.click()
sign_in.just_fyi('Finish setup and relogin')
keycard_flow.begin_setup_button.click()
keycard_flow.enter_default_pin()
keycard_flow.enter_default_pin()
for element in sign_in.maybe_later_button, sign_in.lets_go_button:
element.wait_for_visibility_of_element(30)
element.click()
sign_in.profile_button.wait_for_visibility_of_element(30)
public_key, default_username = sign_in.get_public_key_and_username(return_username=True)
profile_view = sign_in.get_profile_view()
if public_key != basic_user['public_key']:
self.errors.append('Public key %s does not match expected' % public_key)
if default_username != basic_user['username']:
self.errors.append('Default username %s does not match expected' % default_username)
profile_view.logout()
home = sign_in.sign_in(keycard=True)
if not home.wallet_button.is_element_displayed(10):
self.errors.append("Failed to login to Keycard account")
self.errors.verify_no_errors()
@marks.testrail_id(6243)
@marks.medium
def test_keycard_can_recover_keycard_account_offline_and_add_watch_only_acc(self):
sign_in = SignInView(self.driver)
sign_in.toggle_airplane_mode()
sign_in.just_fyi('Recover multiaccount offline')
sign_in.accept_tos_checkbox.enable()
sign_in.get_started_button.click_until_presence_of_element(sign_in.access_key_button)
sign_in.access_key_button.click()
sign_in.recover_with_keycard_button.click()
keycard_view = sign_in.begin_recovery_button.click()
keycard_view.connect_pairing_card_button.click()
keycard_view.pair_code_input.set_value(pair_code)
keycard_view.confirm()
keycard_view.enter_default_pin()
sign_in.maybe_later_button.click_until_presence_of_element(sign_in.lets_go_button)
sign_in.lets_go_button.click_until_absense_of_element(sign_in.lets_go_button)
sign_in.home_button.wait_for_visibility_of_element(30)
wallet_view = sign_in.wallet_button.click()
sign_in.just_fyi('Relogin offline')
self.driver.close_app()
self.driver.launch_app()
sign_in.sign_in(keycard=True)
if not sign_in.home_button.is_element_displayed(10):
self.driver.fail('Keycard user is not logged in')
sign_in.just_fyi('Turn off airplane mode and turn on cellular network')
sign_in.toggle_airplane_mode()
sign_in.toggle_mobile_data()
sign_in.element_by_text_part('Stop syncing').wait_and_click(60)
sign_in.wallet_button.click()
if not wallet_view.element_by_text_part('LXS').is_element_displayed():
self.errors.append('Token balance is not fetched while on cellular network!')
wallet_view.just_fyi('Add watch-only account when on cellular network')
wallet_view.add_account_button.click()
wallet_view.add_watch_only_address_button.click()
wallet_view.enter_address_input.send_keys(basic_user['address'])
account_name = 'watch-only'
wallet_view.account_name_input.send_keys(account_name)
wallet_view.add_account_generate_account_button.click()
account_button = wallet_view.get_account_by_name(account_name)
if not account_button.is_element_displayed():
self.driver.fail('Account was not added')
wallet_view.just_fyi('Check that balance is changed after go back to WI-FI')
sign_in.toggle_mobile_data()
for asset in ('ADI', 'STT'):
wallet_view.asset_by_name(asset).scroll_to_element()
wallet_view.wait_balance_is_changed(asset, wait_time=60)
wallet_view.just_fyi('Delete watch-only account')
wallet_view.get_account_by_name(account_name).click()
wallet_view.get_account_options_by_name(account_name).click()
wallet_view.account_settings_button.click()
wallet_view.delete_account_button.click()
wallet_view.yes_button.click()
if wallet_view.get_account_by_name(account_name).is_element_displayed(20):
self.errors.append('Account was not deleted')
self.errors.verify_no_errors()
@marks.testrail_id(6311)
@marks.medium
@marks.transaction
def test_same_seed_added_inside_multiaccount_and_keycard(self):
sign_in = SignInView(self.driver)
recipient = "0x" + transaction_senders['ETH_7']['address']
user = transaction_senders['ETH_ADI_STT_3']
sign_in.just_fyi('Restore keycard multiaccount and logout')
sign_in.recover_access(passphrase=user['passphrase'], keycard=True)
profile_view = sign_in.profile_button.click()
profile_view.logout()
sign_in.just_fyi('Create new multiaccount')
sign_in.close_button.click()
sign_in.your_keys_more_icon.click()
sign_in.generate_new_key_button.click()
sign_in.next_button.click()
sign_in.next_button.click()
sign_in.create_password_input.set_value(common_password)
sign_in.next_button.click()
sign_in.confirm_your_password_input.set_value(common_password)
sign_in.next_button.click()
sign_in.maybe_later_button.click_until_presence_of_element(sign_in.lets_go_button)
sign_in.lets_go_button.click()
sign_in.just_fyi('Add to wallet seed phrase for restored multiaccount')
wallet = sign_in.wallet_button.click()
wallet.add_account_button.click()
wallet.enter_a_seed_phrase_button.click()
wallet.enter_your_password_input.send_keys(common_password)
account_name = 'subacc'
wallet.account_name_input.send_keys(account_name)
wallet.enter_seed_phrase_input.set_value(user['passphrase'])
wallet.add_account_generate_account_button.click()
wallet.get_account_by_name(account_name).click()
sign_in.just_fyi('Send transaction from added account and log out')
transaction_amount_added = wallet.get_unique_amount()
wallet.send_transaction(from_main_wallet=False, amount=transaction_amount_added, recipient=recipient,
sign_transaction=True)
wallet.profile_button.click()
profile_view.logout()
sign_in.just_fyi('Login to keycard account and send another transaction')
sign_in.back_button.click()
sign_in.sign_in(position=2, keycard=True)
sign_in.wallet_button.click()
wallet.wait_balance_is_changed('ETH')
transaction_amount_keycard = wallet.get_unique_amount()
wallet.send_transaction(amount=transaction_amount_keycard, recipient=recipient, keycard=True,
sign_transaction=True)
for amount in [transaction_amount_keycard, transaction_amount_added]:
sign_in.just_fyi("Checking '%s' tx" % amount)
self.network_api.find_transaction_by_unique_amount(user['address'], amount)
self.errors.verify_no_errors()
@marks.testrail_id(695841)
@marks.medium
def test_keycard_settings_pin_puk_pairing(self):
sign_in = SignInView(self.driver)
seed = basic_user['passphrase']
home = sign_in.recover_access(passphrase=seed, keycard=True)
profile = home.profile_button.click()
home.just_fyi("Checking changing PIN")
profile.keycard_button.scroll_and_click()
keycard = profile.change_pin_button.click()
keycard.enter_another_pin()
keycard.wait_for_element_starts_with_text('2 attempts left', 30)
keycard.enter_default_pin()
if not keycard.element_by_translation_id("new-pin-description").is_element_displayed():
self.driver.fail("Screen for setting new pin is not shown!")
[keycard.enter_another_pin() for _ in range(2)]
if not keycard.element_by_translation_id("pin-changed").is_element_displayed(30):
self.driver.fail("Popup about successful setting new PIN is not shown!")
keycard.ok_button.click()
home.just_fyi("Checking changing PUK with new PIN")
profile.change_puk_button.click()
keycard.enter_another_pin()
if not keycard.element_by_translation_id("new-puk-description").is_element_displayed():
self.driver.fail("Screen for setting new puk is not shown!")
[keycard.one_button.click() for _ in range(12)]
if not keycard.element_by_translation_id("repeat-puk").is_element_displayed():
self.driver.fail("Confirmation screen for setting new puk is not shown!")
[keycard.one_button.click() for _ in range(12)]
if not keycard.element_by_translation_id("puk-changed").is_element_displayed(30):
self.driver.fail("Popup about successful setting new PUK is not shown!")
keycard.ok_button.click()
home.just_fyi("Checking setting pairing with new PIN")
profile.change_pairing_code_button.click()
keycard.enter_another_pin()
sign_in.create_password_input.set_value(common_password)
sign_in.confirm_your_password_input.set_value(common_password + "1")
if not keycard.element_by_translation_id("pairing-code_error1").is_element_displayed():
self.errors.append("No error is shown when pairing codes don't match")
sign_in.confirm_your_password_input.delete_last_symbols(1)
sign_in.element_by_translation_id("change-pairing").click()
if not keycard.element_by_translation_id("pairing-changed").is_element_displayed(30):
self.driver.fail("Popup about successful setting new pairing is not shown!")
keycard.ok_button.click()
home.just_fyi("Checking backing up keycard")
profile.create_keycard_backup_button.scroll_and_click()
sign_in.seedphrase_input.set_value(seed)
sign_in.next_button.click()
keycard.return_card_to_factory_settings_checkbox.enable()
keycard.begin_setup_button.click()
keycard.yes_button.wait_and_click()
[keycard.enter_another_pin() for _ in range(2)]
keycard.element_by_translation_id("keycard-backup-success-title").wait_for_element(30)
keycard.ok_button.click()
self.errors.verify_no_errors()
@marks.testrail_id(695851)
@marks.medium
def test_keycard_frozen_card_flows(self):
sign_in = SignInView(self.driver)
seed = basic_user['passphrase']
home = sign_in.recover_access(passphrase=seed, keycard=True)
profile = home.profile_button.click()
profile.keycard_button.scroll_and_click()
home.just_fyi('Set new PUK')
keycard = profile.change_puk_button.click()
keycard.enter_default_pin()
[keycard.enter_default_puk() for _ in range(2)]
keycard.ok_button.click()
home.just_fyi("Checking reset with PUK when logged in")
keycard = profile.change_pin_button.click()
keycard.enter_another_pin()
keycard.wait_for_element_starts_with_text('2 attempts left', 30)
keycard.enter_another_pin()
keycard.element_by_text_part('one attempt').wait_for_element(30)
keycard.enter_another_pin()
if not home.element_by_translation_id("keycard-is-frozen-title").is_element_displayed(30):
self.driver.fail("No popup about frozen keycard is shown!")
home.element_by_translation_id("keycard-is-frozen-reset").click()
keycard.enter_another_pin()
home.element_by_text_part('2/2').wait_for_element(20)
keycard.enter_another_pin()
home.element_by_translation_id("enter-puk-code").click()
keycard.enter_default_puk()
home.element_by_translation_id("keycard-access-reset").wait_for_element(20)
home.profile_button.double_click()
profile.logout()
home.just_fyi("Checking reset with PUK when logged out")
keycard.enter_default_pin()
keycard.wait_for_element_starts_with_text('2 attempts left', 30)
keycard.enter_default_pin()
keycard.element_by_text_part('one attempt').wait_for_element(30)
keycard.enter_default_pin()
if not home.element_by_translation_id("keycard-is-frozen-title").is_element_displayed():
self.driver.fail("No popup about frozen keycard is shown!")
home.element_by_translation_id("keycard-is-frozen-reset").click()
keycard.enter_another_pin()
home.element_by_text_part('2/2').wait_for_element(20)
keycard.enter_another_pin()
home.element_by_translation_id("enter-puk-code").click()
keycard.enter_default_puk()
home.element_by_translation_id("keycard-access-reset").wait_for_element(20)
home.element_by_translation_id("open").click()
home.just_fyi("Checking reset with seed when logged in")
profile = home.profile_button.click()
profile.keycard_button.scroll_and_click()
profile.change_pin_button.click()
keycard.enter_default_pin()
keycard.wait_for_element_starts_with_text('2 attempts left', 30)
keycard.enter_default_pin()
keycard.element_by_text_part('one attempt').wait_for_element(30)
keycard.enter_default_pin()
if not home.element_by_translation_id("keycard-is-frozen-title").is_element_displayed():
self.driver.fail("No popup about frozen keycard is shown!")
home.element_by_translation_id("dismiss").click()
profile.profile_button.double_click()
profile.keycard_button.scroll_and_click()
profile.change_pin_button.click()
keycard.enter_default_pin()
if not home.element_by_translation_id("keycard-is-frozen-title").is_element_displayed(30):
self.driver.fail("No reset card flow is shown for frozen card")
home.element_by_translation_id("keycard-is-frozen-factory-reset").click()
sign_in.seedphrase_input.set_value(transaction_senders['A']['passphrase'])
sign_in.next_button.click()
if not home.element_by_translation_id("seed-key-uid-mismatch").is_element_displayed():
self.driver.fail("No popup about mismatch in seed phrase is shown!")
home.element_by_translation_id("try-again").click()
sign_in.seedphrase_input.clear()
sign_in.seedphrase_input.set_value(seed)
sign_in.next_button.click()
keycard.begin_setup_button.click()
keycard.yes_button.click()
keycard.enter_default_pin()
home.element_by_translation_id("intro-wizard-title5").wait_for_element(20)
keycard.enter_default_pin()
home.element_by_translation_id("keycard-access-reset").wait_for_element(30)
home.ok_button.click()
profile.profile_button.double_click()
profile.logout()
home.just_fyi("Checking reset with seed when logged out")
keycard.enter_another_pin()
keycard.wait_for_element_starts_with_text('2 attempts left', 30)
keycard.enter_another_pin()
keycard.element_by_text_part('one attempt').wait_for_element(30)
keycard.enter_another_pin()
if not home.element_by_translation_id("keycard-is-frozen-title").is_element_displayed():
self.driver.fail("No popup about frozen keycard is shown!")
sign_in.element_by_translation_id("keycard-is-frozen-factory-reset").click()
sign_in.seedphrase_input.set_value(seed)
sign_in.next_button.click()
keycard.begin_setup_button.click()
keycard.yes_button.click()
keycard.enter_default_pin()
home.element_by_translation_id("intro-wizard-title5").wait_for_element(20)
keycard.enter_default_pin()
home.element_by_translation_id("keycard-access-reset").wait_for_element(30)
home.ok_button.click()
keycard.enter_default_pin()
home.home_button.wait_for_element(30)
@marks.testrail_id(695852)
@marks.medium
def test_keycard_blocked_card_lost_or_frozen_flows(self):
sign_in = SignInView(self.driver)
seed = basic_user['passphrase']
home = sign_in.recover_access(passphrase=seed, keycard=True)
profile = home.profile_button.click()
profile.keycard_button.scroll_and_click()
home.just_fyi("Checking blocked card screen when entering 3 times invalid PIN + 5 times invalid PUK")
keycard = profile.change_pin_button.click()
keycard.enter_another_pin()
keycard.wait_for_element_starts_with_text('2 attempts left', 30)
keycard.enter_another_pin()
keycard.element_by_text_part('one attempt').wait_for_element(30)
keycard.enter_another_pin()
if not home.element_by_translation_id("keycard-is-frozen-title").is_element_displayed():
self.driver.fail("No popup about frozen keycard is shown!")
home.element_by_translation_id("keycard-is-frozen-reset").click()
keycard.enter_another_pin()
home.element_by_text_part('2/2').wait_for_element(20)
keycard.enter_another_pin()
home.element_by_translation_id("enter-puk-code").click()
for i in range(1, 4):
keycard.enter_default_puk()
sign_in.wait_for_element_starts_with_text('%s attempts left' % str(5 - i))
i += 1
keycard.enter_default_puk()
sign_in.element_by_text_part('one attempt').wait_for_element(30)
keycard.enter_default_puk()
keycard.element_by_translation_id("keycard-is-blocked-title").wait_for_element(30)
keycard.close_button.click()
if not keycard.element_by_translation_id("keycard-blocked").is_element_displayed():
self.errors.append("In keycard settings there is no info that card is blocked")
keycard.back_button.click()
profile.logout()
home.just_fyi("Check blocked card when user is logged out and use lost or frozen to restore access")
keycard.enter_another_pin()
keycard.element_by_translation_id("keycard-is-blocked-title").wait_for_element(30)
keycard.element_by_translation_id("keycard-recover").click()
keycard.yes_button.click()
sign_in.seedphrase_input.set_value(seed)
sign_in.next_button.click()
keycard.begin_setup_button.click()
keycard.yes_button.click()
keycard.enter_default_pin()
home.element_by_translation_id("intro-wizard-title5").wait_for_element(20)
keycard.enter_default_pin()
home.element_by_translation_id("keycard-access-reset").wait_for_element(30)
home.ok_button.click()
keycard.enter_default_pin()
home.home_button.wait_for_element(30)
self.errors.verify_no_errors()

File diff suppressed because it is too large Load Diff

View File

@ -1,763 +0,0 @@
import time
import random
import emoji
from tests import marks, background_service_message
from tests.users import basic_user, dummy_user, ens_user_ropsten, ens_user
from tests.base_test_case import SingleDeviceTestCase, MultipleDeviceTestCase
from views.sign_in_view import SignInView
from views.chat_view import ChatView
class TestChatManagement(SingleDeviceTestCase):
@marks.testrail_id(5426)
@marks.medium
def test_public_clear_history_via_options_and_long_press(self):
home = SignInView(self.driver).create_user()
home.just_fyi("Creating 3 types of chats")
public_options, public_long_press = '#public-clear-options', '#public-long-options'
message = 'test message'
for pub_chat in [public_options[1:], public_long_press[1:]]:
chat = home.join_public_chat(pub_chat)
[chat.send_message(message) for _ in range(2)]
home.home_button.double_click()
home.just_fyi('Clearing history via long press')
home.clear_chat_long_press(public_long_press)
home.just_fyi('Clearing history via options')
chat = home.get_chat(public_options).click()
chat.clear_history()
if chat.element_by_text(message).is_element_displayed():
self.errors.append(
'Messages in %s chat are still shown after clearing history via options' % public_options)
home.just_fyi("Recheck that history won't reappear after relogin")
home.relogin()
for chat_name in public_options, public_long_press:
chat = home.get_chat(chat_name).click()
if chat.chat_element_by_text(message).is_element_displayed():
self.errors.append('Messages in %s chat are shown after clearing history and relaunch' % chat_name)
chat.home_button.click()
self.errors.verify_no_errors()
@marks.testrail_id(6320)
@marks.medium
def test_can_start_chat_from_suggestions_using_search_chat(self):
sign_in = SignInView(self.driver)
home = sign_in.create_user()
chat = ChatView(self.driver)
ens_name_status, ens_name_another_domain, public_chat_name = ens_user_ropsten['ens'], \
ens_user['ens_another'], 'some-pub-chat'
search_list = {
ens_name_status: {
'home': {
'Start a new private chat',
'Join a public chat',
'%s.stateofus.eth' % ens_name_status,
'#%s' % ens_name_status
},
'navigate_to': '%s.stateofus.eth' % ens_name_status,
'chat': {
chat.add_to_contacts,
chat.element_by_text('@%s' % ens_name_status),
chat.chat_message_input
}
},
ens_name_another_domain: {
'home': {
'Start a new private chat',
},
'home_not_shown': 'Join a public chat',
'navigate_to': 'Start a new private chat',
'chat': {
chat.add_to_contacts,
chat.element_by_text('@%s' % ens_name_another_domain),
chat.chat_message_input
},
},
public_chat_name: {
'home': {
'Join a public chat',
},
'home_not_shown': 'Start a new private chat',
'navigate_to': '#%s' % public_chat_name,
'chat': {
chat.element_by_text('#%s' % public_chat_name),
chat.chat_message_input
},
},
}
home.just_fyi('Join public chat to have search input on home view')
chat_name = home.get_random_chat_name()
public_chat = home.join_public_chat(chat_name)
public_chat.get_back_to_home_view()
home.swipe_down()
for keyword in search_list:
home.just_fyi('Can start chat from searching for %s' % keyword)
home.search_by_keyword(keyword)
if not home.element_by_text_part('No search results. Do you mean').is_element_displayed():
self.errors.append('"No search results" is not shown')
if 'home_not_shown' in search_list[keyword]:
if home.element_by_text(search_list[keyword]['home_not_shown']).is_element_displayed():
self.errors.append('%s is shown on home view while searching for %s' % (
search_list[keyword]['home_not_shown'], keyword))
for text in search_list[keyword]['home']:
if not home.element_by_text(text).is_element_displayed():
self.errors.append('%s is not shown on home view while searching for %s' % (text, keyword))
home.element_by_text(search_list[keyword]['navigate_to']).click()
for element in search_list[keyword]['chat']:
if not element.is_element_displayed():
self.errors.append(
'Requested %s element is not shown on chat view after navigating from suggestion '
'for %s' % (element.name, keyword))
home.back_button.click()
home.just_fyi('No suggestion at attempt to search for invalid data')
invalid_data = [' ', 'ab;', '.6', '@ana']
for text in invalid_data:
home.search_by_keyword(text)
if home.element_by_text_part('No search results. Do you mean').is_element_displayed():
self.errors.append('"No search results" is shown when searching for invalid value %s' % text)
home.cancel_button.click()
self.errors.verify_no_errors()
@marks.testrail_id(6319)
@marks.medium
def test_deny_access_camera_and_gallery(self):
home = SignInView(self.driver).create_user()
general_camera_error = home.element_by_translation_id("camera-access-error")
home.just_fyi("Denying access to camera in universal qr code scanner")
home.plus_button.click()
home.universal_qr_scanner_button.click()
home.deny_button.click()
general_camera_error.wait_for_visibility_of_element(3)
home.ok_button.click()
home.get_back_to_home_view()
home.just_fyi("Denying access to camera in scan chat key view")
home.plus_button.click()
chat = home.start_new_chat_button.click()
chat.scan_contact_code_button.click()
chat.deny_button.click()
general_camera_error.wait_for_visibility_of_element(3)
chat.ok_button.click()
home.get_back_to_home_view()
home.just_fyi("Denying access to gallery at attempt to send image")
home.add_contact(basic_user['public_key'])
chat.show_images_button.click()
chat.deny_button.click()
chat.element_by_translation_id("external-storage-denied").wait_for_visibility_of_element(3)
chat.ok_button.click()
home.just_fyi("Denying access to audio at attempt to record audio")
chat.audio_message_button.click()
chat.deny_button.click()
chat.element_by_translation_id("audio-recorder-permissions-error").wait_for_visibility_of_element(3)
chat.ok_button.click()
home.get_back_to_home_view()
home.just_fyi("Denying access to camera in wallet view")
wallet = home.wallet_button.click()
wallet.scan_qr_button.click()
wallet.deny_button.click()
general_camera_error.wait_for_visibility_of_element(3)
wallet.ok_button.click()
home.just_fyi("Denying access to camera in send transaction > scan address view")
wallet.accounts_status_account.click()
send_transaction = wallet.send_transaction_button.click()
send_transaction.chose_recipient_button.scroll_and_click()
send_transaction.scan_qr_code_button.click()
send_transaction.deny_button.click()
general_camera_error.wait_for_visibility_of_element(3)
send_transaction.ok_button.click()
wallet.close_button.click()
wallet.close_send_transaction_view_button.click()
home.just_fyi("Allow access to camera in universal qr code scanner and check it in other views")
wallet.home_button.click()
home.plus_button.click()
home.universal_qr_scanner_button.click()
home.allow_button.click()
if not home.element_by_text('Scan QR code').is_element_displayed():
self.errors.append('Scan QR code is not opened after denying and allowing permission to the camera')
home.cancel_button.click()
wallet = home.wallet_button.click()
wallet.scan_qr_button.click()
if not home.element_by_text('Scan QR code').is_element_displayed():
self.errors.append(
'Scan QR code is not opened after allowing permission to the camera from univesal QR code'
' scanner view')
wallet.cancel_button.click()
wallet.home_button.click()
home.get_chat(basic_user['username']).click()
chat.show_images_button.click()
chat.allow_button.click()
if not chat.first_image_from_gallery.is_element_displayed():
self.errors.append('Image previews are not shown after denying and allowing access to gallery')
self.errors.verify_no_errors()
@marks.testrail_id(5757)
@marks.medium
def test_search_chat_on_home(self):
sign_in = SignInView(self.driver)
home = sign_in.create_user()
home.just_fyi('Join public chat, start 1-1 with username and with ENS')
chat_name = home.get_random_chat_name()
public_chat = home.join_public_chat(chat_name)
public_chat.get_back_to_home_view()
for public_key in (basic_user['public_key'], ens_user_ropsten['ens'], dummy_user['public_key']):
chat = home.add_contact(public_key)
chat.get_back_to_home_view()
profile = home.profile_button.click()
profile.open_contact_from_profile(dummy_user['username'])
nickname = 'dummy_user'
public_chat.set_nickname(nickname)
public_chat.home_button.click()
search_list = {
basic_user['username']: basic_user['username'],
ens_user_ropsten['username']: ens_user_ropsten['ens'],
chat_name: chat_name,
nickname: nickname,
dummy_user['username']: nickname,
ens_user_ropsten['ens']: ens_user_ropsten['ens']
}
home.just_fyi('Can search for public chat name, ens name, username')
home.swipe_down()
for keyword in search_list:
home.search_by_keyword(keyword)
search_results = home.chat_name_text.find_elements()
if not search_results:
self.errors.append('No search results after searching by %s keyword' % keyword)
for element in search_results:
if search_list[keyword] not in element.text:
self.errors.append("'%s' is shown on the home screen after searching by '%s' keyword" %
(element.text, keyword))
home.cancel_button.click()
home.just_fyi('Can search for public chat while offline')
home.toggle_airplane_mode()
home.search_input.click()
home.search_input.send_keys(chat_name)
search_results = home.chat_name_text.find_elements()
if not search_results:
self.errors.append('No search results after searching by %s keyword' % chat_name)
for element in search_results:
if search_list[chat_name] not in element.text:
self.errors.append("'%s' is shown on the home screen after searching by '%s' keyword" %
(element.text, chat_name))
self.errors.verify_no_errors()
@marks.testrail_id(6221)
@marks.medium
def test_app_on_background_by_back_button(self):
sign_in = SignInView(self.driver)
home = sign_in.create_user()
home.click_system_back_button()
home.driver.press_keycode(187)
if self.driver.current_activity != '.NexusLauncherActivity':
self.driver.fail('App is not in background! Current activity is: %s' % self.driver.current_activity)
home.status_in_background_button.click()
if not home.plus_button.is_element_displayed():
self.driver.fail('Chats view was not opened')
@marks.testrail_id(6213)
@marks.medium
def test_unblocked_user_is_not_added_in_contacts(self):
home = SignInView(self.driver).create_user()
chat = home.add_contact(basic_user["public_key"], add_in_contacts=False)
chat.just_fyi('Block user not added as contact from chat view')
chat.chat_options.click()
chat.view_profile_button.click()
chat.block_contact()
chat.get_back_to_home_view()
chat.just_fyi('Unblock user not added as contact from chat view')
profile = home.profile_button.click()
profile.contacts_button.click()
profile.blocked_users_button.click()
profile.element_by_text(basic_user["username"]).click()
chat.unblock_contact_button.click()
profile.just_fyi('Navigating to contact list and check that user is not in list')
profile.close_button.click()
profile.back_button.click()
if profile.element_by_text(basic_user["username"]).is_element_displayed():
self.driver.fail("Unblocked user not added previously in contact list added in contacts!")
@marks.testrail_id(5498)
@marks.medium
def test_share_user_profile_url_public_chat(self):
home = SignInView(self.driver).create_user()
home.just_fyi('Join to one-to-one chat and share link to other user profile via messenger')
chat = home.add_contact(dummy_user["public_key"])
chat.chat_options.click()
chat.view_profile_button.click_until_presence_of_element(chat.remove_from_contacts)
chat.profile_details.click()
chat.share_button.click()
chat.share_via_messenger()
if not chat.element_by_text_part(
'https://join.status.im/u/%s' % dummy_user["public_key"]).is_element_present():
self.errors.append("Can't share public key of contact")
for _ in range(2):
chat.click_system_back_button()
home.just_fyi('Join to public chat and share link to it via messenger')
chat.get_back_to_home_view()
public_chat_name = 'pubchat'
public_chat = home.join_public_chat(public_chat_name)
public_chat.chat_options.click()
public_chat.share_chat_button.click()
public_chat.share_via_messenger()
if not chat.element_by_text_part('https://join.status.im/%s' % public_chat_name).is_element_present():
self.errors.append("Can't share link to public chat")
for _ in range(2):
chat.click_system_back_button()
chat.get_back_to_home_view()
home.just_fyi('Open URL and share link to it via messenger')
daap = home.dapp_tab_button.click()
browser = daap.open_url('dap.ps')
browser.options_button.click()
browser.share_url_button.click()
browser.share_via_messenger()
expeceted_text_1 = 'https://join.status.im/b/https://dap.ps'
expeceted_text_2 = 'https://join.status.im/b/http://dap.ps'
if not (chat.element_by_text_part(expeceted_text_1).is_element_present() or
chat.element_by_text_part(expeceted_text_2).is_element_present()):
self.errors.append("Can't share link to URL")
self.errors.verify_no_errors()
class TestChatManagementMultipleDevice(MultipleDeviceTestCase):
@marks.testrail_id(5763)
@marks.medium
def test_block_user_from_one_to_one_header_check_push_notification_service(self):
self.create_drivers(2)
device_1, device_2 = SignInView(self.drivers[0]), SignInView(self.drivers[1])
message_before_block_1 = "Before block from %s" % device_1.driver.number
message_before_block_2 = "Before block from %s" % device_2.driver.number
message_after_block_2 = "After block from %s" % device_2.driver.number
home_1, home_2 = device_1.create_user(enable_notifications=True), device_2.create_user()
profile_1 = home_1.profile_button.click()
device_2_public_key = home_2.get_public_key_and_username()
home_2.home_button.click()
default_username_1 = profile_1.default_username_text.text
profile_1.home_button.click()
device_1.just_fyi('both devices joining the same public chat and send messages')
chat_name = device_1.get_random_chat_name()
for home in home_1, home_2:
home.join_public_chat(chat_name)
chat_public_1, chat_public_2 = home_1.get_chat_view(), home_2.get_chat_view()
for chat in chat_public_1, chat_public_2:
chat.chat_message_input.send_keys("Before block from %s" % chat.driver.number)
chat.send_message_button.click()
chat_public_1.get_back_to_home_view()
chat_public_2.get_back_to_home_view()
device_1.just_fyi('both devices joining 1-1 chat and exchanging several messages')
chat_1 = home_1.add_contact(device_2_public_key)
for _ in range(2):
chat_1.chat_message_input.send_keys(message_before_block_1)
chat_1.send_message_button.click()
chat_2 = home_2.get_chat(default_username_1).click()
for _ in range(2):
chat_2.chat_message_input.send_keys(message_before_block_2)
chat_2.send_message_button.click()
device_1.just_fyi('block user')
chat_1.chat_options.click()
chat_1.view_profile_button.click()
chat_1.block_contact()
chat_1.get_back_to_home_view()
chat_1.home_button.click()
device_1.just_fyi('no 1-1, messages from blocked user are hidden in public chat')
from views.home_view import ChatElement
blocked_chat_user = ChatElement(self.drivers[0], basic_user['username'])
if blocked_chat_user.is_element_displayed():
home_1.driver.fail("Chat with blocked user '%s' is not deleted" % device_2.driver.number)
public_chat_after_block_1 = home_1.join_public_chat(chat_name)
if public_chat_after_block_1.chat_element_by_text(message_before_block_2).is_element_displayed():
self.errors.append(
"Messages from blocked user '%s' are not cleared in public chat '%s'" % (device_2.driver.number,
chat_name))
device_1.click_system_home_button()
device_2.just_fyi('send messages to 1-1 and public chat')
for _ in range(2):
chat_2.chat_message_input.send_keys(message_after_block_2)
chat_2.send_message_button.click()
chat_2.get_back_to_home_view()
home_2.join_public_chat(chat_name)
chat_public_2 = home_2.get_chat_view()
[chat_public_2.send_message(message_after_block_2) for _ in range(2)]
device_1.just_fyi("check that new messages and push notifications don't arrive from blocked user")
device_1.open_notification_bar()
if device_1.element_by_text_part(message_after_block_2).is_element_displayed():
self.errors.append("Push notification is received from blocked user")
device_1.element_by_text_part(background_service_message).click()
if public_chat_after_block_1.chat_element_by_text(message_after_block_2).is_element_displayed():
self.errors.append("Message from blocked user '%s' is received" % device_2.driver.number)
if home_1.notifications_unread_badge.is_element_displayed():
device_1.driver.fail("Unread badge is shown after receiving new message from blocked user")
if blocked_chat_user.is_element_displayed():
device_2.driver.fail("Chat with blocked user is reappeared after receiving new messages in home view")
device_1.open_notification_bar()
home_1.stop_status_service_button.click()
device_2.just_fyi("send messages when device 1 is offline")
for _ in range(2):
chat_public_2.chat_message_input.send_keys(message_after_block_2)
chat_public_2.send_message_button.click()
chat_public_2.get_back_to_home_view()
home_2.get_chat(default_username_1).click()
for _ in range(2):
chat_2.chat_message_input.send_keys(message_after_block_2)
chat_2.send_message_button.click()
device_1.just_fyi("reopen app and check that messages from blocked user are not fetched")
device_1.click_system_home_button()
self.drivers[0].launch_app()
device_1.sign_in()
public_chat_after_block_1.home_button.double_click()
if home_1.notifications_unread_badge.is_element_displayed():
device_1.driver.fail("Unread badge is shown after after fetching new messages from offline")
if blocked_chat_user.is_element_displayed():
self.errors.append("Chat with blocked user is reappeared after fetching new messages from offline")
home_1.join_public_chat(chat_name)
home_1.get_chat_view()
if chat_public_1.chat_element_by_text(message_after_block_2).is_element_displayed():
self.errors.append("Message from blocked user '%s' is received after fetching new messages from offline"
% device_2.driver.number)
device_1.just_fyi("check that PNs are still enabled in profile after closing 'background notification centre' "
"message and relogin")
device_1.open_notification_bar()
if not device_1.element_by_text_part(background_service_message).is_element_displayed():
self.errors.append("Background notification service is not started after relogin")
self.errors.verify_no_errors()
@marks.testrail_id(6233)
@marks.medium
def test_reply_to_message_in_chats(self):
self.create_drivers(2)
device_1, device_2 = SignInView(self.drivers[0]), SignInView(self.drivers[1])
message_from_sender = "Message sender"
message_from_receiver = "Message receiver"
home_1, home_2 = device_1.create_user(), device_2.create_user()
device_1.just_fyi('Both devices join to 1-1 chat')
device_2_public_key = home_2.get_public_key_and_username()
device_1_profile = home_1.profile_button.click()
device_1_username = device_1_profile.default_username_text.text
home_1.home_button.click()
device_1.just_fyi("Sender adds receiver and quotes own message")
device_1_chat = home_1.add_contact(device_2_public_key)
device_1_chat.send_message(message_from_sender)
device_1_chat.quote_message(message_from_sender)
if device_1_chat.quote_username_in_message_input.text != "↪ You":
self.errors.append("'You' is not displayed in reply quote snippet replying to own message")
device_1_chat.just_fyi("Clear quote and check there is not snippet anymore")
device_1_chat.cancel_reply_button.click()
if device_1_chat.cancel_reply_button.is_element_displayed():
self.errors.append("Message quote kept in public chat input after it's cancelation")
device_1_chat.just_fyi("Send reply")
device_1_chat.quote_message(message_from_sender)
reply_to_message_from_sender = message_from_sender + " reply"
device_1_chat.send_message(reply_to_message_from_sender)
device_1.just_fyi("Receiver verifies received reply...")
home_2.home_button.click()
device_2_chat_item = home_2.get_chat(device_1_username)
device_2_chat_item.wait_for_visibility_of_element(20)
device_2_chat = device_2_chat_item.click()
if device_2_chat.chat_element_by_text(reply_to_message_from_sender).replied_message_text != message_from_sender:
self.errors.append("No reply received in 1-1 chat")
device_1_chat.back_button.click()
device_2_chat.back_button.click()
device_1.just_fyi('both devices joining the same public chat and send messages')
chat_name = device_1.get_random_chat_name()
for home in home_1, home_2:
home.join_public_chat(chat_name)
chat_public_1, chat_public_2 = home_1.get_chat_view(), home_2.get_chat_view()
chat_public_1.send_message(message_from_sender)
chat_public_2.quote_message(message_from_sender)
if chat_public_2.quote_username_in_message_input.text != ("↪ Replying to " + device_1_username):
self.errors.append(
" %s is not displayed in reply quote snippet replying to own message " % device_1_username)
device_1.just_fyi('Message receiver verifies reply is present in received message')
chat_public_2.send_message(message_from_receiver)
public_replied_message = chat_public_1.chat_element_by_text(message_from_receiver)
if public_replied_message.replied_message_text != message_from_sender:
self.errors.append("Reply is not present in message received in public chat")
device_1.just_fyi('Can reply to link')
link_message, reply = 'Test with link: https://status.im/ here should be nothing unusual.' \
' Just a regular reply.', 'reply to link'
chat_public_1.send_message(link_message)
chat_public_2.quote_message(link_message[:10])
chat_public_2.send_message(reply)
public_replied_message = chat_public_1.chat_element_by_text(reply)
if public_replied_message.replied_message_text != link_message:
self.errors.append("Reply for '%s' not present in message received in public chat" % link_message)
device_1.just_fyi('Can reply to emoji message')
reply = 'reply to emoji'
emoji_message = random.choice(list(emoji.EMOJI_UNICODE))
emoji_unicode = emoji.EMOJI_UNICODE[emoji_message]
chat_public_1.send_message(emoji.emojize(emoji_message))
chat_public_2.quote_message(emoji.emojize(emoji_message))
chat_public_2.send_message(reply)
public_replied_message = chat_public_1.chat_element_by_text(reply)
if public_replied_message.replied_message_text != emoji_unicode:
self.errors.append("Reply for '%s' emoji not present in message received in public chat" % emoji_unicode)
self.errors.verify_no_errors()
@marks.testrail_id(6326)
@marks.medium
def test_mention_users_not_in_chats_if_not_in_contacts(self):
self.create_drivers(2)
device_1, device_2 = SignInView(self.drivers[0]), SignInView(self.drivers[1])
sender = ens_user
home_1, home_2 = device_1.create_user(), device_2.recover_access(passphrase=sender['passphrase'])
profile_2 = home_2.profile_button.click()
profile_2.connect_existing_ens(sender['ens'])
profile_2.home_button.double_click()
device_1.just_fyi('Both devices joining the same public chat and send messages')
chat_name = device_1.get_random_chat_name()
[chat_1, chat_2] = [home.join_public_chat(chat_name) for home in (home_1, home_2)]
message = 'From ' + sender['ens'] + ' message'
chat_2.send_message(message)
username_value = '@' + sender['ens']
self.drivers[1].close_app()
self.drivers[1].launch_app()
device_2.back_button.click()
device_2.your_keys_more_icon.click()
device_2.generate_new_key_button.click()
device_2.create_user(second_user=True)
home_2.join_public_chat(chat_name)
newusermessage = 'Newusermessage2'
chat_2.send_message(newusermessage)
random_username = chat_1.chat_element_by_text(newusermessage).username.text
chat_1.wait_ens_name_resolved_in_chat(message=message, username_value=username_value)
device_1.just_fyi('Set nickname for ENS user')
chat_1.view_profile_long_press(message)
nickname = 'nicknamefortestuser'
chat_1.set_nickname(nickname)
ens_nickname_value = nickname + " @" + sender['ens']
chat_1.wait_ens_name_resolved_in_chat(message=message, username_value=ens_nickname_value)
device_1.just_fyi('Check there is ENS+Nickname user in separate 1-1 chat')
chat_1.get_back_to_home_view()
home_1.add_contact(public_key=basic_user['public_key'])
chat_1.chat_message_input.send_keys('@')
if (chat_1.search_user_in_mention_suggestion_list(ens_nickname_value).is_element_displayed() or
chat_1.search_user_in_mention_suggestion_list(
sender['username']).is_element_displayed()):
self.errors.append('ENS-owner user who is not in 1-1 chat is available in mention suggestion list')
device_1.just_fyi('Check there is no random user in different public chat')
chat_1.get_back_to_home_view()
chat_1 = home_1.join_public_chat(chat_name + "2")
chat_1.chat_message_input.send_keys('@')
if chat_1.search_user_in_mention_suggestion_list(random_username).is_element_displayed():
self.errors.append('Random user from public chat is in mention suggestion list another public chat')
device_1.just_fyi('Check there is ENS+Nickname user in Group chat and no random user')
chat_1.get_back_to_home_view()
home_1.add_contact(sender['public_key'])
chat_1.get_back_to_home_view()
home_1.create_group_chat(user_names_to_add=[nickname])
chat_1.chat_message_input.send_keys('@')
if chat_1.search_user_in_mention_suggestion_list(random_username).is_element_displayed():
self.errors.append('Random user from public chat is in mention suggestion list of Group chat')
if not (chat_1.search_user_in_mention_suggestion_list(ens_nickname_value).is_element_displayed() or
chat_1.search_user_in_mention_suggestion_list(sender['username']).is_element_displayed()):
self.errors.append('ENS-owner user is not available in mention suggestion list of Group chat')
device_1.just_fyi('Check there is no blocked user in mentions Group/Public chat ')
home_1.home_button.click()
public_1 = home_1.join_public_chat(chat_name)
public_1.chat_element_by_text(message).member_photo.click()
public_1.block_contact()
public_1.chat_message_input.send_keys('@')
if (chat_1.search_user_in_mention_suggestion_list(ens_nickname_value).is_element_displayed() or
chat_1.search_user_in_mention_suggestion_list(sender['username']).is_element_displayed()):
self.errors.append('Blocked user is available in mention suggestion list')
self.errors.verify_no_errors()
@marks.testrail_id(695771)
@marks.medium
def test_activity_center_group_chats_trusted_contacts(self):
self.create_drivers(2)
device_1, device_2 = SignInView(self.drivers[0]), SignInView(self.drivers[1])
message_from_sender = "Message sender"
group_chat_name_1 = "GroupChat1"
group_chat_name_2 = "GroupChat2"
home_1, home_2 = device_1.create_user(), device_2.create_user()
device_1.just_fyi('Device1 sets permissions to accept chat requests only from trusted contacts')
profile_1 = home_1.profile_button.click()
profile_1.privacy_and_security_button.click()
profile_1.accept_new_chats_from.click()
profile_1.accept_new_chats_from_contacts_only.click()
profile_1.profile_button.click()
public_key_user_1, username_1 = profile_1.get_public_key_and_username(return_username=True)
public_key_user_2, username_2 = home_2.get_public_key_and_username(return_username=True)
device_1.just_fyi('Device2 creates 1-1 chat Group chats')
home_2.home_button.click()
one_to_one_device_2 = home_2.add_contact(public_key_user_1)
one_to_one_device_2.send_message(message_from_sender)
one_to_one_device_2.home_button.click()
home_2.create_group_chat([username_1], group_chat_name=group_chat_name_1)
device_1.just_fyi('Device1 check there are no any chats in Activity Center nor Chats view')
home_1.home_button.click()
if home_1.element_by_text_part(username_2).is_element_displayed() or home_1.element_by_text_part(
group_chat_name_1).is_element_displayed():
self.errors.append("Chats are present on Chats view despite they created by non-contact")
home_1.notifications_button.click()
if home_1.element_by_text_part(username_2).is_element_displayed() or home_1.element_by_text_part(
group_chat_name_1).is_element_displayed():
self.errors.append("Chats are present in Activity Center view despite they created by non-contact")
device_1.just_fyi('Device1 adds Device2 in Contacts so chat requests should be visible now')
home_1.home_button.click()
home_1.add_contact(public_key_user_2)
device_1.just_fyi('Device2 creates 1-1 chat Group chats once again')
home_2.home_button.click()
home_2.get_chat_from_home_view(username_1).click()
one_to_one_device_2.send_message(message_from_sender)
one_to_one_device_2.home_button.click()
home_2.create_group_chat([username_1], group_chat_name=group_chat_name_2)
device_1.just_fyi('Device1 verifies 1-1 chat Group chats are visible')
home_1.home_button.click()
if not home_1.element_by_text_part(username_2).is_element_displayed() or not home_1.element_by_text_part(
group_chat_name_2).is_element_displayed():
self.errors.append("Chats are not present on Chats view while they have to!")
self.errors.verify_no_errors()
@marks.testrail_id(695782)
@marks.medium
def test_can_accept_or_reject_multiple_chats_from_activity_center(self):
self.create_drivers(2)
device_1, device_2 = SignInView(self.drivers[0]), SignInView(self.drivers[1])
message_from_sender = "Message sender"
group_chat_name_1 = "GroupChat1"
group_chat_name_2 = "GroupChat2"
home_1, home_2 = device_1.create_user(), device_2.create_user()
device_1.just_fyi('Device1 adds Devices and creates 1-1 and Group chat with it')
public_key_user_1, username_1 = home_1.get_public_key_and_username(return_username=True)
public_key_user_2, username_2 = home_2.get_public_key_and_username(return_username=True)
home_1.home_button.click()
device_1_one_to_one_chat = home_1.add_contact(public_key_user_2)
device_1_one_to_one_chat.send_message(message_from_sender)
device_1_one_to_one_chat.home_button.click()
home_1.create_group_chat([username_2], group_chat_name=group_chat_name_1)
home_1.home_button.click()
home_2.home_button.click()
device_1.just_fyi('Device2 rejects both chats and verifies they disappeared and not in Chats too')
home_2.notifications_button.click()
home_2.notifications_select_button.click()
home_2.element_by_text_part(username_1[:10]).click()
home_2.element_by_text_part(group_chat_name_1).click()
home_2.notifications_reject_and_delete_button.click()
if home_2.element_by_text_part(username_1[:20]).is_element_displayed(2):
self.errors.append("1-1 chat is on Activity Center view after action made on it")
if home_2.element_by_text_part(group_chat_name_1).is_element_displayed(2):
self.errors.append("Group chat is on Activity Center view after action made on it")
home_2.home_button.click()
if home_2.element_by_text_part(username_1[:20]).is_element_displayed(2):
self.errors.append("1-1 chat is added on home after rejection")
if home_2.element_by_text_part(group_chat_name_1).is_element_displayed(2):
self.errors.append("Group chat is added on home after rejection")
home_2.just_fyi("Verify there are still no chats after relogin")
home_2.relogin()
if home_2.element_by_text_part(username_1[:20]).is_element_displayed(2):
self.errors.append("1-1 chat appears on Chats view after relogin")
if home_2.element_by_text_part(group_chat_name_1).is_element_displayed(2):
self.errors.append("Group chat appears on Chats view after relogin")
home_2.notifications_button.click()
if home_2.element_by_text_part(username_1[:20]).is_element_displayed(2):
self.errors.append("1-1 chat request reappears back in Activity Center view after relogin")
if home_2.element_by_text_part(group_chat_name_1).is_element_displayed(2):
self.errors.append("Group chat request reappears back in Activity Center view after relogin")
home_2.home_button.click()
device_1.just_fyi('Device1 creates 1-1 and Group chat again')
home_1.get_chat_from_home_view(username_2).click()
device_1_one_to_one_chat.send_message('Some text here')
device_1_one_to_one_chat.home_button.click()
home_1.create_group_chat([username_2], group_chat_name=group_chat_name_2)
device_1.just_fyi('Device2 accepts both chats (via Select All button) and verifies they disappeared '
'from activity center view but present on Chats view')
home_2.notifications_button.click()
home_2.notifications_select_button.click()
home_2.notifications_select_all.click()
home_2.notifications_accept_and_add_button.click()
if home_2.element_by_text_part(username_1[:20]).is_element_displayed(2):
self.errors.append("1-1 chat request stays on Activity Center view after it was accepted")
if home_2.element_by_text_part(group_chat_name_2).is_element_displayed(2):
self.errors.append("Group chat request stays on Activity Center view after it was accepted")
home_2.home_button.click()
if not home_2.element_by_text_part(username_1[:20]).is_element_displayed(2):
self.errors.append("1-1 chat is not added on home after accepted from Activity Center")
if not home_2.element_by_text_part(group_chat_name_2).is_element_displayed(2):
self.errors.append("Group chat is not added on home after accepted from Activity Center")
self.errors.verify_no_errors()

View File

@ -1,260 +0,0 @@
import time
import pytest
from tests import marks
from tests.users import transaction_senders, ens_user
from tests.base_test_case import MultipleDeviceTestCase, MultipleSharedDeviceTestCase, create_shared_drivers
from views.sign_in_view import SignInView
@pytest.mark.xdist_group(name="commands_2")
@marks.critical
class TestCommandsMultipleDevicesMerged(MultipleSharedDeviceTestCase):
@classmethod
def setup_class(cls):
cls.drivers, cls.loop = create_shared_drivers(2)
cls.device_1, cls.device_2 = SignInView(cls.drivers[0]), SignInView(cls.drivers[1])
cls.sender = transaction_senders['ETH_STT_3']
cls.home_1 = cls.device_1.recover_access(passphrase=cls.sender['passphrase'], enable_notifications=True)
cls.home_2 = cls.device_2.create_user()
for home in cls.home_1, cls.home_2:
profile = home.profile_button.click()
profile.profile_notifications_button.scroll_and_click()
profile.wallet_push_notifications.click()
cls.recipient_public_key, cls.recipient_username = cls.home_2.get_public_key_and_username(return_username=True)
cls.wallet_1, cls.wallet_2 = cls.home_1.wallet_button.click(), cls.home_2.wallet_button.click()
[wallet.home_button.click() for wallet in (cls.wallet_1, cls.wallet_2)]
cls.chat_1 = cls.home_1.add_contact(cls.recipient_public_key)
cls.chat_1.send_message("hello!")
cls.account_name_1 = cls.wallet_1.status_account_name
@marks.testrail_id(6253)
@marks.transaction
def test_1_1_chat_command_send_eth_outgoing_tx_push(self):
amount = self.chat_1.get_unique_amount()
self.home_1.just_fyi('Send %s ETH in 1-1 chat and check it for sender and receiver: Address requested' % amount)
self.chat_1.commands_button.click()
send_transaction = self.chat_1.send_command.click()
send_transaction.get_username_in_transaction_bottom_sheet_button(self.recipient_username).click()
if send_transaction.scan_qr_code_button.is_element_displayed():
self.drivers[0].fail('Recipient is editable in bottom sheet when send ETH from 1-1 chat')
send_transaction.amount_edit_box.set_value(amount)
send_transaction.confirm()
send_transaction.sign_transaction_button.click()
sender_message = 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 23.11.21, 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.set_value(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.set_value(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)
@marks.transaction
def test_1_1_chat_command_request_and_receive_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')
self.home_1.driver.close_app()
self.home_2.just_fyi('Request %s STT in 1-1 chat and check it is visible for sender and receiver' % amount)
chat_2 = self.home_2.get_chat(username=self.sender['username']).click()
chat_2.commands_button.click()
request_transaction = chat_2.request_command.click()
request_transaction.amount_edit_box.set_value(amount)
request_transaction.confirm()
asset_button = request_transaction.asset_by_name(asset_name)
request_transaction.select_asset_button.click_until_presence_of_element(asset_button)
asset_button.click()
request_transaction.request_transaction_button.click()
chat_2_request_message = chat_2.get_incoming_transaction()
if not chat_2_request_message.is_element_displayed():
self.drivers[1].fail('No incoming transaction in 1-1 chat is shown for recipient after requesting STT')
self.home_1.just_fyi('Check that transaction message is fetched from offline and sign transaction')
self.device_1.driver.launch_app()
self.device_1.sign_in()
self.home_1.connection_offline_icon.wait_for_invisibility_of_element(30)
self.home_1.get_chat(self.recipient_username).click()
chat_1_sender_message = self.chat_1.get_outgoing_transaction()
if not chat_1_sender_message.is_element_displayed():
self.drivers[0].fail('No outgoing transaction in 1-1 chat is shown for sender after requesting STT')
chat_1_sender_message.transaction_status.wait_for_element_text(chat_1_sender_message.address_received)
send_message = chat_1_sender_message.sign_and_send.click()
send_message.next_button.click()
send_message.sign_transaction()
self.home_2.just_fyi('Check that transaction message is updated with new status after offline')
[chat.toggle_airplane_mode() for chat in (self.chat_1, chat_2)]
self.network_api.wait_for_confirmation_of_transaction(self.sender['address'], amount, token=True)
for home in (self.home_1, self.home_2):
home.toggle_airplane_mode()
home.home_button.double_click()
home.connection_offline_icon.wait_for_invisibility_of_element(100)
self.home_2.get_chat(self.sender['username']).click()
self.home_1.get_chat(self.recipient_username).click()
[message.transaction_status.wait_for_element_text(message.confirmed, wait_time=120) for message in
(chat_1_sender_message, chat_2_request_message)]
self.home_1.just_fyi('Check that can find tx in history and balance is updated after offline')
self.home_1.wallet_button.click()
self.wallet_1.wait_balance_is_changed('STT', initial_amount_stt)
self.wallet_1.find_transaction_in_history(amount=amount, asset=asset_name)
self.errors.verify_no_errors()
class TestCommandsMultipleDevices(MultipleDeviceTestCase):
@marks.testrail_id(6257)
@marks.medium
@marks.transaction
def test_network_mismatch_for_send_request_in_1_1_chat(self):
sender = transaction_senders['ETH_1']
self.create_drivers(2)
sign_in_1, sign_in_2 = SignInView(self.drivers[0]), SignInView(self.drivers[1])
sign_in_1.recover_access(passphrase=sender['passphrase'])
sign_in_2.create_user()
home_1, home_2 = sign_in_1.get_home_view(), sign_in_2.get_home_view()
wallet_1 = home_1.wallet_button.click()
wallet_1.home_button.click()
profile_2 = home_2.profile_button.click()
username_2 = profile_2.default_username_text.text
profile_2.switch_network()
chat_2 = home_2.add_contact(sender['public_key'])
chat_2.send_message("Hey there!")
amount = chat_2.get_unique_amount()
chat_2.commands_button.click()
request_transaction = chat_2.request_command.click()
request_transaction.amount_edit_box.set_value(amount)
request_transaction.confirm()
request_transaction.request_transaction_button.click()
chat_2_request_message = chat_2.get_incoming_transaction()
chat_2_request_message.long_press_element()
if chat_2.reply_message_button.is_element_displayed():
self.errors.append('Reply is available on long-tap on Incoming transaction message!')
chat_1 = home_1.get_chat(username_2).click()
chat_1_sender_message = chat_1.get_outgoing_transaction()
chat_1_sender_message.long_press_element()
if chat_1.reply_message_button.is_element_displayed():
self.errors.append('Reply is available on long-tap on Outgoing transaction message!')
send_message = chat_1_sender_message.sign_and_send.click()
send_message.next_button.click()
send_message.sign_transaction()
self.network_api.wait_for_confirmation_of_transaction(sender['address'], amount)
chat_1_sender_message.transaction_status.wait_for_element_text(chat_1_sender_message.confirmed)
wallet_2 = chat_2.wallet_button.click()
wallet_2.accounts_status_account.click()
wallet_2.swipe_down()
wallet_2.home_button.click(desired_view="chat")
if chat_2_request_message.transaction_status == chat_1_sender_message.confirmed:
self.errors.append("Transaction is shown as confirmed on mainnet, but was sent on ropsten!")
self.errors.verify_no_errors()

View File

@ -1,173 +0,0 @@
from tests import marks
from tests.base_test_case import MultipleDeviceTestCase
from views.sign_in_view import SignInView
from views.chat_view import CommunityView
class TestCommunitiesMultipleDevices(MultipleDeviceTestCase):
@marks.testrail_id(695842)
@marks.medium
@marks.flaky
def test_creating_community_accept_membership(self):
self.create_drivers(2)
home_1, home_2 = SignInView(self.drivers[0]).create_user(), SignInView(self.drivers[1]).create_user()
community_name, pub_chat_name, channel_name = "some name", home_1.get_random_chat_name(), "first_channel"
community_description, community_pic = "something in community", 'sauce_logo.png'
message, message_member = "message", "from member"
userkey_2, username_2 = home_2.get_public_key_and_username(return_username=True)
home_2.home_button.click()
community_1 = home_1.create_community(community_name, community_description, set_image=True,
file_name=community_pic)
channel_1 = community_1.add_channel(channel_name)
channel_1.send_message(message)
home_1.home_button.double_click()
home_1.just_fyi("Sending community link to public chat")
community_1 = home_1.get_chat(community_name, community=True).click()
community_link_text = community_1.copy_community_link()
pub_1 = home_1.join_public_chat(pub_chat_name)
pub_1.chat_message_input.paste_text_from_clipboard()
pub_1.send_message_button.click()
pub_1.get_back_to_home_view()
home_2.just_fyi("Tapping on community link and request membership")
pub_2 = home_2.join_public_chat(pub_chat_name)
pub_2.element_by_text(community_name).wait_for_element(100)
community_message_2 = pub_2.get_community_link_preview_by_text(community_link_text)
if community_message_2.community_description != community_description:
self.errors.append(
"Community description '%s' does not match expected" % community_message_2.community_description)
if community_message_2.community_members_amount != 1:
self.errors.append("Members amount in resolved message '%s' does not match expected" % str(
community_message_2.community_members_amount))
community_message_2.view()
community_2 = CommunityView(self.drivers[1])
community_2.request_access_button.click()
if not community_2.membership_request_pending_text.is_element_displayed():
self.errors.append("Membership request is not pending")
home_1.just_fyi("Checking pending membership")
community_1 = home_1.get_chat(community_name, community=True).click()
community_1.community_options_button.click()
community_1.community_info_button.click()
community_1.community_membership_request_value.wait_for_element(60)
if community_1.community_membership_request_value.text != '1':
self.drivers[0].fail(
"Membership request value '%s' is not equal expected" % community_1.community_membership_request_value)
home_1.just_fyi("Approve membership")
community_1.handle_membership_request(username_2, approve=True)
if not community_1.element_by_text(username_2).is_element_displayed():
self.errors.append("New member %s is not shown as added to community on info page!" % username_2)
if not community_2.community_info_picture.is_element_image_similar_to_template(community_pic):
self.errors.append("Community image is different!")
channel_2 = community_2.get_chat(channel_name).click()
if not channel_2.chat_element_by_text(message).is_element_displayed(30):
self.errors.append("Message was not received in community channel!")
channel_2.send_message(message_member)
community_1.home_button.double_click()
home_1.get_chat(community_name, community=True).click()
chat_element_1 = community_1.get_chat(channel_name)
if not chat_element_1.new_messages_public_chat.is_element_displayed():
self.errors.append("Unread messages counter is not shown for community channel!")
if not community_1.element_by_text(message_member).is_element_displayed():
self.errors.append("Message from member is not shown for community channel!")
self.errors.verify_no_errors()
@marks.testrail_id(695845)
@marks.medium
def test_notification_in_activity_center_for_mention_in_community_and_group_chat(self):
self.create_drivers(2)
home_1, home_2 = SignInView(self.drivers[0]).create_user(), SignInView(self.drivers[1]).create_user()
community_name, gr_chat_name, channel_name = "some name", home_1.get_random_chat_name(), "first_channel"
community_description = "something in community"
message, message_member = "message", "from member"
userkey_2, username_2 = home_2.get_public_key_and_username(return_username=True)
userkey_1, username_1 = home_1.get_public_key_and_username(return_username=True)
home_1.home_button.click()
one_to_one_1 = home_1.add_contact(userkey_2)
one_to_one_1.home_button.click()
home_2.home_button.click()
home_1.just_fyi("Create community on Device_1")
community_1 = home_1.create_community(community_name, community_description, set_image=True)
channel_1 = community_1.add_channel(channel_name)
channel_1.send_message(message)
home_1.home_button.double_click()
home_1.just_fyi("Joining Group chat, receiving community link in there")
one_to_one_2 = home_2.add_contact(userkey_1)
one_to_one_2.home_button.click()
community_1 = home_1.get_chat(community_name, community=True).click()
community_link_text = community_1.copy_community_link()
pub_1 = home_1.create_group_chat(user_names_to_add=[username_2], group_chat_name=gr_chat_name)
pub_2 = home_2.get_chat(gr_chat_name).click()
pub_2.join_chat_button.click()
pub_1.chat_message_input.paste_text_from_clipboard()
pub_1.send_message_button.click()
pub_1.get_back_to_home_view()
home_2.just_fyi("Tapping on community link and request membership")
pub_2.element_by_text(community_name).wait_for_element(60)
community_message_2 = pub_2.get_community_link_preview_by_text(community_link_text)
community_2 = community_message_2.view()
community_2.request_access_button.click()
if not community_2.membership_request_pending_text.is_element_displayed():
self.errors.append("Membership request is not pending")
home_1.just_fyi("Checking pending membership")
community_1 = home_1.get_chat(community_name, community=True).click()
community_1.community_options_button.click()
community_1.community_info_button.click()
community_1.community_membership_request_value.wait_for_element(60)
home_1.just_fyi("Approve membership")
community_1.handle_membership_request(username_2, approve=True)
channel_2 = community_2.get_chat(channel_name).click()
channel_2.select_mention_from_suggestion_list(username_1, username_1[:2])
channel_2.send_as_keyevent("community")
channel_mesage = username_1 + " community"
channel_2.send_message_button.click()
community_1.home_button.double_click()
channel_2.home_button.click()
home_2.get_chat_from_home_view(gr_chat_name).click()
pub_2.select_mention_from_suggestion_list(username_1, username_1[:2])
pub_2.send_as_keyevent("group")
group_chat_message = username_1 + " group"
pub_2.send_message_button.click()
if not home_1.notifications_unread_badge.is_element_displayed():
self.errors.append("Unread badge is NOT shown after receiving mentions from Group and Community")
home_1.notifications_unread_badge.wait_and_click(30)
home_1.just_fyi("Check there are two notifications from two chats are present in Activity Center")
if home_1.get_chat_from_activity_center_view(username_2).chat_message_preview == group_chat_message:
home_1.just_fyi("Open group chat where user mentioned and return to Activity Center")
home_1.get_chat_from_activity_center_view(username_2).click()
home_1.home_button.click()
home_1.notifications_button.click()
else:
self.errors.append("No mention in Activity Center for Group Chat")
if home_1.get_chat_from_activity_center_view(username_2).chat_message_preview == channel_mesage:
home_1.just_fyi("Open community chat where user mentioned and return to Activity Center")
home_1.get_chat_from_activity_center_view(username_2).click()
home_1.home_button.click()
else:
self.errors.append("No mention in Activity Center for community chat")
home_1.just_fyi("Check there are no unread messages counters on chats after message read")
if (home_1.notifications_unread_badge.is_element_present() or
home_1.get_chat_from_home_view(gr_chat_name).new_messages_counter.text == "1" or
home_1.get_chat_from_home_view(community_name).new_messages_counter.text == "1"):
self.errors.append("Unread message indicator is kept after all messages read in chats")
home_1.just_fyi("Check there is an empty view on Activity Center")
home_1.notifications_button.click()
if not home_1.element_by_translation_id('empty-activity-center').is_element_present():
self.errors.append("It appears Activity Center still has some chats after user opened all of them")
self.errors.verify_no_errors()

View File

@ -1,222 +0,0 @@
from tests import marks
from tests.base_test_case import MultipleDeviceTestCase, SingleDeviceTestCase, MultipleSharedDeviceTestCase, create_shared_drivers
from tests.users import transaction_senders, ens_user, chat_users
from views.sign_in_view import SignInView
import random
import emoji
class TestGroupChatMultipleDevice(MultipleDeviceTestCase):
@marks.testrail_id(5694)
@marks.medium
def test_make_admin_member_of_group_chat(self):
self.create_drivers(2)
device_1, device_2 = SignInView(self.drivers[0]), SignInView(self.drivers[1])
home_1, home_2 = device_1.create_user(), device_2.create_user()
public_key_1, username_1 = device_1.get_public_key_and_username(True)
device_1.home_button.click()
chat_name = home_1.get_random_chat_name()
device_2.just_fyi('Create and join to group chat')
device_2_key, device_2_username = device_2.get_public_key_and_username(True)
device_2.home_button.click()
home_1.add_contact(device_2_key)
home_1.get_back_to_home_view()
chat_1 = home_1.create_group_chat([device_2_username], chat_name)
chat_2 = home_2.get_chat(chat_name).click()
chat_2.join_chat_button.click()
device_1.just_fyi('Check group info view and options of users')
chat_1.chat_options.click()
group_info_1 = chat_1.group_info.click()
if not group_info_1.user_admin(username_1).is_element_displayed():
self.errors.append("Admin user is not marked as admin")
group_info_1.get_user_from_group_info(username_1).click()
if chat_1.profile_block_contact.is_element_displayed():
self.errors.append("Admin is redirected to own profile on tapping own username from group info")
group_info_1.get_user_from_group_info(device_2_username).click()
if not chat_1.profile_block_contact.is_element_displayed():
self.errors.append("Admin is not redirected to user profile on tapping member username from group info")
chat_1.close_button.click()
device_1.just_fyi('Made admin another user and check system message')
options = group_info_1.get_username_options(device_2_username).click()
options.make_admin_button.click()
admin_system_message = chat_1.has_been_made_admin_system_message(username_1, device_2_username)
for chat in (chat_1, chat_2):
if not chat.chat_element_by_text(admin_system_message).is_element_displayed():
self.errors.append("Message with test '%s' was not received" % admin_system_message)
device_2.just_fyi('Check Admin in group info and that "add members" is available')
chat_2.chat_options.click()
group_info_1 = chat_2.group_info.click()
for username in (username_1, device_2_username):
if not group_info_1.user_admin(username).is_element_displayed():
self.errors.append("Admin user is not marked as admin")
if not group_info_1.add_members.is_element_displayed():
self.errors.append("Add member button is not available for new admin")
self.errors.verify_no_errors()
@marks.testrail_id(6327)
@marks.medium
def test_nicknames_ens_group_chats(self):
self.create_drivers(2)
home_1 = SignInView(self.drivers[0]).create_user()
home_2 = SignInView(self.drivers[1]).recover_access(ens_user['passphrase'])
profile_1, profile_2 = [home.profile_button.click() for home in (home_1, home_2)]
key_1, username_1 = profile_1.get_public_key_and_username(return_username=True)
ens, full_ens, username_2 = ens_user['ens'], '@%s' % ens_user['ens'], ens_user['username']
profile_2.connect_existing_ens(ens)
[profile.home_button.click() for profile in (profile_1, profile_2)]
home_1.just_fyi('Set nickname, using emojis, special chars and cyrrilic chars without adding to contact')
emoji_message = random.choice(list(emoji.EMOJI_UNICODE))
emoji_unicode = emoji.EMOJI_UNICODE[emoji_message]
special_char, cyrrilic = '"£¢€¥~`•|√π¶∆×°™®©%$@', 'стат'
nickname_to_set = emoji.emojize(emoji_message) + special_char + cyrrilic
nickname_expected = emoji_unicode + special_char + cyrrilic
chat_1 = home_1.add_contact(ens, add_in_contacts=False, nickname=nickname_to_set)
if chat_1.user_name_text.text != nickname_expected:
self.errors.append('Expected special char nickname %s does not match actual %s' % (nickname_expected, chat_1.user_name_text.text))
home_1.just_fyi('Can remove nickname without adding to contact')
chat_1.chat_options.click()
chat_1.view_profile_button.click()
chat_1.profile_nickname_button.click()
chat_1.nickname_input_field.clear()
chat_1.element_by_text('Done').click()
chat_1.close_button.click()
if chat_1.user_name_text.text != full_ens:
self.errors.append(
'Nickname was not removed! real chat name is %s instead of %s' % (chat_1.user_name_text.text, full_ens))
home_1.just_fyi('Adding ENS user to contacts and start group chat with him')
group_name = 'ens_group'
chat_1.add_to_contacts.click()
chat_2 = home_2.add_contact(key_1)
chat_2.send_message("first")
chat_2.home_button.click()
chat_1.home_button.click()
chat_1 = home_1.create_group_chat([full_ens], group_name)
chat_2 = home_2.get_chat(group_name).click()
chat_2.join_chat_button.click()
home_1.just_fyi('Check ENS and in group chat and suggestions list')
chat_1.element_by_text_part(full_ens).wait_for_visibility_of_element(60)
chat_1.select_mention_from_suggestion_list(ens, typed_search_pattern=ens[:2])
if chat_1.chat_message_input.text != '@' + ens + ' ':
self.errors.append(
'ENS username is not resolved in chat input after selecting it in mention suggestions list!')
additional_text = 'and more'
chat_1.send_as_keyevent(additional_text)
chat_1.send_message_button.click()
message_text = '%s %s' % (full_ens, additional_text)
if not chat_1.chat_element_by_text(message_text).is_element_displayed():
self.errors.append("ENS name is not resolved on sent message")
chat_1 = home_1.get_chat_view()
home_1.just_fyi('Set nickname via group info and check that can mention by nickname /username in group chat')
nickname = 'funny_bunny'
device_2_options = chat_1.get_user_options(full_ens)
device_2_options.view_profile_button.click()
chat_1.set_nickname(nickname, close_profile=False)
if not chat_1.element_by_text(nickname).is_element_displayed():
self.errors.append('Nickname is not shown in profile view after setting from group info')
chat_1.close_button.click()
chat_1.element_by_text(nickname).scroll_to_element()
chat_1.close_button.click()
message_text = '%s %s' % (nickname, additional_text)
if not chat_1.chat_element_by_text(message_text).is_element_displayed():
self.errors.append("ENS name was not replaced with nickname on sent message")
chat_1.chat_message_input.send_keys('@')
if not chat_1.element_by_text('%s %s' % (nickname, full_ens)).is_element_displayed():
self.errors.append("ENS name with nickname is not shown in mention input after set")
if not chat_1.element_by_text(username_2).is_element_displayed():
self.errors.append("3-random name is not shown in mention input after set from group info")
chat_1.chat_message_input.clear()
chat_1.select_mention_from_suggestion_list('%s %s' % (nickname, full_ens), typed_search_pattern=username_2[:2])
if chat_1.chat_message_input.text != '@' + ens + ' ':
self.errors.append(
'ENS is not resolved in chat input after setting nickname in mention suggestions list (search by 3-random name)!')
chat_1.chat_message_input.clear()
chat_1.select_mention_from_suggestion_list('%s %s' % (nickname, full_ens), typed_search_pattern=nickname[:2])
if chat_1.chat_message_input.text != '@' + ens + ' ':
self.errors.append(
'ENS is not resolved in chat input after setting nickname in mention suggestions list (search by nickname)!')
chat_1.chat_message_input.clear()
home_1.just_fyi('Can delete nickname via group info and recheck received messages')
device_2_options = chat_1.get_user_options(full_ens)
device_2_options.view_profile_button.click()
chat_1.profile_nickname_button.click()
chat_1.nickname_input_field.clear()
chat_1.element_by_text('Done').click()
chat_1.close_button.click()
chat_1.close_button.click()
message_text = '%s %s' % (full_ens, additional_text)
if not chat_1.chat_element_by_text(message_text).is_element_displayed():
self.errors.append("ENS name is not resolved on sent message after removing nickname")
chat_1.chat_message_input.send_keys('@')
if chat_1.element_by_text_part(nickname).is_element_displayed():
self.errors.append("Nickname is shown in group chat after removing!")
self.errors.verify_no_errors()
class TestCommandsSingleDevices(SingleDeviceTestCase):
@marks.testrail_id(5721)
@marks.medium
def test_cant_add_more_twenty_participants_to_group_chat(self):
sign_in = SignInView(self.driver)
home = sign_in.create_user()
users = [chat_users['A'],
chat_users['B'],
transaction_senders['ETH_8'],
transaction_senders['ETH_1'],
transaction_senders['ETH_2'],
transaction_senders['ETH_7'],
transaction_senders['ETH_STT_3'],
transaction_senders['ETH_STT_ADI_1'],
transaction_senders['C'],
transaction_senders['F'],
transaction_senders['G'],
transaction_senders['H'],
transaction_senders['I'],
transaction_senders['M'],
transaction_senders['N'],
transaction_senders['Q'],
transaction_senders['R'],
transaction_senders['S'],
transaction_senders['T'],
transaction_senders['U']]
usernames = []
home.just_fyi('Add 20 users to contacts')
profile = home.profile_button.click()
profile.contacts_button.click()
chat = home.get_chat_view()
for user in users:
profile.add_new_contact_button.click()
chat.public_key_edit_box.click()
chat.public_key_edit_box.set_value(user['public_key'])
chat.confirm_until_presence_of_element(profile.add_new_contact_button)
usernames.append(user['username'])
home.just_fyi('Create group chat with max amount of users')
profile.home_button.click()
chat = home.create_group_chat(usernames, 'some_group_chat')
home.just_fyi('Verify that can not add more users via group info')
chat.get_back_to_home_view()
home.get_chat('some_group_chat').click()
chat.chat_options.click()
group_info_view = chat.group_info.click()
if group_info_view.add_members.is_element_displayed():
self.errors.append('Add members button is displayed when max users are added in chat')
if not group_info_view.element_by_text_part('20 members').is_element_displayed():
self.errors.append('Amount of users is not shown on Group info screen')
self.errors.verify_no_errors()

View File

@ -1,118 +0,0 @@
import time
from tests import marks
from tests.users import transaction_senders, ens_user_ropsten
from tests.base_test_case import MultipleDeviceTestCase, SingleDeviceTestCase
from views.sign_in_view import SignInView
class TestCommandsMultipleDevices(MultipleDeviceTestCase):
@marks.testrail_id(6294)
@marks.medium
@marks.transaction
def test_keycard_request_and_receive_stt_in_1_1_chat_offline_opened_from_push(self):
sender = transaction_senders['ETH_STT_1']
self.create_drivers(2)
device_1, device_2 = SignInView(self.drivers[0]), SignInView(self.drivers[1])
device_1.just_fyi('Grab user data for transactions and public chat, set up wallets')
home_1 = device_1.create_user(keycard=True)
recipient_public_key, recipient_username = home_1.get_public_key_and_username(return_username=True)
amount = device_1.get_unique_amount()
asset_name = 'STT'
wallet_1 = home_1.wallet_button.click()
wallet_1.select_asset(asset_name)
wallet_1.home_button.click()
home_2 = device_2.recover_access(passphrase=sender['passphrase'], keycard=True, enable_notifications=True)
wallet_2 = home_2.wallet_button.click()
initial_amount_stt = wallet_2.get_asset_amount_by_name('STT')
wallet_2.home_button.click()
device_2.just_fyi('Add recipient to contact and send 1 message')
chat_2 = home_2.add_contact(recipient_public_key)
chat_2.send_message("Hey there!")
profile_2 = wallet_2.profile_button.click()
profile_2.airplane_mode_button.click()
device_2.home_button.double_click()
chat_element = home_1.get_chat(sender['username'])
chat_element.wait_for_visibility_of_element(30)
chat_1 = chat_element.click()
home_1.just_fyi('Request %s STT in 1-1 chat and check it is visible for sender and receiver' % amount)
chat_1.commands_button.click()
request_transaction = chat_1.request_command.click()
request_transaction.amount_edit_box.set_value(amount)
request_transaction.confirm()
asset_button = request_transaction.asset_by_name(asset_name)
request_transaction.select_asset_button.click_until_presence_of_element(asset_button)
asset_button.click()
request_transaction.request_transaction_button.click()
chat_1_request_message = chat_1.get_incoming_transaction()
if not chat_1_request_message.is_element_displayed():
self.drivers[0].fail('No incoming transaction in 1-1 chat is shown for recipient after requesting STT')
home_2.just_fyi('Check that transaction message is fetched from offline and sign transaction')
profile_2.airplane_mode_button.click()
transaction_request_pn = 'Request transaction'
device_2.open_notification_bar()
if not device_2.element_by_text(transaction_request_pn).is_element_displayed(60):
self.errors.append("Push notification is not received after going back from offline")
device_2.element_by_text(transaction_request_pn).click()
home_2.connection_offline_icon.wait_for_invisibility_of_element(120)
home_2.get_chat(recipient_username).click()
chat_2_sender_message = chat_2.get_outgoing_transaction()
chat_2_sender_message.wait_for_visibility_of_element(60)
chat_2_sender_message.transaction_status.wait_for_element_text(chat_2_sender_message.address_received)
send_message = chat_2_sender_message.sign_and_send.click()
send_message.next_button.click()
send_message.sign_transaction(keycard=True)
chat_1.toggle_airplane_mode()
home_2.just_fyi('Check that transaction message is updated with new status after offline')
[chat.toggle_airplane_mode() for chat in (chat_1, chat_2)]
self.network_api.wait_for_confirmation_of_transaction(sender['address'], amount, token=True)
for home in (home_1, home_2):
home.toggle_airplane_mode()
home.home_button.double_click()
home_1.get_chat(sender['username']).click()
home_2.get_chat(recipient_username).click()
chat_2_sender_message.transaction_status.wait_for_element_text(chat_2_sender_message.confirmed, wait_time=120)
home_1.just_fyi('Check that can find tx in history and balance is updated after offline')
[home.wallet_button.click() for home in (home_1, home_2)]
wallet_2.wait_balance_is_changed('STT', initial_amount_stt)
wallet_1.wait_balance_is_changed('STT', scan_tokens=True)
[wallet.find_transaction_in_history(amount=amount, asset='STT') for wallet in (wallet_1, wallet_2)]
self.errors.verify_no_errors()
class TestCommandsSingleDevices(SingleDeviceTestCase):
@marks.testrail_id(6295)
@marks.medium
@marks.transaction
def test_keycard_send_eth_to_ens(self):
sign_in = SignInView(self.driver)
sender = transaction_senders['ETH_4']
home = sign_in.recover_access(sender['passphrase'], keycard=True)
wallet = home.wallet_button.click()
wallet.home_button.click()
chat = home.add_contact(ens_user_ropsten['ens'])
chat.commands_button.click()
amount = chat.get_unique_amount()
send_message = chat.send_command.click()
send_message.amount_edit_box.set_value(amount)
send_message.confirm()
send_message.next_button.click()
from views.send_transaction_view import SendTransactionView
send_transaction = SendTransactionView(self.driver)
send_transaction.sign_transaction(keycard=True)
chat_sender_message = chat.get_outgoing_transaction()
self.network_api.wait_for_confirmation_of_transaction(sender['address'], amount)
chat_sender_message.transaction_status.wait_for_element_text(chat_sender_message.confirmed)

View File

@ -1,47 +0,0 @@
from tests import marks
from tests.base_test_case import SingleDeviceTestCase
from views.sign_in_view import SignInView
class TestBrowsing(SingleDeviceTestCase):
# TODO: waiting mode (rechecked 23.11.21, valid)
@marks.testrail_id(6300)
@marks.skip
@marks.medium
def test_webview_security(self):
home_view = SignInView(self.driver).create_user()
daap_view = home_view.dapp_tab_button.click()
browsing_view = daap_view.open_url('https://simpledapp.status.im/webviewtest/url-spoof-ssl.html')
browsing_view.url_edit_box_lock_icon.click()
if not browsing_view.element_by_translation_id("browser-not-secure").is_element_displayed():
self.errors.append("Broken certificate displayed as secure connection \n")
browsing_view.cross_icon.click()
daap_view.open_url('https://simpledapp.status.im/webviewtest/webviewtest.html')
browsing_view.element_by_text_part('204').click()
if browsing_view.element_by_text_part('google.com').is_element_displayed():
self.errors.append("URL changed on attempt to redirect to no-content page \n")
browsing_view.cross_icon.click()
daap_view.open_url('https://simpledapp.status.im/webviewtest/webviewtest.html')
browsing_view.element_by_text_part('XSS check').click()
browsing_view.open_in_status_button.click()
if browsing_view.element_by_text_part('simpledapp.status.im').is_element_displayed():
self.errors.append("XSS attemp succedded \n")
browsing_view.ok_button.click()
browsing_view.cross_icon.click()
daap_view.open_url('https://simpledapp.status.im/webviewtest/url-blank.html')
if daap_view.edit_url_editbox.text == '':
self.errors.append("Blank URL value. Must show the actual URL \n")
browsing_view.cross_icon.click()
daap_view.open_url('https://simpledapp.status.im/webviewtest/port-timeout.html')
# wait up ~2.5 mins for port time out
if daap_view.element_by_text_part('example.com').is_element_displayed(150):
self.errors.append("URL spoof due to port timeout \n")
self.errors.verify_no_errors()

View File

@ -1,126 +0,0 @@
from tests import marks, test_dapp_name
from tests.base_test_case import SingleDeviceTestCase
from tests.users import basic_user
from views.sign_in_view import SignInView
class TestDApps(SingleDeviceTestCase):
@marks.testrail_id(6635)
@marks.medium
def test_webview_camera_permission(self):
web_view_camera_url = 'https://simpledapp.status.im/webviewtest/webviewcamera.html'
home = SignInView(self.driver).create_user()
self.driver.set_clipboard_text(web_view_camera_url)
dapp = home.dapp_tab_button.click()
dapp.enter_url_editbox.click()
dapp.paste_text()
dapp.confirm()
from views.web_views.base_web_view import BaseWebView
camera_dapp = BaseWebView(self.driver)
camera_dapp.just_fyi("Check camera request blocked (because it's not enabled in app yet)")
camera_request_blocked = home.get_translation_by_key("page-camera-request-blocked")
if not dapp.element_by_text_part(camera_request_blocked).is_element_displayed():
self.driver.fail("There is no pop-up notifying that camera access need to be granted in app")
camera_dapp.swipe_down()
if not camera_dapp.camera_image_in_dapp.is_element_image_similar_to_template('blank_camera_image.png'):
self.driver.fail("Even camera permissions not allowed - acccess to camera granted")
profile = home.profile_button.click()
profile.privacy_and_security_button.click()
camera_dapp.just_fyi("Enable camera requests in Dapps")
profile.element_by_translation_id("webview-camera-permission-requests").scroll_and_click()
home.dapp_tab_button.click(desired_element_text='webview')
camera_dapp.just_fyi("Check DApp asks now to allow camera aceess but Deny in DApp")
camera_dapp.browser_refresh_page_button.click()
camera_dapp.deny_button.click()
if not camera_dapp.camera_image_in_dapp.is_element_image_similar_to_template('blank_camera_image.png'):
self.driver.fail("Even camera access Denied to Dapp, - acccess to camera granted")
camera_dapp.just_fyi("Check DApp asks now to allow camera aceess and Allow access to DApp")
camera_dapp.browser_refresh_page_button.click()
camera_dapp.allow_button.click()
if camera_dapp.camera_image_in_dapp.is_element_image_similar_to_template('blank_camera_image.png'):
self.driver.fail("Even camera access Accepted to Dapp, - camera view is not shown")
camera_dapp.just_fyi("Relogin and check camera access still needs to be allowed")
home.profile_button.click()
profile.relogin()
home.dapp_tab_button.click()
camera_dapp.open_tabs_button.click()
dapp.element_by_text_part("https").click()
if not camera_dapp.allow_button.is_element_displayed():
self.driver.fail("No request to camera access after relogin")
@marks.testrail_id(6232)
@marks.medium
@marks.flaky
# TODO: due to 13011
def test_switching_accounts_in_dapp(self):
home = SignInView(self.driver).create_user()
wallet = home.wallet_button.click()
wallet.just_fyi('create new account in multiaccount')
status_account = home.status_account_name
account_name = 'Subaccount'
wallet.add_account(account_name)
address = wallet.get_wallet_address(account_name)
home.just_fyi('can see two accounts in DApps')
dapp = home.dapp_tab_button.click()
dapp.select_account_button.click()
for text in 'Select the account', status_account, account_name:
if not dapp.element_by_text_part(text).is_element_displayed():
self.driver.fail("No expected element %s is shown in menu" % text)
home.just_fyi('add permission to Status account')
dapp.enter_url_editbox.click()
status_test_dapp = home.open_status_test_dapp()
home.just_fyi('check that permissions from previous account was removed once you choose another')
dapp.select_account_button.click()
dapp.select_account_by_name(account_name).wait_for_element(30)
dapp.select_account_by_name(account_name).click()
profile = dapp.profile_button.click()
profile.privacy_and_security_button.click()
profile.dapp_permissions_button.click()
if profile.element_by_text(test_dapp_name).is_element_displayed():
self.errors.append("Permissions for %s are not removed" % test_dapp_name)
home.just_fyi('check that can change account')
profile.dapp_tab_button.click()
if not status_test_dapp.element_by_text_part(account_name).is_element_displayed():
self.errors.append("No expected account %s is shown in authorize web3 popup for wallet" % account_name)
status_test_dapp.allow_button.click()
dapp.profile_button.click(desired_element_text='DApp permissions')
profile.element_by_text(test_dapp_name).click()
for text in 'Chat key', account_name:
if not dapp.element_by_text_part(text).is_element_displayed():
self.errors.append("Access is not granted to %s" % text)
home.just_fyi('check correct account is shown for transaction if sending from DApp')
profile.dapp_tab_button.click(desired_element_text='Accounts')
status_test_dapp.assets_button.click()
send_transaction = status_test_dapp.request_stt_button.click()
send_transaction.ok_got_it_button.wait_and_click()
address = send_transaction.get_formatted_recipient_address(address)
if not send_transaction.element_by_text(address).is_element_displayed():
self.errors.append("Wallet address %s in not shown in 'From' on Send Transaction screen" % address)
home.just_fyi('Relogin and check multiaccount loads fine')
send_transaction.cancel_button.click()
home.profile_button.click()
home.relogin()
home.wallet_button.click()
if not wallet.element_by_text(account_name).is_element_displayed():
self.errors.append("Subaccount is gone after relogin in Wallet!")
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(account_name).is_element_displayed():
self.errors.append("Subaccount is not selected after relogin in Dapps!")
self.errors.verify_no_errors()

View File

@ -1,65 +0,0 @@
from selenium.common.exceptions import NoSuchElementException
from tests import marks, test_dapp_url
from tests.base_test_case import SingleDeviceTestCase
from tests.users import basic_user, ens_user
from views.sign_in_view import SignInView
class TestDeepLinks(SingleDeviceTestCase):
@marks.testrail_id(5441)
@marks.medium
def test_open_user_profile_using_deep_link(self):
sign_in = SignInView(self.driver)
sign_in.create_user()
for user_ident in ens_user['ens'], ens_user['ens_another'], ens_user['public_key']:
self.driver.close_app()
deep_link = 'status-im://u/%s' % user_ident
sign_in.open_weblink_and_login(deep_link)
chat = sign_in.get_chat_view()
for text in ens_user['username'], sign_in.get_translation_by_key("add-to-contacts"):
if not chat.element_by_text(text).scroll_to_element(10):
self.driver.fail("User profile screen is not opened")
@marks.testrail_id(5442)
@marks.medium
def test_open_dapp_using_deep_link(self):
sign_in_view = SignInView(self.driver)
sign_in_view.create_user()
self.driver.close_app()
dapp_name = test_dapp_url
dapp_deep_link = 'status-im://b/%s' % dapp_name
sign_in_view.open_weblink_and_login(dapp_deep_link)
web_view = sign_in_view.get_chat_view()
try:
test_dapp_view = web_view.open_in_status_button.click()
test_dapp_view.allow_button.is_element_present()
except NoSuchElementException:
self.driver.fail("DApp '%s' is not opened!" % dapp_name)
@marks.testrail_id(5781)
@marks.medium
def test_deep_link_with_invalid_user_public_key_own_profile_key(self):
sign_in = SignInView(self.driver)
sign_in.recover_access(passphrase=basic_user['passphrase'])
self.driver.close_app()
sign_in.just_fyi('Check that no error when opening invalid deep link')
deep_link = 'status-im://u/%s' % basic_user['public_key'][:-10]
sign_in.open_weblink_and_login(deep_link)
home = sign_in.get_home_view()
home.plus_button.click_until_presence_of_element(home.start_new_chat_button)
if not home.start_new_chat_button.is_element_present():
self.errors.append(
"Can't navigate to start new chat after app opened from deep link with invalid public key")
self.driver.close_app()
sign_in.just_fyi('Check that no error when opening invalid deep link')
deep_link = 'status-im://u/%s' % basic_user['public_key']
sign_in.open_weblink_and_login(deep_link)
from views.profile_view import ProfileView
profile = ProfileView(self.driver)
if not profile.default_username_text != basic_user['username']:
self.errors.append("Can't navigate to profile from deep link with own public key")
self.errors.verify_no_errors()

File diff suppressed because it is too large Load Diff

View File

@ -1,343 +0,0 @@
import time
import pytest
from support.utilities import get_merged_txs_list
from tests import marks, pin, puk, pair_code
from tests.base_test_case import SingleDeviceTestCase, MultipleSharedDeviceTestCase, create_shared_drivers
from tests.users import transaction_senders, basic_user, wallet_users
from views.sign_in_view import SignInView
@pytest.mark.xdist_group(name="keycard_tx_1")
@marks.critical
class TestKeycardTxOneDeviceMerged(MultipleSharedDeviceTestCase):
@classmethod
def setup_class(cls):
cls.user = transaction_senders['ETH_STT_ADI_1']
cls.address = '0x%s' % transaction_senders['ETH_7']['address']
cls.drivers, cls.loop = create_shared_drivers(1)
cls.sign_in = SignInView(cls.drivers[0])
cls.home = cls.sign_in.recover_access(passphrase=cls.user['passphrase'], keycard=True)
cls.wallet = cls.home.wallet_button.click()
cls.assets = ('ETH', 'ADI', 'STT')
[cls.wallet.wait_balance_is_changed(asset) for asset in cls.assets]
cls.initial_balances = dict()
for asset in cls.assets:
cls.initial_balances[asset] = cls.wallet.get_asset_amount_by_name(asset)
@marks.testrail_id(700767)
def test_keycard_send_tx_eth(self):
wallet = self.home.wallet_button.click()
transaction_amount = wallet.get_unique_amount()
wallet.send_transaction(amount=transaction_amount, sign_transaction=True, keycard=True,
recipient=self.address)
wallet.just_fyi('Check that transaction is appeared in transaction history')
transaction = wallet.find_transaction_in_history(amount=transaction_amount, return_hash=True)
self.wallet.wallet_button.double_click()
self.network_api.find_transaction_by_hash(transaction)
self.network_api.wait_for_confirmation_of_transaction(self.user['address'], transaction_amount)
self.wallet.wait_balance_is_changed('ETH', initial_balance=self.initial_balances['ETH'])
@marks.testrail_id(700768)
def test_keycard_relogin_after_restore(self):
self.sign_in.just_fyi('Check that username and public key match expected')
public_key, default_username = self.sign_in.get_public_key_and_username(return_username=True)
profile = self.sign_in.get_profile_view()
if public_key != self.user['public_key']:
self.errors.append('Public key %s does not match expected' % public_key)
if default_username != self.user['username']:
self.errors.append('Default username %s does not match expected' % default_username)
profile.logout()
self.sign_in.just_fyi('Check that can login with restored from mnemonic keycard account')
self.sign_in.sign_in(keycard=True)
if not self.sign_in.home_button.is_element_displayed(10):
self.sign_in.driver.fail('Keycard user is not logged in')
self.errors.verify_no_errors()
@marks.testrail_id(700769)
@marks.transaction
def test_keycard_send_tx_sign_message_request_stt_testdapp(self):
self.home.home_button.double_click()
status_test_dapp = self.home.open_status_test_dapp()
status_test_dapp.wait_for_d_aap_to_load()
self.wallet.just_fyi("Requesting STT in dapp")
status_test_dapp.assets_button.click()
send_tx = status_test_dapp.request_stt_button.click()
send_tx.sign_transaction(keycard=True)
self.wallet.just_fyi("Checking signing message")
status_test_dapp.transactions_button.click()
status_test_dapp.sign_message_button.click()
if not send_tx.element_by_text("Test message").is_element_displayed():
self.errors.append("No message shown when signing!")
keycard = send_tx.sign_with_keycard_button.click()
keycard.enter_default_pin()
if not keycard.element_by_text_part('Signed message').is_element_displayed():
self.errors.append('Message was not signed')
keycard.just_fyi('Check logcat for sensitive data')
values_in_logcat = send_tx.find_values_in_logcat(pin=pin, puk=puk, password=pair_code)
if values_in_logcat:
self.sign_in.driver.fail("After signing message: %s" % values_in_logcat)
self.wallet.just_fyi("Check send 2 txs in batch")
status_test_dapp.send_two_tx_in_batch_button.scroll_to_element()
send_tx = status_test_dapp.send_two_tx_in_batch_button.click()
send_tx.sign_transaction(keycard=True)
if not send_tx.sign_with_keycard_button.is_element_displayed(10):
self.sign_in.driver.fail('Second send transaction screen did not appear!')
send_tx.sign_transaction(keycard=True)
self.wallet.just_fyi("Checking send 2 txs one after another")
status_test_dapp.send_two_tx_one_by_one_button.scroll_to_element()
send_tx = status_test_dapp.send_two_tx_one_by_one_button.click()
send_tx.sign_transaction(keycard=True)
if not send_tx.sign_with_keycard_button.is_element_displayed(20):
self.sign_in.driver.fail('Second send transaction screen did not appear!')
send_tx.sign_transaction(keycard=True)
self.wallet.just_fyi('Verify that wallet balance is updated after receiving money from faucet')
self.home.wallet_button.click()
self.wallet.wait_balance_is_changed('STT', initial_balance=self.initial_balances['STT'])
self.errors.verify_no_errors()
@marks.testrail_id(700770)
def test_keycard_wallet_recover_pairing_check_balance_after_offline_tx_history(self):
user = transaction_senders['A']
self.sign_in.toggle_airplane_mode()
self.sign_in.driver.reset()
self.sign_in.just_fyi('Keycard: recover multiaccount with pairing code ')
self.sign_in.accept_tos_checkbox.enable()
self.sign_in.get_started_button.click_until_presence_of_element(self.sign_in.access_key_button)
self.sign_in.access_key_button.click()
self.sign_in.recover_with_keycard_button.click()
keycard = self.sign_in.begin_recovery_button.click()
keycard.connect_pairing_card_button.click()
keycard.pair_code_input.set_value(pair_code)
self.sign_in.pair_to_this_device_button.click()
keycard.enter_default_pin()
self.sign_in.maybe_later_button.click_until_presence_of_element(self.sign_in.lets_go_button)
self.sign_in.lets_go_button.click_until_absense_of_element(self.sign_in.lets_go_button)
self.sign_in.home_button.wait_for_visibility_of_element(30)
self.sign_in.just_fyi("Check balance will be restored after going back online")
self.sign_in.toggle_airplane_mode()
wallet = self.home.wallet_button.click()
[wallet.wait_balance_is_changed(asset) for asset in ("ETH", "LXS")]
self.wallet.just_fyi("Checking whole tx history after backing from offline")
self.wallet.accounts_status_account.click()
address = user['address']
ropsten_txs = self.network_api.get_transactions(address)
ropsten_tokens = self.network_api.get_token_transactions(address)
expected_txs_list = get_merged_txs_list(ropsten_txs, ropsten_tokens)
transactions = self.wallet.transaction_history_button.click()
if self.wallet.element_by_translation_id("transactions-history-empty").is_element_displayed():
self.wallet.pull_to_refresh()
status_tx_number = transactions.transactions_table.get_transactions_number()
if status_tx_number < 1:
self.errors.append('No transactions found')
for n in range(status_tx_number):
transactions_details = transactions.transactions_table.transaction_by_index(n).click()
tx_hash = transactions_details.get_transaction_hash()
tx_from = transactions_details.get_sender_address()
tx_to = transactions_details.get_recipient_address()
if tx_from != expected_txs_list[tx_hash]['from']:
self.errors.append('Transactions senders do not match!')
if tx_to != expected_txs_list[tx_hash]['to']:
self.errors.append('Transactions recipients do not match!')
transactions_details.close_button.click()
self.errors.verify_no_errors()
@marks.testrail_id(5689)
def test_keycard_create_account_unlock_same_seed(self):
self.sign_in.driver.reset()
self.sign_in.just_fyi("Create keycard account and save seed phrase")
self.sign_in.accept_tos_checkbox.enable()
self.sign_in.get_started_button.click()
self.sign_in.generate_key_button.click_until_presence_of_element(self.sign_in.next_button)
self.sign_in.next_button.click_until_absense_of_element(self.sign_in.element_by_translation_id("intro-wizard-title2"))
keycard_flow = self.sign_in.keycard_storage_button.click()
keycard_flow.confirm_pin_and_proceed()
seed_phrase = keycard_flow.backup_seed_phrase()
self.sign_in.maybe_later_button.wait_for_visibility_of_element(30)
self.sign_in.maybe_later_button.click_until_presence_of_element(self.sign_in.lets_go_button)
self.sign_in.lets_go_button.click_until_absense_of_element(self.sign_in.lets_go_button)
self.sign_in.profile_button.wait_for_visibility_of_element(30)
self.sign_in.just_fyi('Check that after creating keycard account balance is 0, not ...')
wallet_1 = self.sign_in.wallet_button.click()
wallet_address = wallet_1.get_wallet_address()
wallet_1.wallet_button.double_click()
if wallet_1.status_account_total_usd_value.text != '0':
self.errors.append("Account USD value is not 0, it is %s" % wallet_1.status_account_total_usd_value.text)
public_key, default_username = self.sign_in.get_public_key_and_username(return_username=True)
profile_1 = self.sign_in.get_profile_view()
profile_1.logout()
profile_1.just_fyi('Check that can re-login with keycard account after account creation')
self.sign_in.multi_account_on_login_button.wait_for_visibility_of_element(5)
self.sign_in.multi_account_on_login_button.click()
if not keycard_flow.element_by_text_part(default_username).is_element_displayed():
self.errors.append("%s is not found on keycard login screen!" % default_username)
keycard_flow.enter_default_pin()
if not self.sign_in.home_button.is_element_displayed(10):
self.errors.append('Keycard user is not logged in')
self.sign_in.just_fyi('Unlock keycard multiaccount at attempt to restore same multiaccount from seed')
self.sign_in.profile_button.click()
profile_1.logout()
self.sign_in.access_key_button.click()
self.sign_in.enter_seed_phrase_button.click()
self.sign_in.seedphrase_input.click()
self.sign_in.seedphrase_input.set_value(seed_phrase)
self.sign_in.next_button.click()
self.sign_in.element_by_translation_id("unlock", uppercase=True).click()
keycard_flow.enter_default_pin()
device_1_home = self.sign_in.home_button.click()
device_1_home.plus_button.click()
if not device_1_home.start_new_chat_button.is_element_displayed():
self.errors.append("Can't proceed using account after it's re-recover twice.")
self.sign_in.just_fyi("Restore same multiaccount from backed up seed phrase on another device")
self.sign_in.driver.reset()
self.sign_in.recover_access(seed_phrase)
self.sign_in.just_fyi("Check username and wallet address on restored account")
wallet_2 = self.sign_in.wallet_button.click()
wallet_address_2 = wallet_2.get_wallet_address()
wallet_2.wallet_button.double_click()
if wallet_address != wallet_address_2:
self.errors.append('Wallet address on restored multiaccount is not equal to created keycard multiaccount')
public_key_2, default_username_2 = self.sign_in.get_public_key_and_username(return_username=True)
if public_key != public_key_2:
self.errors.append('Public key on restored multiaccount is not equal to created keycard multiaccount')
if default_username_2 != default_username:
self.errors.append('Username on restored multiaccount is not equal to created keycard multiaccount')
self.errors.verify_no_errors()
class TestTransactionWalletSingleDevice(SingleDeviceTestCase):
@marks.testrail_id(6292)
@marks.transaction
@marks.medium
def test_keycard_send_funds_between_accounts_set_max_in_multiaccount_instance(self):
sign_in_view = SignInView(self.driver).create_user(keycard=True)
wallet = sign_in_view.wallet_button.click()
status_account_address = wallet.get_wallet_address()[2:]
self.network_api.get_donate(status_account_address, external_faucet=True)
wallet.wait_balance_is_changed()
account_name = 'subaccount'
wallet.add_account(account_name, keycard=True)
wallet.get_account_by_name(account_name).click()
wallet.get_account_options_by_name(account_name).click()
wallet.account_settings_button.click()
wallet.swipe_up()
wallet.just_fyi("Checking that delete account and importing account are not available on keycard")
if wallet.delete_account_button.is_element_displayed(10):
self.errors.append('Delete account option is shown on added account "On Status Tree"!')
wallet.wallet_button.double_click()
wallet.add_account_button.click()
if wallet.enter_a_seed_phrase_button.is_element_displayed():
self.errors.append('Importing account option is available on keycard!')
wallet.click_system_back_button()
wallet.just_fyi("Send transaction to new account")
transaction_amount = '0.004'
initial_balance = self.network_api.get_balance(status_account_address)
wallet.send_transaction(account_name=account_name, amount=transaction_amount, keycard=True)
self.network_api.wait_for_confirmation_of_transaction(status_account_address, transaction_amount)
self.network_api.verify_balance_is_updated(str(initial_balance), status_account_address)
wallet.just_fyi("Verifying previously sent transaction in new account")
wallet.get_account_by_name(account_name).click()
wallet.send_transaction_button.click()
wallet.close_send_transaction_view_button.click()
balance_after_receiving_tx = float(wallet.get_asset_amount_by_name('ETH'))
expected_balance = self.network_api.get_rounded_balance(balance_after_receiving_tx, transaction_amount)
if balance_after_receiving_tx != expected_balance:
self.driver.fail('New account balance %s does not match expected %s after receiving a transaction' % (
balance_after_receiving_tx, transaction_amount))
wallet.just_fyi("Sending eth from new account to main account")
updated_balance = self.network_api.get_balance(status_account_address)
transaction_amount_1 = round(float(transaction_amount) * 0.2, 11)
wallet.wait_balance_is_changed()
wallet.get_account_by_name(account_name).click()
send_transaction = wallet.send_transaction(from_main_wallet=False, account_name=wallet.status_account_name,
amount=transaction_amount_1, keycard=True)
wallet.close_button.click()
sub_account_address = wallet.get_wallet_address(account_name)[2:]
self.network_api.wait_for_confirmation_of_transaction(sub_account_address, transaction_amount_1)
wallet.find_transaction_in_history(amount=format(float(transaction_amount_1), '.11f').rstrip('0'))
wallet.just_fyi("Check transactions on subaccount")
self.network_api.verify_balance_is_updated(updated_balance, status_account_address)
wallet.just_fyi("Verify total ETH on main wallet view")
self.network_api.wait_for_confirmation_of_transaction(status_account_address, transaction_amount_1)
self.network_api.verify_balance_is_updated((updated_balance + transaction_amount_1), status_account_address)
wallet.close_button.click()
balance_of_sub_account = float(self.network_api.get_balance(sub_account_address)) / 1000000000000000000
balance_of_status_account = float(self.network_api.get_balance(status_account_address)) / 1000000000000000000
wallet.scan_tokens()
total_eth_from_two_accounts = float(wallet.get_asset_amount_by_name('ETH'))
expected_balance = self.network_api.get_rounded_balance(total_eth_from_two_accounts,
(balance_of_status_account + balance_of_sub_account))
if total_eth_from_two_accounts != expected_balance:
self.driver.fail('Total wallet balance %s != of Status account (%s) + SubAccount (%s)' % (
total_eth_from_two_accounts, balance_of_status_account, balance_of_sub_account))
wallet.just_fyi("Check that can set max and send transaction with max amount from subaccount")
wallet.get_account_by_name(account_name).click()
wallet.send_transaction_button.click()
send_transaction.set_max_button.click()
set_amount = float(send_transaction.amount_edit_box.text)
if set_amount == 0.0 or set_amount >= balance_of_sub_account:
self.driver.fail('Value after setting up max amount is set to %s' % str(set_amount))
send_transaction.confirm()
send_transaction.chose_recipient_button.click()
send_transaction.accounts_button.click()
send_transaction.element_by_text(wallet.status_account_name).click()
send_transaction.sign_transaction_button.click()
send_transaction.sign_transaction(keycard=True)
wallet.element_by_text('Assets').click()
wallet.wait_balance_is_equal_expected_amount(asset='ETH', expected_balance=0, main_screen=False)
@marks.testrail_id(6310)
@marks.medium
@marks.transaction
def test_keycard_sign_typed_message_deploy_simple_contract(self):
sender = transaction_senders['ETH_6']
home = SignInView(self.driver).recover_access(sender['passphrase'], keycard=True)
wallet = home.wallet_button.click()
status_test_dapp = home.open_status_test_dapp()
status_test_dapp.wait_for_d_aap_to_load()
status_test_dapp.transactions_button.click_until_presence_of_element(status_test_dapp.sign_typed_message_button)
wallet.just_fyi("Checking sign typed message")
send_transaction = status_test_dapp.sign_typed_message_button.click()
send_transaction.sign_with_keycard_button.click()
keycard_view = send_transaction.sign_with_keycard_button.click()
keycard_view.enter_default_pin()
if not keycard_view.element_by_text_part('0x6df0ce').is_element_displayed():
self.errors.append('Typed message was not signed')
wallet.just_fyi("Checking deploy simple contract")
send_transaction_view = status_test_dapp.deploy_contract_button.click()
send_transaction_view.sign_transaction(keycard=True)
if not status_test_dapp.element_by_text('Contract deployed at: ').is_element_displayed(300):
self.driver.fail('Contract was not created or tx taking too long')
for text in ['Call contract get function',
'Call contract set function', 'Call function 2 times in a row']:
status_test_dapp.element_by_text(text).scroll_to_element()
self.errors.verify_no_errors()

View File

@ -1,795 +0,0 @@
import random
import string
import pytest
from tests import marks, common_password
from tests.base_test_case import SingleDeviceTestCase, MultipleDeviceTestCase, MultipleSharedDeviceTestCase,\
create_shared_drivers
from tests.users import transaction_senders, basic_user, wallet_users, ens_user_ropsten, ens_user
from views.send_transaction_view import SendTransactionView
from views.sign_in_view import SignInView
@pytest.mark.xdist_group(name="send_tx_1")
@marks.critical
class TestSendTxDeviceMerged(MultipleSharedDeviceTestCase):
@classmethod
def setup_class(cls):
cls.user = transaction_senders['ETH_ADI_STT_3']
cls.recipient_address = '0x%s' % transaction_senders['ETH_7']['address']
cls.drivers, cls.loop = create_shared_drivers(1)
[cls.amount_adi, cls.amount_eth, cls.amount_stt] = ['0.000%s' % str(random.randint(100, 999)) + '1' for _ in range(3)]
cls.sign_in = SignInView(cls.drivers[0])
cls.home = cls.sign_in.recover_access(cls.user['passphrase'])
cls.wallet = cls.home.wallet_button.click()
cls.assets = ('ETH', 'ADI', 'STT')
[cls.wallet.wait_balance_is_changed(asset) for asset in cls.assets]
cls.initial_balances = dict()
for asset in cls.assets:
cls.initial_balances[asset] = cls.wallet.get_asset_amount_by_name(asset)
cls.wallet.send_transaction(amount=cls.amount_eth, recipient=cls.recipient_address)
cls.wallet.send_transaction(amount=cls.amount_adi, recipient=cls.recipient_address, asset_name='ADI')
@marks.testrail_id(700763)
@marks.transaction
def test_send_tx_eth_check_logcat(self):
self.wallet.just_fyi('Check that transaction is appeared in tx history')
self.wallet.find_transaction_in_history(amount=self.amount_eth)
self.wallet.wallet_button.double_click()
self.network_api.wait_for_confirmation_of_transaction(self.user['address'], self.amount_eth)
self.wallet.wait_balance_is_changed('ETH', initial_balance=self.initial_balances['ETH'])
self.wallet.just_fyi('Check logcat for sensitive data')
values_in_logcat = self.wallet.find_values_in_logcat(password=common_password)
if values_in_logcat:
self.wallet.driver.fail(values_in_logcat)
@marks.testrail_id(700764)
@marks.transaction
def test_send_tx_token_7_decimals(self):
asset = 'ADI'
self.wallet.just_fyi("Checking tx with 7 decimals")
transaction_adi = self.wallet.find_transaction_in_history(amount=self.amount_adi, asset=asset, return_hash=True)
self.wallet.wallet_button.double_click()
self.network_api.find_transaction_by_hash(transaction_adi)
self.wallet.wait_balance_is_changed(asset, initial_balance=self.initial_balances[asset])
@marks.testrail_id(5342)
@marks.transaction
def test_send_tx_sign_message_2tx_in_batch_tx_filters_request_stt_testdapp(self):
self.wallet.home_button.click()
status_test_dapp = self.home.open_status_test_dapp()
status_test_dapp.wait_for_d_aap_to_load()
self.wallet.just_fyi("Checking request STT")
status_test_dapp.assets_button.click()
status_test_dapp.request_stt_button.wait_for_element(60)
send_transaction = status_test_dapp.request_stt_button.click()
send_transaction.sign_transaction()
self.wallet.just_fyi("Checking signing message")
status_test_dapp.transactions_button.click()
send_transaction = status_test_dapp.sign_message_button.click()
send_transaction.enter_password_input.set_value(common_password)
send_transaction.sign_button.click()
if not status_test_dapp.element_by_text_part('Signed message').is_element_displayed():
self.errors.append('Message was not signed')
send_transaction.just_fyi('Check logcat for sensitive data')
values_in_logcat = send_transaction.find_values_in_logcat(password=common_password)
if values_in_logcat:
self.errors.append("When signing message from dapp: %s" % values_in_logcat)
self.wallet.just_fyi("Checking send 2 txs in batch")
status_test_dapp.send_two_tx_in_batch_button.scroll_to_element()
send_transaction = status_test_dapp.send_two_tx_in_batch_button.click()
send_transaction.sign_transaction()
if not send_transaction.sign_with_password.is_element_displayed(10):
self.errors.append('Second send transaction screen did not appear!')
send_transaction.sign_transaction()
self.wallet.just_fyi("Checking send 2 txs one after another")
status_test_dapp.send_two_tx_one_by_one_button.scroll_to_element()
send_transaction = status_test_dapp.send_two_tx_one_by_one_button.click()
send_transaction.sign_transaction()
if not send_transaction.sign_with_password.is_element_displayed(20):
self.errors.append('Second send transaction screen did not appear!')
send_transaction.sign_transaction()
self.wallet.just_fyi("Checking test filters")
status_test_dapp.test_filters_button.scroll_and_click()
for element in status_test_dapp.element_by_text('eth_uninstallFilter'), status_test_dapp.ok_button:
if element.is_element_displayed(10):
self.errors.append("'Test filters' button produced an error")
self.errors.verify_no_errors()
@marks.testrail_id(700765)
@marks.transaction
def test_send_tx_custom_token_18_decimals_invalid_password(self):
contract_address, name, symbol, decimals = '0x101848D5C5bBca18E6b4431eEdF6B95E9ADF82FA', 'Weenus 💪', 'WEENUS', '18'
self.home.wallet_button.double_click()
self.wallet.just_fyi("Check that can add custom token")
self.wallet.multiaccount_more_options.click()
self.wallet.manage_assets_button.click()
token_view = self.wallet.add_custom_token_button.click()
token_view.contract_address_input.send_keys(contract_address)
if token_view.name_input.text != name:
self.errors.append('Name for custom token was not set')
if token_view.symbol_input.text != symbol:
self.errors.append('Symbol for custom token was not set')
if token_view.decimals_input.text != decimals:
self.errors.append('Decimals for custom token was not set')
token_view.add_button.click()
token_view.close_button.click()
self.wallet.asset_by_name(symbol).scroll_to_element()
if not self.wallet.asset_by_name(symbol).is_element_displayed():
self.errors.append('Custom token is not shown on Wallet view')
send_tx = self.wallet.send_transaction_from_main_screen.click()
send_tx.select_asset_button.click()
asset_button = send_tx.asset_by_name(symbol)
send_tx.select_asset_button.click_until_presence_of_element(
send_tx.eth_asset_in_select_asset_bottom_sheet_button)
asset_button.click()
send_tx.amount_edit_box.click()
send_tx.amount_edit_box.set_value(self.amount_eth)
send_tx.set_recipient_address(self.recipient_address)
send_tx.sign_transaction_button.click()
if self.wallet.sign_in_phrase.is_element_displayed():
self.wallet.set_up_wallet_when_sending_tx()
send_tx.just_fyi('Check that can not sign tx with invalid password')
self.wallet.next_button.click_if_shown()
self.wallet.ok_got_it_button.click_if_shown()
send_tx.sign_with_password.click_until_presence_of_element(send_tx.enter_password_input)
send_tx.enter_password_input.click()
send_tx.enter_password_input.send_keys('wrong_password')
send_tx.sign_button.click()
if send_tx.element_by_text_part('Transaction sent').is_element_displayed():
self.errors.append('Transaction was sent with a wrong password')
self.wallet.just_fyi("Check that can send tx with custom token")
send_tx.enter_password_input.click()
send_tx.enter_password_input.clear()
send_tx.enter_password_input.send_keys(common_password)
send_tx.sign_button.click_until_absense_of_element(send_tx.sign_button)
send_tx.ok_button.wait_for_element(120)
if not self.wallet.element_by_translation_id("transaction-sent").is_element_displayed():
self.errors.append("Tx is not sent!")
send_tx.ok_button.click()
# TODO: disabled due to 10838 (rechecked 23.11.21, valid)
# transactions_view = wallet.transaction_history_button.click()
# transactions_view.transactions_table.find_transaction(amount=amount, asset=symbol)
self.errors.verify_no_errors()
@marks.testrail_id(700757)
def test_send_tx_set_recipient_options(self):
nickname = 'my_some_nickname'
account_name = 'my_acc_name'
account_address = '0x8c2E3Cd844848E79cFd4671cE45C12F210b630d7'
recent_add_to_fav_name = 'my_Recent_STT'
recent_add_to_fav_address = '0x58d8c3d70ce4fa4b9fb10a665c8712238746f2ff'
ens_status, ens_other = ens_user_ropsten, ens_user
basic_add_to_fav_name = 'my_basic_address'
self.drivers[0].reset()
self.home = self.sign_in.recover_access(wallet_users['D']['passphrase'])
self.home.just_fyi('Add new account and new ENS contact for recipient')
chat = self.home.add_contact(ens_status['ens'])
chat.chat_options.click()
chat.view_profile_button.click_until_presence_of_element(chat.remove_from_contacts)
chat.set_nickname(nickname)
wallet = self.home.wallet_button.click()
wallet.add_account(account_name=account_name)
wallet.accounts_status_account.click()
send_tr = wallet.send_transaction_button.click()
wallet.just_fyi("Check that can't send to invalid address")
send_tr.amount_edit_box.click()
send_tr.amount_edit_box.set_value(send_tr.get_unique_amount())
send_tr.chose_recipient_button.click()
for address in (basic_user['public_key'], '0xDE709F2102306220921060314715629080E2fB77'):
send_tr.enter_recipient_address_input.set_value(address)
send_tr.enter_recipient_address_input.click()
send_tr.done_button.click()
if send_tr.set_max_button.is_element_displayed():
self.errors.append('Can proceed with wrong address %s in recipient' % address)
send_tr.just_fyi('Set one of my accounts')
send_tr.chose_recipient_button.click_if_shown()
send_tr.element_by_translation_id("my-accounts").click()
send_tr.element_by_text(account_name).click()
if send_tr.enter_recipient_address_text.text != send_tr.get_formatted_recipient_address(account_address):
self.errors.append('Added account is not resolved as recipient')
send_tr.just_fyi('Set contract address from recent and check smart contract error')
send_tr.chose_recipient_button.click()
send_tr.element_by_translation_id("recent").click()
send_tr.element_by_text('↓ 1000 MDS').click()
if not send_tr.element_by_translation_id("warning-sending-to-contract-descr").is_element_displayed():
self.driver.fail('No warning is shown at attempt to set as recipient smart contract')
send_tr.ok_button.click()
send_tr.element_by_text('↑ 0.001 ETHro').scroll_and_click()
send_tr.add_to_favorites(recent_add_to_fav_name)
wallet.element_by_translation_id("recent").click()
send_tr.just_fyi('Scan invalid QR')
send_tr.scan_qr_code_button.click()
send_tr.allow_button.click(1)
wallet.enter_qr_edit_box.scan_qr('something%s' % basic_user['address'])
if not send_tr.element_by_text_part('Invalid address').is_element_displayed(10):
self.driver.fail('No error is shown at attempt to scan invalid address')
wallet.ok_button.click()
send_tr.just_fyi('Scan code, add it to favorites and recheck that it is preserved')
send_tr.scan_qr_code_button.click()
wallet.enter_qr_edit_box.scan_qr(basic_user['address'])
send_tr.add_to_favorites(basic_add_to_fav_name)
send_tr.element_by_translation_id("favourites").scroll_and_click()
for name in (recent_add_to_fav_name, basic_add_to_fav_name):
wallet.element_by_text(name).scroll_to_element()
send_tr.element_by_text(recent_add_to_fav_name).scroll_and_click()
if str(send_tr.enter_recipient_address_text.text).lower() != send_tr.get_formatted_recipient_address(
recent_add_to_fav_address):
self.errors.append('Recent address that was added to favourites was not resolved correctly')
send_tr.just_fyi('Set contact')
send_tr.chose_recipient_button.click()
send_tr.element_by_translation_id("contacts").scroll_and_click()
send_tr.element_by_text(nickname).scroll_and_click()
send_tr.recipient_done.click()
if send_tr.enter_recipient_address_text.text != send_tr.get_formatted_recipient_address(ens_status['address']):
self.errors.append('ENS from contact is not resolved as recipient')
send_tr.just_fyi('Set different ENS options')
send_tr.set_recipient_address(ens_other['ens_another'])
if send_tr.enter_recipient_address_text.text != send_tr.get_formatted_recipient_address(ens_other['address']):
self.errors.append('ENS address on another domain is not resolved as recipient')
send_tr.set_recipient_address('%s.stateofus.eth' % ens_status['ens'])
if send_tr.enter_recipient_address_text.text != send_tr.get_formatted_recipient_address(ens_status['address']):
self.errors.append('ENS address on stateofus.eth is not resolved as recipient')
send_tr.just_fyi('Check search and set address from search')
send_tr.chose_recipient_button.click()
send_tr.search_by_keyword(ens_status['ens'][:2])
if not send_tr.element_by_text('@' + ens_status['ens']).is_element_displayed():
self.errors.append('ENS address from contacts is not shown in search')
send_tr.cancel_button.click()
send_tr.search_by_keyword('my')
for name in (nickname, account_name, recent_add_to_fav_name, basic_add_to_fav_name):
if not send_tr.element_by_text(name).is_element_displayed():
self.errors.append('%s is not shown in search when searching by namepart' % name)
send_tr.element_by_text(basic_add_to_fav_name).click()
if send_tr.enter_recipient_address_text.text != send_tr.get_formatted_recipient_address(
'0x' + basic_user['address']):
self.errors.append('QR scanned address that was added to favourites was not resolved correctly')
self.errors.verify_no_errors()
class TestTransactionWalletSingleDevice(SingleDeviceTestCase):
@marks.testrail_id(5784)
@marks.medium
@marks.transaction
def test_sign_typed_message_deploy_simple_contract_request_pub_key_from_dapp(self):
user = transaction_senders['ETH_5']
home = SignInView(self.driver).recover_access(passphrase=user['passphrase'])
home.just_fyi("Checking requesting public key from dapp")
status_test_dapp = home.open_status_test_dapp(allow_all=False)
status_test_dapp.status_api_button.click_until_presence_of_element(status_test_dapp.request_contact_code_button)
status_test_dapp.request_contact_code_button.click_until_presence_of_element(status_test_dapp.deny_button)
status_test_dapp.deny_button.click()
if status_test_dapp.element_by_text(user['public_key']).is_element_displayed():
self.errors.append('Public key is returned but access was not allowed')
status_test_dapp.request_contact_code_button.click_until_presence_of_element(status_test_dapp.deny_button)
status_test_dapp.allow_button.click()
if not status_test_dapp.element_by_text(user['public_key']).is_element_displayed():
self.errors.append('Public key is not returned')
status_test_dapp.get_empty_dapp_tab()
home.wallet_button.click()
home.just_fyi("Checking sign typed message")
home.open_status_test_dapp(allow_all=True)
status_test_dapp.transactions_button.click_until_presence_of_element(status_test_dapp.sign_typed_message_button)
send_transaction = status_test_dapp.sign_typed_message_button.click()
send_transaction.enter_password_input.send_keys(common_password)
send_transaction.sign_button.click_until_absense_of_element(send_transaction.sign_button)
if not status_test_dapp.element_by_text_part('0x1673d96e836').is_element_displayed(30):
self.errors.append("Hash of signed typed message is not shown!")
home.just_fyi("Checking deploy simple contract")
send_transaction = status_test_dapp.deploy_contract_button.click()
send_transaction.sign_transaction()
if not status_test_dapp.element_by_text('Contract deployed at: ').is_element_displayed(240):
self.errors.append('Contract was not created')
for text in ['Call contract get function',
'Call contract set function', 'Call function 2 times in a row']:
status_test_dapp.element_by_text(text).scroll_to_element()
self.errors.verify_no_errors()
@marks.testrail_id(5429)
@marks.medium
def test_set_currency(self):
home = SignInView(self.driver).create_user()
user_currency = 'Euro (EUR)'
wallet = home.wallet_button.click()
wallet.set_currency(user_currency)
if not wallet.element_by_text_part('EUR').is_element_displayed(20):
self.driver.fail('EUR currency is not displayed')
@marks.testrail_id(5358)
@marks.medium
def test_backup_recovery_phrase_warning_from_wallet(self):
sign_in = SignInView(self.driver)
sign_in.create_user()
wallet = sign_in.wallet_button.click()
if wallet.backup_recovery_phrase_warning_text.is_element_present():
self.driver.fail("'Back up your seed phrase' warning is shown on Wallet while no funds are present")
address = wallet.get_wallet_address()
self.network_api.get_donate(address[2:], external_faucet=True, wait_time=200)
wallet.close_button.click()
wallet.wait_balance_is_changed(scan_tokens=True)
if not wallet.backup_recovery_phrase_warning_text.is_element_present(30):
self.driver.fail("'Back up your seed phrase' warning is not shown on Wallet with funds")
profile = wallet.get_profile_view()
wallet.backup_recovery_phrase_warning_text.click()
profile.backup_recovery_phrase()
@marks.testrail_id(5407)
@marks.medium
@marks.transaction
def test_offline_can_login_cant_send_transaction(self):
home = SignInView(self.driver).create_user()
wallet = home.wallet_button.click()
wallet.toggle_airplane_mode()
wallet.accounts_status_account.click_until_presence_of_element(wallet.send_transaction_button)
send_transaction = wallet.send_transaction_button.click()
send_transaction.set_recipient_address('0x%s' % basic_user['address'])
send_transaction.amount_edit_box.set_value("0")
send_transaction.confirm()
send_transaction.sign_transaction_button.click()
if send_transaction.sign_with_password.is_element_displayed():
self.driver.fail("Sign transaction button is active in offline mode")
self.driver.close_app()
self.driver.launch_app()
SignInView(self.driver).sign_in()
home.home_button.wait_for_visibility_of_element()
home.connection_offline_icon.wait_for_visibility_of_element(20)
@marks.testrail_id(6225)
@marks.transaction
@marks.medium
def test_send_funds_between_accounts_in_multiaccount_instance(self):
sign_in = SignInView(self.driver)
sign_in.create_user()
wallet = sign_in.wallet_button.click()
status_account_address = wallet.get_wallet_address()[2:]
self.network_api.get_donate(status_account_address, external_faucet=True)
wallet.wait_balance_is_changed()
account_name = 'subaccount'
wallet.add_account(account_name)
wallet.just_fyi("Send transaction to new account")
initial_balance = self.network_api.get_balance(status_account_address)
transaction_amount = '0.003%s' % str(random.randint(10000, 99999)) + '1'
wallet.send_transaction(account_name=account_name, amount=transaction_amount)
self.network_api.wait_for_confirmation_of_transaction(status_account_address, transaction_amount)
self.network_api.verify_balance_is_updated(str(initial_balance), status_account_address)
wallet.just_fyi("Verifying previously sent transaction in new account")
wallet.get_account_by_name(account_name).click()
wallet.send_transaction_button.click()
wallet.close_send_transaction_view_button.click()
balance_after_receiving_tx = float(wallet.get_asset_amount_by_name('ETH'))
expected_balance = self.network_api.get_rounded_balance(balance_after_receiving_tx, transaction_amount)
if balance_after_receiving_tx != expected_balance:
self.driver.fail('New account balance %s does not match expected %s after receiving a transaction' % (
balance_after_receiving_tx, transaction_amount))
wallet.just_fyi("Sending eth from new account to main account")
updated_balance = self.network_api.get_balance(status_account_address)
transaction_amount_1 = round(float(transaction_amount) * 0.2, 12)
wallet.send_transaction(from_main_wallet=False, account_name=wallet.status_account_name,
amount=transaction_amount_1)
wallet.close_button.click()
sub_account_address = wallet.get_wallet_address(account_name)[2:]
self.network_api.wait_for_confirmation_of_transaction(status_account_address, transaction_amount_1)
self.network_api.verify_balance_is_updated(updated_balance, status_account_address)
wallet.find_transaction_in_history(amount=transaction_amount)
wallet.find_transaction_in_history(amount=format(float(transaction_amount_1), '.11f').rstrip('0'))
wallet.just_fyi("Check transactions on subaccount")
self.network_api.verify_balance_is_updated(updated_balance, status_account_address)
wallet.just_fyi("Verify total ETH on main wallet view")
self.network_api.wait_for_confirmation_of_transaction(status_account_address, transaction_amount_1)
self.network_api.verify_balance_is_updated((updated_balance + transaction_amount_1), status_account_address)
wallet.close_button.click()
balance_of_sub_account = float(self.network_api.get_balance(sub_account_address)) / 1000000000000000000
balance_of_status_account = float(self.network_api.get_balance(status_account_address)) / 1000000000000000000
wallet.scan_tokens()
total_eth_from_two_accounts = float(wallet.get_asset_amount_by_name('ETH'))
expected_balance = self.network_api.get_rounded_balance(total_eth_from_two_accounts,
(balance_of_status_account + balance_of_sub_account))
if total_eth_from_two_accounts != expected_balance:
self.driver.fail('Total wallet balance %s != of Status account (%s) + SubAccount (%s)' % (
total_eth_from_two_accounts, balance_of_status_account, balance_of_sub_account))
@marks.testrail_id(6235)
@marks.medium
def test_can_change_account_settings(self):
sign_in_view = SignInView(self.driver)
sign_in_view.create_user()
wallet_view = sign_in_view.wallet_button.click()
status_account_address = wallet_view.get_wallet_address()
wallet_view.get_account_options_by_name().click()
wallet_view.just_fyi('open Account Settings screen and check that all elements are shown')
wallet_view.account_settings_button.click()
for text in 'On Status tree', status_account_address, "m/44'/60'/0'/0/0":
if not wallet_view.element_by_text(text).is_element_displayed():
self.errors.append("'%s' text is not shown on Account Settings screen!" % text)
wallet_view.just_fyi('change account name/color and verified applied changes')
account_name = ''.join(random.choice(string.ascii_uppercase + string.digits) for _ in range(10))
wallet_view.account_name_input.clear()
wallet_view.account_name_input.send_keys(account_name)
wallet_view.account_color_button.select_color_by_position(1)
wallet_view.apply_settings_button.click()
wallet_view.element_by_text('This device').scroll_to_element()
wallet_view.close_button.click()
wallet_view.close_button.click()
account_button = wallet_view.get_account_by_name(account_name)
if not account_button.is_element_displayed():
self.driver.fail('Account name was not changed')
if not account_button.color_matches('multi_account_color.png'):
self.driver.fail('Account color does not match expected')
self.errors.verify_no_errors()
@marks.testrail_id(6282)
@marks.medium
def test_can_scan_eip_681_links(self):
sign_in = SignInView(self.driver)
sign_in.recover_access(transaction_senders['C']['passphrase'])
wallet = sign_in.wallet_button.click()
wallet.wait_balance_is_changed()
send_transaction_view = SendTransactionView(self.driver)
sign_in.just_fyi("Setting up wallet")
wallet.accounts_status_account.click_until_presence_of_element(wallet.send_transaction_button)
send_transaction = wallet.send_transaction_button.click()
send_transaction.set_recipient_address('0x%s' % basic_user['address'])
send_transaction.amount_edit_box.set_value("0")
send_transaction.confirm()
send_transaction.sign_transaction_button.click()
wallet.set_up_wallet_when_sending_tx()
wallet.cancel_button.click()
wallet.close_button.click()
url_data = {
'ens_for_receiver': {
'url': 'ethereum:0xc55cf4b03948d7ebc8b9e8bad92643703811d162@3/transfer?address=nastya.stateofus.eth&uint256=1e-1',
'data': {
'asset': 'STT',
'amount': '0.1',
'address': '0x58d8…F2ff',
},
},
# 'gas_settings': {
# 'url': 'ethereum:0x3d597789ea16054a084ac84ce87f50df9198f415@3?value=1e16&gasPrice=1000000000&gasLimit=100000',
# 'data': {
# 'amount': '0.01',
# 'asset': 'ETHro',
# 'address': '0x3D59…F415',
# 'gas_limit': '100000',
# 'gas_price': '1',
# },
# },
'payment_link': {
'url': 'ethereum:pay-0xc55cf4b03948d7ebc8b9e8bad92643703811d162@3/transfer?address=0x3d597789ea16054a084ac84ce87f50df9198f415&uint256=1e1',
'data': {
'amount': '10',
'asset': 'STT',
'address': '0x3D59…F415',
},
},
'validation_amount_too_presize': {
'url': 'ethereum:0xc55cf4b03948d7ebc8b9e8bad92643703811d162@3/transfer?address=0x101848D5C5bBca18E6b4431eEdF6B95E9ADF82FA&uint256=1e-19',
'data': {
'amount': '1e-19',
'asset': 'STT',
'address': '0x1018…82FA',
},
'send_transaction_validation_error': 'Amount is too precise',
},
'validation_amount_too_big': {
'url': 'ethereum:0x101848D5C5bBca18E6b4431eEdF6B95E9ADF82FA@3?value=1e25',
'data': {
'amount': '10000000',
'asset': 'ETHro',
'address': '0x1018…82FA',
},
'send_transaction_validation_error': 'Insufficient funds',
},
'validation_wrong_chain_id': {
'url': 'ethereum:0x101848D5C5bBca18E6b4431eEdF6B95E9ADF82FA?value=1e17',
'error': 'Network does not match',
'data': {
'amount': '0.1',
'asset': 'ETHro',
'address': '0x1018…82FA',
},
},
'validation_wrong_address': {
'url': 'ethereum:0x744d70fdbe2ba4cf95131626614a1763df805b9e@3/transfer?address=blablabla&uint256=1e10',
'error': 'Invalid address',
},
}
for key in url_data:
wallet.just_fyi('Checking %s case' % key)
wallet.scan_qr_button.click()
if wallet.allow_button.is_element_displayed():
wallet.allow_button.click()
wallet.enter_qr_edit_box.scan_qr(url_data[key]['url'])
if url_data[key].get('error'):
if not wallet.element_by_text_part(url_data[key]['error']).is_element_displayed():
self.errors.append('Expected error %s is not shown' % url_data[key]['error'])
wallet.ok_button.click()
if url_data[key].get('data'):
actual_data = send_transaction_view.get_values_from_send_transaction_bottom_sheet()
difference_in_data = url_data[key]['data'].items() - actual_data.items()
if difference_in_data:
self.errors.append(
'In %s case returned value does not match expected in %s' % (key, repr(difference_in_data)))
if url_data[key].get('send_transaction_validation_error'):
error = url_data[key]['send_transaction_validation_error']
if not wallet.element_by_text_part(error).is_element_displayed():
self.errors.append(
'Expected error %s is not shown' % error)
if wallet.close_send_transaction_view_button.is_element_displayed():
wallet.close_send_transaction_view_button.wait_and_click()
else:
wallet.cancel_button.wait_and_click()
self.errors.verify_no_errors()
@marks.testrail_id(5437)
@marks.medium
def test_validation_amount_errors(self):
sender = wallet_users['C']
sign_in = SignInView(self.driver)
errors = {'send_transaction_screen': {
'too_precise': 'Amount is too precise. Max number of decimals is 7.',
'insufficient_funds': 'Insufficient funds'
},
'sending_screen': {
'Amount': 'Insufficient funds',
'Network fee': 'Not enough ETH for gas'
},
}
warning = 'Warning %s is not shown on %s'
sign_in.recover_access(sender['passphrase'])
wallet = sign_in.wallet_button.click()
wallet.wait_balance_is_changed('ADI')
wallet.accounts_status_account.click()
screen = 'send transaction screen from wallet'
sign_in.just_fyi('Checking %s on %s' % (errors['send_transaction_screen']['too_precise'], screen))
initial_amount_adi = wallet.get_asset_amount_by_name('ADI')
send_transaction = wallet.send_transaction_button.click()
adi_button = send_transaction.asset_by_name('ADI')
send_transaction.select_asset_button.click_until_presence_of_element(
send_transaction.eth_asset_in_select_asset_bottom_sheet_button)
adi_button.click()
send_transaction.amount_edit_box.click()
amount = '0.000%s' % str(random.randint(100000, 999999)) + '1'
send_transaction.amount_edit_box.set_value(amount)
if not send_transaction.element_by_text(
errors['send_transaction_screen']['too_precise']).is_element_displayed():
self.errors.append(warning % (errors['send_transaction_screen']['too_precise'], screen))
sign_in.just_fyi('Checking %s on %s' % (errors['send_transaction_screen']['insufficient_funds'], screen))
send_transaction.amount_edit_box.clear()
send_transaction.amount_edit_box.set_value(str(initial_amount_adi) + '1')
if not send_transaction.element_by_text(
errors['send_transaction_screen']['insufficient_funds']).is_element_displayed():
self.errors.append(warning % (errors['send_transaction_screen']['insufficient_funds'], screen))
wallet.close_send_transaction_view_button.click()
wallet.close_button.click()
screen = 'sending screen from wallet'
sign_in.just_fyi('Checking %s on %s' % (errors['sending_screen']['Network fee'], screen))
account_name = 'new'
wallet.add_account(account_name)
wallet.get_account_by_name(account_name).click()
wallet.send_transaction_button.click()
send_transaction.amount_edit_box.set_value('0')
send_transaction.set_recipient_address(ens_user_ropsten['ens'])
send_transaction.next_button.click()
wallet.ok_got_it_button.wait_and_click(30)
if not send_transaction.validation_error_element.is_element_displayed(10):
self.errors.append('Validation icon is not shown when testing %s on %s' % (errors['sending_screen']['Network fee'], screen))
if not wallet.element_by_translation_id("tx-fail-description2").is_element_displayed():
self.errors.append("No warning about failing tx is shown!")
send_transaction.cancel_button.click()
screen = 'sending screen from DApp'
sign_in.just_fyi('Checking %s on %s' % (errors['sending_screen']['Network fee'], screen))
home = wallet.home_button.click()
dapp = sign_in.dapp_tab_button.click()
dapp.select_account_button.click()
dapp.select_account_by_name(account_name).wait_for_element(30)
dapp.select_account_by_name(account_name).click()
status_test_dapp = home.open_status_test_dapp()
status_test_dapp.wait_for_d_aap_to_load()
status_test_dapp.transactions_button.click_until_presence_of_element(
status_test_dapp.send_two_tx_in_batch_button)
status_test_dapp.send_two_tx_in_batch_button.click()
if not send_transaction.validation_error_element.is_element_displayed(10):
self.errors.append(warning % (errors['sending_screen']['Network fee'], screen))
self.errors.verify_no_errors()
@marks.testrail_id(695855)
@marks.transaction
@marks.medium
def test_custom_gas_settings(self):
sender = transaction_senders['ETH_7']
sign_in = SignInView(self.driver)
sign_in.recover_access(sender['passphrase'])
wallet = sign_in.wallet_button.click()
wallet.wait_balance_is_changed()
wallet.accounts_status_account.click()
send_transaction = wallet.send_transaction_button.click()
amount = '0.000%s' % str(random.randint(100000, 999999)) + '1'
send_transaction.amount_edit_box.set_value(amount)
send_transaction.set_recipient_address(ens_user_ropsten['ens'])
send_transaction.next_button.click()
wallet.ok_got_it_button.wait_and_click(30)
send_transaction.network_fee_button.click()
send_transaction = wallet.get_send_transaction_view()
fee_fields = (send_transaction.per_gas_tip_limit_input, send_transaction.per_gas_price_limit_input)
[default_tip, default_price] = [field.text for field in fee_fields]
default_limit = '21000'
wallet.just_fyi("Check basic validation")
values = {
send_transaction.gas_limit_input:
{
'default': default_limit,
'value': '22000',
'20999': 'wallet-send-min-units',
'@!': 'invalid-number',
},
send_transaction.per_gas_tip_limit_input:
{
'default': default_tip,
'value': '2.5',
'aaaa': 'invalid-number',
},
send_transaction.per_gas_price_limit_input:
{
'default': default_price,
'value': str(round(float(default_price)+3, 9)),
'-2': 'invalid-number',
}
}
for field in values:
for key in values[field]:
if key != 'default' and key != 'value':
field.clear()
field.send_keys(key)
if not send_transaction.element_by_translation_id(values[field][key]).is_element_displayed(10):
self.errors.append("%s is not shown for %s" % (values[field][key], field.accessibility_id))
field.clear()
field.set_value(values[field]['value'])
wallet.just_fyi("Set custom fee and check that it will be applied")
send_transaction.save_fee_button.scroll_and_click()
if wallet.element_by_translation_id("change-tip").is_element_displayed():
wallet.element_by_translation_id("continue-anyway").click()
send_transaction.sign_transaction()
self.network_api.wait_for_confirmation_of_transaction(sender['address'], amount, confirmations=3)
transaction = wallet.find_transaction_in_history(amount=amount, return_hash=True)
expected_params = {
'fee_cap': values[send_transaction.per_gas_price_limit_input]['value'],
'tip_cap': '2.5',
'gas_limit': '22000'
}
actual_params = self.network_api.get_custom_fee_tx_params(transaction)
if actual_params != expected_params:
self.errors.append('Real params %s for tx do not match expected %s' % (str(actual_params), str(expected_params)))
wallet.just_fyi('Verify custom fee data on tx screen')
wallet.swipe_up()
for key in expected_params:
if not wallet.element_by_text_part(expected_params[key]).is_element_displayed():
self.errors.append("Custom tx param %s is not shown on tx history screen" % key)
wallet.just_fyi("Check below fee popup on mainnet")
profile = wallet.profile_button.click()
profile.switch_network()
sign_in.wallet_button.click()
wallet.accounts_status_account.click()
send_transaction = wallet.send_transaction_button.click_until_presence_of_element(send_transaction.amount_edit_box)
send_transaction.amount_edit_box.set_value(0)
send_transaction.set_recipient_address(ens_user_ropsten['ens'])
send_transaction.next_button.click()
wallet.element_by_translation_id("network-fee").click()
if not wallet.element_by_translation_id("tx-fail-description2").is_element_displayed():
self.errors.append("Tx is likely to fail is not shown!")
if send_transaction.network_fee_button.is_element_displayed():
self.errors.append("Still can set tx fee when balance is not enough")
## TODO: should be moved to another test after 8f52b9b63ccd9a52b7fe37ab4f89a2e7b6721fcd
# send_transaction = wallet.get_send_transaction_view()
# send_transaction.gas_limit_input.clear()
# send_transaction.gas_limit_input.set_value(default_limit)
# send_transaction.per_gas_price_limit_input.clear()
# send_transaction.per_gas_price_limit_input.click()
# send_transaction.per_gas_price_limit_input.send_keys('1')
# if not wallet.element_by_translation_id("below-base-fee").is_element_displayed(10):
# self.errors.append("Fee is below error is not shown")
# send_transaction.save_fee_button.scroll_and_click()
# if not wallet.element_by_translation_id("change-tip").is_element_displayed():
# self.errors.append("Popup about changing fee error is not shown")
# wallet.element_by_translation_id("continue-anyway").click()
# if not send_transaction.element_by_text_part('0.000021 ETH').is_element_displayed():
# self.driver.fail("Custom fee is not applied!")
self.errors.verify_no_errors()
class TestTransactionWalletMultipleDevice(MultipleDeviceTestCase):
@marks.testrail_id(6330)
@marks.medium
@marks.transaction
def test_can_send_all_tokens_via_max_option(self):
sender = transaction_senders['ETH_STT_2']
receiver = transaction_senders['ETH_1']
self.create_drivers(2)
device_1, device_2 = SignInView(self.drivers[0]), SignInView(self.drivers[1])
home_1, home_2 = device_1.recover_access(sender['passphrase']), device_2.recover_access(receiver['passphrase'])
wallet_sender = home_1.wallet_button.click()
wallet_receiver = home_2.wallet_button.click()
if wallet_receiver.asset_by_name('STT').is_element_present(10):
initial_balance = wallet_receiver.get_asset_amount_by_name("STT")
else:
initial_balance = '0'
device_1.just_fyi("Sending token amount to device who will use Set Max option for token")
amount = '0.012345678912345678'
wallet_sender.send_transaction(asset_name='STT', amount=amount, recipient=receiver['address'])
wallet_receiver.wait_balance_is_changed(asset='STT', initial_balance=initial_balance, scan_tokens=True)
wallet_receiver.accounts_status_account.click()
device_1.just_fyi("Send all tokens via Set Max option")
send_transaction = wallet_receiver.send_transaction_button.click()
send_transaction.select_asset_button.click()
asset_name = 'STT'
asset_button = send_transaction.asset_by_name(asset_name)
send_transaction.select_asset_button.click_until_presence_of_element(
send_transaction.eth_asset_in_select_asset_bottom_sheet_button)
asset_button.click()
send_transaction.set_max_button.click()
send_transaction.set_recipient_address(sender['address'])
send_transaction.sign_transaction_button.click()
send_transaction.sign_transaction()
wallet_receiver.close_button.click()
initial_balance = float(initial_balance) + float(amount)
wallet_receiver.wait_balance_is_changed(asset='STT', initial_balance=str(initial_balance), scan_tokens=True)

View File

@ -1,565 +0,0 @@
import pytest
from tests import marks
from tests.base_test_case import MultipleDeviceTestCase, MultipleSharedDeviceTestCase, create_shared_drivers
from tests.users import transaction_senders, basic_user, ens_user, ens_user_ropsten
from views.sign_in_view import SignInView
from views.chat_view import ChatView
# TODO: moved here until resolve of 13048
@pytest.mark.xdist_group(name="group_chat_3")
@marks.critical
class TestGroupChatMultipleDeviceMerged(MultipleSharedDeviceTestCase):
@classmethod
def setup_class(cls):
cls.drivers, cls.loop = create_shared_drivers(3)
cls.message_before_adding = 'message before adding new user'
cls.message_to_admin = 'Hey, admin!'
cls.homes, cls.public_keys, cls.usernames, cls.chats = {}, {}, {}, {}
for key in cls.drivers:
sign_in = SignInView(cls.drivers[key])
cls.homes[key] = sign_in.create_user(enable_notifications=True)
cls.public_keys[key], cls.usernames[key] = sign_in.get_public_key_and_username(True)
sign_in.home_button.click()
cls.chat_name = cls.homes[0].get_random_chat_name()
cls.homes[0].just_fyi('Admin adds future members to contacts')
for i in range(1, 3):
cls.homes[0].add_contact(cls.public_keys[i])
cls.homes[0].home_button.double_click()
cls.homes[0].just_fyi('Member adds admin to contacts to see PNs and put app in background')
cls.homes[1].add_contact(cls.public_keys[0])
cls.homes[1].home_button.double_click()
cls.homes[0].just_fyi('Admin creates group chat')
cls.chats[0] = cls.homes[0].create_group_chat([cls.usernames[1]], cls.chat_name)
for i in range(1, 3):
cls.chats[i] = ChatView(cls.drivers[i])
cls.chats[0].send_message(cls.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[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)
invite_system_message = self.chats[0].invite_system_message(self.usernames[0], self.usernames[1])
invited_to_join = self.chats[0].invited_to_join_system_message(self.usernames[0], self.chat_name)
create_for_admin_system_message = self.chats[0].create_for_admin_system_message(self.chat_name)
for message in [create_for_admin_system_message, create_system_message, invite_system_message]:
if not self.chats[0].chat_element_by_text(message):
self.errors.append('%s system message is not shown' % message)
for message in [invited_to_join, create_system_message, invite_system_message]:
if not self.chats[1].chat_element_by_text(message):
self.errors.append('%s system message is not shown' % message)
self.errors.verify_no_errors()
@marks.testrail_id(700731)
def test_group_chat_join_send_text_messages_push(self):
message_to_admin = self.message_to_admin
[self.homes[i].home_button.double_click() for i in range(3)]
self.homes[1].get_chat(self.chat_name).click()
self.chats[1].just_fyi('Join to group chat')
join_system_message = self.chats[1].join_system_message(self.usernames[1])
self.chats[1].join_chat_button.click()
if not self.chats[1].chat_element_by_text(join_system_message).is_element_displayed(30):
self.drivers[1].fail('System message after joining group chat is not shown')
self.chats[1].send_message(message_to_admin)
self.chats[0].just_fyi('check that PN is received and after tap you are redirected to group chat')
self.chats[0].open_notification_bar()
pn = self.homes[0].get_pn(message_to_admin)
if pn:
pn.click()
else:
self.homes[0].click_system_back_button()
self.homes[0].get_chat(self.chat_name).click()
self.chats[1].just_fyi('Check message status and message delivery')
message_status = self.chats[1].chat_element_by_text(message_to_admin).status
if message_status != 'delivered':
self.errors.append('Message status is not delivered, it is %s!' % message_status)
for message in (join_system_message, message_to_admin):
if not self.chats[0].chat_element_by_text(message).is_element_displayed(30):
self.drivers[0].fail('Message %s was not received by admin' % message)
self.errors.verify_no_errors()
@marks.testrail_id(700732)
def test_group_chat_add_new_member_activity_centre(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 no PN but unread in AC if got invite from non-contact")
if not self.homes[2].notifications_unread_badge.is_element_displayed(60):
self.drivers[2].fail("Group chat is not appeared in AC!")
self.homes[2].open_notification_bar()
if self.homes[2].element_by_text_part(self.usernames[0]).is_element_displayed():
self.errors.append("PN about group chat invite is shown when invited by non-contact")
self.homes[2].click_system_back_button()
self.homes[2].get_chat(self.chat_name).click()
self.chats[2].join_chat_button.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(3998)
def test_group_chat_offline_pn(self):
[self.homes[i].home_button.double_click() for i in range(3)]
chat_name = 'for_offline_pn'
self.homes[0].create_group_chat([self.usernames[1], self.usernames[2]], chat_name)
self.homes[0].home_button.double_click()
for i in range(1, 3):
self.homes[i].get_chat(chat_name).click()
self.chats[i].join_chat_button.click()
message_1, message_2 = 'message from old member', 'message from new member'
self.homes[0].just_fyi("Put admin device to offline and send messages from members")
self.homes[0].toggle_airplane_mode()
self.chats[1].send_message(message_1)
self.chats[2].send_message(message_2)
self.homes[0].just_fyi("Put admin device to online and check that messages and PNs will be fetched")
self.homes[0].toggle_airplane_mode()
self.homes[0].connection_offline_icon.wait_for_invisibility_of_element(60)
self.homes[0].open_notification_bar()
for message in (message_1, message_2):
if not self.homes[0].get_pn(message):
self.errors.append('%s PN was not fetched from offline' % message)
self.homes[0].click_system_back_button()
unread_group = self.homes[0].get_chat(chat_name)
if not unread_group.new_messages_counter.text == '2':
self.errors.append('%s does not match unread messages' % unread_group.new_messages_counter.text)
unread_group.click()
self.homes[0].just_fyi("check that messages are shown for every member")
for i in range(3):
for message in (message_1, message_2):
if not self.chats[i].chat_element_by_text(message).is_element_displayed():
self.errors.append('%s if not shown for device %s' % (message, str(i)))
self.errors.verify_no_errors()
@marks.testrail_id(5756)
def test_group_chat_decline_invite_chat_highligted(self):
chat_name = 'for_invited'
left_system_message = self.chats[0].leave_system_message(self.usernames[1])
[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! ")
self.homes[1].get_chat(chat_name).click()
chat_2.decline_invitation_button.click()
if self.chats[0].chat_element_by_text(left_system_message).is_element_displayed():
self.errors.append('System message when user declined invite is shown')
if self.homes[1].element_by_text(chat_name).is_element_displayed():
self.errors.append("Group chat '%s' is shown, but user declined invite" % chat_name)
self.homes[0].just_fyi('Send message after invite is declined and check that it is not reappeared')
message = 'sent after leaving'
self.chats[0].send_message(message)
if self.homes[1].element_by_text(chat_name).is_element_displayed():
self.errors.append("Group chat '%s' reappeared when new message is sent" % chat_name)
self.errors.verify_no_errors()
@marks.testrail_id(3997)
def test_group_chat_leave_relogin(self):
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()
join_button = self.chats[1].join_chat_button
if join_button.is_element_displayed():
join_button.click()
self.homes[0].just_fyi("Admin deleted chat via long press")
self.homes[0].leave_chat_long_press(self.chat_name)
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="sync_2")
@marks.critical
class TestSyncMultipleDevicesMerged(MultipleSharedDeviceTestCase):
@classmethod
def setup_class(cls):
cls.drivers, cls.loop = create_shared_drivers(2)
cls.no_contact_nickname = 'no_contact_nickname'
cls.device_1, cls.device_2 = SignInView(cls.drivers[0]), SignInView(cls.drivers[1])
cls.home_1 = cls.device_1.create_user()
cls.name_1, cls.name_2 = 'device_%s' % cls.drivers[0].number, 'device_%s' % cls.drivers[1].number
cls.message_before_sync, cls.message_after_sync = 'sent before sync', 'sent after sync'
cls.contact_before_sync = basic_user
cls.public_chat_before_sync, cls.public_chat_after_sync = cls.home_1.get_random_chat_name(), 'after-pairing'
cls.home_1.just_fyi("(main device): get recovery phrase")
cls.profile_1 = cls.home_1.profile_button.click()
cls.profile_1.privacy_and_security_button.click()
cls.profile_1.backup_recovery_phrase_button.click()
cls.profile_1.ok_continue_button.click()
cls.recovery_phrase = cls.profile_1.get_recovery_phrase()
cls.profile_1.close_button.click()
cls.profile_1.home_button.click()
cls.profile_1.get_recovery_phrase()
cls.home_1.just_fyi('Add contact, 1-1 chat (main device): 3-random, contact with ENS, start 1-1')
cls.chat_1 = cls.home_1.add_contact(cls.contact_before_sync['public_key'])
cls.chat_1.send_message(cls.message_before_sync)
cls.chat_1.home_button.click()
cls.home_1.add_contact(ens_user['ens'])
cls.chat_1.home_button.click()
cls.home_1.just_fyi('Chats, contacts (main device): join public chat, block user, set nickname')
public_chat_1 = cls.home_1.join_public_chat(cls.public_chat_before_sync)
public_chat_1.home_button.click()
cls.home_1.add_contact(transaction_senders['A']['public_key'], add_in_contacts=False,
nickname=cls.no_contact_nickname)
cls.chat_1.open_user_profile_from_1_1_chat()
cls.chat_1.block_contact()
cls.device_2.just_fyi("(secondary device): restore same multiaccount on another device")
cls.home_2 = cls.device_2.recover_access(passphrase=' '.join(cls.recovery_phrase.values()))
cls.profile_1, cls.profile_2 = cls.home_1.profile_button.click(), cls.home_2.profile_button.click()
cls.device_2.just_fyi('Nicknames (main device): set nickname for contact')
cls.profile_1.open_contact_from_profile(cls.contact_before_sync['username'])
cls.nickname = 'my_basic_user'
cls.chat_1.set_nickname(cls.nickname)
cls.device_1.back_button.click()
cls.device_2.just_fyi('Pair main and secondary devices')
cls.profile_2.discover_and_advertise_device(cls.name_2)
cls.profile_1.discover_and_advertise_device(cls.name_1)
cls.profile_1.get_toggle_device_by_name(cls.name_2).wait_and_click()
cls.profile_1.sync_all_button.click()
cls.profile_1.sync_all_button.wait_for_visibility_of_element(20)
[device.profile_button.double_click() for device in (cls.profile_1, cls.profile_2)]
@marks.testrail_id(702194)
def test_sync_initial_contacts_blocked_users(self):
self.profile_2.contacts_button.scroll_to_element(9, 'up')
self.profile_2.contacts_button.click()
if not self.profile_2.blocked_users_button.is_element_displayed(30):
self.errors.append('Blocked users are not synced after initial sync')
for name in (basic_user['username'], self.nickname, '@%s' % ens_user['ens']):
if not self.profile_2.element_by_text(name).is_element_displayed():
self.errors.append('"%s" is not found in Contacts on initial sync' % name)
self.profile_2.blocked_users_button.click()
if not self.profile_2.element_by_text(self.no_contact_nickname).is_element_displayed():
self.errors.append(
"'%s' nickname without adding to contacts is not synced on initial sync" % self.no_contact_nickname)
self.errors.verify_no_errors()
@marks.testrail_id(702195)
def test_sync_initial_public_chats(self):
[device.home_button.double_click() for device in (self.profile_1, self.profile_2)]
if not self.home_2.element_by_text_part(self.public_chat_before_sync).is_element_displayed():
self.errors.append(
"'%s' public chat is not appeared on secondary device on initial sync" % self.public_chat_before_sync)
self.errors.verify_no_errors()
@marks.testrail_id(702196)
def test_sync_contacts_block_unblock(self):
[device.profile_button.double_click() for device in (self.profile_1, self.profile_2)]
new_user_for_block = transaction_senders['C']
self.profile_1.just_fyi("Contacts(main device): block and unblock user")
self.profile_1.profile_button.click()
self.profile_1.contacts_button.scroll_to_element(direction='up')
self.profile_1.contacts_button.click()
self.profile_1.blocked_users_button.click()
self.profile_1.element_by_text(self.no_contact_nickname).click()
self.chat_1.unblock_contact_button.click()
self.profile_1.close_button.click()
self.home_1.home_button.click()
self.home_1.add_contact(new_user_for_block['public_key'], add_in_contacts=False)
self.chat_1.open_user_profile_from_1_1_chat()
self.chat_1.block_contact()
self.device_2.just_fyi('Contacts (secondary device): check unblocked and blocked user')
self.profile_2.contacts_button.click()
self.profile_2.blocked_users_button.click()
if self.profile_2.element_by_text(self.no_contact_nickname).is_element_displayed():
self.errors.append("'%s' unblocked user is not synced!" % self.no_contact_nickname)
if not self.profile_2.element_by_text(new_user_for_block['username']).is_element_displayed():
self.errors.append("'%s' blocked user is not synced!" % new_user_for_block['username'])
self.errors.verify_no_errors()
@marks.testrail_id(702197)
def test_sync_contacts_add_remove_set_nickname_ens(self):
[device.home_button.double_click() for device in (self.profile_1, self.profile_2)]
new_contact, new_nickname = transaction_senders['F'], "completely_new_nick"
self.home_1.add_contact(ens_user_ropsten['ens'])
self.home_1.home_button.click()
self.home_1.add_contact(new_contact['public_key'])
self.device_2.just_fyi('Contacts (secondary device):check new contact')
self.profile_2.profile_button.double_click()
self.profile_2.contacts_button.scroll_to_element(direction='up')
self.profile_2.contacts_button.click()
for contact in (new_contact['username'], '@%s' % ens_user_ropsten['ens']):
if not self.profile_2.element_by_text(contact).is_element_displayed():
self.errors.append("'%s' new contact is not synced!" % contact)
self.device_1.just_fyi('(Main device): set nickname, (secondary device): check nickname')
self.chat_1.open_user_profile_from_1_1_chat()
self.chat_1.set_nickname(new_nickname)
if not self.profile_2.element_by_text(new_nickname).is_element_displayed():
self.errors.append("'%s' new nickname is not synced!" % new_nickname)
self.device_1.just_fyi('(Main device): remove contact, (secondary device): check removed contact')
self.chat_1.open_user_profile_from_1_1_chat()
self.chat_1.remove_from_contacts.click()
self.chat_1.close_button.click()
self.profile_2.element_by_text(new_nickname).is_element_disappeared(40)
self.errors.verify_no_errors()
@marks.testrail_id(702198)
def test_sync_1_1_chat_message(self):
[device.home_button.double_click() for device in (self.profile_1, self.profile_2)]
self.home_1.get_chat(self.nickname).click()
self.chat_1.send_message(self.message_after_sync)
self.home_2.just_fyi("Chats (secondary device): check messages in 1-1")
chat = self.home_2.get_chat(self.nickname).click()
if chat.chat_element_by_text(self.message_before_sync).is_element_displayed():
self.errors.append('"%s" message sent before pairing is synced' % self.message_before_sync)
if not chat.chat_element_by_text(self.message_after_sync).is_element_displayed(60):
self.errors.append('"%s" message in 1-1 is not synced' % self.message_after_sync)
self.errors.verify_no_errors()
@marks.testrail_id(702199)
def test_sync_public_chat_add_remove(self):
[device.home_button.double_click() for device in (self.profile_1, self.profile_2)]
self.home_1.join_public_chat(self.public_chat_after_sync)
if not self.home_2.element_by_text("#%s" % self.public_chat_after_sync).is_element_displayed(10):
self.errors.append('Public chat "%s" is not synced' % self.public_chat_after_sync)
self.home_1.home_button.click()
self.home_1.delete_chat_long_press('#%s' % self.public_chat_after_sync)
if not self.home_2.element_by_text('#%s' % self.public_chat_after_sync).is_element_disappeared(60):
self.errors.append('Remove of "%s" public chat is not synced!' % self.public_chat_after_sync)
self.errors.verify_no_errors()
class TestGroupChatMultipleDevice(MultipleDeviceTestCase):
@marks.testrail_id(6324)
@marks.medium
def test_invite_to_group_chat_handling(self):
self.create_drivers(3)
sign_ins, homes, public_keys, usernames, chats = {}, {}, {}, {}, {}
for key in self.drivers:
sign_ins[key] = SignInView(self.drivers[key])
homes[key] = sign_ins[key].create_user()
public_keys[key], usernames[key] = sign_ins[key].get_public_key_and_username(True)
sign_ins[key].home_button.click()
[driver.close_app() for driver in (self.drivers[1], self.drivers[2])]
chat_name = homes[0].get_random_chat_name()
homes[0].just_fyi('Create group chats without members')
chats[0] = homes[0].create_group_chat([], chat_name)
link = chats[0].get_group_invite_via_group_info()
chats[0].get_back_to_home_view()
chats[0].just_fyi('Member_1, member_2: both users send requests to join group chat')
[sign_in.open_weblink_and_login(link) for sign_in in (sign_ins[1], sign_ins[2])]
introduction_messages = ['message for retrying']
for i in range(1, 3):
homes[i].element_by_text_part(chat_name).click()
chats[i] = ChatView(self.drivers[i])
introduction_messages.append('Please add me, member_%s to your gorgeous group chat' % str(i))
chats[i].request_membership_for_group_chat(introduction_messages[i])
chats[0].just_fyi('Admin: accept request for Member_1 and decline for Member_2')
homes[0].get_chat(chat_name).click()
chats[0].group_membership_request_button.wait_and_click()
chats[0].element_by_text(usernames[1]).click()
if not chats[0].element_by_text_part(introduction_messages[1]).is_element_displayed():
self.errors.append('Introduction message is not shown!')
chats[0].accept_group_invitation_button.wait_and_click()
chats[0].accept_membership_for_group_chat_via_chat_view(usernames[2], accept=False)
chats[0].click_system_back_button()
chats[2].just_fyi('Member_2: retry request')
chats[2].retry_group_invite_button.wait_and_click()
chats[2].request_membership_for_group_chat(introduction_messages[0])
chats[2].just_fyi('Admin: decline request for Member_2')
chats[0].group_membership_request_button.wait_and_click()
chats[0].element_by_text(usernames[2]).click()
if not chats[0].element_by_text_part(introduction_messages[0]).is_element_displayed():
self.errors.append('Introduction message that was set after retrying attempt is not shown for admin!')
chats[0].decline_group_invitation_button.wait_and_click()
chats[0].click_system_back_button()
chats[2].just_fyi('Member_2: remove chat')
chats[2].remove_group_invite_button.wait_and_click()
chats[2].just_fyi('Double check after relogin')
if chats[0].group_membership_request_button.is_element_displayed():
self.errors.append('Group membership request is still shown when there are no pending requests anymore')
[homes[i].relogin() for i in range(0, 3)]
if homes[2].element_by_text_part(chat_name).is_element_displayed():
self.errors.append('Group chat was not removed when removing after declining group invite')
[home.get_chat(chat_name).click() for home in (homes[0], homes[1])]
if chats[0].group_membership_request_button.is_element_displayed():
self.errors.append(
'Group membership request is shown after relogin when there are no pending requests anymore')
join_system_message = chats[0].join_system_message(usernames[1])
for chat in (chats[1], chats[0]):
if not chat.chat_element_by_text(join_system_message).is_element_displayed():
self.errors.append('%s is not shown after joining to group chat via invite' % join_system_message)
self.errors.verify_no_errors()
@marks.testrail_id(4001)
@marks.medium
def test_remove_member_from_group_chat(self):
self.create_drivers(3)
homes, public_keys, usernames, chats = {}, {}, {}, {}
for key in self.drivers:
sign_in_view = SignInView(self.drivers[key])
homes[key] = sign_in_view.create_user()
public_keys[key], usernames[key] = sign_in_view.get_public_key_and_username(True)
sign_in_view.home_button.click()
chat_name = homes[0].get_random_chat_name()
for i in range(1, 3):
homes[0].add_contact(public_keys[i])
homes[0].get_back_to_home_view()
chats[0] = homes[0].create_group_chat([usernames[1],
usernames[2]], chat_name)
chats[0].just_fyi('Member_1, member_2: both users join to group chat')
for i in range(1, 3):
chats[i] = homes[i].get_chat(chat_name).click()
chats[i].join_chat_button.click()
chats[0].just_fyi("Admin: get options for device 2 in group chat and remove him")
options = chats[0].get_user_options(usernames[1])
options.remove_user_button.click()
left_message = chats[0].leave_system_message(usernames[1])
for key in chats:
if not chats[key].chat_element_by_text(left_message).is_element_displayed():
self.errors.append("Message with text '%s' was not received" % left_message)
chats[0].just_fyi("Check that input field is not available after removing")
if chats[1].chat_message_input.is_element_displayed():
self.errors.append("Message input is still available for removed user")
chats[0].just_fyi("Send message and check that it is available only for remaining users")
message = 'after removing member'
chats[0].send_message(message)
for chat in (chats[0], chats[2]):
if not chat.chat_element_by_text(message).is_element_displayed(30):
self.errors.append("Message '%s' was not received after removing member" % message)
if chats[1].chat_element_by_text(message).is_element_displayed():
self.errors.append("Message '%s' was received by removed member" % message)
self.errors.verify_no_errors()
@marks.testrail_id(6317)
@marks.medium
def test_pair_devices_group_chat_different_messages_nicknames(self):
self.create_drivers(3)
device_1, device_2, device_3 = SignInView(self.drivers[0]), SignInView(self.drivers[1]), SignInView(
self.drivers[2])
home_1 = device_1.create_user()
profile_1 = home_1.profile_button.click()
profile_1.privacy_and_security_button.click()
profile_1.backup_recovery_phrase_button.click()
profile_1.ok_continue_button.click()
recovery_phrase = profile_1.get_recovery_phrase()
profile_1.close_button.click()
profile_1.home_button.click()
home_3 = device_3.create_user()
public_key_3, username_3 = home_3.get_public_key_and_username(return_username=True)
device_3.home_button.click()
device_1_name, device_2_name, group_chat_name = 'creator', 'paired', 'some group chat'
home_2 = device_2.recover_access(passphrase=' '.join(recovery_phrase.values()))
device_1.just_fyi('Add contact, start group chat')
nickname = 'my_tester'
home_1.add_contact(public_key_3, nickname=nickname)
home_1.get_back_to_home_view()
chat_1 = home_1.create_group_chat([username_3], group_chat_name)
chat_3 = home_3.get_chat(group_chat_name).click()
chat_3.join_chat_button.click()
device_2.just_fyi('Go to profile > Devices, set device name, discover device 2 to device 1')
profile_2 = home_2.profile_button.click()
profile_2.discover_and_advertise_device(device_2_name)
device_1.profile_button.click()
profile_1.discover_and_advertise_device(device_1_name)
profile_1.get_toggle_device_by_name(device_2_name).click()
profile_1.sync_all_button.click()
profile_1.sync_all_button.wait_for_visibility_of_element(15)
profile_1.click_system_back_button(2)
device_1.just_fyi('Send message to group chat and verify it on all devices')
text_message = 'some text'
profile_1.home_button.click(desired_view='chat')
profile_2.home_button.click()
chat_1.send_message(text_message)
chat_2 = home_2.get_chat(group_chat_name).click()
for chat in chat_1, chat_2, chat_3:
if not chat.chat_element_by_text(text_message).is_element_displayed():
self.errors.append('Message was sent, but it is not shown')
device_3.just_fyi('Send message to group chat as member and verify nickname on it')
message_from_member = 'member1'
chat_3.send_message(message_from_member)
chat_1.chat_element_by_text(message_from_member).wait_for_visibility_of_element(20)
for chat in chat_1, chat_2:
if not chat.chat_element_by_text(message_from_member).username != '%s %s' % (nickname, username_3):
self.errors.append('Nickname is not shown in group chat')
device_1.just_fyi('Send image to group chat and verify it on all devices')
chat_1.show_images_button.click()
chat_1.allow_button.click()
chat_1.first_image_from_gallery.click()
chat_1.send_message_button.click()
chat_1.chat_message_input.click()
for chat in chat_1, chat_2, chat_3:
if not chat.image_message_in_chat.is_element_displayed(60):
self.errors.append('Image is not shown in chat after sending for %s' % chat.driver.number)
device_1.just_fyi('Send audio message to group chat and verify it on all devices')
chat_1.record_audio_message(message_length_in_seconds=3)
device_1.send_message_button.click()
chat_1.chat_message_input.click()
for chat in chat_1, chat_2, chat_3:
if not chat.play_pause_audio_message_button.is_element_displayed(30):
self.errors.append('Audio message is not shown in chat after sending!')
device_1.just_fyi('Send sticker to group chat and verify it on all devices')
chat_1.profile_button.click()
profile_1.switch_network()
home_1.get_chat(group_chat_name).click()
chat_1.install_sticker_pack_by_name()
chat_1.sticker_icon.click()
if not chat_1.sticker_message.is_element_displayed(30):
self.errors.append('Sticker was not sent')
self.errors.verify_no_errors()

View File

@ -1,13 +1,211 @@
import emoji
import random
import pytest
import time
from time import sleep
from tests import marks, common_password
from tests.base_test_case import MultipleDeviceTestCase, SingleDeviceTestCase, 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_ropsten
from views.sign_in_view import SignInView
from views.send_transaction_view import SendTransactionView
import pytest
@pytest.mark.xdist_group(name="commands_2")
@marks.critical
class TestCommandsMultipleDevicesMerged(MultipleSharedDeviceTestCase):
@classmethod
def setup_class(cls):
cls.drivers, cls.loop = create_shared_drivers(2)
cls.device_1, cls.device_2 = SignInView(cls.drivers[0]), SignInView(cls.drivers[1])
cls.sender = transaction_senders['ETH_STT_3']
cls.home_1 = cls.device_1.recover_access(passphrase=cls.sender['passphrase'], enable_notifications=True)
cls.home_2 = cls.device_2.create_user()
for home in cls.home_1, cls.home_2:
profile = home.profile_button.click()
profile.profile_notifications_button.scroll_and_click()
profile.wallet_push_notifications.click()
cls.recipient_public_key, cls.recipient_username = cls.home_2.get_public_key_and_username(return_username=True)
cls.wallet_1, cls.wallet_2 = cls.home_1.wallet_button.click(), cls.home_2.wallet_button.click()
[wallet.home_button.click() for wallet in (cls.wallet_1, cls.wallet_2)]
cls.chat_1 = cls.home_1.add_contact(cls.recipient_public_key)
cls.chat_1.send_message("hello!")
cls.account_name_1 = cls.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.set_value(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 23.11.21, 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.set_value(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.set_value(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')
self.home_1.driver.close_app()
self.home_2.just_fyi('Request %s STT in 1-1 chat and check it is visible for sender and receiver' % amount)
chat_2 = self.home_2.get_chat(username=self.sender['username']).click()
chat_2.commands_button.click()
request_transaction = chat_2.request_command.click()
request_transaction.amount_edit_box.set_value(amount)
request_transaction.confirm()
asset_button = request_transaction.asset_by_name(asset_name)
request_transaction.select_asset_button.click_until_presence_of_element(asset_button)
asset_button.click()
request_transaction.request_transaction_button.click()
chat_2_request_message = chat_2.get_incoming_transaction()
if not chat_2_request_message.is_element_displayed():
self.drivers[1].fail('No incoming transaction in 1-1 chat is shown for recipient after requesting STT')
self.home_1.just_fyi('Check that transaction message is fetched from offline and sign transaction')
self.device_1.driver.launch_app()
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="1_1_chat_2")
@ -434,7 +632,7 @@ class TestContactBlockMigrateKeycardMultipleSharedDevices(MultipleSharedDeviceTe
[home.home_button.click() for home in [cls.home_1, cls.home_2]]
@marks.testrail_id(702186)
def test_keycard_command_send_eth_1_1_chat(self):
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()
@ -479,7 +677,7 @@ class TestContactBlockMigrateKeycardMultipleSharedDevices(MultipleSharedDeviceTe
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")
sleep(20)
time.sleep(20)
send_message = sender_message.sign_and_send.click()
send_message.next_button.click()
send_message.sign_transaction(keycard=True)
@ -527,10 +725,10 @@ class TestContactBlockMigrateKeycardMultipleSharedDevices(MultipleSharedDeviceTe
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=self.default_username_2[0:4])
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!')
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()
@ -608,7 +806,7 @@ class TestContactBlockMigrateKeycardMultipleSharedDevices(MultipleSharedDeviceTe
for message in self.message, message_blocked:
if self.chat_1.chat_element_by_text(message).is_element_displayed():
self.errors.append(
"'%s' from blocked user is fetched from offline in public chat" % (message))
"'%s' from blocked user is fetched from offline in public chat" % message)
self.chat_2.just_fyi('Unblock user and check that can see further messages')
profile_1 = self.home_1.get_profile_view()
@ -741,257 +939,247 @@ class TestContactBlockMigrateKeycardMultipleSharedDevices(MultipleSharedDeviceTe
self.errors.verify_no_errors()
class TestMessagesOneToOneChatMultiple(MultipleDeviceTestCase):
@marks.testrail_id(5362)
@marks.medium
def test_unread_messages_counter_preview_highlited_1_1_chat(self):
self.create_drivers(2)
device_1, device_2 = SignInView(self.drivers[0]), SignInView(self.drivers[1])
home_1, home_2 = device_1.create_user(), device_2.create_user()
profile_2 = home_2.profile_button.click()
default_username_2 = profile_2.default_username_text.text
home_2 = profile_2.home_button.click()
public_key_1 = home_1.get_public_key_and_username()
home_1.home_button.click()
chat_2 = home_2.add_contact(public_key_1)
@pytest.mark.xdist_group(name="ens_stickers_mention_2")
@marks.critical
class TestEnsStickersMultipleDevicesMerged(MultipleSharedDeviceTestCase):
message, message_2, message_3 = 'test message', 'test message2', 'test'
chat_2.send_message(message)
chat_element = home_1.get_chat(default_username_2)
home_1.dapp_tab_button.click()
chat_2.send_message(message_2)
@classmethod
def setup_class(cls):
cls.drivers, cls.loop = create_shared_drivers(2)
cls.device_1, cls.device_2 = SignInView(cls.drivers[0]), SignInView(cls.drivers[1])
cls.sender, cls.reciever = transaction_senders['ETH_3'], ens_user
cls.home_1 = cls.device_1.recover_access(passphrase=cls.sender['passphrase'])
cls.home_2 = cls.device_2.recover_access(ens_user['passphrase'], enable_notifications=True)
cls.ens = '@%s' % cls.reciever['ens']
cls.pub_chat_name = cls.home_1.get_random_chat_name()
cls.chat_1 = cls.home_1.join_public_chat(cls.pub_chat_name)
cls.chat_2 = cls.home_2.join_public_chat(cls.pub_chat_name)
[home.home_button.double_click() for home in (cls.home_1, cls.home_2)]
cls.profile_2 = cls.home_2.profile_button.click()
cls.profile_2.connect_existing_ens(cls.reciever['ens'])
cls.home_1.add_contact(cls.reciever['ens'])
cls.home_2.home_button.click()
cls.home_2.add_contact(cls.sender['public_key'])
# To avoid activity centre for restored users
[chat.send_message("hey!") for chat in (cls.chat_1, cls.chat_2)]
[home.home_button.double_click() for home in (cls.home_1, cls.home_2)]
if home_1.home_button.counter.text != '1':
self.errors.append('New messages counter is not shown on Home button')
device_1.home_button.click()
if chat_element.new_messages_counter.text != '1':
self.errors.append('New messages counter is not shown on chat element')
chat_1 = chat_element.click()
chat_1.add_to_contacts.click()
@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)
home_1.home_button.double_click()
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()
if home_1.home_button.counter.is_element_displayed():
self.errors.append('New messages counter is shown on Home button for already seen message')
if chat_element.new_messages_counter.text == '1':
self.errors.append('New messages counter is shown on chat element for already seen message')
home_1.delete_chat_long_press(default_username_2)
home_1.just_fyi("Checking preview of message and chat highlighting")
chat_2.send_message(message_3)
chat_1_element = home_1.get_chat(default_username_2)
if chat_1_element.chat_preview.is_element_differs_from_template('highligted_preview.png', 0):
self.errors.append("Preview message is not hightligted or text is not shown! ")
home_1.get_chat(default_username_2).click()
home_1.home_button.double_click()
if not home_1.get_chat(default_username_2).chat_preview.is_element_differs_from_template('highligted_preview.png', 0):
self.errors.append("Preview message is still highlighted after opening ")
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()
class TestMessagesOneToOneChatSingle(SingleDeviceTestCase):
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.set_value(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.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)
@marks.testrail_id(5322)
@marks.medium
def test_delete_cut_and_paste_messages(self):
sign_in = SignInView(self.driver)
home = sign_in.create_user()
chat = home.add_contact(transaction_senders['N']['public_key'])
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)
message_text = 'test'
message_input = chat.chat_message_input
message_input.send_keys(message_text)
@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)]
message_input.delete_last_symbols(2)
current_text = message_input.text
if current_text != message_text[:-2]:
self.driver.fail("Message input text '%s' doesn't match expected '%s'" % (current_text, message_text[:-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)
message_input.cut_text()
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)
message_input.paste_text_from_clipboard()
chat.send_message_button.click()
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()
chat.chat_element_by_text(message_text[:-2]).wait_for_visibility_of_element(2)
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.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.click()
@marks.testrail_id(6298)
@marks.medium
def test_can_scan_qr_with_chat_key_from_home_start_chat(self):
sign_in = SignInView(self.driver)
home = sign_in.recover_access(basic_user['passphrase'])
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)
url_data = {
'ens_with_stateofus_domain_deep_link': {
'url': 'https://join.status.im/u/%s.stateofus.eth' % ens_user_ropsten['ens'],
'username': '@%s' % ens_user_ropsten['ens']
},
'ens_without_stateofus_domain_deep_link': {
'url': 'https://join.status.im/u/%s' % ens_user_ropsten['ens'],
'username': '@%s' % ens_user_ropsten['ens']
},
'ens_another_domain_deep_link': {
'url': 'status-im://u/%s' % ens_user['ens_another'],
'username': '@%s' % ens_user['ens_another']
},
'own_profile_key_deep_link': {
'url': 'https://join.status.im/u/%s' % basic_user['public_key'],
'error': "That's you"
},
'other_user_profile_key_deep_link': {
'url': 'https://join.status.im/u/%s' % transaction_senders['M']['public_key'],
'username': transaction_senders['M']['username']
},
'other_user_profile_key_deep_link_invalid': {
'url': 'https://join.status.im/u/%sinvalid' % ens_user['public_key'],
'error': 'Please enter or scan a valid chat key'
},
'own_profile_key': {
'url': basic_user['public_key'],
'error': "That's you"
},
# 'ens_without_stateofus_domain': {
# 'url': ens_user['ens'],
# 'username': ens_user['username']
# },
'other_user_profile_key': {
'url': transaction_senders['M']['public_key'],
'username': transaction_senders['M']['username']
},
'other_user_profile_key_invalid': {
'url': '%s123' % ens_user['public_key'],
'error': 'Please enter or scan a valid chat key'
},
}
for key in url_data:
home.plus_button.click_until_presence_of_element(home.start_new_chat_button)
contacts = home.start_new_chat_button.click()
sign_in.just_fyi('Checking scanning qr for "%s" case' % key)
contacts.scan_contact_code_button.click()
if contacts.allow_button.is_element_displayed():
contacts.allow_button.click()
contacts.enter_qr_edit_box.scan_qr(url_data[key]['url'])
from views.chat_view import ChatView
chat = ChatView(self.driver)
if url_data[key].get('error'):
if not chat.element_by_text_part(url_data[key]['error']).is_element_displayed():
self.errors.append('Expected error %s is not shown' % url_data[key]['error'])
chat.ok_button.click()
if url_data[key].get('username'):
if not chat.chat_message_input.is_element_displayed():
self.errors.append(
'In "%s" case chat input is not found after scanning, so no redirect to 1-1' % key)
if not chat.element_by_text(url_data[key]['username']).is_element_displayed():
self.errors.append('In "%s" case "%s" not found after scanning' % (key, url_data[key]['username']))
chat.get_back_to_home_view()
self.errors.verify_no_errors()
@marks.testrail_id(6322)
@marks.medium
def test_can_scan_different_links_with_universal_qr_scanner(self):
user = transaction_senders['ETH_STT_3']
home = SignInView(self.driver).recover_access(user['passphrase'])
wallet = home.wallet_button.click()
wallet.home_button.click()
send_transaction = SendTransactionView(self.driver)
url_data = {
'ens_without_stateofus_domain_deep_link': {
'url': 'https://join.status.im/u/%s' % ens_user_ropsten['ens'],
'username': '@%s' % ens_user_ropsten['ens']
},
'other_user_profile_key_deep_link': {
'url': 'status-im://u/%s' % basic_user['public_key'],
'username': basic_user['username']
},
'other_user_profile_key_deep_link_invalid': {
'url': 'https://join.status.im/u/%sinvalid' % ens_user['public_key'],
'error': 'Unable to read this code'
},
'own_profile_key': {
'url': user['public_key'],
},
'other_user_profile_key': {
'url': transaction_senders['A']['public_key'],
'username': transaction_senders['A']['username']
},
'wallet_validation_wrong_address_transaction': {
'url': 'ethereum:0x744d70fdbe2ba4cf95131626614a1763df805b9e@3/transfer?address=blablabla&uint256=1e10',
'error': 'Invalid address',
},
'wallet_eip_ens_for_receiver': {
'url': 'ethereum:0xc55cf4b03948d7ebc8b9e8bad92643703811d162@3/transfer?address=nastya.stateofus.eth&uint256=1e-1',
'data': {
'asset': 'STT',
'amount': '0.1',
'address': '0x58d8…F2ff',
},
},
'wallet_eip_payment_link': {
'url': 'ethereum:pay-0xc55cf4b03948d7ebc8b9e8bad92643703811d162@3/transfer?address=0x3d597789ea16054a084ac84ce87f50df9198f415&uint256=1e1',
'data': {
'amount': '10',
'asset': 'STT',
'address': '0x3D59…F415',
},
},
'dapp_deep_link': {
'url': 'https://join.status.im/b/simpledapp.eth',
},
'dapp_deep_link_https': {
'url': 'https://join.status.im/b/https://simpledapp.eth',
},
'public_chat_deep_link': {
'url': 'https://join.status.im/baga-ma-2020',
'chat_name': 'baga-ma-2020'
},
}
for key in url_data:
home.plus_button.click_until_presence_of_element(home.start_new_chat_button)
home.just_fyi('Checking %s case' % key)
if home.universal_qr_scanner_button.is_element_displayed():
home.universal_qr_scanner_button.click()
if home.allow_button.is_element_displayed():
home.allow_button.click()
home.enter_qr_edit_box.scan_qr(url_data[key]['url'])
from views.chat_view import ChatView
chat = ChatView(self.driver)
if key == 'own_profile_key':
from views.profile_view import ProfileView
profile = ProfileView(self.driver)
if not profile.default_username_text.is_element_displayed():
self.errors.append('In %s case was not redirected to own profile' % key)
home.home_button.double_click()
if url_data[key].get('error'):
if not chat.element_by_text_part(url_data[key]['error']).is_element_displayed():
self.errors.append('Expected error %s is not shown' % url_data[key]['error'])
chat.ok_button.click()
if url_data[key].get('username'):
if not chat.element_by_text(url_data[key]['username']).is_element_displayed():
self.errors.append('In %s case username not shown' % key)
if 'wallet' in key:
if url_data[key].get('data'):
actual_data = send_transaction.get_values_from_send_transaction_bottom_sheet()
difference_in_data = url_data[key]['data'].items() - actual_data.items()
if difference_in_data:
self.errors.append(
'In %s case returned value does not match expected in %s' % (key, repr(difference_in_data)))
wallet.close_send_transaction_view_button.click()
wallet.home_button.click()
if 'dapp' in key:
home.open_in_status_button.click()
if not (chat.allow_button.is_element_displayed() or chat.element_by_text(
"Can't find web3 library").is_element_displayed()):
self.errors.append('No allow button is shown in case of navigating to Status dapp!')
chat.dapp_tab_button.click()
chat.home_button.click()
if 'public' in key:
if not chat.chat_message_input.is_element_displayed():
self.errors.append('No message input is shown in case of navigating to public chat via deep link!')
if not chat.element_by_text_part(url_data[key]['chat_name']).is_element_displayed():
self.errors.append('Chat name is not shown in case of navigating to public chat via deep link!')
chat.get_back_to_home_view()
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.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(self.ens).click()
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')
# TODO: issue #11003
pn = self.home_2.get_pn(self.reciever['username'])
if pn:
pn.click()
else:
self.home_2.click_system_back_button(2)
if self.home_2.element_starts_with_text(self.reciever['ens']).is_element_differs_from_template('mentioned.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(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_1, profile_2) = (home.profile_button.click() for home in (self.home_1, self.home_2))
[profile.switch_network() for profile in (profile_1, profile_2)]
# TODO: no check there is no stickers on ropsten due to transfer stickers to status-go
self.home_2.just_fyi('Check that can use purchased stickerpack')
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_1.just_fyi('Install free sticker pack and use it in 1-1 chat')
self.home_1.get_chat(self.ens).click()
self.chat_1.install_sticker_pack_by_name('Status Cat')
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')
self.home_2.home_button.double_click()
self.home_2.get_chat(self.sender['username']).click()
self.chat_2.chat_item.click()
if not self.chat_2.element_by_text_part('Status Cat').is_element_displayed():
self.errors.append('Stickerpack is not available for installation after tapping on sticker message')
self.chat_2.element_by_text_part('Free').click()
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.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_ropsten['ens'][:-2]):
chat.public_key_edit_box.clear()
chat.public_key_edit_box.set_value(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.set_value(ens_user_ropsten['ens'])
resolved_ens = '%s.stateofus.eth' % ens_user_ropsten['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,206 @@
import pytest
from tests import marks
from tests.base_test_case import MultipleSharedDeviceTestCase, create_shared_drivers
from views.sign_in_view import SignInView
from views.chat_view import ChatView
@pytest.mark.xdist_group(name="group_chat_3")
@marks.critical
class TestGroupChatMultipleDeviceMerged(MultipleSharedDeviceTestCase):
@classmethod
def setup_class(cls):
cls.drivers, cls.loop = create_shared_drivers(3)
cls.message_before_adding = 'message before adding new user'
cls.message_to_admin = 'Hey, admin!'
cls.homes, cls.public_keys, cls.usernames, cls.chats = {}, {}, {}, {}
for key in cls.drivers:
sign_in = SignInView(cls.drivers[key])
cls.homes[key] = sign_in.create_user(enable_notifications=True)
cls.public_keys[key], cls.usernames[key] = sign_in.get_public_key_and_username(True)
sign_in.home_button.click()
cls.chat_name = cls.homes[0].get_random_chat_name()
cls.homes[0].just_fyi('Admin adds future members to contacts')
for i in range(1, 3):
cls.homes[0].add_contact(cls.public_keys[i])
cls.homes[0].home_button.double_click()
cls.homes[0].just_fyi('Member adds admin to contacts to see PNs and put app in background')
cls.homes[1].add_contact(cls.public_keys[0])
cls.homes[1].home_button.double_click()
cls.homes[0].just_fyi('Admin creates group chat')
cls.chats[0] = cls.homes[0].create_group_chat([cls.usernames[1]], cls.chat_name)
for i in range(1, 3):
cls.chats[i] = ChatView(cls.drivers[i])
cls.chats[0].send_message(cls.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[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)
invite_system_message = self.chats[0].invite_system_message(self.usernames[0], self.usernames[1])
invited_to_join = self.chats[0].invited_to_join_system_message(self.usernames[0], self.chat_name)
create_for_admin_system_message = self.chats[0].create_for_admin_system_message(self.chat_name)
for message in [create_for_admin_system_message, create_system_message, invite_system_message]:
if not self.chats[0].chat_element_by_text(message):
self.errors.append('%s system message is not shown' % message)
for message in [invited_to_join, create_system_message, invite_system_message]:
if not self.chats[1].chat_element_by_text(message):
self.errors.append('%s system message is not shown' % message)
self.errors.verify_no_errors()
@marks.testrail_id(700731)
def test_group_chat_join_send_text_messages_push(self):
message_to_admin = self.message_to_admin
[self.homes[i].home_button.double_click() for i in range(3)]
self.homes[1].get_chat(self.chat_name).click()
self.chats[1].just_fyi('Join to group chat')
join_system_message = self.chats[1].join_system_message(self.usernames[1])
self.chats[1].join_chat_button.click()
if not self.chats[1].chat_element_by_text(join_system_message).is_element_displayed(30):
self.drivers[1].fail('System message after joining group chat is not shown')
self.chats[1].send_message(message_to_admin)
self.chats[0].just_fyi('check that PN is received and after tap you are redirected to group chat')
self.chats[0].open_notification_bar()
pn = self.homes[0].get_pn(message_to_admin)
if pn:
pn.click()
else:
self.homes[0].click_system_back_button()
self.homes[0].get_chat(self.chat_name).click()
self.chats[1].just_fyi('Check message status and message delivery')
message_status = self.chats[1].chat_element_by_text(message_to_admin).status
if message_status != 'delivered':
self.errors.append('Message status is not delivered, it is %s!' % message_status)
for message in (join_system_message, message_to_admin):
if not self.chats[0].chat_element_by_text(message).is_element_displayed(30):
self.drivers[0].fail('Message %s was not received by admin' % message)
self.errors.verify_no_errors()
@marks.testrail_id(700732)
def test_group_chat_add_new_member_activity_centre(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 no PN but unread in AC if got invite from non-contact")
if not self.homes[2].notifications_unread_badge.is_element_displayed(60):
self.drivers[2].fail("Group chat is not appeared in AC!")
self.homes[2].open_notification_bar()
if self.homes[2].element_by_text_part(self.usernames[0]).is_element_displayed():
self.errors.append("PN about group chat invite is shown when invited by non-contact")
self.homes[2].click_system_back_button()
self.homes[2].get_chat(self.chat_name).click()
self.chats[2].join_chat_button.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(3998)
def test_group_chat_offline_pn(self):
[self.homes[i].home_button.double_click() for i in range(3)]
chat_name = 'for_offline_pn'
self.homes[0].create_group_chat([self.usernames[1], self.usernames[2]], chat_name)
self.homes[0].home_button.double_click()
for i in range(1, 3):
self.homes[i].get_chat(chat_name).click()
self.chats[i].join_chat_button.click()
message_1, message_2 = 'message from old member', 'message from new member'
self.homes[0].just_fyi("Put admin device to offline and send messages from members")
self.homes[0].toggle_airplane_mode()
self.chats[1].send_message(message_1)
self.chats[2].send_message(message_2)
self.homes[0].just_fyi("Put admin device to online and check that messages and PNs will be fetched")
self.homes[0].toggle_airplane_mode()
self.homes[0].connection_offline_icon.wait_for_invisibility_of_element(60)
self.homes[0].open_notification_bar()
for message in (message_1, message_2):
if not self.homes[0].get_pn(message):
self.errors.append('%s PN was not fetched from offline' % message)
self.homes[0].click_system_back_button()
unread_group = self.homes[0].get_chat(chat_name)
if not unread_group.new_messages_counter.text == '2':
self.errors.append('%s does not match unread messages' % unread_group.new_messages_counter.text)
unread_group.click()
self.homes[0].just_fyi("check that messages are shown for every member")
for i in range(3):
for message in (message_1, message_2):
if not self.chats[i].chat_element_by_text(message).is_element_displayed():
self.errors.append('%s if not shown for device %s' % (message, str(i)))
self.errors.verify_no_errors()
@marks.testrail_id(5756)
def test_group_chat_decline_invite_chat_highligted(self):
chat_name = 'for_invited'
left_system_message = self.chats[0].leave_system_message(self.usernames[1])
[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! ")
self.homes[1].get_chat(chat_name).click()
chat_2.decline_invitation_button.click()
if self.chats[0].chat_element_by_text(left_system_message).is_element_displayed():
self.errors.append('System message when user declined invite is shown')
if self.homes[1].element_by_text(chat_name).is_element_displayed():
self.errors.append("Group chat '%s' is shown, but user declined invite" % chat_name)
self.homes[0].just_fyi('Send message after invite is declined and check that it is not reappeared')
message = 'sent after leaving'
self.chats[0].send_message(message)
if self.homes[1].element_by_text(chat_name).is_element_displayed():
self.errors.append("Group chat '%s' reappeared when new message is sent" % chat_name)
self.errors.verify_no_errors()
@marks.testrail_id(3997)
def test_group_chat_leave_relogin(self):
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()
join_button = self.chats[1].join_chat_button
if join_button.is_element_displayed():
join_button.click()
self.homes[0].just_fyi("Admin deleted chat via long press")
self.homes[0].leave_chat_long_press(self.chat_name)
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

@ -2,10 +2,10 @@ import random
import pytest
from support.utilities import fill_string_with_char
from tests import marks, common_password, unique_password
from tests.base_test_case import SingleDeviceTestCase, MultipleSharedDeviceTestCase, create_shared_drivers
from tests import marks, common_password
from tests.base_test_case import MultipleSharedDeviceTestCase, create_shared_drivers
from views.sign_in_view import SignInView
from tests.users import basic_user, transaction_senders, recovery_users
from tests.users import basic_user, transaction_senders
@pytest.mark.xdist_group(name="onboarding_1")
@ -213,8 +213,8 @@ class TestOnboardingOneDeviceMerged(MultipleSharedDeviceTestCase):
[element.wait_and_click(10) for element in (self.sign_in.maybe_later_button, self.sign_in.lets_go_button)]
self.home.cross_icon_inside_welcome_screen_button.wait_and_click(10)
if not self.home.element_by_translation_id("welcome-blank-message").is_element_displayed():
self.errors.append("'%s' text is not shown after welcome view was closed" % self.home.get_translation_by_key(
"welcome-blank-message"))
self.errors.append("'%s' text is not shown after welcome view was closed" %
self.home.get_translation_by_key("welcome-blank-message"))
self.home.profile_button.click()
shown_username = self.profile.default_username_text.text
if shown_username != username:
@ -302,7 +302,7 @@ class TestRestoreOneDeviceMerged(MultipleSharedDeviceTestCase):
self.errors.verify_no_errors()
@marks.testrail_id(700750)
def test_restore_validation_seed_phrase_field(self):
def test_restore_seed_phrase_field_validation(self):
validations = [
{
'case': 'empty value',
@ -340,8 +340,7 @@ class TestRestoreOneDeviceMerged(MultipleSharedDeviceTestCase):
self.errors.append("Possible to create account with empty seed phrase")
for validation in validations:
self.sign_in.just_fyi("Checking %s" % validation.get('case'))
phrase, msg, words_count, popup = validation.get('phrase'), \
validation.get('validation message'), \
phrase, msg, words_count, popup = validation.get('phrase'), validation.get('validation message'), \
validation.get('words count'), \
validation.get('popup')
if self.sign_in.access_key_button.is_element_displayed():
@ -377,8 +376,7 @@ class TestRestoreOneDeviceMerged(MultipleSharedDeviceTestCase):
self.errors.verify_no_errors()
@marks.testrail_id(702189)
@marks.transaction
def test_restore_account_migrate_multiaccount_to_keycard_no_db_saved_add_wallet_sign_tx(self):
def test_restore_account_migrate_multiaccount_to_keycard_no_db_saved_add_wallet_send_tx(self):
self.sign_in.driver.close_app()
self.sign_in.driver.launch_app()
self.sign_in.sign_in(password=self.password)
@ -479,24 +477,3 @@ class TestRestoreOneDeviceMerged(MultipleSharedDeviceTestCase):
wallet.send_transaction(amount=transaction_amount_added, recipient=transaction_senders['ETH_8']['address'],
keycard=True, sign_transaction=True)
self.errors.verify_no_errors()
class TestCreateAccount(SingleDeviceTestCase):
@marks.testrail_id(5455)
@marks.medium
def test_recover_accounts_with_certain_seedphrase(self):
sign_in = SignInView(self.driver)
for phrase, account in recovery_users.items():
home_view = sign_in.recover_access(passphrase=phrase, password=unique_password)
wallet_view = home_view.wallet_button.click()
address = wallet_view.get_wallet_address()
if address != account:
self.errors.append('Restored wallet address "%s" does not match expected "%s"' % (address, account))
profile = home_view.profile_button.click()
profile.privacy_and_security_button.click()
profile.delete_my_profile_button.scroll_and_click()
profile.delete_my_profile_password_input.set_value(unique_password)
profile.delete_profile_button.click()
profile.ok_button.click()
self.errors.verify_no_errors()

View File

@ -0,0 +1,253 @@
import pytest
from tests import marks
from tests.base_test_case import MultipleSharedDeviceTestCase, create_shared_drivers
from tests.users import transaction_senders, basic_user, ens_user, ens_user_ropsten
from views.sign_in_view import SignInView
# TODO: suspended according to #13257
@pytest.mark.xdist_group(name="pairing_2")
@marks.critical
@marks.skip
class TestPairingMultipleDevicesMerged(MultipleSharedDeviceTestCase):
@classmethod
def setup_class(cls):
from views.dbs.main_pairing.data import seed_phrase, password
cls.drivers, cls.loop = create_shared_drivers(2)
cls.device_1, cls.device_2 = SignInView(cls.drivers[0]), SignInView(cls.drivers[1])
cls.home_1 = cls.device_1.import_db(seed_phrase=seed_phrase, import_db_folder_name='main_pairing',
password=password)
cls.home_2 = cls.device_2.recover_access(seed_phrase)
cls.home_1.just_fyi('Pair main and secondary devices')
[cls.profile_1, cls.profile_2] = [home.profile_button.click() for home in (cls.home_1, cls.home_2)]
name_1, name_2 = 'device_1', 'a_%s_2' % cls.device_2.get_unique_amount()
cls.profile_2.discover_and_advertise_device(name_2)
cls.profile_1.sync_settings_button.scroll_and_click()
cls.profile_1.devices_button.scroll_to_element()
cls.profile_1.devices_button.click()
cls.home_1.element_by_text_part(name_2).scroll_and_click()
cls.profile_1.sync_all_button.click()
cls.profile_1.sync_all_button.wait_for_visibility_of_element(20)
[profile.get_back_to_home_view() for profile in [cls.profile_1, cls.profile_2]]
[home.home_button.click() for home in [cls.home_1, cls.home_2]]
def test_pairing_initial_sync_chats(self):
self.profile_2.just_fyi("Check chats and previews")
from views.dbs.main_pairing.data import chats
for chat in chats.keys():
if chats[chat]['initial_sync']:
if 'preview' in chats.keys():
actual_chat_preview = self.home_2.get_chat(chat).chat_preview.text
expected_chat_preview = chats[chat]['preview']
if actual_chat_preview != expected_chat_preview:
self.errors.append('Expected preview for %s is "%s", in fact "%s" after initial sync' %
(chat, expected_chat_preview, actual_chat_preview))
# TODO: blocked due to 13176
# self.profile_2.just_fyi("Check unread indicator")
# if self.home_2.home_button.counter.text != '2':
# self.errors.append('New messages counter is not shown on Home button')
# for chat in chats.keys():
# if 'unread' in chats.keys():
# if self.home_2.get_chat(chat).new_messages_counter.text != chats[chat]['unread']:
# self.errors.append('No unread for %s after initial sync' % chat)
self.errors.verify_no_errors()
@marks.skip
# TODO: blocked due to 13176
def test_pairing_initial_sync_activity_centre(self):
from views.dbs.main_pairing.data import activity_centre
if self.home_2.notifications_unread_badge.is_element_displayed():
self.home_2.notifications_unread_badge.click()
for chat in activity_centre.keys():
from views.home_view import ActivityCenterChatElement
chat_in_ac = ActivityCenterChatElement(self.driver, chat_name=chat)
if not chat_in_ac.is_element_displayed():
self.errors.append('No chat "%s" in activity centre' % chat)
else:
if not chat_in_ac.chat_message_preview != activity_centre[chat]:
self.errors.append('No chat preview for "%s" in activity centre, "%s" instead' %
chat, chat_in_ac.chat_message_preview)
else:
self.home_2.driver.fail("No unread messages in Activity centre!")
self.errors.verify_no_errors()
def test_pairing_initial_sync_contacts_blocked_nickname(self):
from views.dbs.main_pairing.data import contacts, blocked
self.profile_2 = self.home_2.profile_button.click()
self.profile_2.contacts_button.click()
for contact in contacts:
if not self.profile_2.element_by_text(contact).is_element_displayed():
self.errors.append("%s contact is not synced after initial sync" % contact)
self.profile_2.blocked_users_button.click()
for blocked_user in blocked.keys():
if not self.profile_2.element_by_text(blocked_user).is_element_displayed():
self.errors.append("%s blocked user is not synced after initial sync" % blocked_user)
self.profile_2.get_back_to_home_view()
@pytest.mark.xdist_group(name="sync_2")
@marks.critical
class TestPairingSyncMultipleDevicesMerged(MultipleSharedDeviceTestCase):
@classmethod
def setup_class(cls):
cls.drivers, cls.loop = create_shared_drivers(2)
cls.no_contact_nickname = 'no_contact_nickname'
cls.device_1, cls.device_2 = SignInView(cls.drivers[0]), SignInView(cls.drivers[1])
cls.home_1 = cls.device_1.create_user()
cls.name_1, cls.name_2 = 'device_%s' % cls.drivers[0].number, 'device_%s' % cls.drivers[1].number
cls.message_before_sync, cls.message_after_sync = 'sent before sync', 'sent after sync'
cls.contact_before_sync = basic_user
cls.public_chat_before_sync, cls.public_chat_after_sync = cls.home_1.get_random_chat_name(), 'after-pairing'
cls.home_1.just_fyi("(main device): get recovery phrase")
cls.profile_1 = cls.home_1.profile_button.click()
cls.profile_1.privacy_and_security_button.click()
cls.profile_1.backup_recovery_phrase_button.click()
cls.profile_1.ok_continue_button.click()
cls.recovery_phrase = cls.profile_1.get_recovery_phrase()
cls.profile_1.close_button.click()
cls.profile_1.home_button.click()
cls.profile_1.get_recovery_phrase()
cls.home_1.just_fyi('Add contact, 1-1 chat (main device): 3-random, contact with ENS, start 1-1')
cls.chat_1 = cls.home_1.add_contact(cls.contact_before_sync['public_key'])
cls.chat_1.send_message(cls.message_before_sync)
cls.chat_1.home_button.click()
cls.home_1.add_contact(ens_user['ens'])
cls.chat_1.home_button.click()
cls.home_1.just_fyi('Chats, contacts (main device): join public chat, block user, set nickname')
public_chat_1 = cls.home_1.join_public_chat(cls.public_chat_before_sync)
public_chat_1.home_button.click()
cls.home_1.add_contact(transaction_senders['A']['public_key'], add_in_contacts=False,
nickname=cls.no_contact_nickname)
cls.chat_1.open_user_profile_from_1_1_chat()
cls.chat_1.block_contact()
cls.device_2.just_fyi("(secondary device): restore same multiaccount on another device")
cls.home_2 = cls.device_2.recover_access(passphrase=' '.join(cls.recovery_phrase.values()))
cls.profile_1, cls.profile_2 = cls.home_1.profile_button.click(), cls.home_2.profile_button.click()
cls.device_2.just_fyi('Nicknames (main device): set nickname for contact')
cls.profile_1.open_contact_from_profile(cls.contact_before_sync['username'])
cls.nickname = 'my_basic_user'
cls.chat_1.set_nickname(cls.nickname)
cls.device_1.back_button.click()
cls.device_2.just_fyi('Pair main and secondary devices')
cls.profile_2.discover_and_advertise_device(cls.name_2)
cls.profile_1.discover_and_advertise_device(cls.name_1)
cls.profile_1.get_toggle_device_by_name(cls.name_2).wait_and_click()
cls.profile_1.sync_all_button.click()
cls.profile_1.sync_all_button.wait_for_visibility_of_element(20)
[device.profile_button.double_click() for device in (cls.profile_1, cls.profile_2)]
@marks.testrail_id(702194)
def test_pairing_sync_initial_contacts_blocked_users(self):
self.profile_2.contacts_button.scroll_to_element(9, 'up')
self.profile_2.contacts_button.click()
if not self.profile_2.blocked_users_button.is_element_displayed(30):
self.errors.append('Blocked users are not synced after initial sync')
for name in (basic_user['username'], self.nickname, '@%s' % ens_user['ens']):
if not self.profile_2.element_by_text(name).is_element_displayed():
self.errors.append('"%s" is not found in Contacts on initial sync' % name)
self.profile_2.blocked_users_button.click()
if not self.profile_2.element_by_text(self.no_contact_nickname).is_element_displayed():
self.errors.append(
"'%s' nickname without adding to contacts is not synced on initial sync" % self.no_contact_nickname)
self.errors.verify_no_errors()
@marks.testrail_id(702195)
def test_pairing_sync_initial_public_chats(self):
[device.home_button.double_click() for device in (self.profile_1, self.profile_2)]
if not self.home_2.element_by_text_part(self.public_chat_before_sync).is_element_displayed():
self.errors.append(
"'%s' public chat is not appeared on secondary device on initial sync" % self.public_chat_before_sync)
self.errors.verify_no_errors()
@marks.testrail_id(702196)
def test_pairing_sync_contacts_block_unblock(self):
[device.profile_button.double_click() for device in (self.profile_1, self.profile_2)]
new_user_for_block = transaction_senders['C']
self.profile_1.just_fyi("Contacts(main device): block and unblock user")
self.profile_1.profile_button.click()
self.profile_1.contacts_button.scroll_to_element(direction='up')
self.profile_1.contacts_button.click()
self.profile_1.blocked_users_button.click()
self.profile_1.element_by_text(self.no_contact_nickname).click()
self.chat_1.unblock_contact_button.click()
self.profile_1.close_button.click()
self.home_1.home_button.click()
self.home_1.add_contact(new_user_for_block['public_key'], add_in_contacts=False)
self.chat_1.open_user_profile_from_1_1_chat()
self.chat_1.block_contact()
self.device_2.just_fyi('Contacts (secondary device): check unblocked and blocked user')
self.profile_2.contacts_button.click()
self.profile_2.blocked_users_button.click()
if self.profile_2.element_by_text(self.no_contact_nickname).is_element_displayed():
self.errors.append("'%s' unblocked user is not synced!" % self.no_contact_nickname)
if not self.profile_2.element_by_text(new_user_for_block['username']).is_element_displayed():
self.errors.append("'%s' blocked user is not synced!" % new_user_for_block['username'])
self.errors.verify_no_errors()
@marks.testrail_id(702197)
def test_pairing_sync_contacts_add_remove_set_nickname_ens(self):
[device.home_button.double_click() for device in (self.profile_1, self.profile_2)]
new_contact, new_nickname = transaction_senders['F'], "completely_new_nick"
self.home_1.add_contact(ens_user_ropsten['ens'])
self.home_1.home_button.click()
self.home_1.add_contact(new_contact['public_key'])
self.device_2.just_fyi('Contacts (secondary device):check new contact')
self.profile_2.profile_button.double_click()
self.profile_2.contacts_button.scroll_to_element(direction='up')
self.profile_2.contacts_button.click()
for contact in (new_contact['username'], '@%s' % ens_user_ropsten['ens']):
if not self.profile_2.element_by_text(contact).is_element_displayed():
self.errors.append("'%s' new contact is not synced!" % contact)
self.device_1.just_fyi('(Main device): set nickname, (secondary device): check nickname')
self.chat_1.open_user_profile_from_1_1_chat()
self.chat_1.set_nickname(new_nickname)
if not self.profile_2.element_by_text(new_nickname).is_element_displayed():
self.errors.append("'%s' new nickname is not synced!" % new_nickname)
self.device_1.just_fyi('(Main device): remove contact, (secondary device): check removed contact')
self.chat_1.open_user_profile_from_1_1_chat()
self.chat_1.remove_from_contacts.click()
self.chat_1.close_button.click()
self.profile_2.element_by_text(new_nickname).is_element_disappeared(40)
self.errors.verify_no_errors()
@marks.testrail_id(702198)
def test_pairing_sync_1_1_chat_message(self):
[device.home_button.double_click() for device in (self.profile_1, self.profile_2)]
self.home_1.get_chat(self.nickname).click()
self.chat_1.send_message(self.message_after_sync)
self.home_2.just_fyi("Chats (secondary device): check messages in 1-1")
chat = self.home_2.get_chat(self.nickname).click()
if chat.chat_element_by_text(self.message_before_sync).is_element_displayed():
self.errors.append('"%s" message sent before pairing is synced' % self.message_before_sync)
if not chat.chat_element_by_text(self.message_after_sync).is_element_displayed(60):
self.errors.append('"%s" message in 1-1 is not synced' % self.message_after_sync)
self.errors.verify_no_errors()
@marks.testrail_id(702199)
def test_pairing_sync_public_chat_add_remove(self):
[device.home_button.double_click() for device in (self.profile_1, self.profile_2)]
self.home_1.join_public_chat(self.public_chat_after_sync)
if not self.home_2.element_by_text("#%s" % self.public_chat_after_sync).is_element_displayed(10):
self.errors.append('Public chat "%s" is not synced' % self.public_chat_after_sync)
self.home_1.home_button.click()
self.home_1.delete_chat_long_press('#%s' % self.public_chat_after_sync)
if not self.home_2.element_by_text('#%s' % self.public_chat_after_sync).is_element_disappeared(60):
self.errors.append('Remove of "%s" public chat is not synced!' % self.public_chat_after_sync)
self.errors.verify_no_errors()

View File

@ -0,0 +1,509 @@
import random
from datetime import timedelta
import emoji
import pytest
from dateutil import parser
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
from selenium.common.exceptions import NoSuchElementException
@pytest.mark.xdist_group(name="public_chat_2")
@marks.critical
class TestPublicChatMultipleDeviceMerged(MultipleSharedDeviceTestCase):
@classmethod
def setup_class(cls):
cls.drivers, cls.loop = create_shared_drivers(2)
device_1, device_2 = SignInView(cls.drivers[0]), SignInView(cls.drivers[1])
cls.home_1, cls.home_2 = device_1.create_user(), device_2.create_user()
profile_1 = cls.home_1.profile_button.click()
cls.username_1 = profile_1.default_username_text.text
profile_1.home_button.click()
cls.pub_chat_delete_long_press = 'pub-chat'
cls.text_message = 'hello'
cls.home_1.join_public_chat(cls.pub_chat_delete_long_press)
[home.home_button.click() for home in (cls.home_1, cls.home_2)]
cls.public_chat_name = cls.home_1.get_random_chat_name()
cls.chat_1 = cls.home_1.join_public_chat(cls.public_chat_name)
cls.chat_2 = cls.home_2.join_public_chat(cls.public_chat_name)
cls.chat_1.send_message(cls.text_message)
@marks.testrail_id(5313)
def test_public_chat_message_send_check_timestamps_while_on_different_tab(self):
message = self.text_message
self.chat_2.dapp_tab_button.click()
sent_time_variants = self.chat_1.convert_device_time_to_chat_timestamp()
timestamp = self.chat_1.chat_element_by_text(message).timestamp_on_tap
if timestamp not in sent_time_variants:
self.errors.append("Timestamp is not shown, expected: '%s', in fact: '%s'" %
(sent_time_variants.join(','), timestamp))
self.chat_2.home_button.click(desired_view='chat')
for chat in self.chat_1, self.chat_2:
chat.verify_message_is_under_today_text(message, self.errors)
if self.chat_2.chat_element_by_text(message).username.text != self.username_1:
self.errors.append("Default username '%s' is not shown next to the received message" % self.username_1)
self.errors.verify_no_errors()
@marks.testrail_id(700734)
def test_public_chat_message_edit(self):
message_before_edit, message_after_edit = self.text_message, "Message AFTER edit 2"
self.chat_1.edit_message_in_chat(message_before_edit, message_after_edit)
for chat in (self.chat_1, self.chat_2):
if not chat.element_by_text_part("⌫ Edited").is_element_displayed(60):
self.errors.append('No mark in message bubble about this message was edited')
if not self.chat_2.element_by_text_part(message_after_edit).is_element_displayed(60):
self.errors.append('Message is not edited')
self.errors.verify_no_errors()
@marks.testrail_id(700735)
def test_public_chat_message_delete(self):
message_to_delete = 'delete me, please'
self.chat_1.send_message(message_to_delete)
self.chat_1.delete_message_in_chat(message_to_delete)
for chat in (self.chat_1, self.chat_2):
if not chat.chat_element_by_text(message_to_delete).is_element_disappeared(30):
self.errors.append("Deleted message is shown in chat view for public chat")
self.errors.verify_no_errors()
@marks.testrail_id(700719)
def test_public_chat_emoji_send_copy_paste_reply(self):
emoji_name = random.choice(list(emoji.EMOJI_UNICODE))
emoji_unicode = emoji.EMOJI_UNICODE[emoji_name]
emoji_message = emoji.emojize(emoji_name)
self.chat_1.send_message(emoji_message)
for chat in self.chat_1, self.chat_2:
if not chat.chat_element_by_text(emoji_unicode).is_element_displayed(30):
self.errors.append('Message with emoji was not sent or received in public chat')
self.chat_1.just_fyi("Can copy and paste emojis")
self.chat_1.element_by_text_part(emoji_unicode).long_press_element()
self.chat_1.element_by_text('Copy').click()
self.chat_1.chat_message_input.paste_text_from_clipboard()
if self.chat_1.chat_message_input.text != emoji_unicode:
self.errors.append('Emoji message was not copied')
self.chat_1.just_fyi("Can reply to emojis")
self.chat_2.quote_message(emoji_unicode)
message_text = 'test message'
self.chat_2.chat_message_input.send_keys(message_text)
self.chat_2.send_message_button.click()
chat_element_1 = self.chat_1.chat_element_by_text(message_text)
if not chat_element_1.is_element_displayed(sec=10) or chat_element_1.replied_message_text != emoji_unicode:
self.errors.append('Reply message was not received by the sender')
self.errors.verify_no_errors()
@marks.testrail_id(5360)
def test_public_chat_unread_messages_counter(self):
self.chat_1.send_message('пиу')
home_1 = self.chat_1.home_button.click()
message = 'test message'
self.chat_2.send_message(message)
if not self.chat_1.home_button.public_unread_messages.is_element_displayed():
self.errors.append('New messages public chat badge is not shown on Home button')
chat_element = home_1.get_chat('#' + self.public_chat_name)
if not chat_element.new_messages_public_chat.is_element_displayed():
self.errors.append('New messages counter is not shown in public chat')
self.errors.verify_no_errors()
@marks.testrail_id(700718)
def test_public_chat_unread_messages_counter_for_mention_relogin(self):
message = 'test message2'
[chat.get_back_to_home_view() for chat in (self.chat_1, self.chat_2)]
chat_element = self.home_1.get_chat('#' + self.public_chat_name)
self.home_2.get_chat('#' + self.public_chat_name).click()
self.chat_2.select_mention_from_suggestion_list(self.username_1, self.username_1[:2])
self.chat_2.send_message_button.click()
chat_element.new_messages_counter.wait_for_element(30)
chat_element.new_messages_counter.wait_for_element_text("1", 60)
chat_element.click()
self.home_1.home_button.double_click()
if self.home_1.home_button.public_unread_messages.is_element_displayed():
self.errors.append('New messages public chat badge is shown on Home button')
if chat_element.new_messages_public_chat.is_element_displayed():
self.errors.append('Unread messages badge is shown in public chat while there are no unread messages')
[home.get_chat('#' + self.public_chat_name).click() for home in (self.home_1, self.home_2)]
self.chat_1.send_message(message)
self.chat_2.chat_element_by_text(message).wait_for_element(20)
self.home_2.reopen_app()
chat_element = self.home_2.get_chat('#' + self.public_chat_name)
if chat_element.new_messages_public_chat.is_element_displayed():
self.drivers[0].fail('New messages counter is shown after relogin')
self.errors.verify_no_errors()
@marks.testrail_id(5319)
def test_public_chat_delete_chat_long_press(self):
[chat.get_back_to_home_view() for chat in (self.chat_1, self.chat_2)]
self.home_1.delete_chat_long_press('#%s' % self.pub_chat_delete_long_press)
self.home_2.just_fyi("Send message to deleted chat")
self.deleted_chat_2 = self.home_2.join_public_chat(self.pub_chat_delete_long_press)
self.deleted_chat_2.send_message()
if self.home_1.get_chat_from_home_view('#%s' % self.pub_chat_delete_long_press).is_element_displayed():
self.drivers[0].fail('Deleted public chat reappears after sending message to it')
self.home_1.reopen_app()
if self.home_1.get_chat_from_home_view('#%s' % self.pub_chat_delete_long_press).is_element_displayed():
self.drivers[0].fail('Deleted public chat reappears after relogin')
@marks.testrail_id(700736)
def test_public_chat_link_send_open(self):
[chat.get_back_to_home_view() for chat in (self.chat_1, self.chat_2)]
[home.get_chat('#' + self.public_chat_name).click() for home in (self.home_1, self.home_2)]
url_message = 'http://status.im'
self.chat_2.send_message(url_message)
self.chat_1.element_starts_with_text(url_message, 'button').click()
web_view = self.chat_1.open_in_status_button.click()
if not web_view.element_by_text('Private, Secure Communication').is_element_displayed(60):
self.drivers[0].fail('URL was not opened from public chat')
@marks.testrail_id(700737)
def test_public_chat_links_with_previews_github_youtube_twitter_gif_send_enable(self):
[chat.home_button.double_click() for chat in (self.chat_1, self.chat_2)]
[home.get_chat('#' + self.public_chat_name).click() for home in (self.home_1, self.home_2)]
giphy_url = 'https://giphy.com/gifs/this-is-fine-QMHoU66sBXqqLqYvGO'
preview_urls = {'github_pr': {'url': 'https://github.com/status-im/status-react/pull/11707',
'txt': 'Update translations by jinhojang6 · Pull Request #11707 · status-im/status-react',
'subtitle': 'GitHub'},
'yotube': {
'url': 'https://www.youtube.com/watch?v=XN-SVmuJH2g&list=PLbrz7IuP1hrgNtYe9g6YHwHO6F3OqNMao',
'txt': 'Status & Keycard Hardware-Enforced Security',
'subtitle': 'YouTube'},
'twitter': {
'url': 'https://twitter.com/ethdotorg/status/1445161651771162627?s=20',
'txt': "We've rethought how we translate content, allowing us to translate",
'subtitle': 'Twitter'
}}
self.home_1.just_fyi("Check enabling and sending first gif")
self.chat_2.send_message(giphy_url)
self.chat_2.element_by_translation_id("dont-ask").click()
self.chat_1.element_by_translation_id("enable").wait_and_click()
self.chat_1.element_by_translation_id("enable-all").wait_and_click()
self.chat_1.close_modal_view_from_chat_button.click()
if not self.chat_1.get_preview_message_by_text(giphy_url).preview_image:
self.errors.append("No preview is shown for %s" % giphy_url)
for key in preview_urls:
self.home_2.just_fyi("Checking %s preview case" % key)
data = preview_urls[key]
self.chat_2.send_message(data['url'])
message = self.chat_1.get_preview_message_by_text(data['url'])
if data['txt'] not in message.preview_title.text:
self.errors.append("Title '%s' does not match expected" % message.preview_title.text)
if message.preview_subtitle.text != data['subtitle']:
self.errors.append("Subtitle '%s' does not match expected" % message.preview_subtitle.text)
self.home_2.just_fyi("Check if after do not ask again previews are not shown and no enable button appear")
if self.chat_2.element_by_translation_id("enable").is_element_displayed():
self.errors.append("Enable button is still shown after clicking on 'Den't ask again'")
if self.chat_2.get_preview_message_by_text(giphy_url).preview_image:
self.errors.append("Preview is shown for sender without permission")
self.errors.verify_no_errors()
@marks.testrail_id(6270)
def test_public_chat_mark_all_messages_as_read(self):
[chat.get_back_to_home_view() for chat in (self.chat_1, self.chat_2)]
self.home_2.get_chat('#' + self.public_chat_name).click()
self.chat_2.send_message(self.text_message)
if not self.home_1.home_button.public_unread_messages.is_element_displayed():
self.errors.append('New messages public chat badge is not shown on Home button')
chat_element = self.home_1.get_chat('#' + self.public_chat_name)
if not chat_element.new_messages_public_chat.is_element_displayed():
self.errors.append('New messages counter is not shown in public chat')
chat_element.long_press_element()
self.home_1.mark_all_messages_as_read_button.click()
self.home_1.home_button.double_click()
if self.home_1.home_button.public_unread_messages.is_element_displayed():
self.errors.append('New messages public chat badge is shown on Home button after marking messages as read')
if chat_element.new_messages_public_chat.is_element_displayed():
self.errors.append('Unread messages badge is shown in public chat while while there are no unread messages')
self.errors.verify_no_errors()
@pytest.mark.xdist_group(name="public_chat_browser_1")
@marks.critical
class TestPublicChatBrowserOneDeviceMerged(MultipleSharedDeviceTestCase):
@classmethod
def setup_class(cls):
cls.drivers, cls.loop = create_shared_drivers(1)
cls.sign_in = SignInView(cls.drivers[0])
cls.home = cls.sign_in.create_user()
cls.public_chat_name = cls.home.get_random_chat_name()
cls.chat = cls.home.join_public_chat(cls.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 23.11.21, valid)
# 'message_with_tag': '#successishere'
}
message_input = self.chat.chat_message_input
if not message_input.is_element_displayed():
self.home.get_chat('#%s' % self.public_chat_name).click()
message_input.send_keys(message_text['text_message'])
self.chat.send_message_button.click()
self.chat.copy_message_text(message_text['text_message'])
message_input.paste_text_from_clipboard()
if message_input.text != message_text['text_message']:
self.errors.append('Message %s text was not copied in a public chat' % message_text['text_message'])
message_input.clear()
for message in formatted_message:
message_input.send_keys(formatted_message[message])
self.chat.send_message_button.click()
message_bubble = self.chat.chat_element_by_text(formatted_message[message])
message_bubble.sent_status_checkmark.long_press_element()
self.chat.element_by_text('Copy').click()
message_input.paste_text_from_clipboard()
if message_input.text != formatted_message[message]:
self.errors.append('Message %s text was not copied in a public chat' % formatted_message[message])
message_input.clear()
self.errors.verify_no_errors()
@marks.testrail_id(700738)
def test_public_chat_tag_message(self):
tag_message = '#wuuut'
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].close_app()
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'])
if web_page.element_by_text_part(urls['bbc.com']).is_element_displayed():
self.errors.append('Closed tab is present after deletion')
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.back_button.click()
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

@ -0,0 +1,478 @@
import random
import pytest
from support.utilities import get_merged_txs_list
from tests import marks, common_password, pin, puk, pair_code
from tests.base_test_case import MultipleSharedDeviceTestCase, create_shared_drivers
from tests.users import transaction_senders, basic_user, wallet_users, ens_user_ropsten, ens_user
from views.sign_in_view import SignInView
@pytest.mark.xdist_group(name="send_tx_1")
@marks.critical
class TestSendTxDeviceMerged(MultipleSharedDeviceTestCase):
@classmethod
def setup_class(cls):
cls.user = transaction_senders['ETH_ADI_STT_3']
cls.recipient_address = '0x%s' % transaction_senders['ETH_7']['address']
cls.drivers, cls.loop = create_shared_drivers(1)
[cls.amount_adi, cls.amount_eth, cls.amount_stt] = ['0.000%s' % str(random.randint(100, 999)) + '1' for _ in range(3)]
cls.sign_in = SignInView(cls.drivers[0])
cls.home = cls.sign_in.recover_access(cls.user['passphrase'])
cls.wallet = cls.home.wallet_button.click()
cls.assets = ('ETH', 'ADI', 'STT')
[cls.wallet.wait_balance_is_changed(asset) for asset in cls.assets]
cls.initial_balances = dict()
for asset in cls.assets:
cls.initial_balances[asset] = cls.wallet.get_asset_amount_by_name(asset)
cls.wallet.send_transaction(amount=cls.amount_eth, recipient=cls.recipient_address)
cls.wallet.send_transaction(amount=cls.amount_adi, recipient=cls.recipient_address, asset_name='ADI')
@marks.testrail_id(700763)
def test_send_tx_eth_check_logcat(self):
self.wallet.just_fyi('Check that transaction is appeared in tx history')
self.wallet.find_transaction_in_history(amount=self.amount_eth)
self.wallet.wallet_button.double_click()
self.network_api.wait_for_confirmation_of_transaction(self.user['address'], self.amount_eth)
self.wallet.wait_balance_is_changed('ETH', initial_balance=self.initial_balances['ETH'])
self.wallet.just_fyi('Check logcat for sensitive data')
values_in_logcat = self.wallet.find_values_in_logcat(password=common_password)
if values_in_logcat:
self.wallet.driver.fail(values_in_logcat)
@marks.testrail_id(700764)
def test_send_tx_token_7_decimals(self):
asset = 'ADI'
self.wallet.just_fyi("Checking tx with 7 decimals")
transaction_adi = self.wallet.find_transaction_in_history(amount=self.amount_adi, asset=asset, return_hash=True)
self.wallet.wallet_button.double_click()
self.network_api.find_transaction_by_hash(transaction_adi)
self.wallet.wait_balance_is_changed(asset, initial_balance=self.initial_balances[asset])
@marks.testrail_id(5342)
def test_send_tx_sign_message_2tx_in_batch_tx_filters_request_stt_testdapp(self):
self.wallet.home_button.click()
status_test_dapp = self.home.open_status_test_dapp()
status_test_dapp.wait_for_d_aap_to_load()
self.wallet.just_fyi("Checking request STT")
status_test_dapp.assets_button.click()
status_test_dapp.request_stt_button.wait_for_element(60)
send_transaction = status_test_dapp.request_stt_button.click()
send_transaction.sign_transaction()
self.wallet.just_fyi("Checking signing message")
status_test_dapp.transactions_button.click()
send_transaction = status_test_dapp.sign_message_button.click()
send_transaction.enter_password_input.set_value(common_password)
send_transaction.sign_button.click()
if not status_test_dapp.element_by_text_part('Signed message').is_element_displayed():
self.errors.append('Message was not signed')
send_transaction.just_fyi('Check logcat for sensitive data')
values_in_logcat = send_transaction.find_values_in_logcat(password=common_password)
if values_in_logcat:
self.errors.append("When signing message from dapp: %s" % values_in_logcat)
self.wallet.just_fyi("Checking send 2 txs in batch")
status_test_dapp.send_two_tx_in_batch_button.scroll_to_element()
send_transaction = status_test_dapp.send_two_tx_in_batch_button.click()
send_transaction.sign_transaction()
if not send_transaction.sign_with_password.is_element_displayed(10):
self.errors.append('Second send transaction screen did not appear!')
send_transaction.sign_transaction()
self.wallet.just_fyi("Checking send 2 txs one after another")
status_test_dapp.send_two_tx_one_by_one_button.scroll_to_element()
send_transaction = status_test_dapp.send_two_tx_one_by_one_button.click()
send_transaction.sign_transaction()
if not send_transaction.sign_with_password.is_element_displayed(20):
self.errors.append('Second send transaction screen did not appear!')
send_transaction.sign_transaction()
self.wallet.just_fyi("Checking test filters")
status_test_dapp.test_filters_button.scroll_and_click()
for element in status_test_dapp.element_by_text('eth_uninstallFilter'), status_test_dapp.ok_button:
if element.is_element_displayed(10):
self.errors.append("'Test filters' button produced an error")
self.errors.verify_no_errors()
@marks.testrail_id(700765)
def test_send_tx_custom_token_18_decimals_invalid_password(self):
contract_address, name, symbol, decimals = '0x101848D5C5bBca18E6b4431eEdF6B95E9ADF82FA', 'Weenus 💪', 'WEENUS', '18'
self.home.wallet_button.double_click()
self.wallet.just_fyi("Check that can add custom token")
self.wallet.multiaccount_more_options.click()
self.wallet.manage_assets_button.click()
token_view = self.wallet.add_custom_token_button.click()
token_view.contract_address_input.send_keys(contract_address)
if token_view.name_input.text != name:
self.errors.append('Name for custom token was not set')
if token_view.symbol_input.text != symbol:
self.errors.append('Symbol for custom token was not set')
if token_view.decimals_input.text != decimals:
self.errors.append('Decimals for custom token was not set')
token_view.add_button.click()
token_view.close_button.click()
self.wallet.asset_by_name(symbol).scroll_to_element()
if not self.wallet.asset_by_name(symbol).is_element_displayed():
self.errors.append('Custom token is not shown on Wallet view')
send_tx = self.wallet.send_transaction_from_main_screen.click()
send_tx.select_asset_button.click()
asset_button = send_tx.asset_by_name(symbol)
send_tx.select_asset_button.click_until_presence_of_element(
send_tx.eth_asset_in_select_asset_bottom_sheet_button)
asset_button.click()
send_tx.amount_edit_box.click()
send_tx.amount_edit_box.set_value(self.amount_eth)
send_tx.set_recipient_address(self.recipient_address)
send_tx.sign_transaction_button.click()
if self.wallet.sign_in_phrase.is_element_displayed():
self.wallet.set_up_wallet_when_sending_tx()
send_tx.just_fyi('Check that can not sign tx with invalid password')
self.wallet.next_button.click_if_shown()
self.wallet.ok_got_it_button.click_if_shown()
send_tx.sign_with_password.click_until_presence_of_element(send_tx.enter_password_input)
send_tx.enter_password_input.click()
send_tx.enter_password_input.send_keys('wrong_password')
send_tx.sign_button.click()
if send_tx.element_by_text_part('Transaction sent').is_element_displayed():
self.errors.append('Transaction was sent with a wrong password')
self.wallet.just_fyi("Check that can send tx with custom token")
send_tx.enter_password_input.click()
send_tx.enter_password_input.clear()
send_tx.enter_password_input.send_keys(common_password)
send_tx.sign_button.click_until_absense_of_element(send_tx.sign_button)
send_tx.ok_button.wait_for_element(120)
if not self.wallet.element_by_translation_id("transaction-sent").is_element_displayed():
self.errors.append("Tx is not sent!")
send_tx.ok_button.click()
# TODO: disabled due to 10838 (rechecked 23.11.21, valid)
# transactions_view = wallet.transaction_history_button.click()
# transactions_view.transactions_table.find_transaction(amount=amount, asset=symbol)
self.errors.verify_no_errors()
@marks.testrail_id(700757)
def test_send_tx_set_recipient_options(self):
nickname = 'my_some_nickname'
account_name = 'my_acc_name'
account_address = '0x8c2E3Cd844848E79cFd4671cE45C12F210b630d7'
recent_add_to_fav_name = 'my_Recent_STT'
recent_add_to_fav_address = '0x58d8c3d70ce4fa4b9fb10a665c8712238746f2ff'
ens_status, ens_other = ens_user_ropsten, ens_user
basic_add_to_fav_name = 'my_basic_address'
self.drivers[0].reset()
self.home = self.sign_in.recover_access(wallet_users['D']['passphrase'])
self.home.just_fyi('Add new account and new ENS contact for recipient')
chat = self.home.add_contact(ens_status['ens'])
chat.chat_options.click()
chat.view_profile_button.click_until_presence_of_element(chat.remove_from_contacts)
chat.set_nickname(nickname)
wallet = self.home.wallet_button.click()
wallet.add_account(account_name=account_name)
wallet.accounts_status_account.click()
send_tr = wallet.send_transaction_button.click()
wallet.just_fyi("Check that can't send to invalid address")
send_tr.amount_edit_box.click()
send_tr.amount_edit_box.set_value(send_tr.get_unique_amount())
send_tr.chose_recipient_button.click()
for address in (basic_user['public_key'], '0xDE709F2102306220921060314715629080E2fB77'):
send_tr.enter_recipient_address_input.set_value(address)
send_tr.enter_recipient_address_input.click()
send_tr.done_button.click()
if send_tr.set_max_button.is_element_displayed():
self.errors.append('Can proceed with wrong address %s in recipient' % address)
send_tr.just_fyi('Set one of my accounts')
send_tr.chose_recipient_button.click_if_shown()
send_tr.element_by_translation_id("my-accounts").click()
send_tr.element_by_text(account_name).click()
if send_tr.enter_recipient_address_text.text != send_tr.get_formatted_recipient_address(account_address):
self.errors.append('Added account is not resolved as recipient')
send_tr.just_fyi('Set contract address from recent and check smart contract error')
send_tr.chose_recipient_button.click()
send_tr.element_by_translation_id("recent").click()
send_tr.element_by_text('↓ 1000 MDS').click()
if not send_tr.element_by_translation_id("warning-sending-to-contract-descr").is_element_displayed():
self.driver.fail('No warning is shown at attempt to set as recipient smart contract')
send_tr.ok_button.click()
send_tr.element_by_text('↑ 0.001 ETHro').scroll_and_click()
send_tr.add_to_favorites(recent_add_to_fav_name)
wallet.element_by_translation_id("recent").click()
send_tr.just_fyi('Scan invalid QR')
send_tr.scan_qr_code_button.click()
send_tr.allow_button.click(1)
wallet.enter_qr_edit_box.scan_qr('something%s' % basic_user['address'])
if not send_tr.element_by_text_part('Invalid address').is_element_displayed(10):
self.driver.fail('No error is shown at attempt to scan invalid address')
wallet.ok_button.click()
send_tr.just_fyi('Scan code, add it to favorites and recheck that it is preserved')
send_tr.scan_qr_code_button.click()
wallet.enter_qr_edit_box.scan_qr(basic_user['address'])
send_tr.add_to_favorites(basic_add_to_fav_name)
send_tr.element_by_translation_id("favourites").scroll_and_click()
for name in (recent_add_to_fav_name, basic_add_to_fav_name):
wallet.element_by_text(name).scroll_to_element()
send_tr.element_by_text(recent_add_to_fav_name).scroll_and_click()
if str(send_tr.enter_recipient_address_text.text).lower() != send_tr.get_formatted_recipient_address(
recent_add_to_fav_address):
self.errors.append('Recent address that was added to favourites was not resolved correctly')
send_tr.just_fyi('Set contact')
send_tr.chose_recipient_button.click()
send_tr.element_by_translation_id("contacts").scroll_and_click()
send_tr.element_by_text(nickname).scroll_and_click()
send_tr.recipient_done.click()
if send_tr.enter_recipient_address_text.text != send_tr.get_formatted_recipient_address(ens_status['address']):
self.errors.append('ENS from contact is not resolved as recipient')
send_tr.just_fyi('Set different ENS options')
send_tr.set_recipient_address(ens_other['ens_another'])
if send_tr.enter_recipient_address_text.text != send_tr.get_formatted_recipient_address(ens_other['address']):
self.errors.append('ENS address on another domain is not resolved as recipient')
send_tr.set_recipient_address('%s.stateofus.eth' % ens_status['ens'])
if send_tr.enter_recipient_address_text.text != send_tr.get_formatted_recipient_address(ens_status['address']):
self.errors.append('ENS address on stateofus.eth is not resolved as recipient')
send_tr.just_fyi('Check search and set address from search')
send_tr.chose_recipient_button.click()
send_tr.search_by_keyword(ens_status['ens'][:2])
if not send_tr.element_by_text('@' + ens_status['ens']).is_element_displayed():
self.errors.append('ENS address from contacts is not shown in search')
send_tr.cancel_button.click()
send_tr.search_by_keyword('my')
for name in (nickname, account_name, recent_add_to_fav_name, basic_add_to_fav_name):
if not send_tr.element_by_text(name).is_element_displayed():
self.errors.append('%s is not shown in search when searching by namepart' % name)
send_tr.element_by_text(basic_add_to_fav_name).click()
if send_tr.enter_recipient_address_text.text != send_tr.get_formatted_recipient_address(
'0x' + basic_user['address']):
self.errors.append('QR scanned address that was added to favourites was not resolved correctly')
self.errors.verify_no_errors()
@pytest.mark.xdist_group(name="keycard_tx_1")
@marks.critical
class TestKeycardTxOneDeviceMerged(MultipleSharedDeviceTestCase):
@classmethod
def setup_class(cls):
cls.user = transaction_senders['ETH_STT_ADI_1']
cls.address = '0x%s' % transaction_senders['ETH_7']['address']
cls.drivers, cls.loop = create_shared_drivers(1)
cls.sign_in = SignInView(cls.drivers[0])
cls.home = cls.sign_in.recover_access(passphrase=cls.user['passphrase'], keycard=True)
cls.wallet = cls.home.wallet_button.click()
cls.assets = ('ETH', 'ADI', 'STT')
[cls.wallet.wait_balance_is_changed(asset) for asset in cls.assets]
cls.initial_balances = dict()
for asset in cls.assets:
cls.initial_balances[asset] = cls.wallet.get_asset_amount_by_name(asset)
@marks.testrail_id(700767)
def test_keycard_send_tx_eth(self):
wallet = self.home.wallet_button.click()
transaction_amount = wallet.get_unique_amount()
wallet.send_transaction(amount=transaction_amount, sign_transaction=True, keycard=True,
recipient=self.address)
wallet.just_fyi('Check that transaction is appeared in transaction history')
transaction = wallet.find_transaction_in_history(amount=transaction_amount, return_hash=True)
self.wallet.wallet_button.double_click()
self.network_api.find_transaction_by_hash(transaction)
self.network_api.wait_for_confirmation_of_transaction(self.user['address'], transaction_amount)
self.wallet.wait_balance_is_changed('ETH', initial_balance=self.initial_balances['ETH'])
@marks.testrail_id(700768)
def test_keycard_relogin_after_restore(self):
self.sign_in.just_fyi('Check that username and public key match expected')
public_key, default_username = self.sign_in.get_public_key_and_username(return_username=True)
profile = self.sign_in.get_profile_view()
if public_key != self.user['public_key']:
self.errors.append('Public key %s does not match expected' % public_key)
if default_username != self.user['username']:
self.errors.append('Default username %s does not match expected' % default_username)
profile.logout()
self.sign_in.just_fyi('Check that can login with restored from mnemonic keycard account')
self.sign_in.sign_in(keycard=True)
if not self.sign_in.home_button.is_element_displayed(10):
self.sign_in.driver.fail('Keycard user is not logged in')
self.errors.verify_no_errors()
@marks.testrail_id(700769)
def test_keycard_send_tx_sign_message_request_stt_testdapp(self):
self.home.home_button.double_click()
status_test_dapp = self.home.open_status_test_dapp()
status_test_dapp.wait_for_d_aap_to_load()
self.wallet.just_fyi("Requesting STT in dapp")
status_test_dapp.assets_button.click()
send_tx = status_test_dapp.request_stt_button.click()
send_tx.sign_transaction(keycard=True)
self.wallet.just_fyi("Checking signing message")
status_test_dapp.transactions_button.click()
status_test_dapp.sign_message_button.click()
if not send_tx.element_by_text("Test message").is_element_displayed():
self.errors.append("No message shown when signing!")
keycard = send_tx.sign_with_keycard_button.click()
keycard.enter_default_pin()
if not keycard.element_by_text_part('Signed message').is_element_displayed():
self.errors.append('Message was not signed')
keycard.just_fyi('Check logcat for sensitive data')
values_in_logcat = send_tx.find_values_in_logcat(pin=pin, puk=puk, password=pair_code)
if values_in_logcat:
self.sign_in.driver.fail("After signing message: %s" % values_in_logcat)
self.wallet.just_fyi("Check send 2 txs in batch")
status_test_dapp.send_two_tx_in_batch_button.scroll_to_element()
send_tx = status_test_dapp.send_two_tx_in_batch_button.click()
send_tx.sign_transaction(keycard=True)
if not send_tx.sign_with_keycard_button.is_element_displayed(10):
self.sign_in.driver.fail('Second send transaction screen did not appear!')
send_tx.sign_transaction(keycard=True)
self.wallet.just_fyi("Checking send 2 txs one after another")
status_test_dapp.send_two_tx_one_by_one_button.scroll_to_element()
send_tx = status_test_dapp.send_two_tx_one_by_one_button.click()
send_tx.sign_transaction(keycard=True)
if not send_tx.sign_with_keycard_button.is_element_displayed(20):
self.sign_in.driver.fail('Second send transaction screen did not appear!')
send_tx.sign_transaction(keycard=True)
self.wallet.just_fyi('Verify that wallet balance is updated after receiving money from faucet')
self.home.wallet_button.click()
self.wallet.wait_balance_is_changed('STT', initial_balance=self.initial_balances['STT'])
self.errors.verify_no_errors()
@marks.testrail_id(700770)
def test_keycard_wallet_recover_pairing_check_balance_after_offline_tx_history(self):
user = transaction_senders['A']
self.sign_in.toggle_airplane_mode()
self.sign_in.driver.reset()
self.sign_in.just_fyi('Keycard: recover multiaccount with pairing code ')
self.sign_in.accept_tos_checkbox.enable()
self.sign_in.get_started_button.click_until_presence_of_element(self.sign_in.access_key_button)
self.sign_in.access_key_button.click()
self.sign_in.recover_with_keycard_button.click()
keycard = self.sign_in.begin_recovery_button.click()
keycard.connect_pairing_card_button.click()
keycard.pair_code_input.set_value(pair_code)
self.sign_in.pair_to_this_device_button.click()
keycard.enter_default_pin()
self.sign_in.maybe_later_button.click_until_presence_of_element(self.sign_in.lets_go_button)
self.sign_in.lets_go_button.click_until_absense_of_element(self.sign_in.lets_go_button)
self.sign_in.home_button.wait_for_visibility_of_element(30)
self.sign_in.just_fyi("Check balance will be restored after going back online")
self.sign_in.toggle_airplane_mode()
wallet = self.home.wallet_button.click()
[wallet.wait_balance_is_changed(asset) for asset in ("ETH", "LXS")]
self.wallet.just_fyi("Checking whole tx history after backing from offline")
self.wallet.accounts_status_account.click()
address = user['address']
ropsten_txs = self.network_api.get_transactions(address)
ropsten_tokens = self.network_api.get_token_transactions(address)
expected_txs_list = get_merged_txs_list(ropsten_txs, ropsten_tokens)
transactions = self.wallet.transaction_history_button.click()
if self.wallet.element_by_translation_id("transactions-history-empty").is_element_displayed():
self.wallet.pull_to_refresh()
status_tx_number = transactions.transactions_table.get_transactions_number()
if status_tx_number < 1:
self.errors.append('No transactions found')
for n in range(status_tx_number):
transactions_details = transactions.transactions_table.transaction_by_index(n).click()
tx_hash = transactions_details.get_transaction_hash()
tx_from = transactions_details.get_sender_address()
tx_to = transactions_details.get_recipient_address()
if tx_from != expected_txs_list[tx_hash]['from']:
self.errors.append('Transactions senders do not match!')
if tx_to != expected_txs_list[tx_hash]['to']:
self.errors.append('Transactions recipients do not match!')
transactions_details.close_button.click()
self.errors.verify_no_errors()
@marks.testrail_id(5689)
def test_keycard_create_account_unlock_same_seed(self):
self.sign_in.driver.reset()
self.sign_in.just_fyi("Create keycard account and save seed phrase")
self.sign_in.accept_tos_checkbox.enable()
self.sign_in.get_started_button.click()
self.sign_in.generate_key_button.click_until_presence_of_element(self.sign_in.next_button)
self.sign_in.next_button.click_until_absense_of_element(self.sign_in.element_by_translation_id("intro-wizard-title2"))
keycard_flow = self.sign_in.keycard_storage_button.click()
keycard_flow.confirm_pin_and_proceed()
seed_phrase = keycard_flow.backup_seed_phrase()
self.sign_in.maybe_later_button.wait_for_visibility_of_element(30)
self.sign_in.maybe_later_button.click_until_presence_of_element(self.sign_in.lets_go_button)
self.sign_in.lets_go_button.click_until_absense_of_element(self.sign_in.lets_go_button)
self.sign_in.profile_button.wait_for_visibility_of_element(30)
self.sign_in.just_fyi('Check that after creating keycard account balance is 0, not ...')
wallet_1 = self.sign_in.wallet_button.click()
wallet_address = wallet_1.get_wallet_address()
wallet_1.wallet_button.double_click()
if wallet_1.status_account_total_usd_value.text != '0':
self.errors.append("Account USD value is not 0, it is %s" % wallet_1.status_account_total_usd_value.text)
public_key, default_username = self.sign_in.get_public_key_and_username(return_username=True)
profile_1 = self.sign_in.get_profile_view()
profile_1.logout()
profile_1.just_fyi('Check that can re-login with keycard account after account creation')
self.sign_in.multi_account_on_login_button.wait_for_visibility_of_element(5)
self.sign_in.multi_account_on_login_button.click()
if not keycard_flow.element_by_text_part(default_username).is_element_displayed():
self.errors.append("%s is not found on keycard login screen!" % default_username)
keycard_flow.enter_default_pin()
if not self.sign_in.home_button.is_element_displayed(10):
self.errors.append('Keycard user is not logged in')
self.sign_in.just_fyi('Unlock keycard multiaccount at attempt to restore same multiaccount from seed')
self.sign_in.profile_button.click()
profile_1.logout()
self.sign_in.access_key_button.click()
self.sign_in.enter_seed_phrase_button.click()
self.sign_in.seedphrase_input.click()
self.sign_in.seedphrase_input.set_value(seed_phrase)
self.sign_in.next_button.click()
self.sign_in.element_by_translation_id("unlock", uppercase=True).click()
keycard_flow.enter_default_pin()
device_1_home = self.sign_in.home_button.click()
device_1_home.plus_button.click()
if not device_1_home.start_new_chat_button.is_element_displayed():
self.errors.append("Can't proceed using account after it's re-recover twice.")
self.sign_in.just_fyi("Restore same multiaccount from backed up seed phrase on another device")
self.sign_in.driver.reset()
self.sign_in.recover_access(seed_phrase)
self.sign_in.just_fyi("Check username and wallet address on restored account")
wallet_2 = self.sign_in.wallet_button.click()
wallet_address_2 = wallet_2.get_wallet_address()
wallet_2.wallet_button.double_click()
if wallet_address != wallet_address_2:
self.errors.append('Wallet address on restored multiaccount is not equal to created keycard multiaccount')
public_key_2, default_username_2 = self.sign_in.get_public_key_and_username(return_username=True)
if public_key != public_key_2:
self.errors.append('Public key on restored multiaccount is not equal to created keycard multiaccount')
if default_username_2 != default_username:
self.errors.append('Username on restored multiaccount is not equal to created keycard multiaccount')
self.errors.verify_no_errors()

View File

@ -3,8 +3,8 @@ import string
import pytest
from tests import marks, common_password
from tests.base_test_case import SingleDeviceTestCase, MultipleSharedDeviceTestCase, create_shared_drivers
from tests.users import wallet_users, transaction_senders, basic_user, ens_user, ens_user_ropsten
from tests.base_test_case import MultipleSharedDeviceTestCase, create_shared_drivers
from tests.users import wallet_users, basic_user
from views.sign_in_view import SignInView
from support.utilities import get_merged_txs_list
@ -28,7 +28,7 @@ class TestWalletManagementDeviceMerged(MultipleSharedDeviceTestCase):
'STT': cls.wallet.get_asset_amount_by_name('STT')}
@marks.testrail_id(700756)
def test_wallet_tx_history_copy_tx_hash_on_lte(self):
def test_wallet_tx_history_copy_tx_hash_on_cellular(self):
self.wallet.accounts_status_account.click()
address = wallet_users['D']['address']
ropsten_txs = self.network_api.get_transactions(address)
@ -389,58 +389,4 @@ class TestWalletManagementDeviceMerged(MultipleSharedDeviceTestCase):
self.errors.append(
"'Insufficient funds' error is not shown when sending %s STT from wallet with balance %s" % (
round(stt_value + 1), stt_value))
self.errors.verify_no_errors()
class TestWalletManagement(SingleDeviceTestCase):
@marks.testrail_id(6269)
@marks.medium
def test_search_asset_and_currency(self):
sign_in = SignInView(self.driver)
home = sign_in.create_user()
profile = home.profile_button.click()
profile.switch_network()
search_list_assets = {
'ad': ['AdEx', 'Open Trading Network', 'TrueCAD'],
'zs': ['ZSC']
}
wallet = home.wallet_button.click()
home.just_fyi('Searching for asset by name and symbol')
wallet.multiaccount_more_options.click()
wallet.manage_assets_button.click()
for keyword in search_list_assets:
home.search_by_keyword(keyword)
if keyword == 'ad':
search_elements = wallet.all_assets_full_names.find_elements()
else:
search_elements = wallet.all_assets_symbols.find_elements()
if not search_elements:
self.errors.append('No search results after searching by %s keyword' % keyword)
search_results = [element.text for element in search_elements]
if search_results != search_list_assets[keyword]:
self.errors.append("'%s' is shown on the home screen after searching by '%s' keyword" %
(', '.join(search_results), keyword))
home.cancel_button.click()
wallet.close_button.click()
home.just_fyi('Searching for currency')
search_list_currencies = {
'aF': ['Afghanistan Afghani (AFN)', 'South Africa Rand (ZAR)'],
'bolívi': ['Bolivia Bolíviano (BOB)']
}
wallet.multiaccount_more_options.click_until_presence_of_element(wallet.set_currency_button)
wallet.set_currency_button.click()
for keyword in search_list_currencies:
home.search_by_keyword(keyword)
search_elements = wallet.currency_item_text.find_elements()
if not search_elements:
self.errors.append('No search results after searching by %s keyword' % keyword)
search_results = [element.text for element in search_elements]
if search_results != search_list_currencies[keyword]:
self.errors.append("'%s' is shown on the home screen after searching by '%s' keyword" %
(', '.join(search_results), keyword))
home.cancel_button.click()
self.errors.verify_no_errors()
self.errors.verify_no_errors()

View File

@ -3,11 +3,8 @@ import pytest
testrail_case_id = pytest.mark.testrail_case_id
testrail_id = pytest.mark.testrail_id # atomic tests
critical = pytest.mark.critical
high = pytest.mark.high
medium = pytest.mark.medium
low = pytest.mark.low
flaky = pytest.mark.flaky
transaction = pytest.mark.transaction
upgrade = pytest.mark.upgrade
skip = pytest.mark.skip

View File

@ -0,0 +1,436 @@
import random
from time import sleep
import emoji
import pytest
from tests import marks
from tests.base_test_case import create_shared_drivers, MultipleSharedDeviceTestCase
from views.sign_in_view import SignInView
@pytest.mark.xdist_group(name="public_chat_medium_2")
@marks.medium
class TestPublicChatMultipleDeviceMergedMedium(MultipleSharedDeviceTestCase):
@classmethod
def setup_class(cls):
cls.drivers, cls.loop = create_shared_drivers(2)
device_1, device_2 = SignInView(cls.drivers[0]), SignInView(cls.drivers[1])
cls.home_1, cls.home_2 = device_1.create_user(), device_2.create_user()
profile_1 = cls.home_1.profile_button.click()
cls.public_key_1, cls.username_1 = profile_1.get_public_key_and_username(return_username=True)
profile_1.home_button.click()
cls.text_message = 'hello'
[home.home_button.click() for home in (cls.home_1, cls.home_2)]
cls.public_chat_name = cls.home_1.get_random_chat_name()
cls.chat_1, cls.chat_2 = cls.home_1.join_public_chat(cls.public_chat_name), cls.home_2.join_public_chat(
cls.public_chat_name)
cls.chat_1.send_message(cls.text_message)
@marks.testrail_id(6342)
def test_public_chat_timeline_different_statuses_reaction(self):
emoji_message = random.choice(list(emoji.EMOJI_UNICODE))
emoji_unicode = emoji.EMOJI_UNICODE[emoji_message]
self.home_1.just_fyi('Set status in profile')
statuses = {
'*formatted text*': 'formatted text',
'https://www.youtube.com/watch?v=JjPWmEh2KhA': 'Status Town Hall',
emoji.emojize(emoji_message): emoji_unicode,
}
timeline_1 = self.home_1.status_button.click()
for status in statuses.keys():
timeline_1.set_new_status(status)
sleep(60)
timeline_1.element_by_translation_id("enable").wait_and_click()
timeline_1.element_by_translation_id("enable-all").wait_and_click()
timeline_1.close_modal_view_from_chat_button.click()
for status in statuses:
expected_value = statuses[status]
if not timeline_1.element_by_text_part(expected_value).is_element_displayed():
self.errors.append("Expected value %s is not shown" % expected_value)
text_status = 'some text'
timeline_1.set_new_status(status=text_status, image=True)
for timestamp in ('Now', '1M', '2M'):
if not timeline_1.element_by_text(timestamp).is_element_displayed():
self.errors.append("Expected timestamp %s is not shown in timeline_1" % timestamp)
if not timeline_1.image_message_in_chat.is_element_displayed():
self.errors.append("Timeline image is not shown in timeline_1")
self.home_2.just_fyi('Check that can see user status without adding him as contact')
self.home_2.home_button.click()
chat_2 = self.home_2.add_contact(self.public_key_1, add_in_contacts=False)
chat_2.chat_options.click()
timeline_2 = chat_2.view_profile_button.click()
if not timeline_2.image_message_in_chat.is_element_displayed(40):
self.errors.append(
'Timeline image of another user is not shown when open another user profile before adding to contacts')
chat_2.chat_element_by_text(text_status).wait_for_element(30)
chat_2.element_by_translation_id("enable").scroll_and_click()
chat_2.element_by_translation_id("enable-all").wait_and_click()
chat_2.close_modal_view_from_chat_button.click()
for status in statuses:
chat_2.element_by_text_part(statuses['*formatted text*']).scroll_to_element()
expected_value = statuses[status]
if not chat_2.element_by_text_part(expected_value).is_element_displayed():
self.errors.append(
"Expected value %s is not shown in other user profile without adding to contacts" % expected_value)
self.home_2.just_fyi('Add device1 to contacts and check that status will be shown in timeline_1')
chat_2.close_button.scroll_and_click(direction='up')
chat_2.add_to_contacts.click()
timeline_2 = chat_2.status_button.click()
for status in statuses:
expected_value = statuses[status]
if not timeline_2.element_by_text_part(expected_value).is_element_displayed():
self.errors.append(
"Expected value %s is not shown in timeline_1 after adding user to contacts" % expected_value)
if not timeline_2.image_message_in_chat.is_element_displayed(40):
self.errors.append(
'Timeline image of another user is not shown when open another user profile after adding to contacts')
self.home_2.just_fyi('Checking message tag and reactions on statuses')
tag_status = '#public-chat-to-redirect-long-name'
timeline_1.set_new_status(tag_status)
public_chat_2 = self.home_2.get_chat_view()
public_chat_2.element_by_text(tag_status).wait_and_click()
public_chat_2.user_name_text.wait_for_element(30)
if not public_chat_2.user_name_text.text == tag_status:
self.errors.append('Could not redirect a user to a public chat tapping the tag message from timeline_1')
public_chat_2.back_button.click()
timeline_1.set_reaction(text_status)
status_with_reaction_1 = timeline_1.chat_element_by_text(text_status)
if status_with_reaction_1.emojis_below_message() != 1:
self.errors.append("Counter of reaction is not updated on your own status in timeline_1!")
self.home_2.home_button.double_click()
self.home_2.get_chat(self.username_1).click()
chat_2.chat_options.click()
chat_2.view_profile_button.click()
status_with_reaction_2 = chat_2.chat_element_by_text(text_status)
if status_with_reaction_2.emojis_below_message(own=False) != 1:
self.errors.append("Counter of reaction is not updated on status of another user in profile!")
self.home_1.just_fyi("Remove reaction and check it is updated for both users")
timeline_1.set_reaction(text_status)
status_with_reaction_1 = timeline_1.chat_element_by_text(text_status)
if status_with_reaction_1.emojis_below_message() != 0:
self.errors.append(
"Counter of reaction is not updated after removing reaction on your own status in timeline_1!")
status_with_reaction_2 = chat_2.chat_element_by_text(text_status)
if status_with_reaction_2.emojis_below_message(own=False) != 0:
self.errors.append(
"Counter of reaction is not updated after removing on status of another user in profile!")
self.home_1.just_fyi("Remove user from contacts and check there is no his status in timeline_1 anymore")
chat_2.remove_from_contacts.click()
chat_2.close_button.click()
chat_2.status_button.click()
if public_chat_2.chat_element_by_text(text_status).is_element_displayed(10):
self.errors.append("Statuses of removed user are still shown in profile")
self.errors.verify_no_errors()
@pytest.mark.xdist_group(name="chat_medium_2")
@marks.medium
class TestChatMultipleDevice(MultipleSharedDeviceTestCase):
@classmethod
def setup_class(cls):
cls.drivers, cls.loop = create_shared_drivers(2)
cls.device_1, cls.device_2 = SignInView(cls.drivers[0]), SignInView(cls.drivers[1])
cls.home_1, cls.home_2 = cls.device_1.create_user(enable_notifications=True), cls.device_2.create_user()
cls.public_key_1, cls.default_username_1 = cls.home_1.get_public_key_and_username(return_username=True)
cls.public_key_2, cls.default_username_2 = cls.home_2.get_public_key_and_username(return_username=True)
profile_2 = cls.home_2.profile_button.click()
profile_2.switch_network()
[home.home_button.click() for home in (cls.home_1, cls.home_2)]
cls.home_1.just_fyi("Creating 1-1 chats")
cls.chat_1 = cls.home_1.add_contact(cls.public_key_2)
cls.chat_2 = cls.home_2.add_contact(cls.public_key_1)
cls.home_2.just_fyi('Install free sticker pack and use it in 1-1 chat')
cls.chat_2.install_sticker_pack_by_name()
[home.home_button.click() for home in (cls.home_1, cls.home_2)]
cls.home_1.just_fyi("Creating group chats")
cls.initial_group_chat_name = "GroupChat before rename"
cls.new_group_chat_name = "GroupChat after rename"
cls.group_chat_1 = cls.home_1.create_group_chat(user_names_to_add=[cls.default_username_2], group_chat_name=cls.initial_group_chat_name)
cls.group_chat_2 = cls.home_2.get_chat(cls.initial_group_chat_name).click()
cls.group_chat_2.join_chat_button.click()
[home.home_button.click() for home in (cls.home_1, cls.home_2)]
cls.home_1.just_fyi("Creating public chats")
cls.public_chat_name = cls.home_1.get_random_chat_name()
cls.public_chat_1, cls.public_chat_2 = cls.home_1.join_public_chat(cls.public_chat_name), cls.home_2.join_public_chat(cls.public_chat_name)
[home.home_button.click() for home in (cls.home_1, cls.home_2)]
cls.home_1.get_chat(cls.default_username_2).click()
cls.home_2.get_chat(cls.default_username_1).click()
cls.message_1, cls.message_2, cls.message_3, cls.message_4 = "Message1", "Message2", "Message3", "Message4"
@marks.testrail_id(702066)
def test_chat_1_1_push_and_reaction_for_messages_sticker_audio_image(self):
# methods with steps to use later in loop
def navigate_to_start_state_of_both_devices():
self.chat_1.put_app_to_background()
self.device_1.open_notification_bar()
self.chat_2.get_back_to_home_view(2)
self.home_2.get_chat_from_home_view(self.default_username_1).click()
def device_2_sends_sticker():
self.chat_2.just_fyi("Sending Sticker in chat")
self.chat_2.show_stickers_button.click()
self.chat_2.sticker_icon.click()
def device_2_sends_image():
self.chat_2.just_fyi("Sending Image in chat")
self.chat_2.show_images_button.click()
self.chat_2.allow_button.click()
self.chat_2.first_image_from_gallery.click()
self.chat_2.send_message_button.click()
def device_2_sends_audio():
self.chat_2.just_fyi("Sending Audio in chat")
self.chat_2.record_audio_message(message_length_in_seconds=3)
self.chat_2.send_message_button.click()
sending_list = {
"sticker": device_2_sends_sticker,
"image": device_2_sends_image,
"audio": device_2_sends_audio,
}
for key, value in sending_list.items():
navigate_to_start_state_of_both_devices()
sending_list[key]()
if not self.device_1.element_by_text_part(key.capitalize()).is_element_displayed(10):
self.errors.append("%s not appeared in Push Notification" % key.capitalize())
self.device_1.click_system_back_button()
self.device_1.get_app_from_background()
else:
self.device_1.element_by_text_part(key.capitalize()).click()
message = self.chat_2.chat_element_by_text(key)
self.chat_1.set_reaction(key)
if message.emojis_below_message(own=False) != 1:
self.errors.append("Counter of reaction is not set on %s for message receiver!" % key)
self.chat_1.set_reaction(key)
if message.emojis_below_message(own=False) == 1:
self.errors.append("Counter of reaction is not re-set on %s for message receiver!" % key)
self.chat_2.just_fyi("Sending Emoji/Tag/Links in chat")
# TODO: add link and tag messages after #11168 is fixed(rechecked 23.11.21, valid)
navigate_to_start_state_of_both_devices()
emoji_name = random.choice(list(emoji.EMOJI_UNICODE))
emoji_unicode = emoji.EMOJI_UNICODE[emoji_name]
self.chat_2.just_fyi("Sending Emoji in chat")
self.chat_2.chat_message_input.send_keys(emoji.emojize(emoji_name))
self.chat_2.send_message_button.click()
if not self.device_1.element_by_text_part(emoji_unicode).is_element_displayed(10):
self.errors.append("Emoji not appeared in Push Notification")
self.device_1.click_system_back_button()
self.device_1.get_app_from_background()
else:
self.device_1.element_by_text_part(emoji_unicode).click()
emoji_message = self.chat_2.chat_element_by_text(emoji_unicode)
self.chat_1.set_reaction(emoji_unicode, emoji_message=True)
if emoji_message.emojis_below_message(own=False) != 1:
self.errors.append("Counter of reaction is not set on Emoji for message receiver!")
self.chat_1.set_reaction(emoji_unicode, emoji_message=True)
if emoji_message.emojis_below_message(own=False) == 1:
self.errors.append("Counter of reaction is not re-set on Emoji for message receiver!")
self.errors.verify_no_errors()
@marks.testrail_id(702069)
def test_chat_1_1_pin_messages(self):
self.home_1.just_fyi("Check that Device1 can pin own message in 1-1 chat")
self.chat_1.send_message(self.message_1)
self.chat_1.send_message(self.message_2)
self.chat_1.pin_message(self.message_1)
if not self.chat_1.chat_element_by_text(self.message_1).pinned_by_label.is_element_present():
self.drivers[0].fail("Message is not pinned!")
self.home_1.just_fyi("Check that Device2 can pin Device1 message in 1-1 chat and two pinned "
"messages are in Device1 profile")
self.chat_2.pin_message(self.message_2)
self.chat_2.chat_options.click()
self.chat_2.view_profile_button.click()
if not self.chat_2.pinned_messages_button.count == "2":
self.drivers[0].fail("Pinned message count is not 2 as expected!")
self.home_1.just_fyi("Check pinned message are visible in Pinned panel for both users")
self.chat_1.chat_options.click()
self.chat_1.view_profile_button.click()
self.chat_1.pinned_messages_button.click()
if not (self.chat_1.chat_element_by_text(self.message_1).pinned_by_label.is_element_present() and
self.chat_1.chat_element_by_text(self.message_2).pinned_by_label.is_element_present() and
self.chat_1.chat_element_by_text(self.message_1).is_element_present() and
self.chat_1.chat_element_by_text(self.message_2).is_element_present()):
self.drivers[0].fail("Something missed on Pinned messaged on Device 1!")
self.chat_2.pinned_messages_button.click()
if not (self.chat_1.chat_element_by_text(self.message_1).pinned_by_label.is_element_present() and
self.chat_2.chat_element_by_text(self.message_2).pinned_by_label.is_element_present() and
self.chat_2.chat_element_by_text(self.message_1).is_element_present() and
self.chat_2.chat_element_by_text(self.message_2).is_element_present()):
self.drivers[0].fail("Something missed on Pinned messaged on Device 2!")
self.chat_1.close_button.click()
self.home_1.just_fyi("Check that Device1 can not pin more than 3 messages and 'Unpin' dialog appears"
"messages are in Device1 profile")
self.chat_1.send_message(self.message_3)
self.chat_1.send_message(self.message_4)
self.chat_1.pin_message(self.message_3)
self.chat_1.pin_message(self.message_4)
if not self.chat_1.unpin_message_popup.is_element_present():
self.drivers[0].fail("No 'Unpin' dialog appears when pining 4th message")
self.home_1.just_fyi("Unpin one message so that another could be pinned")
self.chat_1.unpin_message_popup.message_text(self.message_1).click()
self.chat_1.unpin_message_popup.click_unpin_message_button()
if self.chat_1.unpin_message_popup.is_element_present():
self.drivers[0].fail("Unpin message pop up keep staying after Unpin button pressed")
if self.chat_1.chat_element_by_text(self.message_1).pinned_by_label.is_element_present():
self.drivers[0].fail("Message is not unpinned!")
if not self.chat_1.chat_element_by_text(self.message_4).pinned_by_label.is_element_present():
self.drivers[0].fail("Message is not pinned!")
self.home_1.just_fyi("Unpin another message and check it's unpinned for another user")
self.chat_2.close_button.click()
self.chat_2.pin_message(self.message_4, action="unpin")
self.chat_1.chat_element_by_text(self.message_4).pinned_by_label.wait_for_invisibility_of_element()
if self.chat_1.chat_element_by_text(self.message_4).pinned_by_label.is_element_present():
self.drivers[0].fail("Message_4 is not unpinned!")
@marks.testrail_id(702065)
def test_chat_public_markdown_support(self):
markdown = {
'bold text in asterics': '**',
'bold text in underscores': '__',
'italic text in asteric': '*',
'italic text in underscore': '_',
'inline code': '`',
'code blocks': '```',
'quote reply (one row)': '>',
}
for message, symbol in markdown.items():
self.home_1.just_fyi('checking that "%s" is applied (%s) in 1-1 chat' % (message, symbol))
message_to_send = symbol + message + symbol if 'quote' not in message else symbol + message
self.chat_2.send_message(message_to_send)
if not self.chat_2.chat_element_by_text(message).is_element_displayed():
self.errors.append('%s is not displayed with markdown in 1-1 chat for the sender \n' % message)
if not self.chat_1.chat_element_by_text(message).is_element_displayed():
self.errors.append('%s is not displayed with markdown in 1-1 chat for the recipient \n' % message)
[chat.home_button.double_click() for chat in (self.chat_1, self.chat_2)]
[home.get_chat('#' + self.public_chat_name).click() for home in (self.home_1, self.home_2)]
for message, symbol in markdown.items():
self.home_1.just_fyi('checking that "%s" is applied (%s) in public chat' % (message, symbol))
message_to_send = symbol + message + symbol if 'quote' not in message else symbol + message
self.public_chat_1.send_message(message_to_send)
if not self.public_chat_2.chat_element_by_text(message).is_element_displayed(30):
self.errors.append('%s is not displayed with markdown in public chat for the sender \n' % message)
if not self.public_chat_1.chat_element_by_text(message).is_element_displayed(30):
self.errors.append('%s is not displayed with markdown in public chat for the recipient \n' % message)
self.errors.verify_no_errors()
@marks.testrail_id(702098)
def test_chat_group_chat_rename(self):
[chat.home_button.double_click() for chat in [self.chat_1, self.chat_2]]
self.home_2.just_fyi('Rename chat and check system messages')
[home.get_chat(self.initial_group_chat_name).click() for home in (self.home_1, self.home_2)]
self.group_chat_1.rename_chat_via_group_info(self.new_group_chat_name)
for chat in (self.group_chat_1, self.group_chat_2):
if not chat.element_by_text(
chat.create_system_message(self.default_username_1, self.initial_group_chat_name)).is_element_displayed():
self.errors.append('Initial system message about creating chat was changed!')
if not chat.element_by_text(
chat.changed_group_name_system_message(self.default_username_1,
self.new_group_chat_name)).is_element_displayed():
self.errors.append('Message about changing chat name is not shown')
self.home_2.just_fyi('Check that you can see renamed chat')
self.group_chat_2.back_button.click()
self.home_2.get_chat(self.new_group_chat_name).wait_for_visibility_of_element(60)
self.errors.verify_no_errors()
@marks.testrail_id(702097)
def test_chat_block_and_unblock_user_from_group_chat_via_group_info(self):
[chat.home_button.double_click() for chat in [self.chat_1, self.chat_2]]
self.home_2.just_fyi('Send message and block user via Group Info')
[home.get_chat(self.new_group_chat_name).click() for home in (self.home_1, self.home_2)]
message_before_block = 'message from device2'
self.group_chat_2.send_message(message_before_block)
options_2 = self.group_chat_1.get_user_options(self.default_username_2)
options_2.view_profile_button.click()
options_2.block_contact()
self.home_1.close_button.click()
if self.group_chat_1.chat_element_by_text(message_before_block).is_element_displayed(10):
self.errors.append('User was blocked, but past message are shown')
message_after_block = 'message from device2 after block'
self.group_chat_2.send_message(message_after_block)
if self.group_chat_1.chat_element_by_text(message_after_block).is_element_displayed(10):
self.errors.append('User was blocked, but new messages still received')
self.home_1.just_fyi('Unblock user via group info and check that new messages will arrive')
options_2 = self.group_chat_1.get_user_options(self.default_username_2)
options_2.view_profile_button.click()
options_2.unblock_contact_button.click()
[options_2.close_button.click() for _ in range(2)]
message_after_unblock = 'message from device2 after unblock'
self.group_chat_2.send_message(message_after_unblock)
if not self.group_chat_1.chat_element_by_text(message_after_unblock).is_element_displayed(20):
self.errors.append('User was unblocked, but new messages are not received')
self.errors.verify_no_errors()
@marks.testrail_id(702070)
def test_chat_pin_messages_in_group_chat(self):
[chat.home_button.double_click() for chat in [self.chat_1, self.chat_2]]
self.home_1.just_fyi("Enter group chat and pin message there. It's pinned for both members.")
[home.get_chat(self.new_group_chat_name).click() for home in (self.home_1, self.home_2)]
self.group_chat_1.send_message(self.message_1)
self.group_chat_1.pin_message(self.message_1)
if not (self.group_chat_1.chat_element_by_text(self.message_1).pinned_by_label.is_element_present(30) and
self.group_chat_2.chat_element_by_text(self.message_1).pinned_by_label.is_element_present(30)):
self.errors.append("Message is not pinned in group chat!")
self.home_1.just_fyi("Check that non admin user can not unpin messages")
self.group_chat_2.chat_element_by_text(self.message_1).long_press_element()
if self.group_chat_2.element_by_translation_id("unpin").is_element_present():
self.errors.append("Unpin option is available for non-admin user")
self.home_1.just_fyi("Grant another user with admin rights and check he can unpin message now")
self.group_chat_1.chat_options.click()
group_info = self.group_chat_1.group_info.click()
options = group_info.get_username_options(self.default_username_2).click()
options.make_admin_button.click()
self.group_chat_2.click_system_back_button()
self.group_chat_2.pin_message(self.message_1, action="unpin")
if (self.group_chat_1.chat_element_by_text(self.message_1).pinned_by_label.is_element_present() and
self.group_chat_2.chat_element_by_text(self.message_1).pinned_by_label.is_element_present()):
self.errors.append("Message failed be unpinned by user who granted admin permissions!")
self.errors.verify_no_errors()

View File

@ -0,0 +1,465 @@
import pytest
from tests import marks, common_password, used_fleet
from tests.base_test_case import create_shared_drivers, MultipleSharedDeviceTestCase
from views.sign_in_view import SignInView
from tests.users import basic_user, ens_user, ens_user_ropsten, transaction_senders, chat_users
@pytest.mark.xdist_group(name="browser_profile_medium_1")
@marks.medium
class TestBrowserProfileOneDevice(MultipleSharedDeviceTestCase):
@classmethod
def setup_class(cls):
cls.drivers, cls.loop = create_shared_drivers(1)
cls.sign_in = SignInView(cls.drivers[0])
cls.home = cls.sign_in.create_user()
cls.wiki_texts = ['Español', '日本語', 'Français', '中文', 'Português']
@marks.testrail_id(702149)
def test_browser_can_access_images_by_link(self):
urls = {
'https://cdn.dribbble.com/users/45534/screenshots/3142450/logo_dribbble.png':
'url1.png',
'https://steemitimages.com/DQmYEjeBuAKVRa3b3ZqwLicSHaPUm7WFtQqohGaZdA9ghjx/images%20(4).jpeg':
'url3.png'
}
dapp = self.home.dapp_tab_button.click()
from views.web_views.base_web_view import BaseWebView
base_web = BaseWebView(self.drivers[0])
for url in urls:
dapp.open_url(url)
if dapp.web_page.is_element_differs_from_template(urls[url], 5):
self.errors.append('Web page does not match expected template %s' % urls[url])
base_web.browser_previous_page_button.click_until_presence_of_element(dapp.element_by_text_part('Discover'))
self.errors.verify_no_errors()
@marks.testrail_id(702150)
def test_browser_back_forward_navigation_history_kept_after_relogin(self):
dapp = self.home.dapp_tab_button.click()
ua_url = 'https://uk.m.wikipedia.org/'
browsing = dapp.open_url(ua_url)
browsing.element_by_text_part('Ласкаво просимо').wait_for_element(20)
browsing.just_fyi("Check next page")
browsing.just_fyi('Navigate to next page and back')
browsing.element_by_text_part('може редагувати кожен').click()
browsing.element_by_text_part('написана спільно її читачами').wait_for_element(30)
browsing.browser_previous_page_button.click()
browsing.wait_for_element_starts_with_text('може редагувати кожен')
browsing.just_fyi('Relogin and check that tap on "Next" navigates to next page')
browsing.reopen_app()
self.home.dapp_tab_button.click()
browsing.open_tabs_button.click()
dapp.element_by_text_part(ua_url).click()
browsing.wait_for_element_starts_with_text('може редагувати кожен')
browsing.browser_next_page_button.click()
browsing.element_by_text_part('написана спільно її читачами').wait_for_element(30)
self.errors.verify_no_errors()
@marks.testrail_id(702179)
def test_browser_refresh_page(self):
dapp = self.home.dapp_tab_button.click()
url = 'app.uniswap.org'
dapp.just_fyi("Check refresh button")
web_page = dapp.open_url(url)
dapp.allow_button.click()
element_on_start_page = dapp.element_by_text('Select a token')
dapp.allow_button.click()
element_on_start_page.scroll_and_click()
# when bottom sheet is opened, elements by text couldn't be found
element_on_start_page.wait_for_invisibility_of_element(20)
web_page.browser_refresh_page_button.click()
if not element_on_start_page.is_element_displayed(30):
self.errors.append("Page failed to be refreshed")
self.errors.verify_no_errors()
@marks.testrail_id(702201)
def test_browser_resolve_ipns_name(self):
ipns_url = 'uniswap.eth'
self.home.just_fyi('Switching to Mainnet')
profile = self.home.profile_button.click()
profile.switch_network()
self.home.just_fyi('Opening url containing ipns name')
dapp = self.home.dapp_tab_button.click()
web_page = dapp.open_url(ipns_url)
if not dapp.allow_button.is_element_displayed(30):
self.driver.fail('No permission is asked for dapp, so IPNS name is not resolved')
dapp.allow_button.click()
# Switching back to ropsten
web_page.profile_button.click()
profile.switch_network('Ropsten with upstream RPC')
self.errors.verify_no_errors()
@marks.testrail_id(702151)
def test_browser_open_url_with_non_english_text(self):
dapp = self.home.dapp_tab_button.click()
dapp.just_fyi('Check non english text is shown in open url')
browsing = dapp.open_url('www.wikipedia.org')
for wiki_text in self.wiki_texts:
if not browsing.element_by_text_part(wiki_text).is_element_displayed(15):
self.errors.append("%s is not shown" % wiki_text)
self.errors.verify_no_errors()
@marks.testrail_id(702180)
def test_browser_connect_revoke_wallet(self):
dapp = self.home.dapp_tab_button.click()
browsing = dapp.open_url('www.wikipedia.org')
dapp.just_fyi("Check that can connect wallet and revoke access")
browsing.options_button.click()
browsing.connect_account_button.click()
browsing.allow_button.click()
browsing.options_button.click()
if not browsing.connected_account_button.is_element_displayed():
self.driver.fail("Account is not connected")
browsing.click_system_back_button()
profile = browsing.profile_button.click()
profile.privacy_and_security_button.click()
profile.dapp_permissions_button.click()
if not profile.element_by_text('wikipedia.org').is_element_displayed():
self.errors.append("Permissions are not granted")
profile.dapp_tab_button.click(desired_element_text=self.wiki_texts[0])
browsing.options_button.click()
browsing.connected_account_button.click()
browsing.element_by_translation_id("revoke-access").click()
browsing.options_button.click()
if not browsing.connect_account_button.is_element_displayed():
self.errors.append("Permission for account is not removed if using 'Revoke access' from dapp view")
browsing.click_system_back_button()
browsing.profile_button.click(desired_element_text='DApp permissions')
if profile.element_by_text('wikipedia.org').is_element_displayed():
self.errors.append("Permissions are not revoked")
profile.get_back_to_home_view()
self.errors.verify_no_errors()
@marks.testrail_id(702181)
def test_browser_open_chat_options(self):
dapp = self.home.dapp_tab_button.click()
browsing = dapp.open_url('www.wikipedia.org')
dapp.just_fyi("Check that can open chat view and send some message")
browsing.options_button.click()
browsing.open_chat_from_dapp_button.click()
public_chat = browsing.get_chat_view()
if not public_chat.element_by_text('#wikipedia-org').is_element_displayed():
self.driver.fail("No redirect to public chat")
message = public_chat.get_random_message()
public_chat.send_message(message)
public_chat.dapp_tab_button.click(desired_element_text=self.wiki_texts[0])
browsing.options_button.click()
browsing.open_chat_from_dapp_button.click()
if not public_chat.chat_element_by_text(message).is_element_displayed():
self.errors.append("Messages are not shown if open dapp chat from view")
public_chat.get_back_to_home_view()
self.errors.verify_no_errors()
@marks.testrail_id(702182)
def test_browser_new_tab_open(self):
dapp = self.home.dapp_tab_button.click()
browsing = dapp.open_url('www.wikipedia.org')
dapp.just_fyi("Check that can open new tab using 'New tab' from bottom sheet")
browsing.options_button.click()
browsing.new_tab_button.click()
if not browsing.element_by_translation_id("open-dapp-store").is_element_displayed():
self.errors.append("Was not redirected to home dapp store view using New tab")
self.errors.verify_no_errors()
@marks.testrail_id(702159)
def test_profile_invite_friends(self):
self.home.home_button.click()
self.home.just_fyi("Check it via 'Invite friends' on home view")
self.home.invite_friends_button.click()
self.home.share_via_messenger()
self.home.element_by_text_part("Hey join me on Status: https://join.status.im/u/0x")
self.home.click_system_back_button()
self.home.just_fyi("Check it via bottom sheet menu")
self.home.plus_button.click()
self.home.chats_menu_invite_friends_button.click()
self.home.share_via_messenger()
self.home.element_by_text_part("Hey join me on Status: https://join.status.im/u/0x")
self.home.click_system_back_button()
self.errors.verify_no_errors()
@marks.testrail_id(702160)
def test_profile_add_remove_contact_via_contacts_view(self):
self.home.just_fyi('Check empty contacts view')
profile = self.home.profile_button.click()
profile.contacts_button.click()
if not profile.add_new_contact_button.is_element_displayed():
self.driver.fail('No expected element on contacts view')
users = {
'scanning_ens_with_stateofus_domain_deep_link': {
'contact_code': 'https://join.status.im/u/%s.stateofus.eth' % ens_user_ropsten['ens'],
'username': ens_user_ropsten['username']
},
'scanning_public_key': {
'contact_code': transaction_senders['A']['public_key'],
'username': transaction_senders['A']['username'],
},
'pasting_public_key': {
'contact_code': basic_user['public_key'],
'username': basic_user['username'],
},
'pasting_ens_another_domain': {
'contact_code': ens_user['ens_another'],
'username': '@%s' % ens_user['ens_another'],
'nickname': 'my_dear_friend'
},
}
self.home.just_fyi('Add contact and check that they appear in Contacts view')
chat = self.home.get_chat_view()
for key in users:
profile.add_new_contact_button.click()
self.home.just_fyi('Checking %s case' % key)
if 'scanning' in key:
chat.scan_contact_code_button.click()
if chat.allow_button.is_element_displayed():
chat.allow_button.click()
chat.enter_qr_edit_box.scan_qr(users[key]['contact_code'])
else:
chat.public_key_edit_box.click()
chat.public_key_edit_box.send_keys(users[key]['contact_code'])
if 'nickname' in users[key]:
chat.nickname_input_field.set_value(users[key]['nickname'])
chat.confirm_until_presence_of_element(profile.add_new_contact_button)
if not profile.element_by_text(users[key]['username']).is_element_displayed():
self.errors.append('In %s case username not found in contact view after scanning' % key)
if 'nickname' in users[key]:
if not profile.element_by_text(users[key]['nickname']).is_element_displayed():
self.errors.append('In %s case nickname %s not found in contact view after scanning' %
(key, users[key]['nickname']))
self.home.just_fyi('Remove contact and check that it disappeared')
user_to_remove = '@%s' % ens_user['ens_another']
profile.element_by_text(user_to_remove).click()
chat.remove_from_contacts.click()
chat.close_button.click()
if profile.element_by_text(user_to_remove).is_element_displayed():
self.errors.append('Removed user is still shown in contact view')
self.home.just_fyi(
'Relogin and open profile view of the contact removed from Contact list to ensure there is no crash')
profile.profile_button.click()
profile.relogin()
one_to_one_chat = self.home.add_contact(public_key=ens_user['ens_another'], add_in_contacts=False)
one_to_one_chat.chat_options.click()
profile = one_to_one_chat.view_profile_button.click()
if profile.remove_from_contacts.is_element_displayed():
self.errors.append('User still added in contact after relogin')
self.errors.verify_no_errors()
@marks.testrail_id(702166)
def test_profile_add_custom_network(self):
self.home.get_back_to_home_view()
profile = self.home.profile_button.click()
profile.add_custom_network()
self.sign_in.sign_in()
self.home.profile_button.click()
profile.advanced_button.click()
profile.network_settings_button.scroll_to_element(10, 'up')
if not profile.element_by_text_part('custom_ropsten').is_element_displayed():
self.driver.fail("Network custom_ropsten was not added!")
profile.get_back_to_home_view()
# Switching back to Ropsten for the next cases
profile.switch_network('Ropsten with upstream RPC')
self.errors.verify_no_errors()
@marks.testrail_id(702164)
def test_profile_backup_of_contacts(self):
self.home.just_fyi('Add user to contacts')
chat = self.home.add_contact(basic_user['public_key'])
self.home.just_fyi('Add nickname to contact')
nickname = 'test user'
chat.chat_options.click()
chat.view_profile_button.click()
chat.set_nickname(nickname)
self.home.back_button.click()
self.home.just_fyi('Add ENS-user to contacts')
user_ens = 'pavlotest.eth'
self.home.add_contact(user_ens)
self.home.back_button.click()
self.home.just_fyi('Block user')
self.home.add_contact(chat_users['A']['public_key'], add_in_contacts=False)
chat.chat_options.click()
chat.view_profile_button.click()
chat.block_contact()
self.home.just_fyi('Add nickname to non-contact user')
nickname1 = 'non-contact user'
self.home.add_contact(chat_users['B']['public_key'], add_in_contacts=False)
chat.chat_options.click()
chat.view_profile_button.click()
chat.set_nickname(nickname1)
self.home.just_fyi('Perform backup')
profile = self.home.profile_button.click()
profile.sync_settings_button.click()
profile.backup_settings_button.click()
profile.perform_backup_button.click()
profile.just_fyi('Backup seed phrase')
profile.back_button.click(2)
profile.privacy_and_security_button.click()
profile.backup_recovery_phrase_button.click()
profile.ok_continue_button.click()
recovery_phrase = profile.get_recovery_phrase()
self.drivers[0].reset()
profile.just_fyi('Recover account from seed phrase')
self.sign_in.recover_access(' '.join(recovery_phrase.values()))
self.sign_in.just_fyi('Check backup of contact with nickname')
profile.profile_button.click()
profile.contacts_button.click()
profile.wait_for_element_starts_with_text('Blocked users')
if not profile.element_by_text(nickname).is_element_displayed():
self.errors.append('Nickname of contact was not backed up')
self.sign_in.just_fyi('Check backup of ENS contact')
if not profile.element_by_text('@%s' % user_ens).is_element_displayed():
self.errors.append('ENS contact was not backed up')
self.sign_in.just_fyi('Check backup of blocked user')
profile.blocked_users_button.click()
if not profile.element_by_text(chat_users['A']['username']).is_element_displayed():
self.errors.append('Blocked user was not backed up')
profile.get_back_to_home_view()
self.sign_in.just_fyi('Check backup of nickname for non-contact user')
self.home.home_button.double_click()
self.home.add_contact(chat_users['B']['public_key'], add_in_contacts=False)
if not chat.element_by_text(nickname1).is_element_displayed():
self.errors.append("Nickname of non-contact user was not backed up")
self.errors.verify_no_errors()
@marks.testrail_id(702165)
def test_profile_change_log_level(self):
self.home.get_back_to_home_view()
profile = self.home.profile_button.click()
profile.advanced_button.click()
default_log_level = 'INFO'
if not profile.element_by_text(default_log_level).is_element_displayed():
self.errors.append('%s is not selected by default' % default_log_level)
if self.home.find_values_in_geth('lvl=trce', 'lvl=dbug'):
self.errors.append('"%s" is set, but found another entries!' % default_log_level)
if not self.home.find_values_in_geth('lvl=info'):
self.errors.append('"%s" is set, but no entries are found!' % default_log_level)
self.home.just_fyi('Set another loglevel and check that changes are applied')
profile.log_level_setting_button.click()
changed_log_level = 'TRACE'
profile.element_by_text(changed_log_level).click_until_presence_of_element(profile.confirm_button)
profile.confirm_button.click()
self.sign_in.sign_in()
self.home.profile_button.click()
profile.advanced_button.click()
if not profile.element_by_text(changed_log_level).is_element_displayed():
self.errors.append('"%s" is not selected after change' % changed_log_level)
if not self.home.find_values_in_geth('lvl=trc'):
self.errors.append('"%s" is set, but no entries are found!' % changed_log_level)
profile.get_back_to_home_view()
self.errors.verify_no_errors()
@marks.testrail_id(702178)
def test_profile_change_fleet(self):
profile = self.home.profile_button.click()
profile.advanced_button.click()
if not profile.element_by_text(used_fleet).is_element_displayed():
self.errors.append('%s is not selected by default' % used_fleet)
self.home.just_fyi('Set another fleet and check that changes are applied')
profile.fleet_setting_button.click()
changed_fleet = 'wakuv2.prod'
profile.element_by_text(changed_fleet).click_until_presence_of_element(profile.confirm_button)
profile.confirm_button.click()
self.sign_in.sign_in()
self.home.profile_button.click()
profile.advanced_button.click()
if not profile.element_by_text(changed_fleet).is_element_displayed():
self.errors.append('"%s" fleet is not selected after change' % changed_fleet)
if not self.home.find_values_in_geth(changed_fleet):
self.errors.append('"%s" is set, but no entry is found!' % changed_fleet)
profile.get_back_to_home_view()
self.errors.verify_no_errors()
# This case should always be the last in group as it changes common password
@marks.testrail_id(702161)
def test_profile_can_reset_password(self):
self.home.get_back_to_home_view()
new_password = basic_user['special_chars_password']
profile = self.home.profile_button.click()
profile.privacy_and_security_button.click()
profile.just_fyi("Check that can not reset password when entering wrong current password")
profile.reset_password_button.click()
profile.current_password_edit_box.send_keys(common_password + '1')
profile.new_password_edit_box.set_value(new_password)
profile.confirm_new_password_edit_box.set_value(new_password)
profile.next_button.click()
if not profile.current_password_wrong_text.is_element_displayed():
self.errors.append("Validation error for wrong current password is not shown")
profile.just_fyi("Check that can not procced if did not confirm new password")
profile.current_password_edit_box.clear()
profile.current_password_edit_box.set_value(common_password)
profile.new_password_edit_box.set_value(new_password)
profile.confirm_new_password_edit_box.set_value(new_password + '1')
profile.next_button.click()
profile.just_fyi("Delete last symbol and check that can reset password")
profile.confirm_new_password_edit_box.delete_last_symbols(1)
profile.next_button.click()
profile.element_by_translation_id("password-reset-success").wait_for_element(30)
profile.element_by_translation_id("okay").click()
profile.just_fyi("Login with new password")
self.sign_in.sign_in(password=new_password)
if not self.sign_in.home_button.is_element_displayed():
self.errors.append("Could not sign in with new password after reset")
self.errors.verify_no_errors()

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff