refactor group e2e + send_stt_in_1_1 + deleted obsolate e2e

Signed-off-by: Churikova Tetiana <churikova.tm@gmail.com>
This commit is contained in:
Churikova Tetiana 2020-04-10 12:25:46 +02:00
parent 461b6cdb74
commit 966b6e5a33
No known key found for this signature in database
GPG Key ID: 0D4EA7B33B47E6D8
17 changed files with 428 additions and 617 deletions

View File

@ -15,7 +15,7 @@ class TestCreateAccount(SingleDeviceTestCase):
def test_switch_users_and_add_new_account(self): def test_switch_users_and_add_new_account(self):
sign_in = SignInView(self.driver) sign_in = SignInView(self.driver)
sign_in.create_user() sign_in.create_user()
public_key = sign_in.get_public_key() public_key = sign_in.get_public_key_and_username()
profile = sign_in.get_profile_view() profile = sign_in.get_profile_view()
profile.logout() profile.logout()
if sign_in.ok_button.is_element_displayed(): if sign_in.ok_button.is_element_displayed():
@ -31,7 +31,7 @@ class TestCreateAccount(SingleDeviceTestCase):
sign_in.next_button.click() sign_in.next_button.click()
sign_in.lets_go_button.click() sign_in.lets_go_button.click()
if sign_in.get_public_key() == public_key: if sign_in.get_public_key_and_username() == public_key:
self.driver.fail('New account was not created') self.driver.fail('New account was not created')
@marks.testrail_id(5379) @marks.testrail_id(5379)

View File

@ -18,7 +18,7 @@ class TestCreateAccount(SingleDeviceTestCase):
wallet_view.set_up_wallet() wallet_view.set_up_wallet()
if wallet_view.status_account_total_usd_value.text != '0': if wallet_view.status_account_total_usd_value.text != '0':
self.errors.append("Account USD value is not 0, it is %s" % wallet_view.status_account_total_usd_value.text) self.errors.append("Account USD value is not 0, it is %s" % wallet_view.status_account_total_usd_value.text)
public_key = sign_in.get_public_key() public_key = sign_in.get_public_key_and_username()
profile = sign_in.get_profile_view() profile = sign_in.get_profile_view()
default_username = profile.default_username_text.text default_username = profile.default_username_text.text
profile.logout() profile.logout()

View File

@ -49,7 +49,7 @@ class TestProfileSingleDevice(SingleDeviceTestCase):
"syncing' selected!") "syncing' selected!")
sign_in_view.just_fyi("Check that can join public chat and send message") sign_in_view.just_fyi("Check that can join public chat and send message")
chat_name = sign_in_view.get_public_chat_name() chat_name = sign_in_view.get_random_chat_name()
home = profile_view.get_back_to_home_view() home = profile_view.get_back_to_home_view()
chat = home.join_public_chat(chat_name) chat = home.join_public_chat(chat_name)
message = 'test message' message = 'test message'
@ -289,7 +289,7 @@ class TestProfileSingleDevice(SingleDeviceTestCase):
recovery_phrase = " ".join(profile_view.get_recovery_phrase().values()) recovery_phrase = " ".join(profile_view.get_recovery_phrase().values())
profile_view.back_button.click() profile_view.back_button.click()
profile_view.back_button.click() profile_view.back_button.click()
public_key = profile_view.get_public_key() public_key = profile_view.get_public_key_and_username()
wallet_view = profile_view.wallet_button.click() wallet_view = profile_view.wallet_button.click()
wallet_view.set_up_wallet() wallet_view.set_up_wallet()
address = wallet_view.get_wallet_address() address = wallet_view.get_wallet_address()
@ -303,7 +303,7 @@ class TestProfileSingleDevice(SingleDeviceTestCase):
if wallet_view.get_wallet_address() != address: if wallet_view.get_wallet_address() != address:
self.driver.fail("Seed phrase displayed in new accounts for back up does not recover respective address") self.driver.fail("Seed phrase displayed in new accounts for back up does not recover respective address")
profile_view = wallet_view.profile_button.click() profile_view = wallet_view.profile_button.click()
if profile_view.get_public_key() != public_key: if profile_view.get_public_key_and_username() != public_key:
self.driver.fail("Seed phrase displayed in new accounts for back up does not recover respective public key") self.driver.fail("Seed phrase displayed in new accounts for back up does not recover respective public key")
@marks.testrail_id(5433) @marks.testrail_id(5433)
@ -510,8 +510,6 @@ class TestProfileSingleDevice(SingleDeviceTestCase):
@marks.testrail_id(5428) @marks.testrail_id(5428)
@marks.low @marks.low
@marks.skip
# TODO: skipped because of 10265
def test_version_format(self): def test_version_format(self):
sign_in_view = SignInView(self.driver) sign_in_view = SignInView(self.driver)
home_view = sign_in_view.create_user() home_view = sign_in_view.create_user()
@ -526,7 +524,7 @@ class TestProfileSingleDevice(SingleDeviceTestCase):
profile_view.app_version_text.click() profile_view.app_version_text.click()
profile_view.back_button.click() profile_view.back_button.click()
profile_view.home_button.click() profile_view.home_button.click()
chat = home_view.join_public_chat(home_view.get_public_chat_name()) chat = home_view.join_public_chat(home_view.get_random_chat_name())
message_input = chat.chat_message_input message_input = chat.chat_message_input
message_input.paste_text_from_clipboard() message_input.paste_text_from_clipboard()
if message_input.text != app_version: if message_input.text != app_version:
@ -614,7 +612,7 @@ class TestProfileMultipleDevice(MultipleDeviceTestCase):
self.create_drivers(2) self.create_drivers(2)
sign_in_1, sign_in_2 = SignInView(self.drivers[0]), SignInView(self.drivers[1]) sign_in_1, sign_in_2 = SignInView(self.drivers[0]), SignInView(self.drivers[1])
home_1, home_2 = sign_in_1.create_user(), sign_in_2.create_user() home_1, home_2 = sign_in_1.create_user(), sign_in_2.create_user()
public_key = home_2.get_public_key() public_key = home_2.get_public_key_and_username()
profile_1, profile_2 = home_1.profile_button.click(), home_2.profile_button.click() profile_1, profile_2 = home_1.profile_button.click(), home_2.profile_button.click()
username_1, username_2 = profile_1.default_username_text.text, profile_2.default_username_text.text username_1, username_2 = profile_1.default_username_text.text, profile_2.default_username_text.text
@ -655,7 +653,7 @@ class TestProfileMultipleDevice(MultipleDeviceTestCase):
self.create_drivers(2) self.create_drivers(2)
sign_in_1, sign_in_2 = SignInView(self.drivers[0]), SignInView(self.drivers[1]) sign_in_1, sign_in_2 = SignInView(self.drivers[0]), SignInView(self.drivers[1])
home_1, home_2 = sign_in_1.create_user(), sign_in_2.create_user() home_1, home_2 = sign_in_1.create_user(), sign_in_2.create_user()
public_key = home_2.get_public_key() public_key = home_2.get_public_key_and_username()
home_2.get_back_to_home_view() home_2.get_back_to_home_view()
profile_1 = home_1.profile_button.click() profile_1 = home_1.profile_button.click()
@ -755,7 +753,7 @@ class TestProfileMultipleDevice(MultipleDeviceTestCase):
# TODO: blocked by 10065 # TODO: blocked by 10065
# profile_1.home_button.click() # profile_1.home_button.click()
# home_2.just_fyi('send several messages to public channel') # home_2.just_fyi('send several messages to public channel')
# public_chat_name = home_2.get_public_chat_name() # public_chat_name = home_2.get_random_chat_name()
# message = 'test_message' # message = 'test_message'
# public_chat_2 = home_2.join_public_chat(public_chat_name) # public_chat_2 = home_2.join_public_chat(public_chat_name)
# public_chat_2.chat_message_input.send_keys(message) # public_chat_2.chat_message_input.send_keys(message)
@ -889,9 +887,9 @@ class TestProfileMultipleDevice(MultipleDeviceTestCase):
device_1_profile.get_back_to_home_view() device_1_profile.get_back_to_home_view()
device_1_name = 'device_%s' % device_1.driver.number device_1_name = 'device_%s' % device_1.driver.number
device_2_name = 'device_%s' % device_2.driver.number device_2_name = 'device_%s' % device_2.driver.number
public_chat_before_sync_name = 'b-public-%s' % device_1_home.get_public_chat_name() public_chat_before_sync_name = 'b-public-%s' % device_1_home.get_random_chat_name()
public_chat_after_sync_name = 'a-public-%s' % device_1_home.get_public_chat_name() public_chat_after_sync_name = 'a-public-%s' % device_1_home.get_random_chat_name()
group_chat_name = 'group-%s' % device_1_home.get_public_chat_name() group_chat_name = 'group-%s' % device_1_home.get_random_chat_name()
message_after_sync = 'sent after sync' message_after_sync = 'sent after sync'
device_1.just_fyi('join public chat, create group chat, edit user picture') device_1.just_fyi('join public chat, create group chat, edit user picture')
@ -981,7 +979,7 @@ class TestProfileMultipleDevice(MultipleDeviceTestCase):
profile_1.home_button.click() profile_1.home_button.click()
home_2.just_fyi('joining same public chat, set ENS name and check it in chat from device2') home_2.just_fyi('joining same public chat, set ENS name and check it in chat from device2')
chat_name = home_1.get_public_chat_name() chat_name = home_1.get_random_chat_name()
chat_2 = home_2.join_public_chat(chat_name) chat_2 = home_2.join_public_chat(chat_name)
chat_1 = home_1.join_public_chat(chat_name) chat_1 = home_1.join_public_chat(chat_name)
chat_1.get_back_to_home_view() chat_1.get_back_to_home_view()

View File

@ -73,7 +73,7 @@ class TestRecoverAccessFromSignInScreen(SingleDeviceTestCase):
}, },
] ]
# check that seed phrase is required (can't be empty) recover_access_view.just_fyi("check that seed phrase is required (can't be empty)")
recover_access_view.enter_seed_phrase_button.click() recover_access_view.enter_seed_phrase_button.click()
recover_access_view.next_button.click() recover_access_view.next_button.click()
if recover_access_view.reencrypt_your_key_button.is_element_displayed(): if recover_access_view.reencrypt_your_key_button.is_element_displayed():
@ -93,11 +93,11 @@ class TestRecoverAccessFromSignInScreen(SingleDeviceTestCase):
recover_access_view.send_as_keyevent(phrase) recover_access_view.send_as_keyevent(phrase)
# TODO: uncomment after 8567 fix # TODO: still disabled because tooltips are not visible
# if msg and not elm.is_element_displayed(): # if msg and not elm.is_element_displayed():
# self.errors.append('"{}" message is not shown'.format(msg)) # self.errors.append('"{}" message is not shown'.format(msg))
# check that words count is shown recover_access_view.just_fyi('check that words count is shown')
if words_count == 1: if words_count == 1:
if not signin_view.element_by_text('%s word' % words_count): if not signin_view.element_by_text('%s word' % words_count):
self.errors.append('"%s word" is not shown ' % words_count) self.errors.append('"%s word" is not shown ' % words_count)
@ -105,16 +105,15 @@ class TestRecoverAccessFromSignInScreen(SingleDeviceTestCase):
if not signin_view.element_by_text('%s words' % words_count): if not signin_view.element_by_text('%s words' % words_count):
self.errors.append('"%s words" is not shown ' % words_count) self.errors.append('"%s words" is not shown ' % words_count)
# check that "Next" is disabled unless we use allowed count of words recover_access_view.just_fyi('check that "Next" is disabled unless we use allowed count of words')
if words_count != 12 or 15 or 18 or 21 or 24: if words_count != 12 or 15 or 18 or 21 or 24:
recover_access_view.next_button.click() recover_access_view.next_button.click()
if recover_access_view.reencrypt_your_key_button.is_element_displayed(): if recover_access_view.reencrypt_your_key_button.is_element_displayed():
self.errors.append("Possible to create account with wrong count (%s) of words" % words_count) self.errors.append("Possible to create account with wrong count (%s) of words" % words_count)
# check behavior for popup "Custom seed phrase" recover_access_view.just_fyi('check behavior for popup "Custom seed phrase"')
if popup: if popup:
text = 'Invalid seed phrase' text = 'Invalid seed phrase'
common_password = 'qwerty'
if not recover_access_view.find_full_text(text): if not recover_access_view.find_full_text(text):
self.errors.append('"%s" text is not shown' % text) self.errors.append('"%s" text is not shown' % text)
recover_access_view.cancel_custom_seed_phrase_button.click() recover_access_view.cancel_custom_seed_phrase_button.click()
@ -144,7 +143,7 @@ class TestRecoverAccessFromSignInScreen(SingleDeviceTestCase):
signin_view.recover_access(capitalized_passphrase) signin_view.recover_access(capitalized_passphrase)
profile_view = signin_view.profile_button.click() profile_view = signin_view.profile_button.click()
username = profile_view.default_username_text.text username = profile_view.default_username_text.text
public_key = signin_view.get_public_key() public_key = signin_view.get_public_key_and_username()
if username != user['username'] or public_key != user['public_key']: if username != user['username'] or public_key != user['public_key']:
self.driver.fail('Incorrect user was recovered') self.driver.fail('Incorrect user was recovered')

View File

@ -1,6 +1,6 @@
import time import time
from tests import marks, camera_access_error_text, get_current_time from tests import marks, camera_access_error_text
from tests.users import basic_user, dummy_user from tests.users import basic_user, dummy_user
from tests.base_test_case import SingleDeviceTestCase, MultipleDeviceTestCase from tests.base_test_case import SingleDeviceTestCase, MultipleDeviceTestCase
from views.sign_in_view import SignInView from views.sign_in_view import SignInView
@ -110,7 +110,7 @@ class TestChatManagement(SingleDeviceTestCase):
chat.send_message_button.click() chat.send_message_button.click()
chat.get_back_to_home_view() chat.get_back_to_home_view()
chat.just_fyi('Deleting %s chat' % chat_name) chat.just_fyi('Deleting %s chat' % chat_name)
home.delete_chat_long_press(chat_name) home.leave_chat_long_press(chat_name) if chat_name == group else home.delete_chat_long_press(chat_name)
home.relogin() home.relogin()
for chat_name in one_to_one, public, group: for chat_name in one_to_one, public, group:
if home.get_chat(chat_name).is_element_displayed(): if home.get_chat(chat_name).is_element_displayed():
@ -123,7 +123,7 @@ class TestChatManagement(SingleDeviceTestCase):
home = sign_in.create_user() home = sign_in.create_user()
public_key = basic_user['public_key'] public_key = basic_user['public_key']
chat = home.join_public_chat(home.get_public_chat_name()) chat = home.join_public_chat(home.get_random_chat_name())
chat.chat_message_input.send_keys(public_key) chat.chat_message_input.send_keys(public_key)
chat.send_message_button.click() chat.send_message_button.click()
chat.chat_element_by_text(public_key).long_press_element() chat.chat_element_by_text(public_key).long_press_element()
@ -161,7 +161,7 @@ class TestChatManagement(SingleDeviceTestCase):
chat.chat_message_input.send_keys('test message') chat.chat_message_input.send_keys('test message')
chat.send_message_button.click() chat.send_message_button.click()
chat.just_fyi('Deleting %s chat' % chat_name) chat.just_fyi('Deleting %s chat' % chat_name)
chat.delete_chat() chat.leave_chat() if chat_name == group else chat.delete_chat()
chat.get_back_to_home_view() chat.get_back_to_home_view()
for chat_name in one_to_one, public, group: for chat_name in one_to_one, public, group:
if home.get_chat(chat_name).is_element_displayed(): if home.get_chat(chat_name).is_element_displayed():
@ -211,7 +211,7 @@ class TestChatManagement(SingleDeviceTestCase):
home = sign_in.create_user() home = sign_in.create_user()
search_list = list() search_list = list()
chat_name = home.get_public_chat_name() chat_name = home.get_random_chat_name()
search_list.append(chat_name) search_list.append(chat_name)
public_chat = home.join_public_chat(chat_name) public_chat = home.join_public_chat(chat_name)
public_chat.get_back_to_home_view() public_chat.get_back_to_home_view()
@ -281,7 +281,7 @@ class TestChatManagement(SingleDeviceTestCase):
chat_view.get_back_to_home_view(times_to_click_on_back_btn=1) chat_view.get_back_to_home_view(times_to_click_on_back_btn=1)
chat_view.just_fyi("Send and quote message in public chat") chat_view.just_fyi("Send and quote message in public chat")
public_chat_name = home.get_public_chat_name() public_chat_name = home.get_random_chat_name()
home.join_public_chat(public_chat_name) home.join_public_chat(public_chat_name)
chat_view.send_message(message_to_quote_public) chat_view.send_message(message_to_quote_public)
chat_view.quote_message(message_to_quote_public) chat_view.quote_message(message_to_quote_public)
@ -385,7 +385,7 @@ class TestChatManagementMultipleDevice(MultipleDeviceTestCase):
home_1, home_2 = device_1.create_user(), device_2.create_user() home_1, home_2 = device_1.create_user(), device_2.create_user()
device_1.just_fyi('both devices joining the same public chat and send messages') device_1.just_fyi('both devices joining the same public chat and send messages')
chat_name = device_1.get_public_chat_name() chat_name = device_1.get_random_chat_name()
for home in home_1, home_2: for home in home_1, home_2:
home.join_public_chat(chat_name) 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, chat_public_2 = home_1.get_chat_view(), home_2.get_chat_view()
@ -430,13 +430,13 @@ class TestChatManagementMultipleDevice(MultipleDeviceTestCase):
message_after_block_2 = "After 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(), device_2.create_user() home_1, home_2 = device_1.create_user(), device_2.create_user()
profile_1 = home_1.profile_button.click() profile_1 = home_1.profile_button.click()
device_2_public_key = home_2.get_public_key() device_2_public_key = home_2.get_public_key_and_username()
home_2.get_back_to_home_view() home_2.get_back_to_home_view()
default_username_1 = profile_1.default_username_text.text default_username_1 = profile_1.default_username_text.text
profile_1.get_back_to_home_view() profile_1.get_back_to_home_view()
device_1.just_fyi('both devices joining the same public chat and send messages') device_1.just_fyi('both devices joining the same public chat and send messages')
chat_name = device_1.get_public_chat_name() chat_name = device_1.get_random_chat_name()
for home in home_1, home_2: for home in home_1, home_2:
home.join_public_chat(chat_name) 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, chat_public_2 = home_1.get_chat_view(), home_2.get_chat_view()
@ -527,7 +527,7 @@ class TestChatManagementMultipleDevice(MultipleDeviceTestCase):
home_1, home_2 = device_1.create_user(), device_2.create_user() home_1, home_2 = device_1.create_user(), device_2.create_user()
device_1.just_fyi('Both devices join to 1-1 chat') device_1.just_fyi('Both devices join to 1-1 chat')
device_2_public_key = home_2.get_public_key() device_2_public_key = home_2.get_public_key_and_username()
device_1_profile = home_1.profile_button.click() device_1_profile = home_1.profile_button.click()
device_1_username = device_1_profile.default_username_text.text device_1_username = device_1_profile.default_username_text.text
home_1.home_button.click() home_1.home_button.click()
@ -553,7 +553,7 @@ class TestChatManagementMultipleDevice(MultipleDeviceTestCase):
device_2_chat.back_button.click() device_2_chat.back_button.click()
device_1.just_fyi('both devices joining the same public chat and send messages') device_1.just_fyi('both devices joining the same public chat and send messages')
chat_name = device_1.get_public_chat_name() chat_name = device_1.get_random_chat_name()
for home in home_1, home_2: for home in home_1, home_2:
home.join_public_chat(chat_name) 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, chat_public_2 = home_1.get_chat_view(), home_2.get_chat_view()

View File

@ -137,28 +137,35 @@ class TestCommandsMultipleDevices(MultipleDeviceTestCase):
@marks.testrail_id(6263) @marks.testrail_id(6263)
@marks.critical @marks.critical
def test_request_and_receive_stt_in_1_1_chat_offline(self): def test_request_and_receive_stt_in_1_1_chat_offline(self):
recipient = transaction_recipients['C']
sender = transaction_senders['C'] sender = transaction_senders['C']
self.create_drivers(2) self.create_drivers(2)
device_1, device_2 = SignInView(self.drivers[0]), SignInView(self.drivers[1]) device_1, device_2 = SignInView(self.drivers[0]), SignInView(self.drivers[1])
home_1 = device_1.recover_access(passphrase=recipient['passphrase'])
home_2 = device_2.recover_access(passphrase=sender['passphrase']) device_1.just_fyi('Grab user data for transactions and public chat, set up wallets')
wallet_1, wallet_2 = home_1.wallet_button.click(), home_2.wallet_button.click() home_1 = device_1.create_user()
recipient_public_key, recipient_username = home_1.get_public_key_and_username(return_username=True)
wallet_1 = home_1.wallet_button.click()
wallet_1.set_up_wallet() wallet_1.set_up_wallet()
recipient_address = wallet_1.get_wallet_address()
wallet_1.back_button.click()
wallet_1.select_asset('STT')
wallet_1.home_button.click() wallet_1.home_button.click()
home_2 = device_2.recover_access(passphrase=sender['passphrase'])
wallet_2 = home_2.wallet_button.click()
wallet_2.set_up_wallet() wallet_2.set_up_wallet()
chat_1 = home_1.add_contact(sender['public_key'])
chat_1.send_message("Hey there!")
amount = chat_1.get_unique_amount()
asset_name = 'STT'
wallet_2.home_button.click() wallet_2.home_button.click()
chat_element = home_2.get_chat(recipient['username'])
chat_element.wait_for_visibility_of_element(30) device_2.just_fyi('Add recipient to contact and send 1 message')
chat_2 = chat_element.click() chat_2 = home_2.add_contact(recipient_public_key)
chat_2.send_message("Hey there!")
amount = chat_2.get_unique_amount()
asset_name = 'STT'
profile_2 = wallet_2.profile_button.click() profile_2 = wallet_2.profile_button.click()
profile_2.logout() profile_2.logout()
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) 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() chat_1.commands_button.click()
@ -176,7 +183,7 @@ class TestCommandsMultipleDevices(MultipleDeviceTestCase):
home_2.just_fyi('Check that transaction message is fetched from offline and sign transaction') home_2.just_fyi('Check that transaction message is fetched from offline and sign transaction')
device_2.sign_in() device_2.sign_in()
home_2.connection_status.wait_for_invisibility_of_element(30) home_2.connection_status.wait_for_invisibility_of_element(30)
home_2.get_chat(recipient['username']).click() home_2.get_chat(recipient_username).click()
chat_2_sender_message = chat_2.chat_element_by_text('↑ Outgoing transaction') chat_2_sender_message = chat_2.chat_element_by_text('↑ Outgoing transaction')
if not chat_2_sender_message.is_element_displayed(): if not chat_2_sender_message.is_element_displayed():
self.driver.fail('No outgoing transaction in 1-1 chat is shown for sender after requesting STT') self.driver.fail('No outgoing transaction in 1-1 chat is shown for sender after requesting STT')
@ -191,12 +198,12 @@ class TestCommandsMultipleDevices(MultipleDeviceTestCase):
chat_2.toggle_airplane_mode() chat_2.toggle_airplane_mode()
self.network_api.wait_for_confirmation_of_transaction(sender['address'], amount, confirmations=15, token=True) self.network_api.wait_for_confirmation_of_transaction(sender['address'], amount, confirmations=15, token=True)
chat_2.toggle_airplane_mode() chat_2.toggle_airplane_mode()
home_1.connection_status.wait_for_invisibility_of_element(30) chat_2.connection_status.wait_for_invisibility_of_element(30)
if chat_2_sender_message.transaction_status.text != 'Confirmed': if chat_2_sender_message.transaction_status.text != 'Confirmed':
self.errors.append('Wrong state is shown for outgoing transaction: "Confirmed" is expected, in fact' self.errors.append('Wrong state is shown for outgoing transaction: "Confirmed" is expected, in fact'
' %s ' % chat_2_sender_message.transaction_status.text) ' %s ' % chat_2_sender_message.transaction_status.text)
try: try:
self.network_api.find_transaction_by_unique_amount(recipient['address'], amount, token=True) self.network_api.find_transaction_by_unique_amount(recipient_address[2:], amount, token=True)
except Failed as e: except Failed as e:
self.errors.append(e.msg) self.errors.append(e.msg)
self.errors.verify_no_errors() self.errors.verify_no_errors()
@ -252,7 +259,6 @@ class TestCommandsMultipleDevices(MultipleDeviceTestCase):
self.errors.verify_no_errors() self.errors.verify_no_errors()
@marks.chat @marks.chat
@marks.transaction @marks.transaction
class TestCommandsSingleDevices(SingleDeviceTestCase): class TestCommandsSingleDevices(SingleDeviceTestCase):

View File

@ -4,58 +4,6 @@ from tests.users import chat_users
from views.sign_in_view import SignInView from views.sign_in_view import SignInView
def return_left_chat_system_message(username):
return "%s left the group" % username
def return_created_chat_system_message(username, chat_name):
return "%s created the group %s" % (username, chat_name)
def return_joined_chat_system_message(username):
return "%s joined the group" % username
def return_made_admin_system_message(username):
return "%s has been made admin" % username
def create_users(driver_1, driver_2):
device_1_sign_in, device_2_sign_in = SignInView(driver_1), SignInView(driver_2)
return device_1_sign_in.create_user(), device_2_sign_in.create_user()
def get_username(device_home):
device_profile_view = device_home.profile_button.click()
username = device_profile_view.default_username_text.text
device_home.home_button.click()
return username
def create_new_group_chat(device_1_home, device_2_home, chat_name):
device_2_home.just_fyi('get public key and default username')
device_2_public_key = device_2_home.get_public_key()
device_2_default_username = get_username(device_2_home)
device_1_home.just_fyi('add device 2 as contact')
device_1_chat = device_1_home.add_contact(device_2_public_key)
device_1_chat.get_back_to_home_view()
device_1_home.just_fyi('create group chat with some user')
device_1_chat = device_1_home.create_group_chat([device_2_default_username], chat_name)
device_2_home.just_fyi('navigate to group chat')
device_2_chat = device_2_home.get_chat(chat_name).click()
return device_1_chat, device_2_chat
def create_and_join_group_chat(device_1_home, device_2_home, chat_name):
device_1_chat, device_2_chat = create_new_group_chat(device_1_home, device_2_home, chat_name)
device_2_chat.join_chat_button.click()
return device_1_chat, device_2_chat
@marks.chat @marks.chat
class TestGroupChatMultipleDevice(MultipleDeviceTestCase): class TestGroupChatMultipleDevice(MultipleDeviceTestCase):
@ -63,36 +11,53 @@ class TestGroupChatMultipleDevice(MultipleDeviceTestCase):
@marks.high @marks.high
def test_create_new_group_chat(self): def test_create_new_group_chat(self):
self.create_drivers(2) self.create_drivers(2)
device_1, device_2 = SignInView(self.drivers[0]), SignInView(self.drivers[1])
device_1_home, device_2_home = create_users(self.drivers[0], self.drivers[1]) device_1_home, device_2_home = device_1.create_user(), device_2.create_user()
chat_name = device_1_home.get_public_chat_name() device_1_key, device_1_username = device_1.get_public_key_and_username(True)
device_1.home_button.click()
chat_name = device_1_home.get_random_chat_name()
device_1_home.plus_button.click() device_1_home.plus_button.click()
device_1_home.just_fyi('Check default placeholder when trying to create group chat without contacts')
device_1_home.new_group_chat_button.click() device_1_home.new_group_chat_button.click()
if not device_1_home.element_by_text('Invite friends').is_element_displayed(): if not device_1_home.element_by_text('Invite friends').is_element_displayed():
self.errors.append("No placeholder is shown when there are no contacts") self.errors.append("No placeholder is shown when there are no contacts")
device_1_home.get_back_to_home_view() device_1_home.get_back_to_home_view()
device_1_chat, device_2_chat = create_and_join_group_chat(device_1_home, device_2_home, chat_name) device_2.just_fyi('Create group chat with new user, check system messages for sender')
device_2_key, device_2_username = device_2.get_public_key_and_username(True)
device_2.home_button.click()
device_1_home.add_contact(device_2_key)
device_1_home.get_back_to_home_view()
device_1_chat = device_1_home.create_group_chat([device_2_username], chat_name)
create_system_message = device_1_chat.create_system_message(device_1_username, chat_name)
invite_system_message = device_1_chat.invite_system_message(device_1_username, device_2_username)
join_system_message = device_1_chat.join_system_message(device_2_username)
create_for_admin_system_message = device_1_chat.create_for_admin_system_message(chat_name)
for message in [create_for_admin_system_message, create_system_message, invite_system_message]:
if not device_1_chat.chat_element_by_text(message):
self.errors.append('%s system message is not shown' % message)
device_2.just_fyi('Navigate to group chat, check system messages for member')
if not device_2_home.get_chat(chat_name).is_element_displayed():
self.drivers[0].fail('Group chat was not created!')
device_2_chat = device_2_home.get_chat(chat_name).click()
for element in device_2_chat.join_chat_button, device_2_chat.decline_invitation_button:
if not element.is_element_displayed():
self.drivers[0].fail('"Join Chat" or "Decline" is not shown for member of group chat')
for message in ['%s invited you to join the group %s' % (device_1_username, chat_name),
create_system_message, invite_system_message]:
if not device_2_chat.chat_element_by_text(message):
self.errors.append('%s system message is not shown' % message)
device_2.just_fyi('Join to group chat, check system messages and send messages to group chat')
device_2_chat.join_chat_button.click()
for chat in (device_1_chat, device_2_chat): for chat in (device_1_chat, device_2_chat):
if chat.user_name_text.text != chat_name: if not chat.chat_element_by_text(join_system_message).is_element_displayed():
self.errors.append('Oops! Chat screen does not match the entered chat name %s' % chat_name) self.errors.append('System message after joining group chat is not shown')
self.errors.verify_no_errors()
@marks.testrail_id(3993)
@marks.critical
def test_send_message_in_group_chat(self):
self.create_drivers(2)
device_1_home, device_2_home = create_users(self.drivers[0], self.drivers[1])
chat_name = device_1_home.get_public_chat_name()
device_1_chat, device_2_chat = create_and_join_group_chat(device_1_home, device_2_home, chat_name)
for chat in (device_1_chat, device_2_chat): for chat in (device_1_chat, device_2_chat):
chat.send_message("Message from device: %s" % chat.driver.number) chat.send_message("Message from device: %s" % chat.driver.number)
for chat in (device_1_chat, device_2_chat): for chat in (device_1_chat, device_2_chat):
for chat_driver in (device_1_chat, device_2_chat): for chat_driver in (device_1_chat, device_2_chat):
if not chat.chat_element_by_text( if not chat.chat_element_by_text(
@ -101,228 +66,248 @@ class TestGroupChatMultipleDevice(MultipleDeviceTestCase):
self.errors.verify_no_errors() self.errors.verify_no_errors()
@marks.testrail_id(5674)
@marks.high
def test_group_chat_system_messages(self):
self.create_drivers(2)
device_1_home, device_2_home = create_users(self.drivers[0], self.drivers[1])
chat_name = device_1_home.get_public_chat_name()
device_1_default_username = get_username(device_1_home)
device_2_default_username = get_username(device_2_home)
device_1_chat, device_2_chat = create_and_join_group_chat(device_1_home, device_2_home, chat_name)
# device 2: delete group chat
device_2_chat = device_2_home.get_chat(chat_name).click()
device_2_chat.delete_chat()
# device 1: check system messages in the group chat
system_messages = [
return_created_chat_system_message(device_1_default_username, chat_name),
return_joined_chat_system_message(device_2_default_username),
return_left_chat_system_message(device_2_default_username)
]
for message in system_messages:
if not device_1_chat.chat_element_by_text(message).is_element_displayed():
self.errors.append("Message with test '%s' was not received" % message)
self.errors.verify_no_errors()
@marks.testrail_id(3997) @marks.testrail_id(3997)
@marks.high @marks.medium
def test_delete_group_chat_via_delete_button(self): def test_leave_group_chat_via_group_info(self):
message_from_device_1 = 'Hello from device 1'
message_from_device_2 = 'Hi there! Sent from device 2'
self.create_drivers(2) self.create_drivers(2)
device_1, device_2 = SignInView(self.drivers[0]), SignInView(self.drivers[1])
device_1_home, device_2_home = device_1.create_user(), device_2.create_user()
chat_name = device_1_home.get_random_chat_name()
device_1_home, device_2_home = create_users(self.drivers[0], self.drivers[1]) device_2.just_fyi('Create and join group chat')
chat_name = device_1_home.get_public_chat_name() device_2_key, device_2_username = device_2.get_public_key_and_username(True)
device_1_chat, device_2_chat = create_and_join_group_chat(device_1_home, device_2_home, chat_name) device_2.home_button.click()
device_1_home.add_contact(device_2_key)
device_1_home.get_back_to_home_view()
device_1_chat = device_1_home.create_group_chat([device_2_username], chat_name)
left_system_message = device_1_chat.leave_system_message(device_2_username)
device_2_chat = device_2_home.get_chat(chat_name).click()
device_2_chat.join_chat_button.click()
# send some messages and delete chat device_2.just_fyi('Send several message and leave chat')
device_1_chat.send_message(message_from_device_1) for chat in device_1_chat, device_2_chat:
device_2_chat.send_message(message_from_device_2) chat.send_message('sent before leaving')
device_1_chat.delete_chat() device_2_chat.leave_chat_via_group_info()
device_2_chat.send_message(message_from_device_2) if not device_1_chat.chat_element_by_text(left_system_message).is_element_displayed():
self.errors.append('No system message after user left the group chat')
# device_1: check if chat is was deleted if device_2_home.element_by_text(chat_name).is_element_displayed():
if device_1_home.element_by_text(chat_name).is_element_displayed(): self.errors.append("Group chat '%s' is shown, but user has left" % chat_name)
self.errors.append("Group chat '%s' is shown, but the chat has been deleted" % chat_name)
device_2.just_fyi('Send message after user is left and check that it is not reappeared')
message = 'sent after leaving'
device_1_chat.send_message(message)
if device_2_home.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() self.errors.verify_no_errors()
@marks.testrail_id(3998) @marks.testrail_id(3998)
@marks.high @marks.high
def test_add_new_group_chat_member(self): def test_offline_add_new_group_chat_member(self):
message_for_device_2 = 'This message should be visible for device 2' message_before_adding = 'message before adding new user'
message_after_adding = 'message after adding new user'
chat_member = chat_users['A'] chat_member = chat_users['A']
self.create_drivers(2) self.create_drivers(2)
device_1, device_2 = SignInView(self.drivers[0]), SignInView(self.drivers[1])
device_1_home, device_2_home = device_1.create_user(), device_2.create_user()
device_1_key, device_1_username = device_1.get_public_key_and_username(True)
device_1_home.home_button.click()
chat_name = device_1_home.get_random_chat_name()
# create accounts on each device device_2.just_fyi('Create group chat with some user')
device_1_home, device_2_home = create_users(self.drivers[0], self.drivers[1]) device_2_key, device_2_username = device_2.get_public_key_and_username(True)
chat_name = device_1_home.get_public_chat_name() device_2.home_button.click()
for key in chat_member['public_key'], device_2_key:
# device 2: get public key and default username device_1_home.add_contact(key)
device_2_public_key = device_2_home.get_public_key()
device_2_default_username = get_username(device_2_home)
# device 1: add contacts
device_1_home.add_contact(chat_member['public_key'])
device_1_home.get_back_to_home_view() device_1_home.get_back_to_home_view()
device_1_chat = device_1_home.add_contact(device_2_public_key)
device_1_chat.get_back_to_home_view()
# device 1: create group chat with some user
device_1_chat = device_1_home.create_group_chat([chat_member['username']], chat_name) device_1_chat = device_1_home.create_group_chat([chat_member['username']], chat_name)
device_1_chat.send_message(message_before_adding)
# device 1: add device 2 as a new member of the group chat device_2.just_fyi('Put member device to offline and check that invite will be fetched')
device_1_chat.add_members_to_group_chat([device_2_default_username]) invite_system_message = device_1_chat.invite_system_message(device_1_username,chat_member['username'])
device_2_home.toggle_airplane_mode()
# device 2: open the chat device_1_chat.add_members_to_group_chat([device_2_username])
device_2_home.toggle_airplane_mode()
device_2_home.connection_status.wait_for_invisibility_of_element(60)
if not device_2_home.get_chat(chat_name).is_element_displayed():
self.driver[0].fail('Invite to group chat was not fetched from offline')
device_2_chat = device_2_home.get_chat(chat_name).click() device_2_chat = device_2_home.get_chat(chat_name).click()
if not device_2_chat.element_by_text(invite_system_message).is_element_displayed():
self.errors.append('Message about adding first chat member is not shown for new added member')
if device_2_chat.element_by_text(message_before_adding).is_element_displayed():
self.errors.append('Message sent before adding user is shown')
device_2.just_fyi('Put admin device to offline and check that message from new member will be fetched')
device_1_chat.toggle_airplane_mode()
device_2_chat.join_chat_button.click() device_2_chat.join_chat_button.click()
device_2_chat.send_message(message_after_adding)
device_1_chat.toggle_airplane_mode()
device_1_chat.connection_status.wait_for_invisibility_of_element(60)
for chat in (device_2_chat, device_1_chat):
if not chat.chat_element_by_text(message_after_adding).is_element_displayed(20):
self.errors.append('Message sent after adding new member is not shown!')
# device 1: send a message that should be visible for device 2
device_1_chat.send_message(message_for_device_2)
if not device_2_chat.chat_element_by_text(message_for_device_2).is_element_displayed(30):
self.errors.append('Message that was sent after device 2 has joined is not visible')
self.errors.verify_no_errors() self.errors.verify_no_errors()
@marks.testrail_id(5756) @marks.testrail_id(5756)
@marks.high @marks.medium
def test_decline_invitation_to_group_chat(self): def test_decline_invitation_to_group_chat(self):
self.create_drivers(2) self.create_drivers(2)
message_for_device_2 = 'This message should not be visible for device 2' device_1, device_2 = SignInView(self.drivers[0]), SignInView(self.drivers[1])
device_1_home, device_2_home = device_1.create_user(), device_2.create_user()
chat_name = device_1_home.get_random_chat_name()
device_1_home.plus_button.click()
device_1_home, device_2_home = create_users(self.drivers[0], self.drivers[1]) device_2.just_fyi('Create group chat with new user')
chat_name = device_1_home.get_public_chat_name() device_2_key, device_2_username = device_2.get_public_key_and_username(True)
device_1_chat, device_2_chat = create_new_group_chat(device_1_home, device_2_home, chat_name) device_2.home_button.click()
device_1_home.add_contact(device_2_key)
device_1_home.get_back_to_home_view()
device_1_chat = device_1_home.create_group_chat([device_2_username], chat_name)
device_2_chat = device_2_home.get_chat(chat_name).click()
device_2_chat.decline_invitation_button.click() device_2_chat.decline_invitation_button.click()
left_system_message = device_2_chat.leave_system_message(device_2_username)
# device 2: check that chat is deleted if not device_1_chat.chat_element_by_text(left_system_message).is_element_displayed():
self.errors.append('No system message after user left the group chat')
if device_2_home.element_by_text(chat_name).is_element_displayed(): if device_2_home.element_by_text(chat_name).is_element_displayed():
self.errors.append("Group chat '%s' is shown, but the chat has been deleted" % chat_name) self.errors.append("Group chat '%s' is shown, but user has left" % chat_name)
# device 1: check system message about leaving a group chat device_2.just_fyi('Send message after invite is declined and check that it is not reappeared')
device_2_default_username = get_username(device_2_home) message = 'sent after leaving'
user2_left_chat_system_message = return_left_chat_system_message(device_2_default_username) device_1_chat.send_message(message)
if not device_1_chat.chat_element_by_text(user2_left_chat_system_message).is_element_displayed():
self.errors.append("Message with text '%s' was not received" % user2_left_chat_system_message)
# device 1: send some message to group chat
device_1_chat.send_message(message_for_device_2)
# device 2: check that chat doesn't reappear
if device_2_home.element_by_text(chat_name).is_element_displayed(): if device_2_home.element_by_text(chat_name).is_element_displayed():
self.errors.append("Group chat '%s' is shown, but the chat has been deleted" % chat_name) self.errors.append("Group chat '%s' reappeared when new message is sent" % chat_name)
self.errors.verify_no_errors() self.errors.verify_no_errors()
@marks.testrail_id(4001) @marks.testrail_id(4001)
@marks.high @marks.medium
@marks.skip
# TODO:should be retested after fix 10054
def test_remove_member_from_group_chat(self): def test_remove_member_from_group_chat(self):
self.create_drivers(2) self.create_drivers(3)
message_for_device_2 = 'This message should not be visible for device 2' devices_home, devices_key, devices_username, devices_chat = {}, {}, {}, {}
for key in self.drivers:
sign_in_view = SignInView(self.drivers[key])
devices_home[key] = sign_in_view.create_user()
devices_key[key], devices_username[key] = sign_in_view.get_public_key_and_username(True)
sign_in_view.home_button.click()
device_1_home, device_2_home = create_users(self.drivers[0], self.drivers[1]) chat_name = devices_home[0].get_random_chat_name()
chat_name = device_1_home.get_public_chat_name() for i in range(1,3):
device_1_chat, device_2_chat = create_and_join_group_chat(device_1_home, device_2_home, chat_name) devices_home[0].add_contact(devices_key[i])
device_2_default_username = get_username(device_2_home) devices_home[0].get_back_to_home_view()
user2_left_chat_system_message = return_left_chat_system_message(device_2_default_username) devices_chat[0] = devices_home[0].create_group_chat([devices_username[1],
devices_username[2]], chat_name)
# device 1: get options for device 2 in group chat and remove him devices_chat[0].just_fyi('Member_1, member_2: both users join to group chat')
options = device_1_chat.get_user_options(device_2_default_username) for i in range(1,3):
devices_chat[i] = devices_home[i].get_chat(chat_name).click()
devices_chat[i].join_chat_button.click()
devices_chat[0].just_fyi("Admin: get options for device 2 in group chat and remove him")
options = devices_chat[0].get_user_options(devices_username[1])
options.remove_user_button.click() options.remove_user_button.click()
left_message = devices_chat[0].leave_system_message(devices_username[1])
for key in devices_chat:
if not devices_chat[key].chat_element_by_text(left_message).is_element_displayed():
self.errors.append("Message with text '%s' was not received" % left_message)
# device 1, 2: check system messages after removing devices_chat[0].just_fyi("Check that input field is not available after removing")
for chat in device_1_chat, device_2_chat: if devices_chat[1].chat_message_input.is_element_displayed():
if not chat.chat_element_by_text(user2_left_chat_system_message).is_element_displayed():
self.errors.append(
"Message with text '%s' was not received" % user2_left_chat_system_message)
# device 2: check there is no message input so user can't send new message in group chat
if device_2_chat.chat_message_input.is_element_displayed():
self.errors.append("Message input is still available for removed user") self.errors.append("Message input is still available for removed user")
# device 1: send some message to group chat devices_chat[0].just_fyi("Send message and check that it is available only for remaining users")
device_1_chat.send_message(message_for_device_2) message = 'after removing member'
devices_chat[0].send_message(message)
# device 2: check that message is not received for chat in (devices_chat[0], devices_chat[2]):
if device_2_chat.chat_element_by_text(message_for_device_2).is_element_displayed(): if not chat.chat_element_by_text(message).is_element_displayed():
self.errors.append("Message with text '%s' was received" % message_for_device_2) self.errors.append("Message '%s' was not received after removing member" % message)
if devices_chat[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() self.errors.verify_no_errors()
@marks.testrail_id(5694) @marks.testrail_id(5694)
@marks.high @marks.medium
def test_make_admin_member_of_group_chat(self): def test_make_admin_member_of_group_chat(self):
self.create_drivers(2) self.create_drivers(2)
chat_member = chat_users['A'] device_1, device_2 = SignInView(self.drivers[0]), SignInView(self.drivers[1])
device_1_home, device_2_home = device_1.create_user(), device_2.create_user()
device_1_key, device_1_username = device_1.get_public_key_and_username(True)
device_1.home_button.click()
chat_name = device_1_home.get_random_chat_name()
device_1_home, device_2_home = create_users(self.drivers[0], self.drivers[1]) device_2.just_fyi('Create and join to group chat')
chat_name = device_1_home.get_public_chat_name() device_2_key, device_2_username = device_2.get_public_key_and_username(True)
device_2_default_username = get_username(device_2_home) device_2.home_button.click()
device_1_home.add_contact(device_2_key)
device_1_home.get_back_to_home_view()
device_1_chat = device_1_home.create_group_chat([device_2_username], chat_name)
device_2_chat = device_2_home.get_chat(chat_name).click()
device_2_chat.join_chat_button.click()
# device 2: add contacts device_1.just_fyi('Check group info view and options of users')
device_2_home.add_contact(chat_member['public_key']) device_1_chat.chat_options.click()
device_2_home.get_back_to_home_view() group_info_view = device_1_chat.group_info.click()
if not group_info_view.user_admin(device_1_username).is_element_displayed():
self.errors.append("Admin user is not marked as admin")
group_info_view.get_user_from_group_info(device_1_username).click()
if device_1_chat.profile_block_contact.is_element_displayed():
self.errors.append("Admin is redirected to own profile on tapping own username from group info")
group_info_view.get_user_from_group_info(device_2_username).click()
if not device_1_chat.profile_block_contact.is_element_displayed():
self.errors.append("Admin is not redirected to user profile on tapping member username from group info")
device_1_chat.back_button.click()
# create and join group chat device_1.just_fyi('Made admin another user and check system message')
device_1_chat, device_2_chat = create_and_join_group_chat(device_1_home, device_2_home, chat_name) options = group_info_view.get_username_options(device_2_username).click()
# device 1: get options for device 2 in group chat and make him admin
options = device_1_chat.get_user_options(device_2_default_username)
options.make_admin_button.click() options.make_admin_button.click()
admin_system_message = device_1_chat.has_been_made_admin_system_message(device_1_username, device_2_username)
# device 2: check presence of system message
# TODO: should be reworked after https://github.com/status-im/status-react/pull/8487: replaced with default username
# user2_made_admin_system_message_for_user_2 = return_made_admin_system_message(device_2_custom_username)
# if not device_2_chat.chat_element_by_text(user2_made_admin_system_message_for_user_2).is_element_displayed():
# self.errors.append("Message with test '%s' was not received" % user2_made_admin_system_message_for_user_2)
# device 2: check that as admin can add new members to group chat
device_2_chat.add_members_to_group_chat([chat_member['username']])
self.errors.verify_no_errors()
@marks.testrail_id(5681)
@marks.high
def test_clear_history_of_group_chat_via_group_view(self):
self.create_drivers(2)
device_1_home, device_2_home = create_users(self.drivers[0], self.drivers[1])
chat_name = device_1_home.get_public_chat_name()
# create and join group chat
device_1_chat, device_2_chat = create_and_join_group_chat(device_1_home, device_2_home, chat_name)
messages = []
# device 1, device 2: send messages and clear history on device 1
for chat in (device_1_chat, device_2_chat): for chat in (device_1_chat, device_2_chat):
message = "Message from device: %s" % chat.driver.number if not chat.chat_element_by_text(admin_system_message).is_element_displayed():
chat.send_message(message) self.errors.append("Message with test '%s' was not received" % admin_system_message)
messages.append(message)
device_1_chat.clear_history_via_group_info() device_2.just_fyi('Check Admin in group info and that "add members" is available')
device_2_chat.chat_options.click()
# device 1: check that history is deleted group_info_view = device_2_chat.group_info.click()
for message in messages: for username in (device_1_username, device_2_username):
if device_1_chat.element_starts_with_text(message).is_element_present(): if not group_info_view.user_admin(username).is_element_displayed():
device_1_chat.driver.fail( self.errors.append("Admin user is not marked as admin")
"Message '%s' is shown after re-login, but group chat history has been cleared" % message) if not group_info_view.add_members.is_element_displayed():
self.errors.append("Add member button is not available for new admin")
device_1_home.relogin()
device_1_home.element_by_text(chat_name).click() self.errors.verify_no_errors()
for message in messages: @marks.testrail_id(6280)
if device_1_chat.element_starts_with_text(message).is_element_present(): @marks.medium
device_1_chat.driver.fail( def test_rename_group_chat(self):
"Message '%s' is shown after re-login, but group chat history has been cleared" % message) self.create_drivers(2)
device_1, device_2 = SignInView(self.drivers[0]), SignInView(self.drivers[1])
device_1_home, device_2_home = device_1.create_user(), device_2.create_user()
device_1_key, device_1_username = device_1.get_public_key_and_username(True)
device_1.home_button.click()
initial_chat_name = device_1_home.get_random_chat_name()
device_2.just_fyi('Create and join group chat')
device_2_key, device_2_username = device_2.get_public_key_and_username(True)
device_2.home_button.click()
device_1_home.add_contact(device_2_key)
device_1_home.get_back_to_home_view()
device_1_chat = device_1_home.create_group_chat([device_2_username], initial_chat_name)
device_2_chat = device_2_home.get_chat(initial_chat_name).click()
device_2_chat.join_chat_button.click()
device_2.just_fyi('Rename chat and check system messages')
new_chat_name = device_1_chat.get_random_chat_name()
device_1_chat.rename_chat_via_group_info(new_chat_name)
for chat in (device_1_chat, device_2_chat):
if not chat.element_by_text(chat.create_system_message(device_1_username, initial_chat_name)).is_element_displayed():
self.errors.append('Initial system message about creating chta was changed!')
if not chat.element_by_text(chat.changed_group_name_system_message(device_1_username, new_chat_name)).is_element_displayed():
self.errors.append('Message about changing chat name is not shown')
device_2.just_fyi('Check that you can navigate to renamed chat')
device_2_chat.back_button.click()
device_2_home.get_chat(new_chat_name).click()
self.errors.verify_no_errors() self.errors.verify_no_errors()

View File

@ -23,7 +23,7 @@ class TestMessagesOneToOneChatMultiple(MultipleDeviceTestCase):
profile_1 = device_1_home.profile_button.click() profile_1 = device_1_home.profile_button.click()
default_username_1 = profile_1.default_username_text.text default_username_1 = profile_1.default_username_text.text
device_1_home = profile_1.get_back_to_home_view() device_1_home = profile_1.get_back_to_home_view()
device_2_public_key = device_2_home.get_public_key() device_2_public_key = device_2_home.get_public_key_and_username()
device_2_home.home_button.click() device_2_home.home_button.click()
device_1_chat = device_1_home.add_contact(device_2_public_key) device_1_chat = device_1_home.add_contact(device_2_public_key)
@ -41,7 +41,7 @@ class TestMessagesOneToOneChatMultiple(MultipleDeviceTestCase):
self.create_drivers(2) self.create_drivers(2)
sign_in_1, sign_in_2 = SignInView(self.drivers[0]), SignInView(self.drivers[1]) sign_in_1, sign_in_2 = SignInView(self.drivers[0]), SignInView(self.drivers[1])
home_1, home_2 = sign_in_1.create_user(), sign_in_2.create_user() home_1, home_2 = sign_in_1.create_user(), sign_in_2.create_user()
public_key_1 = home_1.get_public_key() public_key_1 = home_1.get_public_key_and_username()
home_1.home_button.click() home_1.home_button.click()
home_1.toggle_airplane_mode() # airplane mode on primary device home_1.toggle_airplane_mode() # airplane mode on primary device
@ -86,7 +86,7 @@ class TestMessagesOneToOneChatMultiple(MultipleDeviceTestCase):
profile_1 = home_1.profile_button.click() profile_1 = home_1.profile_button.click()
default_username_1 = profile_1.default_username_text.text default_username_1 = profile_1.default_username_text.text
home_1 = profile_1.get_back_to_home_view() home_1 = profile_1.get_back_to_home_view()
public_key_2 = home_2.get_public_key() public_key_2 = home_2.get_public_key_and_username()
profile_2 = home_2.get_profile_view() profile_2 = home_2.get_profile_view()
profile_2.switch_network('Mainnet with upstream RPC') profile_2.switch_network('Mainnet with upstream RPC')
@ -98,7 +98,7 @@ class TestMessagesOneToOneChatMultiple(MultipleDeviceTestCase):
chat_2 = home_2.get_chat(default_username_1).click() chat_2 = home_2.get_chat(default_username_1).click()
chat_2.chat_element_by_text(message).wait_for_visibility_of_element() chat_2.chat_element_by_text(message).wait_for_visibility_of_element()
public_chat_name = home_1.get_public_chat_name() public_chat_name = home_1.get_random_chat_name()
chat_1.get_back_to_home_view() chat_1.get_back_to_home_view()
home_1.join_public_chat(public_chat_name) home_1.join_public_chat(public_chat_name)
chat_2.get_back_to_home_view() chat_2.get_back_to_home_view()
@ -125,7 +125,7 @@ class TestMessagesOneToOneChatMultiple(MultipleDeviceTestCase):
# profile_1.edit_profile_picture('sauce_logo.png') # profile_1.edit_profile_picture('sauce_logo.png')
# profile_1.home_button.click() # profile_1.home_button.click()
device_2_public_key = device_2_home.get_public_key() device_2_public_key = device_2_home.get_public_key_and_username()
device_2_home.home_button.click() device_2_home.home_button.click()
device_1_chat = device_1_home.add_contact(device_2_public_key) device_1_chat = device_1_home.add_contact(device_2_public_key)
@ -162,7 +162,7 @@ class TestMessagesOneToOneChatMultiple(MultipleDeviceTestCase):
default_username_1 = profile_1.default_username_text.text default_username_1 = profile_1.default_username_text.text
device_1_home = profile_1.get_back_to_home_view() device_1_home = profile_1.get_back_to_home_view()
device_2_public_key = device_2_home.get_public_key() device_2_public_key = device_2_home.get_public_key_and_username()
profile_2 = device_2_home.get_profile_view() profile_2 = device_2_home.get_profile_view()
# TODO: skip until edit image profile is enabled # TODO: skip until edit image profile is enabled
# file_name = 'sauce_logo.png' # file_name = 'sauce_logo.png'
@ -208,7 +208,7 @@ class TestMessagesOneToOneChatMultiple(MultipleDeviceTestCase):
profile_1 = home_1.profile_button.click() profile_1 = home_1.profile_button.click()
default_username_1 = profile_1.default_username_text.text default_username_1 = profile_1.default_username_text.text
home_1 = profile_1.get_back_to_home_view() home_1 = profile_1.get_back_to_home_view()
public_key_2 = home_2.get_public_key() public_key_2 = home_2.get_public_key_and_username()
home_2.home_button.click() home_2.home_button.click()
chat_1 = home_1.add_contact(public_key_2) chat_1 = home_1.add_contact(public_key_2)
@ -263,7 +263,7 @@ class TestMessagesOneToOneChatMultiple(MultipleDeviceTestCase):
profile_2 = device_2_home.profile_button.click() profile_2 = device_2_home.profile_button.click()
default_username_2 = profile_2.default_username_text.text default_username_2 = profile_2.default_username_text.text
device_2_home = profile_2.get_back_to_home_view() device_2_home = profile_2.get_back_to_home_view()
device_1_public_key = device_1_home.get_public_key() device_1_public_key = device_1_home.get_public_key_and_username()
device_1_home.home_button.click() device_1_home.home_button.click()
device_2_chat = device_2_home.add_contact(device_1_public_key) device_2_chat = device_2_home.add_contact(device_1_public_key)
@ -299,7 +299,7 @@ class TestMessagesOneToOneChatMultiple(MultipleDeviceTestCase):
profile_2 = device_2_home.profile_button.click() profile_2 = device_2_home.profile_button.click()
default_username_2 = profile_2.default_username_text.text default_username_2 = profile_2.default_username_text.text
device_2_home = profile_2.get_back_to_home_view() device_2_home = profile_2.get_back_to_home_view()
device_1_public_key = device_1_home.get_public_key() device_1_public_key = device_1_home.get_public_key_and_username()
device_1_home.home_button.click() device_1_home.home_button.click()
device_2_chat = device_2_home.add_contact(device_1_public_key) device_2_chat = device_2_home.add_contact(device_1_public_key)
@ -330,7 +330,7 @@ class TestMessagesOneToOneChatMultiple(MultipleDeviceTestCase):
device_1_chat.get_back_to_home_view() device_1_chat.get_back_to_home_view()
device_2_chat.get_back_to_home_view() device_2_chat.get_back_to_home_view()
chat_name = device_1_home.get_public_chat_name() chat_name = device_1_home.get_random_chat_name()
device_1_home.join_public_chat(chat_name) device_1_home.join_public_chat(chat_name)
device_2_home.join_public_chat(chat_name) device_2_home.join_public_chat(chat_name)
@ -353,7 +353,7 @@ class TestMessagesOneToOneChatMultiple(MultipleDeviceTestCase):
self.create_drivers(2) self.create_drivers(2)
sign_in_1, sign_in_2 = SignInView(self.drivers[0]), SignInView(self.drivers[1]) sign_in_1, sign_in_2 = SignInView(self.drivers[0]), SignInView(self.drivers[1])
device_1_home, device_2_home = sign_in_1.create_user(), sign_in_2.create_user() device_1_home, device_2_home = sign_in_1.create_user(), sign_in_2.create_user()
device_2_public_key = device_2_home.get_public_key() device_2_public_key = device_2_home.get_public_key_and_username()
device_2_home.home_button.click() device_2_home.home_button.click()
device_1_profile = device_1_home.profile_button.click() device_1_profile = device_1_home.profile_button.click()
default_username_1 = device_1_profile.default_username_text.text default_username_1 = device_1_profile.default_username_text.text
@ -382,7 +382,7 @@ class TestMessagesOneToOneChatMultiple(MultipleDeviceTestCase):
# chat.verify_message_is_under_today_text(message, self.errors) # chat.verify_message_is_under_today_text(message, self.errors)
device_1_chat.just_fyi('check user picture and timestamps in chat for sender and recipient in public chat') device_1_chat.just_fyi('check user picture and timestamps in chat for sender and recipient in public chat')
chat_name = device_1_home.get_public_chat_name() chat_name = device_1_home.get_random_chat_name()
for chat in device_1_chat, device_2_chat: for chat in device_1_chat, device_2_chat:
home_view = chat.get_back_to_home_view() home_view = chat.get_back_to_home_view()
home_view.join_public_chat(chat_name) home_view.join_public_chat(chat_name)
@ -405,74 +405,6 @@ class TestMessagesOneToOneChatMultiple(MultipleDeviceTestCase):
self.errors.verify_no_errors() self.errors.verify_no_errors()
@marks.testrail_id(5405)
@marks.high
@marks.skip
# TODO: temporary skipped due to 8601
def test_fiat_value_is_correctly_calculated_on_recipient_side(self):
sender = transaction_senders['Y']
recipient = transaction_recipients['I']
self.create_drivers(2)
signin_view1, signin_view2 = SignInView(self.drivers[0]), SignInView(self.drivers[1])
home_view1, home_view2 = signin_view1.recover_access(sender['passphrase']), signin_view2.recover_access(
recipient['passphrase'])
devices = [
{'home_view': home_view1, 'currency': 'AUD'},
{'home_view': home_view2, 'currency': 'EUR'},
]
# changing currency for both devices
for device in devices:
wallet_view = device['home_view'].wallet_button.click()
wallet_view.set_up_wallet()
wallet_view.set_currency(device['currency'])
wallet_view.get_back_to_home_view()
device1 = devices[0]
device2 = devices[1]
# setting up device1 wallet
# wallet1 = device1['home_view'].wallet_button.click()
# wallet1.get_back_to_home_view()
# sending ETH to device2 in 1*1 chat
device1_chat = device1['home_view'].add_contact(recipient['public_key'])
send_amount = device1_chat.get_unique_amount()
device1_chat.send_transaction_in_1_1_chat('ETHro', send_amount)
sent_message = device1_chat.chat_element_by_text(send_amount)
if not sent_message.is_element_displayed() and not sent_message.contains_text(device1['currency']):
self.errors.append('Wrong currency fiat value while sending ETH in 1*1 chat.')
device2_chat = device2['home_view'].get_chat_with_user(sender['username']).click()
received_message = device2_chat.chat_element_by_text(send_amount)
if not received_message.is_element_displayed() and not received_message.contains_text(device2['currency']):
self.errors.append('Wrong currency fiat value while receiving ETH in 1*1 chat.')
# Currently disabled because sending / requesting funds from wallet is not shown in chat
# device1_chat.get_back_to_home_view()
# wallet1 = device1['home_view'].wallet_button.click()
# send_amount = device1_chat.get_unique_amount()
# Send and request some ETH from wallet and check whether the fiat currency value of
# the new messages is equal to user-selected
# wallet1.send_transaction(asset_name='ETHro', recipient=recipient['username'], amount=send_amount)
# wallet1.get_back_to_home_view()
# device1_chat = device1['home_view'].get_chat(recipient['username']).click()
#
# sent_message = device1_chat.chat_element_by_text(send_amount)
# received_message = device2_chat.chat_element_by_text(send_amount)
#
# if not sent_message.is_element_displayed() and not sent_message.contains_text(device1['currency']):
# self.errors.append('Wrong currency fiat value while sending ETH from wallet.')
#
# if not received_message.is_element_displayed() and not sent_message.contains_text(device2['currency']):
# self.errors.append('Wrong currency fiat value while receiving ETH sent via wallet.')
self.errors.verify_no_errors()
@marks.all @marks.all
@marks.chat @marks.chat
@ -541,7 +473,7 @@ class TestMessagesOneToOneChatSingle(SingleDeviceTestCase):
sign_in = SignInView(self.driver) sign_in = SignInView(self.driver)
home = sign_in.create_user() home = sign_in.create_user()
home.join_public_chat(home.get_public_chat_name()) home.join_public_chat(home.get_random_chat_name())
chat = sign_in.get_chat_view() chat = sign_in.get_chat_view()
emoji_name = random.choice(list(emoji.EMOJI_UNICODE)) emoji_name = random.choice(list(emoji.EMOJI_UNICODE))
emoji_unicode = emoji.EMOJI_UNICODE[emoji_name] emoji_unicode = emoji.EMOJI_UNICODE[emoji_name]
@ -560,96 +492,6 @@ class TestMessagesOneToOneChatSingle(SingleDeviceTestCase):
self.errors.append('Message with emoji was not sent in 1-1 chat') self.errors.append('Message with emoji was not sent in 1-1 chat')
self.errors.verify_no_errors() self.errors.verify_no_errors()
@marks.testrail_id(5393)
@marks.high
@marks.skip
# TODO: temporary skipped due to 8601
def test_that_fiat_value_is_correct_for_token_transactions(self):
sender_passphrase = transaction_senders['X']['passphrase']
recipient_public_key = transaction_recipients['H']['public_key']
recipient_user_name = transaction_recipients['H']['username']
default_currency = 'USD'
user_currency = 'EUR'
sigin_view = SignInView(self.driver)
home_view = sigin_view.recover_access(sender_passphrase)
wallet = home_view.wallet_button.click()
wallet.set_up_wallet()
wallet.get_back_to_home_view()
chat = home_view.add_contact(recipient_public_key)
send_amount, request_amount = [chat.get_unique_amount() for _ in range(2)]
# Send and request some tokens in 1x1 chat and check whether the fiat currency value of the messages is equal
# to default
chat.send_transaction_in_1_1_chat('STT', send_amount)
chat.request_transaction_in_1_1_chat('STT', request_amount)
send_message = chat.chat_element_by_text(send_amount)
if not send_message.is_element_displayed() and not send_message.contains_text(default_currency):
self.errors.append('Wrong fiat value while sending assets in 1-1 chat with default currency.')
request_message = chat.chat_element_by_text(request_amount)
if not request_message.is_element_displayed() and not request_message.contains_text(default_currency):
self.errors.append('Wrong fiat value while requesting assets in 1-1 chat with default currency.')
chat.get_back_to_home_view()
# Switch default currency to user-selected
wallet_view = sigin_view.wallet_button.click()
wallet_view.set_currency(user_currency)
wallet_view.get_back_to_home_view()
chat = home_view.get_chat(recipient_user_name).click()
# Check whether the fiat currency value of the messages sent is not changed to user-selected
send_message = chat.chat_element_by_text(send_amount)
if not send_message.is_element_displayed() and not send_message.contains_text(default_currency):
self.errors.append('Wrong fiat value while sending assets in 1-1 chat with default currency.')
request_message = chat.chat_element_by_text(request_amount)
if not request_message.is_element_displayed() and not request_message.contains_text(default_currency):
self.errors.append('Wrong fiat value while requesting assets in 1-1 chat with default currency.')
# Send and request some tokens in 1x1 chat and check whether the fiat currency value of
# the new messages is equal to user-selected
send_amount, request_amount = [chat.get_unique_amount() for _ in range(2)]
chat.send_transaction_in_1_1_chat('STT', send_amount)
chat.request_transaction_in_1_1_chat('STT', request_amount)
send_message = chat.chat_element_by_text(send_amount)
if not send_message.is_element_displayed() and not send_message.contains_text(user_currency):
self.errors.append('Wrong fiat value while sending assets in 1-1 chat with user selected currency.')
request_message = chat.chat_element_by_text(request_amount)
if not request_message.is_element_displayed() and not request_message.contains_text(user_currency):
self.errors.append('Wrong fiat value while requesting assets in 1-1 chat with user selected currency.')
# disabled since after merge https://github.com/status-im/status-react/pull/8425 no messages are shown
# in 1-1 chat after sending from wallet
# chat.get_back_to_home_view()
#
# wallet = home_view.wallet_button.click()
# send_amount, request_amount = [chat.get_unique_amount() for _ in range(2)]
# Send and request some tokens from wallet and check whether the fiat currency value of
# the new messages is equal to user-selected
#
# wallet.send_transaction(asset_name='STT', recipient=recipient_user_name, amount=send_amount)
# wallet.receive_transaction(asset_name='STT', recipient=recipient_user_name, amount=request_amount)
#
# wallet.get_back_to_home_view()
# chat = home_view.get_chat(recipient_user_name).click()
#
# send_message = chat.chat_element_by_text(send_amount)
# if not send_message.is_element_displayed() and not send_message.contains_text(user_currency):
# self.errors.append('Wrong fiat value while sending assets from wallet with user selected currency.')
#
# request_message = chat.chat_element_by_text(request_amount)
# if not request_message.is_element_displayed() and not request_message.contains_text(user_currency):
# self.errors.append('Wrong fiat value while requesting assets from wallet with user selected currency.')
self.errors.verify_no_errors()
@marks.testrail_id(5782) @marks.testrail_id(5782)
@marks.critical @marks.critical
@ -658,7 +500,7 @@ class TestMessagesOneToOneChatSingle(SingleDeviceTestCase):
home = sign_in.create_user() home = sign_in.create_user()
sign_in.just_fyi('join public chat and check that stickers are not available on Ropsten') sign_in.just_fyi('join public chat and check that stickers are not available on Ropsten')
chat_name = home.get_public_chat_name() chat_name = home.get_random_chat_name()
home.join_public_chat(chat_name) home.join_public_chat(chat_name)
chat = sign_in.get_chat_view() chat = sign_in.get_chat_view()
if chat.show_stickers_button.is_element_displayed(): if chat.show_stickers_button.is_element_displayed():
@ -696,7 +538,7 @@ class TestMessagesOneToOneChatSingle(SingleDeviceTestCase):
profile_view.switch_network('Mainnet with upstream RPC') profile_view.switch_network('Mainnet with upstream RPC')
sign_in_view.just_fyi('join to public chat, buy and install stickers') sign_in_view.just_fyi('join to public chat, buy and install stickers')
chat = home_view.join_public_chat(home_view.get_public_chat_name()) chat = home_view.join_public_chat(home_view.get_random_chat_name())
chat.show_stickers_button.click() chat.show_stickers_button.click()
chat.get_stickers.click() chat.get_stickers.click()
chat.install_sticker_pack_by_name('Tozemoon') chat.install_sticker_pack_by_name('Tozemoon')
@ -737,7 +579,7 @@ class TestMessagesOneToOneChatSingle(SingleDeviceTestCase):
if home_view.connection_status.text != 'Offline': if home_view.connection_status.text != 'Offline':
self.errors.append('Offline status is not shown in home screen') self.errors.append('Offline status is not shown in home screen')
public_chat = home_view.join_public_chat(home_view.get_public_chat_name()) public_chat = home_view.join_public_chat(home_view.get_random_chat_name())
if public_chat.connection_status.text != 'Offline': if public_chat.connection_status.text != 'Offline':
self.errors.append('Offline status is not shown in a public chat') self.errors.append('Offline status is not shown in a public chat')
self.errors.verify_no_errors() self.errors.verify_no_errors()

View File

@ -23,7 +23,7 @@ class TestPublicChatMultipleDevice(MultipleDeviceTestCase):
profile_1 = home_1.profile_button.click() profile_1 = home_1.profile_button.click()
default_username_1 = profile_1.default_username_text.text default_username_1 = profile_1.default_username_text.text
profile_1.home_button.click() profile_1.home_button.click()
public_key_2 = home_2.get_public_key() public_key_2 = home_2.get_public_key_and_username()
home_2.home_button.click() home_2.home_button.click()
home_1.add_contact(public_key_2) home_1.add_contact(public_key_2)
@ -42,7 +42,7 @@ class TestPublicChatMultipleDevice(MultipleDeviceTestCase):
status_chat.get_back_to_home_view() status_chat.get_back_to_home_view()
public_chat_name = home_1.get_public_chat_name() public_chat_name = home_1.get_random_chat_name()
chat_1, chat_2 = home_1.join_public_chat(public_chat_name), home_2.join_public_chat(public_chat_name) chat_1, chat_2 = home_1.join_public_chat(public_chat_name), home_2.join_public_chat(public_chat_name)
message = 'hello' message = 'hello'
@ -59,7 +59,7 @@ class TestPublicChatMultipleDevice(MultipleDeviceTestCase):
def test_public_chat_clear_history(self): def test_public_chat_clear_history(self):
self.create_drivers(2) self.create_drivers(2)
device_1, device_2 = SignInView(self.drivers[0]), SignInView(self.drivers[1]) device_1, device_2 = SignInView(self.drivers[0]), SignInView(self.drivers[1])
chat_name = device_1.get_public_chat_name() chat_name = device_1.get_random_chat_name()
for sign_in in device_1, device_2: for sign_in in device_1, device_2:
home = sign_in.create_user() home = sign_in.create_user()
home.join_public_chat(chat_name) home.join_public_chat(chat_name)
@ -96,7 +96,7 @@ class TestPublicChatMultipleDevice(MultipleDeviceTestCase):
device_1, device_2 = SignInView(self.drivers[0]), SignInView(self.drivers[1]) device_1, device_2 = SignInView(self.drivers[0]), SignInView(self.drivers[1])
home_1, home_2 = device_1.create_user(), device_2.create_user() home_1, home_2 = device_1.create_user(), device_2.create_user()
chat_name = home_1.get_public_chat_name() chat_name = home_1.get_random_chat_name()
chat_1, chat_2 = home_1.join_public_chat(chat_name), home_2.join_public_chat(chat_name) chat_1, chat_2 = home_1.join_public_chat(chat_name), home_2.join_public_chat(chat_name)
home_1.get_back_to_home_view() home_1.get_back_to_home_view()
@ -127,7 +127,7 @@ class TestPublicChatMultipleDevice(MultipleDeviceTestCase):
self.create_drivers(2) self.create_drivers(2)
device_1, device_2 = SignInView(self.drivers[0]), SignInView(self.drivers[1]) device_1, device_2 = SignInView(self.drivers[0]), SignInView(self.drivers[1])
home_1, home_2 = device_1.create_user(), device_2.create_user() home_1, home_2 = device_1.create_user(), device_2.create_user()
chat_name = home_1.get_public_chat_name() chat_name = home_1.get_random_chat_name()
chat_1, chat_2 = home_1.join_public_chat(chat_name), home_2.join_public_chat(chat_name) chat_1, chat_2 = home_1.join_public_chat(chat_name), home_2.join_public_chat(chat_name)
home_1.get_back_to_home_view() home_1.get_back_to_home_view()
message = 'test message' message = 'test message'
@ -158,7 +158,7 @@ class TestPublicChatMultipleDevice(MultipleDeviceTestCase):
device_1, device_2 = SignInView(self.drivers[0]), SignInView(self.drivers[1]) device_1, device_2 = SignInView(self.drivers[0]), SignInView(self.drivers[1])
home_1, home_2 = device_1.create_user(), device_2.create_user() home_1, home_2 = device_1.create_user(), device_2.create_user()
chat_name = home_1.get_public_chat_name() chat_name = home_1.get_random_chat_name()
chat_1, chat_2 = home_1.join_public_chat(chat_name), home_2.join_public_chat(chat_name) chat_1, chat_2 = home_1.join_public_chat(chat_name), home_2.join_public_chat(chat_name)
emoji_name = random.choice(list(emoji.EMOJI_UNICODE)) emoji_name = random.choice(list(emoji.EMOJI_UNICODE))
emoji_unicode = emoji.EMOJI_UNICODE[emoji_name] emoji_unicode = emoji.EMOJI_UNICODE[emoji_name]
@ -191,7 +191,7 @@ class TestPublicChatMultipleDevice(MultipleDeviceTestCase):
self.create_drivers(2) self.create_drivers(2)
device_1, device_2 = SignInView(self.drivers[0]), SignInView(self.drivers[1]) device_1, device_2 = SignInView(self.drivers[0]), SignInView(self.drivers[1])
home_1, home_2 = device_1.create_user(), device_2.create_user() home_1, home_2 = device_1.create_user(), device_2.create_user()
public_chat_name = home_1.get_public_chat_name() public_chat_name = home_1.get_random_chat_name()
chat_1, chat_2 = home_1.join_public_chat(public_chat_name), home_2.join_public_chat(public_chat_name) chat_1, chat_2 = home_1.join_public_chat(public_chat_name), home_2.join_public_chat(public_chat_name)
browser = device_1.dapp_tab_button.click() browser = device_1.dapp_tab_button.click()

View File

@ -111,7 +111,7 @@ class TestDApps(SingleDeviceTestCase):
user = basic_user user = basic_user
sign_in_view = SignInView(self.driver) sign_in_view = SignInView(self.driver)
home_view = sign_in_view.recover_access(passphrase=user['passphrase']) home_view = sign_in_view.recover_access(passphrase=user['passphrase'])
chat = home_view.join_public_chat(home_view.get_public_chat_name()) chat = home_view.join_public_chat(home_view.get_random_chat_name())
chat.back_button.click() chat.back_button.click()
status_test_dapp = home_view.open_status_test_dapp() status_test_dapp = home_view.open_status_test_dapp()
status_test_dapp.wait_for_d_aap_to_load() status_test_dapp.wait_for_d_aap_to_load()

View File

@ -14,7 +14,7 @@ class TestDeepLinks(SingleDeviceTestCase):
sign_in_view = SignInView(self.driver) sign_in_view = SignInView(self.driver)
sign_in_view.create_user() sign_in_view.create_user()
self.driver.close_app() self.driver.close_app()
chat_name = sign_in_view.get_public_chat_name() chat_name = sign_in_view.get_random_chat_name()
deep_link = 'https://join.status.im/%s' % chat_name deep_link = 'https://join.status.im/%s' % chat_name
sign_in_view.open_weblink_and_login(deep_link) sign_in_view.open_weblink_and_login(deep_link)
chat_view = sign_in_view.get_chat_view() chat_view = sign_in_view.get_chat_view()

View File

@ -11,35 +11,6 @@ from views.sign_in_view import SignInView
@marks.transaction @marks.transaction
class TestTransactionWalletSingleDevice(SingleDeviceTestCase): class TestTransactionWalletSingleDevice(SingleDeviceTestCase):
@marks.testrail_id(5307)
@marks.critical
@marks.skip
# TODO: temporary skipped due to 8601
def test_send_eth_from_wallet_to_contact(self):
recipient = basic_user
sender = transaction_senders['N']
sign_in_view = SignInView(self.driver)
sign_in_view.recover_access(sender['passphrase'])
home_view = sign_in_view.get_home_view()
home_view.add_contact(recipient['public_key'])
home_view.get_back_to_home_view()
wallet_view = home_view.wallet_button.click()
wallet_view.set_up_wallet()
wallet_view.accounts_status_account.click()
send_transaction = wallet_view.send_transaction_button.click()
send_transaction.amount_edit_box.click()
transaction_amount = send_transaction.get_unique_amount()
send_transaction.amount_edit_box.set_value(transaction_amount)
send_transaction.confirm()
send_transaction.chose_recipient_button.click()
send_transaction.recent_recipients_button.click()
recent_recipient = send_transaction.element_by_text(recipient['username'])
send_transaction.recent_recipients_button.click_until_presence_of_element(recent_recipient)
recent_recipient.click()
send_transaction.sign_transaction_button.click()
send_transaction.sign_transaction()
self.network_api.find_transaction_by_unique_amount(sender['address'], transaction_amount)
@marks.testrail_id(5308) @marks.testrail_id(5308)
@marks.critical @marks.critical
def test_send_eth_from_wallet_to_address(self): def test_send_eth_from_wallet_to_address(self):
@ -551,45 +522,3 @@ class TestTransactionWalletSingleDevice(SingleDeviceTestCase):
self.driver.fail('Account color does not match expected') self.driver.fail('Account color does not match expected')
self.errors.verify_no_errors() self.errors.verify_no_errors()
@marks.transaction
class TestTransactionWalletMultipleDevice(MultipleDeviceTestCase):
@marks.testrail_id(5378)
@marks.skip
@marks.high
# TODO: temporary skipped due to 8601
def test_transaction_message_sending_from_wallet(self):
recipient = transaction_recipients['E']
sender = transaction_senders['V']
self.create_drivers(2)
device_1, device_2 = SignInView(self.drivers[0]), SignInView(self.drivers[1])
home_1 = device_1.recover_access(passphrase=sender['passphrase'])
home_2 = device_2.recover_access(passphrase=recipient['passphrase'])
chat_1 = home_1.add_contact(recipient['public_key'])
chat_1.get_back_to_home_view()
wallet_1 = home_1.wallet_button.click()
wallet_1.set_up_wallet()
wallet_1.accounts_status_account.click()
send_transaction = wallet_1.send_transaction_button.click()
send_transaction.amount_edit_box.click()
amount = send_transaction.get_unique_amount()
send_transaction.amount_edit_box.set_value(amount)
send_transaction.confirm()
send_transaction.chose_recipient_button.click()
send_transaction.recent_recipients_button.click()
send_transaction.element_by_text_part(recipient['username']).click()
send_transaction.sign_transaction_button.click()
send_transaction.sign_transaction()
wallet_1.home_button.click()
home_1.get_chat(recipient['username']).click()
if not chat_1.chat_element_by_text(amount).is_element_displayed():
self.errors.append('Transaction message is not shown in 1-1 chat for the sender')
chat_2 = home_2.get_chat(sender['username']).click()
if not chat_2.chat_element_by_text(amount).is_element_displayed():
self.errors.append('Transaction message is not shown in 1-1 chat for the recipient')
self.errors.verify_no_errors()

View File

@ -586,7 +586,7 @@ class BaseView(object):
return '0.00%s' % datetime.now().strftime('%-d%-H%-M%-S').strip('0') return '0.00%s' % datetime.now().strftime('%-d%-H%-M%-S').strip('0')
@staticmethod @staticmethod
def get_public_chat_name(): def get_random_chat_name():
return ''.join(random.choice(string.ascii_lowercase) for _ in range(7)) return ''.join(random.choice(string.ascii_lowercase) for _ in range(7))
def get_text_from_qr(self): def get_text_from_qr(self):
@ -626,13 +626,15 @@ class BaseView(object):
def close_share_popup(self): def close_share_popup(self):
TouchAction(self.driver).tap(None, 255, 104, 1).perform() TouchAction(self.driver).tap(None, 255, 104, 1).perform()
def get_public_key(self): def get_public_key_and_username(self, return_username=False):
profile_view = self.profile_button.click() profile_view = self.profile_button.click()
default_username = profile_view.default_username_text.text
profile_view.share_my_profile_button.click() profile_view.share_my_profile_button.click()
profile_view.public_key_text.wait_for_visibility_of_element() profile_view.public_key_text.wait_for_visibility_of_element()
public_key = profile_view.public_key_text.text public_key = profile_view.public_key_text.text
self.close_share_popup() self.close_share_popup()
return public_key user_data = (public_key, default_username) if return_username else public_key
return user_data
def share_via_messenger(self): def share_via_messenger(self):
self.element_by_text('Messages').click() self.element_by_text('Messages').click()

View File

@ -1,4 +1,3 @@
import time
from datetime import datetime from datetime import datetime
import dateutil.parser import dateutil.parser
@ -63,13 +62,6 @@ class UserNameText(BaseText):
self.locator = \ self.locator = \
self.Locator.accessibility_id('chat-name-text') self.Locator.accessibility_id('chat-name-text')
class TransactionPopupText(BaseText):
def __init__(self, driver):
super(TransactionPopupText, self).__init__(driver)
self.locator = self.Locator.xpath_selector("//*[@text='Specify amount']")
class SendCommand(BaseButton): class SendCommand(BaseButton):
def __init__(self, driver): def __init__(self, driver):
super(SendCommand, self).__init__(driver) super(SendCommand, self).__init__(driver)
@ -100,12 +92,6 @@ class RequestCommand(BaseButton):
return self.navigate() return self.navigate()
class AssetCommand(BaseButton):
def __init__(self, driver, asset):
super(AssetCommand, self).__init__(driver)
self.locator = self.Locator.text_selector(asset)
class ChatMenuButton(BaseButton): class ChatMenuButton(BaseButton):
def __init__(self, driver): def __init__(self, driver):
super(ChatMenuButton, self).__init__(driver) super(ChatMenuButton, self).__init__(driver)
@ -145,11 +131,15 @@ class GroupInfoButton(BaseButton):
def navigate(self): def navigate(self):
return GroupChatInfoView(self.driver) return GroupChatInfoView(self.driver)
def click(self):
self.wait_for_element().click()
return self.navigate()
class LeaveChatButton(BaseButton): class LeaveChatButton(BaseButton):
def __init__(self, driver): def __init__(self, driver):
super(LeaveChatButton, self).__init__(driver) super(LeaveChatButton, self).__init__(driver)
self.locator = self.Locator.xpath_selector('//*[@text="Leave public chat"]') self.locator = self.Locator.accessibility_id('leave-chat-button')
class ClearButton(BaseButton): class ClearButton(BaseButton):
@ -194,18 +184,6 @@ class RemoveButton(BaseButton):
self.locator = self.Locator.xpath_selector("//android.widget.TextView[@text='Remove']") self.locator = self.Locator.xpath_selector("//android.widget.TextView[@text='Remove']")
class FirstRecipient(BaseButton):
def __init__(self, driver):
super(FirstRecipient, self).__init__(driver)
self.locator = self.Locator.accessibility_id('contact-item')
class MoreUsersButton(BaseButton):
def __init__(self, driver):
super(MoreUsersButton, self).__init__(driver)
self.locator = self.Locator.xpath_selector("//android.widget.TextView[contains(@text, 'MORE')]")
class OpenInStatusButton(BaseButton): class OpenInStatusButton(BaseButton):
def __init__(self, driver): def __init__(self, driver):
super(OpenInStatusButton, self).__init__(driver) super(OpenInStatusButton, self).__init__(driver)
@ -291,13 +269,13 @@ class DeclineChatButton(BaseButton):
class RemoveFromChatButton(BaseButton): class RemoveFromChatButton(BaseButton):
def __init__(self, driver): def __init__(self, driver):
super(RemoveFromChatButton, self).__init__(driver) super(RemoveFromChatButton, self).__init__(driver)
self.locator = self.Locator.xpath_selector('//*[@text="Remove from chat"]') self.locator = self.Locator.accessibility_id('remove-from-chat')
class MakeAdminButton(BaseButton): class MakeAdminButton(BaseButton):
def __init__(self, driver): def __init__(self, driver):
super(MakeAdminButton, self).__init__(driver) super(MakeAdminButton, self).__init__(driver)
self.locator = self.Locator.xpath_selector('//*[@text="Make admin"]') self.locator = self.Locator.accessibility_id('make-admin')
class ChatElementByText(BaseText): class ChatElementByText(BaseText):
@ -433,8 +411,6 @@ class ChatElementByText(BaseText):
return SignAndSend(self.driver, self.locator.value) return SignAndSend(self.driver, self.locator.value)
@property @property
def replied_message_text(self): def replied_message_text(self):
class RepliedMessageText(BaseText): class RepliedMessageText(BaseText):
@ -481,8 +457,44 @@ class HistoryTimeMarker(BaseText):
class UsernameOptions(BaseButton): class UsernameOptions(BaseButton):
def __init__(self, driver, username): def __init__(self, driver, username):
super(UsernameOptions, self).__init__(driver) super(UsernameOptions, self).__init__(driver)
self.locator = self.Locator.xpath_selector("//*[@text='%s']/..//*[@content-desc='options']" % username) self.locator = self.Locator.xpath_selector("//*[@text='%s']/..//*[@content-desc='menu-option']" % username)
def navigate(self):
return ChatView(self.driver)
def click(self):
self.wait_for_element().click()
return self.navigate()
class UserNameInGroupInfo(BaseButton):
def __init__(self, driver, username):
super(UserNameInGroupInfo, self).__init__(driver)
self.locator = self.Locator.xpath_selector("//*[@text='%s']" % username)
class AdminUser(BaseButton):
def __init__(self, driver, username):
super(AdminUser, self).__init__(driver)
self.locator = self.Locator.xpath_selector("//*[@text='%s']/..//*[@text='Admin']" % username)
class EditGroupChatButton(BaseButton):
def __init__(self, driver):
super(EditGroupChatButton, self).__init__(driver)
self.locator = self.Locator.accessibility_id("edit-button")
class EditGroupChatEditBox(BaseEditBox):
def __init__(self, driver):
super(EditGroupChatEditBox, self).__init__(driver)
self.locator = self.Locator.accessibility_id("new-chat-name")
class DoneButton(BaseButton):
def __init__(self, driver):
super(DoneButton, self).__init__(driver)
self.locator = self.Locator.accessibility_id("done")
class GroupChatInfoView(BaseView): class GroupChatInfoView(BaseView):
def __init__(self, driver): def __init__(self, driver):
@ -492,6 +504,14 @@ class GroupChatInfoView(BaseView):
def get_username_options(self, username: str): def get_username_options(self, username: str):
return UsernameOptions(self.driver, username) return UsernameOptions(self.driver, username)
def user_admin(self, username: str):
return AdminUser(self.driver, username)
def get_user_from_group_info(self, username: str):
return UserNameInGroupInfo(self.driver, username)
class ChatView(BaseView): class ChatView(BaseView):
def __init__(self, driver): def __init__(self, driver):
@ -533,15 +553,15 @@ class ChatView(BaseView):
self.decline_invitation_button = DeclineChatButton(self.driver) self.decline_invitation_button = DeclineChatButton(self.driver)
self.remove_user_button = RemoveFromChatButton(self.driver) self.remove_user_button = RemoveFromChatButton(self.driver)
self.make_admin_button = MakeAdminButton(self.driver) self.make_admin_button = MakeAdminButton(self.driver)
self.edit_group_chat_name_button = EditGroupChatButton(self.driver)
self.edit_group_chat_name_edit_box = EditGroupChatEditBox(self.driver)
self.done_button = DoneButton(self.driver)
self.chat_settings = ChatSettings(self.driver) self.chat_settings = ChatSettings(self.driver)
self.view_profile_button = ViewProfileButton(self.driver) self.view_profile_button = ViewProfileButton(self.driver)
self.more_users_button = MoreUsersButton(self.driver)
self.user_options = UserOptions(self.driver) self.user_options = UserOptions(self.driver)
self.remove_button = RemoveButton(self.driver) self.remove_button = RemoveButton(self.driver)
self.first_recipient_button = FirstRecipient(self.driver)
self.open_in_status_button = OpenInStatusButton(self.driver) self.open_in_status_button = OpenInStatusButton(self.driver)
# Contact's profile # Contact's profile
@ -552,36 +572,34 @@ class ChatView(BaseView):
self.profile_block_contact = ProfileBlockContactButton(self.driver) self.profile_block_contact = ProfileBlockContactButton(self.driver)
self.profile_add_to_contacts = ProfileAddToContactsButton(self.driver) self.profile_add_to_contacts = ProfileAddToContactsButton(self.driver)
def send_funds_to_request(self, amount, sender_password=common_password, wallet_set_up=False):
gas_popup = self.element_by_text_part('Specify amount')
send_request_button = self.chat_element_by_text(amount).send_request_button
send_request_button.click_until_presence_of_element(gas_popup)
send_transaction = self.get_send_transaction_view()
if wallet_set_up:
wallet_view = self.get_wallet_view()
self.send_message_button.click_until_presence_of_element(wallet_view.sign_in_phrase)
wallet_view.done_button.click()
wallet_view.yes_button.click()
else:
self.send_message_button.click_until_presence_of_element(send_transaction.sign_with_password)
send_transaction.sign_transaction(sender_password)
def delete_chat(self): def delete_chat(self):
self.chat_options.click() self.chat_options.click()
self.delete_chat_button.click() self.delete_chat_button.click()
self.delete_button.click() self.delete_button.click()
def leave_chat(self):
self.chat_options.click()
self.leave_chat_button.click()
self.leave_button.click()
def clear_history(self): def clear_history(self):
self.chat_options.click() self.chat_options.click()
self.clear_history_button.click() self.clear_history_button.click()
self.clear_button.click() self.clear_button.click()
def clear_history_via_group_info(self):
def leave_chat_via_group_info(self):
self.chat_options.click() self.chat_options.click()
self.group_info.click() self.group_info.click()
self.clear_history_button.click() self.leave_chat_button.click()
self.clear_button.click() self.leave_button.click()
self.back_button.click()
def rename_chat_via_group_info(self, new_chat_name):
self.chat_options.click()
self.group_info.click()
self.edit_group_chat_name_button.click()
self.edit_group_chat_name_edit_box.set_value(new_chat_name)
self.done_button.click()
def send_transaction_in_group_chat(self, amount, password, recipient): def send_transaction_in_group_chat(self, amount, password, recipient):
self.commands_button.click() self.commands_button.click()
@ -662,3 +680,32 @@ class ChatView(BaseView):
timestamp = datetime.strptime("%s:%s" % (sent_time_object.hour, sent_time_object.minute), '%H:%M').strftime("%I:%M %p") timestamp = datetime.strptime("%s:%s" % (sent_time_object.hour, sent_time_object.minute), '%H:%M').strftime("%I:%M %p")
timestamp = timestamp[1:] if timestamp[0] == '0' else timestamp timestamp = timestamp[1:] if timestamp[0] == '0' else timestamp
return timestamp return timestamp
# Group chat system messages
@staticmethod
def leave_system_message(username):
return "%s left the group" % username
@staticmethod
def has_been_made_admin_system_message(admin, new_admin):
return "%s has made %s admin" % (admin, new_admin)
@staticmethod
def create_system_message(admin, chat_name):
return '%s created the group %s' % (admin, chat_name)
@staticmethod
def invite_system_message(admin, invited_user):
return '%s has invited %s' % (admin, invited_user)
@staticmethod
def join_system_message(username):
return '%s joined the group' % username
@staticmethod
def create_for_admin_system_message(chat_name):
return 'You created the group %s' % chat_name
@staticmethod
def changed_group_name_system_message(admin, chat_name):
return "%s changed the group's name to %s" % (admin, chat_name)

View File

@ -106,7 +106,6 @@ class DappsView(BaseView):
self.always_allow_radio_button = AlwaysAllowRadioButton(self.driver) self.always_allow_radio_button = AlwaysAllowRadioButton(self.driver)
self.close_web3_permissions_window_button = CrossCloseWeb3PermissionButton(self.driver) self.close_web3_permissions_window_button = CrossCloseWeb3PermissionButton(self.driver)
def open_url(self, url): def open_url(self, url):
self.enter_url_editbox.click() self.enter_url_editbox.click()
self.enter_url_editbox.send_keys(url) self.enter_url_editbox.send_keys(url)

View File

@ -258,6 +258,12 @@ class HomeView(BaseView):
self.delete_chat_button.click() self.delete_chat_button.click()
self.delete_button.click() self.delete_button.click()
def leave_chat_long_press(self, username):
self.get_chat(username).long_press_element()
from views.chat_view import LeaveChatButton, LeaveButton
LeaveChatButton(self.driver).click()
LeaveButton(self.driver).click()
def clear_chat_long_press(self, username): def clear_chat_long_press(self, username):
self.get_chat(username).long_press_element() self.get_chat(username).long_press_element()
self.clear_history_button.click() self.clear_history_button.click()

View File

@ -437,7 +437,6 @@ class WalletView(BaseView):
else: else:
self.driver.info('Current USD balance %s is ok' % usd) self.driver.info('Current USD balance %s is ok' % usd)
def wait_balance_is_equal_expected_amount(self, asset ='ETHro', expected_balance=0.1, wait_time=300): def wait_balance_is_equal_expected_amount(self, asset ='ETHro', expected_balance=0.1, wait_time=300):
counter = 0 counter = 0
while True: while True:
@ -469,8 +468,7 @@ class WalletView(BaseView):
self.driver.info('Waiting %s seconds for %s to display asset' % (counter, asset)) self.driver.info('Waiting %s seconds for %s to display asset' % (counter, asset))
else: else:
self.driver.info('Balance is updated!') self.driver.info('Balance is updated!')
return return self
def get_sign_in_phrase(self): def get_sign_in_phrase(self):
return ' '.join([element.text for element in self.sign_in_phrase.find_elements()]) return ' '.join([element.text for element in self.sign_in_phrase.find_elements()])