refactoring e2e

Signed-off-by: Churikova Tetiana <churikova.tm@gmail.com>
This commit is contained in:
Churikova Tetiana 2020-03-17 18:27:10 +01:00
parent a2b2f55996
commit 8aff7f487d
No known key found for this signature in database
GPG Key ID: 0D4EA7B33B47E6D8
19 changed files with 268 additions and 241 deletions

View File

@ -1,7 +1,7 @@
aiohttp==2.2.3
allpairspy==2.3.0
apipkg==1.4
Appium-Python-Client==0.26
Appium-Python-Client==0.50
async-timeout==3.0.1
certifi==2017.7.27.1
chardet==3.0.4
@ -40,7 +40,7 @@ requests==2.20.1
rlp==1.0.1
sauceclient==1.0.0
scrypt==0.8.6
selenium==3.8.1
selenium==3.14.1
six==1.10.0
toolz==0.9.0
urllib3==1.24.2

View File

@ -5,6 +5,6 @@ from selenium.common.exceptions import WebDriverException
def start_web_browser(driver):
logging.info('Start web browser')
try:
driver.start_activity('org.chromium.webview_shell', 'WebViewBrowserActivity')
driver.start_activity('com.android.chrome', 'com.google.android.apps.chrome.Main')
except WebDriverException:
pass

View File

@ -116,6 +116,7 @@ class TestProfileSingleDevice(SingleDeviceTestCase):
@marks.testrail_id(5454)
@marks.critical
@marks.skip
# TODO: waiting for better times - no profile picture for now
def test_user_can_remove_profile_picture(self):
signin_view = SignInView(self.driver)
home_view = signin_view.create_user()
@ -183,10 +184,10 @@ class TestProfileSingleDevice(SingleDeviceTestCase):
address = wallet.address_text.text
share_view = home.get_send_transaction_view()
share_view.share_button.click()
share_view.element_by_text('Copy to clipboard').click()
share_view.element_by_text('Copy').click()
wallet.get_back_to_home_view()
wallet.home_button.click()
home.get_chat_with_user(transaction_senders['M']['username']).click()
home.get_chat(transaction_senders['M']['username']).click()
chat.chat_message_input.click()
chat.paste_text()
if chat.chat_message_input.text != address:
@ -633,7 +634,7 @@ class TestProfileMultipleDevice(MultipleDeviceTestCase):
chat_1.chat_message_input.send_keys(message)
chat_1.send_message_button.click()
profile_2.home_button.click()
chat_2 = home_2.get_chat_with_user(username_1).click()
chat_2 = home_2.get_chat(username_1).click()
chat_2.chat_element_by_text(message).wait_for_visibility_of_element()
chat_2.add_to_contacts.click()
@ -644,7 +645,7 @@ class TestProfileMultipleDevice(MultipleDeviceTestCase):
profile_1.enable_bootnodes.click()
sign_in_1.sign_in()
home_1.get_chat_with_user(username_2).click()
home_1.get_chat(username_2).click()
message_1 = 'new message'
chat_1.chat_message_input.send_keys(message_1)
chat_1.send_message_button.click()
@ -700,7 +701,7 @@ class TestProfileMultipleDevice(MultipleDeviceTestCase):
message = 'test message'
chat_1.chat_message_input.send_keys(message)
chat_1.send_message_button.click()
chat_2 = home_2.get_chat_with_user(username_1).click()
chat_2 = home_2.get_chat(username_1).click()
chat_2.chat_element_by_text(message).wait_for_visibility_of_element()
message_1 = 'new message'
chat_2.chat_message_input.send_keys(message_1)
@ -792,7 +793,7 @@ class TestProfileMultipleDevice(MultipleDeviceTestCase):
@marks.testrail_id(5762)
@marks.high
def test_pair_devices_sync_one_to_one_contacts(self):
def test_pair_devices_sync_one_to_one_contacts_public_chat(self):
self.create_drivers(2)
device_1, device_2 = SignInView(self.drivers[0]), SignInView(self.drivers[1])
device_1_home = device_1.create_user()
@ -808,12 +809,19 @@ class TestProfileMultipleDevice(MultipleDeviceTestCase):
device_2_name = 'device_%s' % device_2.driver.number
message_before_sync = 'sent before sync'
message_after_sync = 'sent after sync'
public_chat_before_sync = 'before-pairing'
public_chat_after_sync = 'after-pairing'
device_1.just_fyi('add contact, start 1-1 chat with basic user')
device_1_chat = device_1_home.add_contact(basic_user['public_key'])
device_1_chat.chat_message_input.send_keys(message_before_sync)
device_1_chat.send_message_button.click()
device_1.just_fyi('join public chat')
device_1_chat.get_back_to_home_view()
device_1_public_chat = device_1_home.join_public_chat(public_chat_before_sync)
device_2.just_fyi('go to profile > Devices, set device name, discover device 2 to device 1')
device_2_home = device_2.recover_access(passphrase=' '.join(recovery_phrase.values()))
device_2_profile = device_2_home.get_profile_view()
@ -832,24 +840,38 @@ class TestProfileMultipleDevice(MultipleDeviceTestCase):
self.errors.append('"%s" is not found in Contacts after initial sync' % basic_user['username'])
device_1.just_fyi('send message to 1-1 chat with basic user and add another contact')
device_1_chat.get_back_to_home_view()
device_1_profile.home_button.click()
device_1_public_chat.back_button.click()
device_1_home.get_chat(basic_user['username']).click()
device_1_chat.chat_message_input.send_keys(message_after_sync)
device_1_chat.send_message_button.click()
device_1_chat.back_button.click()
device_1_home.add_contact(transaction_senders['A']['public_key'])
device_2.just_fyi('check that messages appeared in 1-1 chat and new contacts are synced')
if not device_2_profile.element_by_text(transaction_senders['A']['username']):
device_2.just_fyi('check that messages appeared in 1-1 chat, public chats and new contacts are synced')
if not device_2_profile.element_by_text(transaction_senders['A']['username']).is_element_displayed(30):
self.errors.append(
'"%s" is not found in Contacts after adding when devices are paired' % transaction_senders['A'][
'username'])
device_2_profile.get_back_to_home_view()
chat = device_2_home.get_chat_with_user(basic_user['username']).click()
device_2_profile.home_button.click()
if not device_2_home.element_by_text_part(public_chat_before_sync).is_element_displayed():
self.errors.append(
'"%s" is not found in Home after initial sync when devices are paired' % public_chat_before_sync)
chat = device_2_home.get_chat(basic_user['username']).click()
if chat.chat_element_by_text(message_before_sync).is_element_displayed():
self.errors.append('"%s" message sent before pairing is synced' % message_before_sync)
if not chat.chat_element_by_text(message_after_sync).is_element_displayed():
self.errors.append('"%s" message in 1-1 is not synced' % message_after_sync)
device_1.just_fyi('add new public chat and check that it will be synced with device2')
device_1_chat.get_back_to_home_view()
device_1_home.join_public_chat(public_chat_after_sync)
device_2_home = chat.get_back_to_home_view()
if not device_2_home.element_by_text_part(public_chat_after_sync).is_element_displayed(20):
self.errors.append(
'"%s" public chat is not synced after adding when devices are paired' % public_chat_after_sync)
self.errors.verify_no_errors()
@marks.testrail_id(5680)
@ -971,7 +993,7 @@ class TestProfileMultipleDevice(MultipleDeviceTestCase):
self.errors.append('ENS username is not shown in ENS usernames Chat Settings after enabling')
profile_1.back_button.click()
profile_1.home_button.click()
home_1.get_chat_with_user('#' + chat_name).click()
home_1.get_chat('#' + chat_name).click()
message_text_2 = 'message test text 1'
chat_1.send_message(message_text_2)
if not chat_2.wait_for_element_starts_with_text('@' + user_1['ens']):

View File

@ -1,4 +1,3 @@
import pytest
import time
from tests import marks, camera_access_error_text, get_current_time
@ -12,60 +11,111 @@ class TestChatManagement(SingleDeviceTestCase):
@marks.testrail_id(5426)
@marks.medium
def test_clear_history_one_to_one_chat(self):
sign_in_view = SignInView(self.driver)
home_view = sign_in_view.create_user()
chat_view = home_view.add_contact(basic_user['public_key'])
for _ in range(2):
chat_view.chat_message_input.send_keys('test message')
chat_view.send_message_button.click()
chat_view.clear_history()
if not chat_view.no_messages_in_chat.is_element_present():
self.driver.fail('Message history is shown')
home_view.relogin()
home_view.get_chat_with_user(basic_user['username']).click()
if not chat_view.no_messages_in_chat.is_element_present():
self.driver.fail('Message history is shown after re-login')
@marks.testrail_id(5319)
@marks.critical
def test_long_press_to_delete_1_1_chat(self):
def test_clear_history_via_options(self):
sign_in = SignInView(self.driver)
home = sign_in.create_user()
chat = home.add_contact(basic_user['public_key'])
chat.chat_message_input.send_keys('test message')
chat.send_message_button.click()
chat.get_back_to_home_view()
home.delete_chat_long_press(basic_user['username'])
self.driver.close_app()
self.driver.launch_app()
sign_in.accept_agreements()
sign_in.sign_in()
if home.get_chat_with_user(basic_user['username']).is_element_displayed():
self.driver.fail('Deleted 1-1 chat is present after relaunch app')
@marks.testrail_id(5343)
@marks.critical
def test_long_press_to_delete_public_chat(self):
one_to_one, public, group = basic_user['username'], '#public', 'group'
message = 'test message'
chat.get_back_to_home_view()
home.create_group_chat([basic_user['username']], group)
chat.get_back_to_home_view()
home.join_public_chat(public[1:])
chat.get_back_to_home_view()
for chat_name in one_to_one, public, group:
chat = home.get_chat(chat_name).click()
chat.just_fyi('Sending messages to %s chat' % chat_name)
for _ in range(2):
chat.chat_message_input.send_keys(message)
chat.send_message_button.click()
chat.just_fyi('Clear history for %s chat' % chat_name)
chat.clear_history()
if chat.element_by_text(message).is_element_displayed():
self.errors.append('Messages in %s chat are still shown after clearing history' % chat_name)
chat.get_back_to_home_view()
home.relogin()
for chat_name in one_to_one, public, group:
if home.element_by_text(message).is_element_displayed():
self.errors.append(
'Messages in %s chat are still shown in Preview after clearing history and relaunch' % chat_name)
chat = home.get_chat(chat_name).click()
if chat.element_by_text(message).is_element_displayed():
self.errors.append(
'Messages in %s chat are shown after clearing history and relauch' % chat_name)
chat.get_back_to_home_view()
self.errors.verify_no_errors()
@marks.testrail_id(5319)
@marks.medium
def test_long_press_to_clear_chat_history(self):
sign_in = SignInView(self.driver)
home = sign_in.create_user()
chat_name = home.get_public_chat_name()
chat = home.join_public_chat(chat_name)
chat = home.add_contact(basic_user['public_key'])
one_to_one, public, group = basic_user['username'], '#public', 'group'
message = 'test message'
chat.chat_message_input.send_keys(message)
chat.send_message_button.click()
chat.get_back_to_home_view()
home.delete_chat_long_press('#' + chat_name)
profile = home.profile_button.click()
profile.logout()
sign_in.sign_in()
if home.get_chat_with_user('#' + chat_name).is_element_displayed():
self.errors.append('Deleted public chat is present after relogin')
home.join_public_chat(chat_name)
if chat.chat_element_by_text(message).is_element_displayed():
self.errors.append('Chat history is shown')
home.create_group_chat([basic_user['username']], group)
chat.get_back_to_home_view()
home.join_public_chat(public[1:])
chat.get_back_to_home_view()
for chat_name in one_to_one, public, group:
chat = home.get_chat(chat_name).click()
chat.just_fyi('Sending message to %s chat' % chat_name)
chat.chat_message_input.send_keys(message)
chat.send_message_button.click()
if chat.element_by_text(message).is_element_displayed():
self.errors.append('Messages in %s chat are still shown after clearing history' % chat_name)
home = chat.get_back_to_home_view()
home.just_fyi('Clear history for %s chat' % chat_name)
home.clear_chat_long_press(chat_name)
home.relogin()
for chat_name in one_to_one, public, group:
if home.element_by_text(message).is_element_displayed():
self.errors.append(
'Messages in %s chat are still shown in Preview after clearing history and relaunch' % chat_name)
chat = home.get_chat(chat_name).click()
if chat.element_by_text(message).is_element_displayed():
self.errors.append(
'Messages in %s chat are shown after clearing history and relauch' % chat_name)
chat.get_back_to_home_view()
self.errors.verify_no_errors()
@marks.testrail_id(5319)
@marks.critical
def test_long_press_to_delete_chat(self):
sign_in = SignInView(self.driver)
home = sign_in.create_user()
chat = home.add_contact(basic_user['public_key'])
one_to_one, public, group = basic_user['username'], '#public', 'group'
chat.get_back_to_home_view()
home.create_group_chat([basic_user['username']], group)
chat.get_back_to_home_view()
home.join_public_chat(public[1:])
chat.get_back_to_home_view()
for chat_name in one_to_one, public, group:
chat = home.get_chat(chat_name).click()
chat.just_fyi('Sending message to %s chat' % chat_name)
chat.chat_message_input.send_keys('test message')
chat.send_message_button.click()
chat.get_back_to_home_view()
chat.just_fyi('Deleting %s chat' % chat_name)
home.delete_chat_long_press(chat_name)
home.relogin()
for chat_name in one_to_one, public, group:
if home.get_chat(chat_name).is_element_displayed():
self.driver.fail('Deleted %s is present after relaunch app' % chat_name)
@marks.testrail_id(5304)
@marks.high
def test_open_chat_by_pasting_public_key(self):
@ -87,41 +137,41 @@ class TestChatManagement(SingleDeviceTestCase):
self.driver.fail('Public key is not pasted from clipboard')
contacts_view.confirm()
contacts_view.get_back_to_home_view()
if not home.get_chat_with_user(basic_user['username']).is_element_present():
if not home.get_chat(basic_user['username']).is_element_present():
self.driver.fail("No chat open in home view")
@marks.testrail_id(5387)
@marks.high
def test_delete_one_to_one_chat_via_delete_button(self):
def test_delete_chats_via_delete_button(self):
sign_in = SignInView(self.driver)
home = sign_in.create_user()
chat_view = home.add_contact(basic_user['public_key'])
for _ in range(2):
chat_view.chat_message_input.send_keys('test message')
chat_view.send_message_button.click()
chat_view.delete_chat()
if home.get_chat_with_user(basic_user['username']).is_element_present(10):
self.errors.append("One-to-one' chat is shown, but the chat has been deleted")
home.relogin()
if home.get_chat_with_user(basic_user['username']).is_element_present(10):
self.errors.append("One-to-one' chat is shown after re-login, but the chat has been deleted")
self.errors.verify_no_errors()
chat = home.add_contact(basic_user['public_key'])
@marks.testrail_id(5388)
@marks.high
def test_delete_public_chat_via_delete_button(self):
sign_in = SignInView(self.driver)
home = sign_in.create_user()
chat_name = home.get_public_chat_name()
public_chat = home.join_public_chat(chat_name)
public_chat.chat_message_input.send_keys('test message')
public_chat.send_message_button.click()
public_chat.delete_chat()
if home.element_by_text(chat_name).is_element_present(5):
self.errors.append("Public chat '%s' is shown, but the chat has been deleted" % chat_name)
home.relogin()
if home.element_by_text(chat_name).is_element_present(5):
self.errors.append("Public chat '%s' is shown after re-login, but the chat has been deleted" % chat_name)
one_to_one, public, group = basic_user['username'], '#public', 'group'
chat.get_back_to_home_view()
home.create_group_chat([basic_user['username']], group)
chat.get_back_to_home_view()
home.join_public_chat(public[1:])
chat.get_back_to_home_view()
for chat_name in one_to_one, public, group:
chat = home.get_chat(chat_name).click()
chat.just_fyi('Sending message to %s chat' % chat_name)
chat.chat_message_input.send_keys('test message')
chat.send_message_button.click()
chat.just_fyi('Deleting %s chat' % chat_name)
chat.delete_chat()
chat.get_back_to_home_view()
for chat_name in one_to_one, public, group:
if home.get_chat(chat_name).is_element_displayed():
self.errors.append('Deleted %s chat is shown, but the chat has been deleted' % chat_name)
self.driver.close_app()
self.driver.launch_app()
sign_in.sign_in()
for chat_name in one_to_one, public, group:
if home.get_chat(chat_name).is_element_displayed():
self.errors.append('Deleted %s is shown after re-login, but the chat has been deleted' % chat_name)
self.errors.verify_no_errors()
@marks.testrail_id(5464)
@ -190,7 +240,9 @@ class TestChatManagement(SingleDeviceTestCase):
home = sign_in.create_user()
home.click_system_back_button()
home.driver.press_keycode(187)
home.element_by_text('Status PR').click()
if self.driver.current_activity != '.NexusLauncherActivity':
self.driver.fail('App is not in background! Current activity is: %s' % self.driver.current_activity)
home.status_in_background_button.click()
if not home.plus_button.is_element_displayed():
self.driver.fail('Chats view was not opened')
@ -240,7 +292,7 @@ class TestChatManagement(SingleDeviceTestCase):
if chat_view.cancel_reply_button.is_element_displayed():
self.errors.append("Message quote kept in public chat input after it's cancelation")
chat_view.get_back_to_home_view(times_to_click_on_back_btn=1)
home.get_chat_with_user(dummy_user["username"]).click()
home.get_chat(dummy_user["username"]).click()
chat_view.cancel_reply_button.click()
if chat_view.cancel_reply_button.is_element_displayed():
self.errors.append("Message quote kept in 1-1 chat input after it's cancelation")
@ -402,7 +454,7 @@ class TestChatManagementMultipleDevice(MultipleDeviceTestCase):
chat_1.chat_message_input.send_keys(message_before_block_1)
chat_1.send_message_button.click()
chat_2 = home_2.get_chat_with_user(default_username_1).click()
chat_2 = home_2.get_chat(default_username_1).click()
for _ in range(2):
chat_2.chat_message_input.send_keys(message_before_block_2)
chat_2.send_message_button.click()
@ -413,7 +465,7 @@ class TestChatManagementMultipleDevice(MultipleDeviceTestCase):
chat_1.block_contact()
device_1.just_fyi('no 1-1, messages from blocked user are hidden in public chat')
if home_1.get_chat_with_user(basic_user['username']).is_element_displayed():
if home_1.get_chat(basic_user['username']).is_element_displayed():
home_1.driver.fail("Chat with blocked user '%s' is not deleted" % device_2.driver.number)
public_chat_after_block = home_1.join_public_chat(chat_name)
if public_chat_after_block.chat_element_by_text(message_before_block_2).is_element_displayed():
@ -437,7 +489,7 @@ class TestChatManagementMultipleDevice(MultipleDeviceTestCase):
if public_chat_after_block.chat_element_by_text(message_after_block_2).is_element_displayed():
self.errors.append("Message from blocked user '%s' is received" % device_2.driver.number)
public_chat_after_block.get_back_to_home_view()
if home_1.get_chat_with_user(basic_user['username']).is_element_displayed():
if home_1.get_chat(basic_user['username']).is_element_displayed():
device_2.driver.fail("Chat with blocked user is reappeared after receiving new messages")
self.drivers[0].close_app()
@ -446,7 +498,7 @@ class TestChatManagementMultipleDevice(MultipleDeviceTestCase):
chat_public_2.chat_message_input.send_keys(message_after_block_2)
chat_public_2.send_message_button.click()
chat_public_2.get_back_to_home_view()
home_2.get_chat_with_user(default_username_1).click()
home_2.get_chat(default_username_1).click()
for _ in range(2):
chat_2.chat_message_input.send_keys(message_after_block_2)
chat_2.send_message_button.click()
@ -455,7 +507,7 @@ class TestChatManagementMultipleDevice(MultipleDeviceTestCase):
self.drivers[0].launch_app()
device_1.accept_agreements()
device_1.sign_in()
if home_1.get_chat_with_user(basic_user['username']).is_element_displayed():
if home_1.get_chat(basic_user['username']).is_element_displayed():
self.errors.append("Chat with blocked user is reappeared after fetching new messages from offline")
home_1.join_public_chat(chat_name)
home_1.get_chat_view()
@ -492,7 +544,7 @@ class TestChatManagementMultipleDevice(MultipleDeviceTestCase):
device_1.just_fyi("Receiver verifies received reply...")
home_2.home_button.click()
device_2_chat_item = home_2.get_chat_with_user(device_1_username)
device_2_chat_item = home_2.get_chat(device_1_username)
device_2_chat_item.wait_for_visibility_of_element(20)
device_2_chat = device_2_chat_item.click()
if device_2_chat.chat_element_by_text(reply_to_message_from_sender).replied_message_text != message_from_sender:

View File

@ -41,7 +41,7 @@ class TestCommandsMultipleDevices(MultipleDeviceTestCase):
if status_text_1 != 'Sent':
self.errors.append("Message about sent funds has status '%s' instead of 'Sent'" % status_text_1)
device_2_chat = device_2_home.get_chat_with_user(sender['username']).click()
device_2_chat = device_2_home.get_chat(sender['username']).click()
chat_element_1 = device_2_chat.chat_element_by_text(amount_1)
try:
chat_element_1.wait_for_visibility_of_element(120)
@ -60,7 +60,7 @@ class TestCommandsMultipleDevices(MultipleDeviceTestCase):
if status_text_2 != 'Sent':
self.errors.append("Request funds message has status '%s' instead of 'Sent'" % status_text_2)
device_2_home.get_chat_with_user(sender['username']).click()
device_2_home.get_chat(sender['username']).click()
chat_element_2 = device_2_chat.chat_element_by_text(amount_2)
try:
chat_element_2.wait_for_visibility_of_element(120)
@ -116,7 +116,7 @@ class TestCommandsMultipleDevices(MultipleDeviceTestCase):
if not chat_1.chat_element_by_text(amount).is_element_displayed():
self.errors.append('Message with the sent amount is not shown for the sender')
chat_2 = home_2.get_chat_with_user(sender['username']).click()
chat_2 = home_2.get_chat(sender['username']).click()
if not chat_2.chat_element_by_text(amount).is_element_displayed():
self.errors.append('Message with the sent amount is not shown for the recipient')
@ -151,7 +151,7 @@ class TestCommandsMultipleDevices(MultipleDeviceTestCase):
amount = chat_2.get_unique_amount()
chat_2.request_transaction_in_1_1_chat('ETHro', amount)
chat_1 = home_1.get_chat_with_user(recipient['username']).click()
chat_1 = home_1.get_chat(recipient['username']).click()
chat_1.send_funds_to_request(amount=amount)
if not chat_1.chat_element_by_text(amount).is_element_displayed():
@ -202,7 +202,7 @@ class TestCommandsMultipleDevices(MultipleDeviceTestCase):
sender_button.click()
wallet_1.send_request_button.click()
chat_2 = home_2.get_chat_with_user(default_username_1).click()
chat_2 = home_2.get_chat(default_username_1).click()
chat_element = chat_2.chat_element_by_text(amount)
try:
chat_element.wait_for_visibility_of_element(120)
@ -267,7 +267,7 @@ class TestCommandsMultipleDevices(MultipleDeviceTestCase):
message_1 = chat_1.chat_element_by_text(amount)
if not message_1.is_element_displayed() or not message_1.contains_text('STT'):
self.errors.append('Message with the sent amount is not shown for the sender')
chat_2 = home_2.get_chat_with_user(sender['username']).click()
chat_2 = home_2.get_chat(sender['username']).click()
message_2 = chat_2.chat_element_by_text(amount)
if not message_2.is_element_displayed() or not message_2.contains_text('STT'):
self.errors.append('Message with the sent amount is not shown for the recipient')
@ -299,7 +299,7 @@ class TestCommandsMultipleDevices(MultipleDeviceTestCase):
amount = chat_2.get_unique_amount()
chat_2.request_transaction_in_1_1_chat('STT', amount)
chat_1 = home_1.get_chat_with_user(recipient['username']).click()
chat_1 = home_1.get_chat(recipient['username']).click()
chat_1.send_funds_to_request(amount=amount)
message_1 = chat_1.chat_element_by_text(amount)
@ -334,7 +334,7 @@ class TestCommandsMultipleDevices(MultipleDeviceTestCase):
amount = chat_1.get_unique_amount()
chat_1.send_transaction_in_1_1_chat('ETHro', amount)
chat_2 = home_2.get_chat_with_user(sender['username']).click()
chat_2 = home_2.get_chat(sender['username']).click()
self.network_api.wait_for_confirmation_of_transaction(recipient['address'], amount)
if not chat_2.chat_element_by_text(amount).contains_text('Confirmed', 60):
chat_2.driver.fail('Status "Confirmed" is not shown under transaction for the recipient')

View File

@ -45,7 +45,7 @@ def create_new_group_chat(device_1_home, device_2_home, chat_name):
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_with_user(chat_name).click()
device_2_chat = device_2_home.get_chat(chat_name).click()
return device_1_chat, device_2_chat
@ -114,7 +114,7 @@ class TestGroupChatMultipleDevice(MultipleDeviceTestCase):
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_with_user(chat_name).click()
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
@ -183,7 +183,7 @@ class TestGroupChatMultipleDevice(MultipleDeviceTestCase):
device_1_chat.add_members_to_group_chat([device_2_default_username])
# device 2: open the chat
device_2_chat = device_2_home.get_chat_with_user(chat_name).click()
device_2_chat = device_2_home.get_chat(chat_name).click()
device_2_chat.join_chat_button.click()
# device 1: send a message that should be visible for device 2

View File

@ -32,7 +32,7 @@ class TestMessagesOneToOneChatMultiple(MultipleDeviceTestCase):
device_1_chat.chat_message_input.send_keys(message)
device_1_chat.send_message_button.click()
device_2_chat = device_2_home.get_chat_with_user(default_username_1).click()
device_2_chat = device_2_home.get_chat(default_username_1).click()
device_2_chat.chat_element_by_text(message).wait_for_visibility_of_element()
@marks.testrail_id(5310)
@ -58,7 +58,7 @@ class TestMessagesOneToOneChatMultiple(MultipleDeviceTestCase):
home_1.toggle_airplane_mode() # turning on WiFi connection on primary device
home_1.connection_status.wait_for_invisibility_of_element(30)
chat_element = home_1.get_chat_with_user(username_2)
chat_element = home_1.get_chat(username_2)
chat_element.wait_for_visibility_of_element(30)
chat_1 = chat_element.click()
chat_1.chat_element_by_text(message_1).wait_for_visibility_of_element(2)
@ -95,7 +95,7 @@ class TestMessagesOneToOneChatMultiple(MultipleDeviceTestCase):
chat_1.chat_message_input.send_keys(message)
chat_1.send_message_button.click()
chat_2 = home_2.get_chat_with_user(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()
public_chat_name = home_1.get_public_chat_name()
@ -133,7 +133,7 @@ class TestMessagesOneToOneChatMultiple(MultipleDeviceTestCase):
device_1_chat.chat_message_input.send_keys(message)
device_1_chat.send_message_button.click()
chat_element = device_2_home.get_chat_with_user(default_username_1)
chat_element = device_2_home.get_chat(default_username_1)
chat_element.wait_for_visibility_of_element()
device_2_chat = chat_element.click()
if not device_2_chat.chat_element_by_text(message).is_element_displayed():
@ -175,7 +175,7 @@ class TestMessagesOneToOneChatMultiple(MultipleDeviceTestCase):
device_1_chat.chat_message_input.send_keys(message)
device_1_chat.send_message_button.click()
chat_element = device_2_home.get_chat_with_user(default_username_1)
chat_element = device_2_home.get_chat(default_username_1)
chat_element.wait_for_visibility_of_element()
device_2_chat = chat_element.click()
if not device_2_chat.chat_element_by_text(message).is_element_displayed():
@ -216,7 +216,7 @@ class TestMessagesOneToOneChatMultiple(MultipleDeviceTestCase):
chat_1.chat_message_input.send_keys(url_message)
chat_1.send_message_button.click()
chat_1.get_back_to_home_view()
chat_2 = home_2.get_chat_with_user(default_username_1).click()
chat_2 = home_2.get_chat(default_username_1).click()
chat_2.element_starts_with_text(url_message, 'button').click()
web_view = chat_2.open_in_status_button.click()
try:
@ -240,29 +240,6 @@ class TestMessagesOneToOneChatMultiple(MultipleDeviceTestCase):
self.errors.append('Device 1: URL was not opened from 1-1 chat')
self.errors.verify_no_errors()
@marks.testrail_id(5326)
@marks.critical
def test_offline_status(self):
self.create_drivers(1)
sign_in = SignInView(self.drivers[0])
home_view = sign_in.create_user()
home_view.airplane_mode_button.click()
chat = home_view.add_contact(transaction_senders['C']['public_key'])
chat.element_by_text('Offline').wait_for_visibility_of_element(15)
if chat.connection_status.text != 'Offline':
self.errors.append('Offline status is not shown in 1-1 chat')
chat.get_back_to_home_view()
if home_view.connection_status.text != 'Offline':
self.errors.append('Offline status is not shown in home screen')
public_chat = home_view.join_public_chat(home_view.get_public_chat_name())
if public_chat.connection_status.text != 'Offline':
self.errors.append('Offline status is not shown in a public chat')
self.errors.verify_no_errors()
@marks.testrail_id(5374)
@marks.high
def test_message_marked_as_sent_in_1_1_chat(self):
@ -298,7 +275,7 @@ class TestMessagesOneToOneChatMultiple(MultipleDeviceTestCase):
if device_1_home.home_button.counter.text != '1':
self.errors.append('New messages counter is not shown on Home button')
chat_element = device_1_home.get_chat_with_user(default_username_2)
chat_element = device_1_home.get_chat(default_username_2)
if chat_element.new_messages_counter.text != '1':
self.errors.append('New messages counter is not shown on chat element')
@ -328,7 +305,7 @@ class TestMessagesOneToOneChatMultiple(MultipleDeviceTestCase):
device_2_chat = device_2_home.add_contact(device_1_public_key)
device_2_chat.chat_message_input.send_keys('test message')
device_2_chat.send_message_button.click()
device_1_chat = device_1_home.get_chat_with_user(default_username_2).click()
device_1_chat = device_1_home.get_chat(default_username_2).click()
markdown = {
'bold text in asterics' : '**',
@ -395,7 +372,7 @@ class TestMessagesOneToOneChatMultiple(MultipleDeviceTestCase):
if device_1_chat.chat_element_by_text(message).member_photo.is_element_displayed():
self.errors.append('Member photo is displayed in 1-1 chat for the sender')
device_2_chat = device_2_home.get_chat_with_user(default_username_1).click()
device_2_chat = device_2_home.get_chat(default_username_1).click()
if not device_2_chat.chat_element_by_text(message).contains_text(sent_time):
self.errors.append('Timestamp is not displayed in 1-1 chat for the recipient')
if device_2_chat.chat_element_by_text(message).member_photo.is_element_displayed():
@ -483,7 +460,7 @@ class TestMessagesOneToOneChatMultiple(MultipleDeviceTestCase):
# 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_with_user(recipient['username']).click()
# 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)
@ -622,7 +599,7 @@ class TestMessagesOneToOneChatSingle(SingleDeviceTestCase):
wallet_view.set_currency(user_currency)
wallet_view.get_back_to_home_view()
chat = home_view.get_chat_with_user(recipient_user_name).click()
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)
@ -662,7 +639,7 @@ class TestMessagesOneToOneChatSingle(SingleDeviceTestCase):
# wallet.receive_transaction(asset_name='STT', recipient=recipient_user_name, amount=request_amount)
#
# wallet.get_back_to_home_view()
# chat = home_view.get_chat_with_user(recipient_user_name).click()
# 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):
@ -691,7 +668,7 @@ class TestMessagesOneToOneChatSingle(SingleDeviceTestCase):
chat.get_back_to_home_view()
profile = home.profile_button.click()
profile.switch_network('Mainnet with upstream RPC')
home.get_chat_with_user('#' + chat_name).click()
home.get_chat('#' + chat_name).click()
sign_in.just_fyi('install free sticker pack and use it in public chat')
chat.show_stickers_button.click()
@ -742,3 +719,26 @@ class TestMessagesOneToOneChatSingle(SingleDeviceTestCase):
chat = home.add_contact(ens_user['ens'])
if not chat.element_by_text("@" + ens_user['ens']).is_element_displayed():
self.driver.fail('Wrong user is resolved from username when starting 1-1 chat.')
@marks.testrail_id(5326)
@marks.critical
def test_offline_status(self):
sign_in = SignInView(self.driver)
home_view = sign_in.create_user()
home_view.airplane_mode_button.click()
chat = home_view.add_contact(transaction_senders['C']['public_key'])
chat.element_by_text('Offline').wait_for_visibility_of_element(15)
if chat.connection_status.text != 'Offline':
self.errors.append('Offline status is not shown in 1-1 chat')
chat.get_back_to_home_view()
if home_view.connection_status.text != 'Offline':
self.errors.append('Offline status is not shown in home screen')
public_chat = home_view.join_public_chat(home_view.get_public_chat_name())
if public_chat.connection_status.text != 'Offline':
self.errors.append('Offline status is not shown in a public chat')
self.errors.verify_no_errors()

View File

@ -107,7 +107,7 @@ class TestPublicChatMultipleDevice(MultipleDeviceTestCase):
if not home_1.home_button.public_unread_messages.is_element_displayed():
self.errors.append('New messages public chat badge is not shown on Home button')
chat_element = home_1.get_chat_with_user('#' + chat_name)
chat_element = home_1.get_chat('#' + chat_name)
if not chat_element.new_messages_public_chat.is_element_displayed():
self.errors.append('New messages counter is not shown in public chat')

View File

@ -159,17 +159,3 @@ class TestBrowsing(SingleDeviceTestCase):
status_test_dapp.find_full_text('Sign message')
status_test_dapp.browser_refresh_page_button.click()
status_test_dapp.find_full_text('defaultAccount')
@marks.testrail_id(5785)
@marks.critical
@marks.skip
#TODO: needs to be updated; skipped due to changing DApps in Discover, also not possible to use search
# (no suggestions on emulators)
def test_can_open_dapp_from_dapp_store(self):
sign_in = SignInView(self.driver)
home = sign_in.create_user()
daap_view = home.dapp_tab_button.click()
dapp_store_view = daap_view.discover_dapps_button.click()
dapp_store_view.element_by_text_part("CryptoKitties").click()
if not dapp_store_view.element_by_text_part("Start", "text").is_element_displayed(20):
self.driver.fail("Failed to access CryptoKitties Dapp from Discover Dapp store")

View File

@ -10,8 +10,6 @@ class TestDeepLinks(SingleDeviceTestCase):
@marks.testrail_id(5396)
@marks.high
@marks.skip
# TODO: uncomment after https://github.com/status-im/status-react/issues/10083 will be implemented in app
def test_open_public_chat_using_deep_link(self):
sign_in_view = SignInView(self.driver)
sign_in_view.create_user()
@ -28,13 +26,13 @@ class TestDeepLinks(SingleDeviceTestCase):
@marks.testrail_id(5441)
@marks.medium
@marks.skip
# TODO: uncomment after https://github.com/status-im/status-react/issues/10083 will be implemented in app
# TODO: skipped because universal links won't work in emulators regardless of OS version
def test_open_user_profile_using_deep_link(self):
sign_in_view = SignInView(self.driver)
sign_in_view.create_user()
for user_ident in ens_user['ens'], basic_user['public_key']:
self.driver.close_app()
deep_link = 'https://get.status.im/user/%s' % user_ident
deep_link = 'https://join.status.im/user/%s' % user_ident
sign_in_view.open_weblink_and_login(deep_link)
chat_view = sign_in_view.get_chat_view()
for text in basic_user['username'], 'Add to contacts':
@ -44,7 +42,7 @@ class TestDeepLinks(SingleDeviceTestCase):
@marks.testrail_id(5442)
@marks.medium
@marks.skip
# TODO: uncomment after https://github.com/status-im/status-react/issues/10083 will be implemented in app
# TODO: skipped because universal links won't work in emulators regardless of OS version
def test_open_dapp_using_deep_link(self):
sign_in_view = SignInView(self.driver)
sign_in_view.create_user()
@ -62,7 +60,7 @@ class TestDeepLinks(SingleDeviceTestCase):
@marks.testrail_id(5780)
@marks.medium
@marks.skip
# TODO: uncomment after https://github.com/status-im/status-react/issues/10083 will be implemented in app
# TODO: skipped because universal links won't work in emulators regardless of OS version
def test_open_own_user_profile_using_deep_link(self):
sign_in_view = SignInView(self.driver)
sign_in_view.recover_access(passphrase=basic_user['passphrase'])
@ -78,7 +76,7 @@ class TestDeepLinks(SingleDeviceTestCase):
@marks.testrail_id(5781)
@marks.medium
@marks.skip
# TODO: uncomment after https://github.com/status-im/status-react/issues/10083 will be implemented in app
# TODO: skipped because universal links won't work in emulators regardless of OS version
def test_deep_link_with_invalid_user_public_key(self):
sign_in_view = SignInView(self.driver)
sign_in_view.create_user()

View File

@ -154,18 +154,6 @@ class TestTransactionDApp(SingleDeviceTestCase):
if values_in_logcat:
self.driver.fail(values_in_logcat)
@marks.testrail_id(5355)
@marks.medium
def test_onboarding_screen_when_requesting_tokens_for_new_account(self):
signin_view = SignInView(self.driver)
home_view = signin_view.create_user()
status_test_dapp = home_view.open_status_test_dapp()
status_test_dapp.wait_for_d_aap_to_load()
status_test_dapp.assets_button.click()
send_transaction_view = status_test_dapp.request_stt_button.click()
if not send_transaction_view.onboarding_message.is_element_displayed():
self.driver.fail('It seems onboarding screen is not shown.')
@marks.testrail_id(5677)
@marks.high
def test_onboarding_screen_when_requesting_tokens_for_recovered_account(self):
@ -178,29 +166,6 @@ class TestTransactionDApp(SingleDeviceTestCase):
if not send_transaction_view.onboarding_message.is_element_displayed():
self.driver.fail('It seems onboarding screen is not shown.')
@marks.testrail_id(5380)
@marks.high
def test_user_can_complete_tx_to_dapp_when_onboarding_via_dapp_completed(self):
user = transaction_recipients['G']
signin_view = SignInView(self.driver)
home_view = signin_view.recover_access(passphrase=user['passphrase'])
status_test_dapp = home_view.open_status_test_dapp()
status_test_dapp.wait_for_d_aap_to_load()
status_test_dapp.assets_button.click()
send_transaction_view = status_test_dapp.request_stt_button.click()
if not send_transaction_view.onboarding_message.is_element_displayed():
self.driver.fail('It seems onborading screen is not shown.')
send_transaction_view.complete_onboarding()
if not send_transaction_view.sign_with_password.is_element_displayed():
self.driver.fail('It seems transaction sign screen is not shown.')
send_transaction_view.sign_transaction()
if not status_test_dapp.assets_button.is_element_displayed():
self.driver.fail('It seems users was not redirected to Status DAPP screen.')
@marks.testrail_id(5685)
@marks.medium
@marks.skip

View File

@ -586,10 +586,10 @@ class TestTransactionWalletMultipleDevice(MultipleDeviceTestCase):
send_transaction.sign_transaction()
wallet_1.home_button.click()
home_1.get_chat_with_user(recipient['username']).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_with_user(sender['username']).click()
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

@ -59,8 +59,8 @@ class AbstractTestCase:
desired_caps['build'] = pytest_config_global['build']
desired_caps['name'] = test_suite_data.current_test.name
desired_caps['platformName'] = 'Android'
desired_caps['appiumVersion'] = '1.9.1'
desired_caps['platformVersion'] = '8.0'
desired_caps['appiumVersion'] = '1.16.0'
desired_caps['platformVersion'] = '10.0'
desired_caps['deviceName'] = 'Android GoogleAPI Emulator'
desired_caps['deviceOrientation'] = "portrait"
desired_caps['commandTimeout'] = 600

View File

@ -167,6 +167,11 @@ class BaseElement(object):
attribute_state = attribute_value
return attribute_state
# Method-helper for renew screenshots in case if changed
def save_new_screenshot_of_element(self, full_path_to_file):
screen = Image.open(BytesIO(base64.b64decode(self.find_element().screenshot_as_base64)))
screen.save(full_path_to_file)
def is_element_image_equals_template(self, file_name: str = ''):
if file_name:
self.template = file_name

View File

@ -43,6 +43,10 @@ class AllowButton(BaseButton):
except NoSuchElementException:
pass
class SearchEditBox(BaseEditBox):
def __init__(self, driver):
super(SearchEditBox, self).__init__(driver)
self.locator = self.Locator.text_selector("Search or type web address")
class DenyButton(BaseButton):
def __init__(self, driver):
@ -305,6 +309,11 @@ class OpenInStatusButton(BaseButton):
self.swipe_to_web_element()
self.wait_for_element().click()
class StatusInBackgroundButton(BaseButton):
def __init__(self, driver):
super(StatusInBackgroundButton, self).__init__(driver)
self.locator = self.Locator.xpath_selector('//*[contains(@content-desc,"Status")]')
class OkGotItButton(BaseButton):
def __init__(self,driver):
@ -360,8 +369,11 @@ class BaseView(object):
self.ok_got_it_button = OkGotItButton(self.driver)
self.progress_bar = ProgressBar(self.driver)
self.cross_icon_iside_welcome_screen_button = CrossIconInWelcomeScreen(self.driver)
self.status_in_background_button = StatusInBackgroundButton(self.driver)
# external browser
self.search_in_google_edit_box = SearchEditBox(self.driver)
self.open_in_status_button = OpenInStatusButton(self.driver)
self.apps_button = AppsButton(self.driver)
@ -615,7 +627,7 @@ class BaseView(object):
def share_via_messenger(self):
self.element_by_text('Messages').click()
self.element_by_text('NEW MESSAGE').click()
self.element_by_text('New message').click()
self.send_as_keyevent('+0100100101')
self.confirm()
@ -652,7 +664,7 @@ class BaseView(object):
def toggle_mobile_data(self):
self.driver.start_activity(app_package='com.android.settings', app_activity='.Settings')
network_and_internet = self.element_by_text('Network & Internet')
network_and_internet = self.element_by_text('Network & internet')
network_and_internet.wait_for_visibility_of_element()
network_and_internet.click()
toggle = self.element_by_accessibility_id('WiFi')
@ -664,7 +676,13 @@ class BaseView(object):
def open_universal_web_link(self, deep_link):
start_web_browser(self.driver)
self.send_as_keyevent(deep_link)
self.search_in_google_edit_box.send_keys(deep_link)
self.confirm()
self.open_in_status_button.click()
# Method-helper
def write_page_source_to_file(self, full_path_to_file):
string_source = self.driver.page_source
source = open(full_path_to_file, "a+")
source.write(string_source)

View File

@ -473,38 +473,6 @@ class ChatView(BaseView):
self.profile_block_contact = ProfileBlockContactButton(self.driver)
self.profile_add_to_contacts = ProfileAddToContactsButton(self.driver)
def wait_for_syncing_complete(self):
self.driver.info('Waiting for syncing complete:')
while True:
try:
sync = self.find_text_part('Syncing', 10)
self.driver.info(sync.text)
except TimeoutException:
break
def wait_for_message_in_one_to_one_chat(self, expected_message: str, errors: list, wait_time: int = 20):
try:
element = ChatElementByText(self.driver, expected_message)
element.wait_for_element(wait_time)
except TimeoutException:
errors.append('Message with text "%s" was not received' % expected_message)
def wait_for_messages(self, username: str, expected_messages: list, errors: list, wait_time: int = 30):
expected_messages = expected_messages if type(expected_messages) == list else [expected_messages]
repeat = 0
received_messages = list()
while repeat <= wait_time:
for message in expected_messages:
if self.element_starts_with_text(message, 'text').is_element_present(1):
received_messages.append(message)
if not set(expected_messages) - set(received_messages):
break
time.sleep(3)
repeat += 3
if set(expected_messages) - set(received_messages):
errors.append('Not received messages from user %s: "%s"' % (username, ', '.join(
[i for i in list(set(expected_messages) - set(received_messages))])))
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

Binary file not shown.

Before

Width:  |  Height:  |  Size: 2.0 KiB

After

Width:  |  Height:  |  Size: 2.1 KiB

View File

@ -21,6 +21,10 @@ class DeleteChatButton(BaseButton):
super(DeleteChatButton, self).__init__(driver)
self.locator = self.Locator.accessibility_id("delete-chat-button")
class ClearHistoryButton(BaseButton):
def __init__(self, driver):
super(ClearHistoryButton, self).__init__(driver)
self.locator = self.Locator.accessibility_id("clear-history-button")
class StartNewChatButton(BaseButton):
def __init__(self, driver):
@ -161,6 +165,7 @@ class HomeView(BaseView):
self.invite_friends_button = InviteFriendsButton(self.driver)
self.chats_menu_invite_friends_button = ChatsMenuInviteFriendsButton(self.driver)
self.delete_chat_button = DeleteChatButton(self.driver)
self.clear_history_button = ClearHistoryButton(self.driver)
def wait_for_syncing_complete(self):
self.driver.info('Waiting for syncing complete:')
@ -171,7 +176,7 @@ class HomeView(BaseView):
except TimeoutException:
break
def get_chat_with_user(self, username):
def get_chat(self, username):
return ChatElement(self.driver, username[:25])
def add_contact(self, public_key, add_in_contacts=True):
@ -228,6 +233,13 @@ class HomeView(BaseView):
return status_test_dapp
def delete_chat_long_press(self, username):
self.get_chat_with_user(username).long_press_element()
self.get_chat(username).long_press_element()
self.delete_chat_button.click()
self.delete_button.click()
def clear_chat_long_press(self, username):
self.get_chat(username).long_press_element()
self.clear_history_button.click()
from views.chat_view import ClearButton
self.clear_button = ClearButton(self.driver)
self.clear_button.click()

View File

@ -232,6 +232,7 @@ class SignInView(BaseView):
return self.get_home_view()
def sign_in(self, password=common_password):
self.multi_account_on_login_button.wait_for_visibility_of_element(5)
self.multi_account_on_login_button.click()
self.password_input.set_value(password)
self.sign_in_button.click()