e2e: upgrade - commands, audiomessage

Signed-off-by: Churikova Tetiana <churikova.tm@gmail.com>
This commit is contained in:
Churikova Tetiana 2021-05-03 16:08:29 +02:00
parent dd0031f68e
commit ec528f98cc
No known key found for this signature in database
GPG Key ID: 0D4EA7B33B47E6D8
6 changed files with 80 additions and 42 deletions

View File

@ -1050,7 +1050,7 @@ class TestChatManagementMultipleDevice(MultipleDeviceTestCase):
@marks.testrail_id(695771) @marks.testrail_id(695771)
@marks.medium @marks.medium
def test_open_user_profile_long_press_on_message(self): def test_activity_center_group_chats_trusted_contacts(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])
message_from_sender = "Message sender" message_from_sender = "Message sender"

View File

@ -1,4 +1,4 @@
from tests import marks from tests import marks, pytest_config_global
from tests.base_test_case import SingleDeviceTestCase, MultipleDeviceTestCase from tests.base_test_case import SingleDeviceTestCase, MultipleDeviceTestCase
from tests.users import upgrade_users from tests.users import upgrade_users
from views.sign_in_view import SignInView from views.sign_in_view import SignInView
@ -8,7 +8,7 @@ import views.upgrade_dbs.chats.data as chat_data
class TestUpgradeApplication(SingleDeviceTestCase): class TestUpgradeApplication(SingleDeviceTestCase):
@marks.testrail_id(6284) @marks.testrail_id(6284)
def test_unread_previews_public_chat_upgrade(self): def test_unread_previews_public_chat_version_upgrade(self):
sign_in = SignInView(self.driver) sign_in = SignInView(self.driver)
unread_one_to_one_name, unread_public_name = 'All Whopping Dassierat', '#before-upgrade' unread_one_to_one_name, unread_public_name = 'All Whopping Dassierat', '#before-upgrade'
chats = chat_data.chats chats = chat_data.chats
@ -20,16 +20,15 @@ class TestUpgradeApplication(SingleDeviceTestCase):
old_version = profile.app_version_text.text old_version = profile.app_version_text.text
profile.upgrade_app() profile.upgrade_app()
self.app = sign_in.driver.launch_app()
home = sign_in.sign_in() home = sign_in.sign_in()
home.profile_button.click() home.profile_button.click()
profile.about_button.click() profile.about_button.click()
new_version = profile.app_version_text.text new_version = profile.app_version_text.text
# Commented for releases only if 'release' in pytest_config_global['apk_upgrade']:
# if new_version == old_version: if new_version == old_version:
# self.errors.append('Upgraded app version is %s vs base version is %s ' % (new_version, old_version)) self.errors.append('Upgraded app version is %s vs base version is %s ' % (new_version, old_version))
home.home_button.click() home.home_button.click()
home.just_fyi("Check chat previews") home.just_fyi("Check chat previews")
@ -101,8 +100,7 @@ class TestUpgradeApplication(SingleDeviceTestCase):
tag_message = public_chat.chat_element_by_text(messages['tag']) tag_message = public_chat.chat_element_by_text(messages['tag'])
if tag_message.emojis_below_message(emoji='love', own=True) !=1: if tag_message.emojis_below_message(emoji='love', own=True) !=1:
self.errors.append("Emojis are not displayed below tag message!") self.errors.append("Emojis are not displayed below tag message!")
if not public_chat.sticker_message.is_element_displayed(): public_chat.sticker_message.scroll_to_element()
self.errors.append("Sticker is not displayed!")
public_chat.element_starts_with_text(messages['tag']).click() public_chat.element_starts_with_text(messages['tag']).click()
public_chat.history_start_icon.wait_for_visibility_of_element(20) public_chat.history_start_icon.wait_for_visibility_of_element(20)
if not public_chat.user_name_text.text == messages['tag']: if not public_chat.user_name_text.text == messages['tag']:
@ -122,14 +120,19 @@ class TestUpgradeApplication(SingleDeviceTestCase):
@marks.upgrade @marks.upgrade
class TestUpgradeMultipleApplication(MultipleDeviceTestCase): class TestUpgradeMultipleApplication(MultipleDeviceTestCase):
@marks.testrail_id(6285) @marks.testrail_id(695783)
@marks.skip def test_commands_audio_backward_compatibility_upgrade(self):
def test_unread_previews_public_chat_upgrade(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])
device_2.create_user() device_2_home = device_2.create_user()
device_2_public_key = device_2_home.get_public_key_and_username()
device_2_home.home_button.click()
user = upgrade_users['chats']
device_1.just_fyi("Import db, upgrade") device_1.just_fyi("Import db, upgrade")
home = device_1.import_db(user=upgrade_users['chats'], import_db_folder_name='chats') home = device_1.import_db(user=user, import_db_folder_name='chats')
home.upgrade_app()
home = device_1.sign_in()
device_1.just_fyi("**Check messages in 1-1 chat**") device_1.just_fyi("**Check messages in 1-1 chat**")
command_username = 'Royal Defensive Solenodon' command_username = 'Royal Defensive Solenodon'
@ -140,10 +143,35 @@ class TestUpgradeMultipleApplication(MultipleDeviceTestCase):
chat.scroll_to_start_of_history() chat.scroll_to_start_of_history()
if chat.audio_message_in_chat_timer.text != messages['audio']['length']: if chat.audio_message_in_chat_timer.text != messages['audio']['length']:
self.errors.append('Timer is not shown for audiomessage') self.errors.append('Timer is not shown for audiomessage')
import time device_1.just_fyi('Check command messages')
time.sleep(100) commnad_messages = chat_data.chats[command_username]['commands']
#device_1.just_fyi("Check messages in Activity centre") for key in commnad_messages:
# device_2.just_fyi("Create new multiaccount and send new message to device 1") device_1.just_fyi('Checking %s command messages' % key)
# device_1.just_fyi("Respond to message and check it is shown on device 2") amount = commnad_messages[key]['value']
chat.element_by_text(amount).scroll_to_element()
if 'incoming' in key:
message = chat.get_transaction_message_by_asset(amount, incoming=True)
else:
message = chat.get_transaction_message_by_asset(amount, incoming=False)
if not message.transaction_status != commnad_messages[key]['status']:
self.errors.append('%s case transaction status is not equal expected after upgrade' % key)
if key == 'outgoing_STT_sign':
if not message.sign_and_send.is_element_displayed():
self.errors.append('No "sign and send" option is shown for %s' % key)
chat.home_button.click()
#TODO: blocked until resolving importing unread messages to Activity centre
# device_1.just_fyi("Check messages in Activity centre")
device_2.just_fyi("Create upgraded and non-upgraded app can exchange messages")
message, response = "message after upgrade", "response"
device_1_chat = home.add_contact(device_2_public_key)
device_1_chat.send_message(message)
device_2_chat = device_2_home.get_chat(user['username']).click()
if not device_2_chat.chat_element_by_text(message).is_element_displayed():
self.errors.append("Message sent from upgraded app is not shown on previous release!")
device_2_chat.send_message(response)
if not device_1_chat.chat_element_by_text(response).is_element_displayed():
self.errors.append("Message sent from previous release is not shown on upgraded app!")
self.errors.verify_no_errors() self.errors.verify_no_errors()

View File

@ -43,6 +43,7 @@ upgrade_users['chats'] = dict()
upgrade_users['chats']['passphrase'] = 'identify level pink lift choose winner hour onion style festival rather salmon' upgrade_users['chats']['passphrase'] = 'identify level pink lift choose winner hour onion style festival rather salmon'
upgrade_users['chats']['public_key'] = '0x045d8a344ffee0c5ce187d0248a9b8ffc4a12493c9d9e8b9a395f38' \ upgrade_users['chats']['public_key'] = '0x045d8a344ffee0c5ce187d0248a9b8ffc4a12493c9d9e8b9a395f38' \
'825ebe55ac2350d9e7090e39e6c8d7020aaa799aefe563f1db5b6151370eae246558772ad9e' '825ebe55ac2350d9e7090e39e6c8d7020aaa799aefe563f1db5b6151370eae246558772ad9e'
upgrade_users['chats']['username']= 'Rapid Gleeful Cheetah'
wallet_users = dict() wallet_users = dict()

View File

@ -584,6 +584,7 @@ class BaseView(object):
def upgrade_app(self): def upgrade_app(self):
self.driver.info("**Upgrading apk to apk_upgrade**") self.driver.info("**Upgrading apk to apk_upgrade**")
self.driver.install_app(pytest_config_global['apk_upgrade'], replace=True) self.driver.install_app(pytest_config_global['apk_upgrade'], replace=True)
self.app = self.driver.launch_app()
def search_by_keyword(self, keyword): def search_by_keyword(self, keyword):
self.driver.info('**Search for** `%s`' % keyword) self.driver.info('**Search for** `%s`' % keyword)

View File

@ -301,8 +301,10 @@ class PreviewMessage(ChatElementByText):
class TransactionMessage(ChatElementByText): class TransactionMessage(ChatElementByText):
def __init__(self, driver, text:str): def __init__(self, driver, text:str, transaction_value):
super().__init__(driver, text=text) super().__init__(driver, text=text)
if transaction_value:
self.xpath = "//*[starts-with(@text,'%s')]/../*[@text='%s']/ancestor::android.view.ViewGroup[@content-desc='chat-item']" % (text, transaction_value)
# Common statuses for incoming and outgoing transactions # Common statuses for incoming and outgoing transactions
self.address_requested = self.get_translation_by_key("address-requested") self.address_requested = self.get_translation_by_key("address-requested")
self.confirmed = self.get_translation_by_key("status-confirmed") self.confirmed = self.get_translation_by_key("status-confirmed")
@ -331,8 +333,8 @@ class TransactionMessage(ChatElementByText):
class OutgoingTransaction(TransactionMessage): class OutgoingTransaction(TransactionMessage):
def __init__(self, driver, account_name: str): def __init__(self, driver, account_name: str, transaction_value):
super().__init__(driver, text="↑ Outgoing transaction") super().__init__(driver, text="↑ Outgoing transaction", transaction_value=transaction_value)
self.account_name = account_name self.account_name = account_name
self.address_request_accepted = self.get_translation_by_key("address-request-accepted") self.address_request_accepted = self.get_translation_by_key("address-request-accepted")
self.address_received = self.get_translation_by_key("address-received") self.address_received = self.get_translation_by_key("address-received")
@ -355,8 +357,8 @@ class OutgoingTransaction(TransactionMessage):
class IncomingTransaction(TransactionMessage): class IncomingTransaction(TransactionMessage):
def __init__(self, driver, account_name: str): def __init__(self, driver, account_name: str, transaction_value):
super().__init__(driver, text="↓ Incoming transaction") super().__init__(driver, text="↓ Incoming transaction", transaction_value=transaction_value)
self.account_name = account_name self.account_name = account_name
self.shared_account = "Shared '%s'" % account_name self.shared_account = "Shared '%s'" % account_name
@ -490,17 +492,17 @@ class ChatView(BaseView):
self.timeline_own_account_photo = Button(self.driver, accessibility_id="own-account-photo") self.timeline_own_account_photo = Button(self.driver, accessibility_id="own-account-photo")
def get_outgoing_transaction(self, account=None): def get_outgoing_transaction(self, account=None, transaction_value=None) -> object:
if account is None: if account is None:
account = self.status_account_name account = self.status_account_name
return OutgoingTransaction(self.driver, account) return OutgoingTransaction(self.driver, account, transaction_value)
def get_incoming_transaction(self, account=None): def get_incoming_transaction(self, account=None, transaction_value=None) -> object:
if account is None: if account is None:
account = self.status_account_name account = self.status_account_name
return IncomingTransaction(self.driver, account) return IncomingTransaction(self.driver, account, transaction_value)
def get_preview_message_by_text(self, text=None): def get_preview_message_by_text(self, text=None) -> object:
self.driver.info('**Getting preview message for link:%s**' % text) self.driver.info('**Getting preview message for link:%s**' % text)
return PreviewMessage(self.driver, text) return PreviewMessage(self.driver, text)
@ -650,7 +652,7 @@ class ChatView(BaseView):
element.wait_for_invisibility_of_element() element.wait_for_invisibility_of_element()
def scroll_to_start_of_history(self, depth=20): def scroll_to_start_of_history(self, depth=20):
self.driver.info('*Scrolling *') self.driver.info('*Scrolling th the start of chat history*')
for _ in range(depth): for _ in range(depth):
try: try:
return self.history_start_icon.find_element() return self.history_start_icon.find_element()
@ -719,6 +721,13 @@ class ChatView(BaseView):
self.first_image_from_gallery.click() self.first_image_from_gallery.click()
self.timeline_send_my_status_button.click() self.timeline_send_my_status_button.click()
def get_transaction_message_by_asset(self, transaction_value, incoming=True) -> object:
if incoming:
transaction_message = self.get_incoming_transaction(account=None, transaction_value=transaction_value)
else:
transaction_message = self.get_outgoing_transaction(account=None, transaction_value=transaction_value)
return transaction_message
@staticmethod @staticmethod
def get_resolved_chat_key(username, chat_key): def get_resolved_chat_key(username, chat_key):
return '%s%s%s' % (username, chat_key[:6], chat_key[-4:]) return '%s%s%s' % (username, chat_key[:6], chat_key[-4:])

View File

@ -1,3 +1,4 @@
from tests import transl
chats = { chats = {
'All Whopping Dassierat': { 'All Whopping Dassierat': {
'preview': 'unread 1-1', 'preview': 'unread 1-1',
@ -38,9 +39,6 @@ chats = {
}, },
'Thoughtful Stupendous Graywolf': { 'Thoughtful Stupendous Graywolf': {
'preview':'hey Thoughtful Stupendous Graywolf !', 'preview':'hey Thoughtful Stupendous Graywolf !',
'messages':{
},
}, },
'Royal Defensive Solenodon': { 'Royal Defensive Solenodon': {
'preview':'Request address for transaction accepted', 'preview':'Request address for transaction accepted',
@ -49,27 +47,28 @@ chats = {
'length':'00:10', 'length':'00:10',
'timestamp' : '1:02 PM' 'timestamp' : '1:02 PM'
}, },
},
'commands':{
'incoming_ETH_shared':{ 'incoming_ETH_shared':{
'value':'0.01 ETH', 'value':'0.01 ETH',
'status': "Shared 'Ethereum account'" 'status': "Shared 'Ethereum account'"
}, },
'incoming_ETH_confirmed': { 'incoming_ETH_confirmed': {
'value': '0.1 ETH', 'value': '0.1 ETH',
'status': "Confirmed" 'status': transl["status-confirmed"]
}, },
'incoming_ETH_declined': { 'incoming_ETH_declined': {
'value': '20 ETH', 'value': '20 ETH',
'status': "Transaction declined" 'status': transl["transaction-declined"]
}, },
'incoming_STT_confirmed': { 'incoming_STT_confirmed': {
'value': '200 STT', 'value': '200 STT',
'status': "Confirmed" 'status': transl["status-confirmed"]
}, },
'outgoing_STT_sign': { 'outgoing_STT_sign': {
'value': '200 STT', 'value': '5 STT',
'status': "Address request accepted", 'status': transl["address-request-accepted"],
'action': 'Sign and send'
}, },
} },
} }
} }