e2e: new tests

Signed-off-by: Churikova Tetiana <churikova.tm@gmail.com>
This commit is contained in:
Churikova Tetiana 2020-12-16 18:08:57 +01:00
parent 9fe7ddaf0b
commit 98a8359db3
No known key found for this signature in database
GPG Key ID: 0D4EA7B33B47E6D8
9 changed files with 71 additions and 25 deletions

View File

@ -244,8 +244,7 @@ class TestProfileSingleDevice(SingleDeviceTestCase):
@marks.testrail_id(5502)
@marks.critical
def test_can_add_existing_ens(self):
sign_in = SignInView(self.driver)
home = sign_in.recover_access(ens_user['passphrase'])
home = SignInView(self.driver).recover_access(ens_user['passphrase'])
home.just_fyi('switching to Mainnet')
profile = home.profile_button.click()
@ -256,12 +255,10 @@ class TestProfileSingleDevice(SingleDeviceTestCase):
dapp_view.just_fyi('check if your name can be added via "ENS usernames" in Profile')
dapp_view.element_by_text('Get started').click()
dapp_view.ens_name.set_value(ens_user['ens'])
if not dapp_view.element_by_text_part('is owned by you').is_element_displayed():
self.errors.append('Owned username is not shown in ENS Dapp.')
dapp_view.check_ens_name.click()
if not dapp_view.element_by_text_part('Username added').is_element_displayed():
if not dapp_view.find_element_by_translation_id('ens-saved-title').is_element_displayed():
self.errors.append('No message "Username added" after resolving own username')
dapp_view.element_by_text('Ok, got it').click()
dapp_view.find_element_by_translation_id("ens-got-it").click()
dapp_view.just_fyi('check that after adding username is shown in "ENS usernames" and profile')
if not dapp_view.element_by_text(ens_user['ens']).is_element_displayed():
@ -348,7 +345,6 @@ class TestProfileSingleDevice(SingleDeviceTestCase):
sign_in_view.profile_button.click()
profile_view.logout()
self.driver.reset()
# sign_in_view.accept_agreements()
sign_in_view.recover_access(recovery_phrase)
wallet_view = sign_in_view.wallet_button.click()
wallet_view.set_up_wallet()
@ -927,6 +923,46 @@ class TestProfileMultipleDevice(MultipleDeviceTestCase):
self.errors.verify_no_errors()
@marks.testrail_id(6332)
@marks.medium
def test_disable_use_history_node(self):
self.create_drivers(2)
home_1, home_2 = SignInView(self.drivers[0]).create_user(), SignInView(self.drivers[1]).create_user()
profile_1 = home_1.profile_button.click()
home_2.just_fyi('send several messages to public channel')
public_chat_name = home_2.get_random_chat_name()
message, message_no_history = 'test_message', 'history node is disabled'
public_chat_2 = home_2.join_public_chat(public_chat_name)
public_chat_2.send_message(message)
profile_1.just_fyi('disable use_history_node and check that no history is fetched but you can still send messages')
profile_1.sync_settings_button.click()
profile_1.mail_server_button.click()
profile_1.use_history_node_button.click()
profile_1.home_button.click()
public_chat_1 = home_1.join_public_chat(public_chat_name)
if public_chat_1.chat_element_by_text(message).is_element_displayed(30):
self.errors.append('Chat history was fetched when use_history_node is disabled')
public_chat_1.send_message(message_no_history)
if not public_chat_2.chat_element_by_text(message_no_history).is_element_displayed(30):
self.errors.append('Message sent when use_history_node is disabled was not received')
public_chat_1.profile_button.click()
profile_1.relogin()
home_1.get_chat('#%s'%public_chat_name).click()
if public_chat_1.chat_element_by_text(message).is_element_displayed(30):
self.drivers[0].fail('History was fetched after relogin when use_history_node is disabled')
profile_1.just_fyi('enable use_history_node and check that history is fetched')
home_1.profile_button.click()
profile_1.sync_settings_button.click()
profile_1.mail_server_button.click()
profile_1.use_history_node_button.click()
profile_1.home_button.click(desired_view='chat')
if not public_chat_1.chat_element_by_text(message).is_element_displayed(30):
self.errors.append('History was not fetched after enabling use_history_node')
self.errors.verify_no_errors()
@marks.testrail_id(5762)
@marks.high
def test_pair_devices_sync_one_to_one_contacts_nicknames_public_chat(self):

View File

@ -130,8 +130,9 @@ class TestCommandsMultipleDevices(MultipleDeviceTestCase):
self.errors.append('Was not redirected to transaction history after tapping on PN')
wallet_1.home_button.click(desired_view="chat")
home_1.just_fyi("Check 'Confirmed' state for sender")
chat_1_sender_message.transaction_status.wait_for_element_text('Confirmed')
home_1.just_fyi("Check 'Confirmed' state for sender and receiver")
wallet_2.status_in_background_button.click()
[message.transaction_status.wait_for_element_text('Confirmed') for message in (chat_1_sender_message, chat_2_receiver_message)]
# TODO: should be added PNs for receiver agter getting more stable feature
self.errors.verify_no_errors()
@ -198,11 +199,12 @@ class TestCommandsMultipleDevices(MultipleDeviceTestCase):
self.network_api.wait_for_confirmation_of_transaction(sender['address'], amount, confirmations=15, token=True)
chat_2.toggle_airplane_mode()
chat_2.connection_status.wait_for_invisibility_of_element(30)
chat_2_sender_message.transaction_status.wait_for_element_text('Confirmed')
try:
self.network_api.find_transaction_by_unique_amount(recipient_address[2:], amount, token=True)
except Failed as e:
self.errors.append(e.msg)
[message.transaction_status.wait_for_element_text('Confirmed') for message in
(chat_2_sender_message, chat_1_request_message)]
self.errors.verify_no_errors()
@marks.testrail_id(6265)

View File

@ -76,8 +76,10 @@ class TestCommandsMultipleDevices(MultipleDeviceTestCase):
self.network_api.wait_for_confirmation_of_transaction(sender['address'], amount)
wallet_1.home_button.click(desired_view='chat')
home_1.just_fyi("Check 'Confirmed' state for sender")
chat_1_sender_message.transaction_status.wait_for_element_text('Confirmed')
home_1.just_fyi("Check 'Confirmed' state for sender and receiver")
[message.transaction_status.wait_for_element_text('Confirmed') for message in
(chat_1_sender_message, chat_2_receiver_message)]
self.errors.verify_no_errors()
@marks.testrail_id(6294)
@ -148,7 +150,7 @@ class TestCommandsMultipleDevices(MultipleDeviceTestCase):
self.network_api.wait_for_confirmation_of_transaction(sender['address'], amount, token=True)
chat_2.toggle_airplane_mode()
chat_2.connection_status.wait_for_invisibility_of_element(60)
chat_2_sender_message.transaction_status.wait_for_element_text('Confirmed')
[message.transaction_status.wait_for_element_text('Confirmed') for message in (chat_2_sender_message, chat_1_request_message)]
self.errors.verify_no_errors()

View File

@ -146,14 +146,12 @@ class TestBrowsing(SingleDeviceTestCase):
@marks.testrail_id(5390)
@marks.high
@marks.skip
# TODO: failed due to #11544 and #11545
def test_delete_close_all_tabs(self):
home_view = SignInView(self.driver).create_user()
dapp_view = home_view.dapp_tab_button.click()
urls = {
'google.com': 'Google',
'status.im': 'Status',
'status.im': 'Status - Private',
'bbc.com' : 'bbc.com'
}
for url in urls:

View File

@ -48,7 +48,7 @@ class BaseElement(object):
return cls(MobileBy.XPATH, xpath_expression)
@classmethod
def translation_id_selector(cls, id, suffix='', uppercase = False):
def translation_id(cls, id, suffix='', uppercase = False):
text = transl[id]
if uppercase:
text = transl[id].upper()

View File

@ -598,7 +598,7 @@ class BaseView(object):
def find_element_by_translation_id(self, id, element_type='base', uppercase=False):
self.driver.info("Looking element by id: '%s'" % id)
element = self.element_types[element_type](self.driver)
element.locator = element.Locator.translation_id_selector(id, uppercase=uppercase)
element.locator = element.Locator.translation_id(id, uppercase=uppercase)
return element
def wait_for_element_starts_with_text(self, text, wait_time=60):

View File

@ -347,7 +347,7 @@ class FirstElementFromGalleryButton(BaseButton):
class ViewProfileButton(BaseButton):
def __init__(self, driver):
super(ViewProfileButton, self).__init__(driver)
self.locator = self.Locator.translation_id_selector('view-profile')
self.locator = self.Locator.translation_id('view-profile')
def navigate(self):
return ChatView(self.driver)

View File

@ -404,16 +404,23 @@ class MailServerAddressInput(BaseEditBox):
def __init__(self, driver):
super(MailServerAddressInput, self).__init__(driver)
self.locator = self.Locator.translation_id_selector('mailserver-address',
suffix='/following-sibling::*[1]/android.widget.EditText')
self.locator = self.Locator.translation_id('mailserver-address',
suffix='/following-sibling::*[1]/android.widget.EditText')
class MailServerAutoSelectionButton(BaseButton):
def __init__(self, driver):
super(MailServerAutoSelectionButton, self).__init__(driver)
self.locator = self.Locator.xpath_selector("//*[@text='Automatic selection']/following-sibling::*[1]")
self.locator = self.Locator.translation_id("mailserver-automatic", '/following-sibling::*[1]')
class UseHistoryNodesButton(BaseButton):
def __init__(self, driver):
super(UseHistoryNodesButton, self).__init__(driver)
self.locator = self.Locator.translation_id('offline-messaging-use-history-nodes', '/following-sibling::*[1]')
class MailServerElement(BaseButton):
def __init__(self, driver, server_name):
@ -444,7 +451,7 @@ class MailServerConfirmDeleteButton(BaseButton):
def __init__(self, driver):
super(MailServerConfirmDeleteButton, self).__init__(driver)
self.locator = self.Locator.translation_id_selector("delete-mailserver", uppercase=True)
self.locator = self.Locator.translation_id("delete-mailserver", uppercase=True)
class ActiveNetworkName(BaseText):
@ -701,6 +708,7 @@ class ProfileView(BaseView):
self.mail_server_address_input = MailServerAddressInput(self.driver)
self.mail_server_connect_button = MailServerConnectButton(self.driver)
self.mail_server_auto_selection_button = MailServerAutoSelectionButton(self.driver)
self.use_history_node_button = UseHistoryNodesButton(self.driver)
self.mail_server_delete_button = MailServerDeleteButton(self.driver)
self.mail_server_confirm_delete_button = MailServerConfirmDeleteButton(self.driver)

View File

@ -89,7 +89,7 @@ class ShareUrlButton(BaseButton):
class GoBackButton(BaseButton):
def __init__(self, driver):
super(GoBackButton, self).__init__(driver)
self.locator = self.Locator.translation_id_selector('browsing-site-blocked-go-back')
self.locator = self.Locator.translation_id('browsing-site-blocked-go-back')
class OptionsButton(BaseButton):
def __init__(self, driver):
@ -109,7 +109,7 @@ class CloseAllButton(BaseButton):
class ContinueAnywayButton(BaseButton):
def __init__(self, driver):
super(ContinueAnywayButton, self).__init__(driver)
self.locator = self.Locator.translation_id_selector("continue-anyway")
self.locator = self.Locator.translation_id("continue-anyway")
class BaseWebView(BaseView):