e2e for scanning chat key and small fixes

Signed-off-by: Churikova Tetiana <churikova.tm@gmail.com>
This commit is contained in:
Churikova Tetiana 2020-06-23 11:01:06 +02:00
parent 55c606e966
commit c1583249f6
No known key found for this signature in database
GPG Key ID: 0D4EA7B33B47E6D8
5 changed files with 91 additions and 13 deletions

View File

@ -669,3 +669,83 @@ class TestMessagesOneToOneChatSingle(SingleDeviceTestCase):
self.errors.append('Offline status is not shown in a public chat')
self.errors.verify_no_errors()
@marks.testrail_id(6298)
@marks.medium
def test_can_scan_qr_with_chat_key_from_new_contact_view(self):
sign_in_view = SignInView(self.driver)
home_view = sign_in_view.recover_access(basic_user['passphrase'])
profile = home_view.profile_button.click()
profile.switch_network()
url_data = {
'ens_with_stateofus_domain_deep_link': {
'url': 'https://join.status.im/u/%s.stateofus.eth' % ens_user['ens'],
'username': ens_user['username']
},
'ens_without_stateofus_domain_deep_link': {
'url': 'https://join.status.im/u/%s' % ens_user['ens'],
'username': ens_user['username']
},
'ens_another_domain_deep_link': {
'url': 'status-im://u/%s' % ens_user['ens_another_domain'],
'username': ens_user['username']
},
'own_profile_key_deep_link': {
'url': 'https://join.status.im/u/%s' % basic_user['public_key'],
'error': "That's you"
},
'other_user_profile_key_deep_link':{
'url': 'https://join.status.im/u/%s' % ens_user['public_key'],
'username': ens_user['username']
},
'other_user_profile_key_deep_link_invalid':{
'url': 'https://join.status.im/u/%sinvalid' % ens_user['public_key'],
'error': 'Please enter or scan a valid chat key'
},
'ens_another_domain':{
'url': ens_user['ens_another_domain'],
'username': ens_user['username']
},
'own_profile_key': {
'url': basic_user['public_key'],
'error': "That's you"
},
'ens_without_stateofus_domain': {
'url': ens_user['ens'],
'username': ens_user['username']
},
'other_user_profile_key': {
'url': ens_user['public_key'],
'username': ens_user['username']
},
'other_user_profile_key_invalid': {
'url': '%s123' % ens_user['public_key'],
'error': 'Please enter or scan a valid chat key'
},
}
for key in url_data:
home_view.plus_button.click_until_presence_of_element(home_view.start_new_chat_button)
contact_view = home_view.start_new_chat_button.click()
sign_in_view.just_fyi('Checking %s case' % key)
contact_view.scan_contact_code_button.click()
if contact_view.allow_button.is_element_displayed():
contact_view.allow_button.click()
contact_view.enter_qr_edit_box.set_value(url_data[key]['url'])
contact_view.ok_button.click()
from views.chat_view import ChatView
chat_view = ChatView(self.driver)
if url_data[key].get('error'):
if not chat_view.element_by_text_part(url_data[key]['error']).is_element_displayed():
self.errors.append('Expected error %s is not shown' % url_data[key]['error'])
chat_view.ok_button.click()
if url_data[key].get('username'):
if not chat_view.chat_message_input.is_element_displayed():
self.errors.append('In %s case chat input is not found after scanning' % key)
if not chat_view.element_by_text(url_data[key]['username']).is_element_displayed():
self.errors.append('In %s case username not found after scanning' % key)
chat_view.back_button.click()
self.errors.verify_no_errors()

View File

@ -133,9 +133,7 @@ class TestTransactionWalletSingleDevice(SingleDeviceTestCase):
send_transaction.chose_recipient_button.click()
send_transaction.enter_recipient_address_button.click()
send_transaction.enter_recipient_address_input.set_value(recipient['public_key'])
send_transaction.done_button.click()
if not send_transaction.find_text_part('Invalid address'):
self.errors.append("Invalid address accepted for input as recipient!")
send_transaction.done_button.click_until_presence_of_element(send_transaction.element_by_text_part('Invalid address'))
send_transaction.ok_button.click()
send_transaction.enter_recipient_address_input.set_value('0xDE709F2102306220921060314715629080E2fB77')
send_transaction.done_button.click()
@ -635,7 +633,8 @@ class TestTransactionWalletSingleDevice(SingleDeviceTestCase):
recipient = "0x" + basic_user['address']
amount = '0.0%s' % str(random.randint(10000, 99999)) + '1'
wallet_view.send_transaction(asset_name=symbol, amount=amount, recipient=recipient)
transactions_view = wallet_view.transaction_history_button.click()
transactions_view.transactions_table.find_transaction(amount=amount, asset=symbol)
# TODO: disabled due to 10838
# transactions_view = wallet_view.transaction_history_button.click()
# transactions_view.transactions_table.find_transaction(amount=amount, asset=symbol)
self.errors.verify_no_errors()

View File

@ -325,6 +325,11 @@ class StatusInBackgroundButton(BaseButton):
super(StatusInBackgroundButton, self).__init__(driver)
self.locator = self.Locator.xpath_selector('//*[contains(@content-desc,"Status")]')
class EnterQRcodeEditBox(BaseEditBox):
def __init__(self, driver):
super(EnterQRcodeEditBox, self).__init__(driver)
self.locator = self.Locator.text_selector('Type a message...')
class OkGotItButton(BaseButton):
def __init__(self,driver):
@ -399,6 +404,7 @@ class BaseView(object):
self.status_app_icon = StatusAppIcon(self.driver)
self.airplane_mode_button = AirplaneModeButton(self.driver)
self.enter_qr_edit_box = EnterQRcodeEditBox(self.driver)
self.element_types = {
'base': BaseElement,

View File

@ -646,7 +646,7 @@ class ProfileView(BaseView):
self.use_mobile_data = UseMobileDataToggle(self.driver)
self.ask_me_when_on_mobile_network = AskMeWhenOnMobileNetworkToggle(self.driver)
def switch_network(self, network):
def switch_network(self, network='Mainnet with upstream RPC'):
self.advanced_button.click()
self.network_settings_button.click()
network_button = NetworkSettingsButton.NetworkButton(self.driver, network)

View File

@ -40,12 +40,6 @@ class ScanQRButton(BaseButton):
self.locator = self.Locator.accessibility_id("accounts-qr-code")
class EnterQRcodeEditBox(BaseEditBox):
def __init__(self, driver):
super(EnterQRcodeEditBox, self).__init__(driver)
self.locator = self.Locator.text_selector('Type a message...')
class AssetText(BaseText):
def __init__(self, driver, asset):
super(AssetText, self).__init__(driver)
@ -440,7 +434,6 @@ class WalletView(BaseView):
self.add_account_generate_account_button = AddAccountGenerateAnAccountButton(self.driver)
self.status_account_total_usd_value = StatusAccountTotalValueText(self.driver)
self.scan_qr_button = ScanQRButton(self.driver)
self.enter_qr_edit_box = EnterQRcodeEditBox(self.driver)
# individual account settings
self.account_settings_button = AccountSettingsButton(self.driver)