fix nightly e2e + new scan EIP qr e2e

Signed-off-by: Churikova Tetiana <churikova.tm@gmail.com>
This commit is contained in:
Churikova Tetiana 2020-04-15 16:25:18 +02:00
parent a5a00e0a2c
commit 7a89b2852a
No known key found for this signature in database
GPG Key ID: 0D4EA7B33B47E6D8
7 changed files with 164 additions and 19 deletions

View File

@ -17,14 +17,18 @@ class TestWalletManagement(SingleDeviceTestCase):
sign_in = SignInView(self.driver)
sign_in.recover_access(transaction_senders['A']['passphrase'])
wallet = sign_in.wallet_button.click()
texts = ['This is your signing phrase', 'These three words prove that a transaction is safe.',
"You should see these words before signing each transaction. If you don't, cancel and sign out."]
texts = ['This is your signing phrase',
'You should see these 3 words before signing each transaction',
'If you see a different combination, cancel the transaction and sign out']
wallet.just_fyi('Check tests in set up wallet popup')
for text in texts:
if not wallet.element_by_text_part(text).is_element_displayed():
self.errors.append("'%s' text is not displayed" % text)
phrase = wallet.sign_in_phrase.list
if len(phrase) != 3:
self.errors.append('Transaction phrase length is %s' % len(phrase))
wallet.just_fyi('Check popup will reappear if tap on "Remind me later"')
wallet.remind_me_later_button.click()
wallet.accounts_status_account.click()
send_transaction = wallet.send_transaction_button.click()

View File

@ -252,18 +252,22 @@ class TestChatManagement(SingleDeviceTestCase):
sign_in = SignInView(self.driver)
home = sign_in.create_user()
chat_view = home.add_contact(basic_user["public_key"], add_in_contacts=False)
chat_view.just_fyi('Block user not added as contact from chat view')
chat_view.chat_options.click()
chat_view.view_profile_button.click()
chat_view.block_contact()
chat_view.just_fyi('Unblock user not added as contact from chat view')
profile = sign_in.profile_button.click()
profile.contacts_button.click()
profile.blocked_users_button.click()
profile.element_by_text(basic_user["username"]).click()
chat_view.unblock_contact_button.click()
chat_view.back_button.click()
home.plus_button.click()
home.start_new_chat_button.click()
if home.element_by_text(basic_user["username"]).is_element_displayed():
profile.just_fyi('Navigating to contact list and check that user is not in list')
profile.back_button.click(2)
if profile.element_by_text(basic_user["username"]).is_element_displayed():
self.driver.fail("Unblocked user not added previously in contact list added in contacts!")
@marks.testrail_id(5496)
@ -319,7 +323,7 @@ class TestChatManagementMultipleDevice(MultipleDeviceTestCase):
chat_2.send_message_button.click()
chat_2.driver.quit()
device_1.just_fyi('tap on userpic and check redirect to user profile')
device_1.just_fyi('Tap on userpic and check redirect to user profile')
chat_element = chat_1.chat_element_by_text(message)
chat_element.find_element()
username = chat_element.username.text
@ -332,17 +336,18 @@ class TestChatManagementMultipleDevice(MultipleDeviceTestCase):
if not element.scroll_to_element():
self.errors.append('%s is not visible' % element.name)
device_1.just_fyi('add user to contacts, check contact list in Profile and below "Start new chat"')
device_1.just_fyi('Add user to contacts, check contact list in Profile')
chat_1.add_to_contacts.click()
if not chat_1.remove_from_contacts.is_element_displayed():
self.errors.append("'Add to contacts' is not changed to 'Remove from contacts'")
chat_1.get_back_to_home_view()
profile_1 = chat_1.profile_button.click()
userprofile = profile_1.open_contact_from_profile(username)
if not userprofile.remove_from_contacts.is_element_displayed():
self.errors.append("'Add to contacts' is not changed to 'Remove from contacts'")
profile_1.get_back_to_home_view()
profile_1.home_button.click()
chat_1.get_back_to_home_view()
device_1.just_fyi('Check that user is added to contacts below "Start new chat" and you redirected to 1-1 on tap')
home_1.plus_button.click()
home_1.start_new_chat_button.click()
if not home_1.element_by_text(username).is_element_displayed():
@ -353,15 +358,15 @@ class TestChatManagementMultipleDevice(MultipleDeviceTestCase):
if chat_1.add_to_contacts.is_element_displayed():
self.errors.append('"Add to contacts" button is shown in 1-1 after adding user to contacts from profile')
device_1.just_fyi('remove user from contacts')
device_1.just_fyi('Remove user from contacts')
chat_1.profile_button.click()
profile_1.element_by_text(username).click()
userprofile = profile_1.open_contact_from_profile(username)
userprofile.remove_from_contacts.click()
if userprofile.remove_from_contacts.is_element_displayed():
self.errors.append("'Remove from contacts' is not changed to 'Add to contacts'")
device_1.just_fyi('Check that user is removed from contact list in profile')
userprofile.back_button.click()
# TODO: next line is added temporary to avoid navigation issue #7437 - should be deleted after fix
home_1.profile_button.click()
if profile_1.element_by_text(username).is_element_displayed():
self.errors.append('List of contacts in profile contains removed user')
profile_1.home_button.click()

View File

@ -64,6 +64,7 @@ class TestDeepLinks(SingleDeviceTestCase):
deep_link = 'https://join.status.im/u/%s' % basic_user['public_key']
sign_in_view.open_weblink_and_login(deep_link)
profile_view = sign_in_view.get_profile_view()
profile_view.privacy_and_security_button.wait_for_element()
if profile_view.default_username_text.text != basic_user['username'] \
or not profile_view.contacts_button.is_element_displayed() \
or not profile_view.share_my_profile_button.is_element_displayed():

View File

@ -5,6 +5,7 @@ from support.utilities import get_merged_txs_list
from tests import marks, unique_password, common_password
from tests.base_test_case import SingleDeviceTestCase, MultipleDeviceTestCase
from tests.users import transaction_senders, basic_user, wallet_users, transaction_recipients
from views.send_transaction_view import SendTransactionView
from views.sign_in_view import SignInView
@ -521,4 +522,103 @@ class TestTransactionWalletSingleDevice(SingleDeviceTestCase):
if not account_button.color_matches('multi_account_color.png'):
self.driver.fail('Account color does not match expected')
self.errors.verify_no_errors()
self.errors.verify_no_errors()
@marks.testrail_id(6282)
@marks.medium
def test_can_scan_eip_681_links(self):
sign_in_view = SignInView(self.driver)
sign_in_view.recover_access(transaction_senders['C']['passphrase'])
wallet_view = sign_in_view.wallet_button.click()
wallet_view.set_up_wallet()
send_transaction_view = SendTransactionView(self.driver)
url_data = {
'ens_for_receiver': {
'url': 'ethereum:0xc55cf4b03948d7ebc8b9e8bad92643703811d162@3/transfer?address=nastya.stateofus.eth&uint256=1e-1',
'data':{
'asset': 'STT',
'amount': '0.1',
'address': '0x58d8…F2ff',
},
},
'gas_settings': {
'url': 'ethereum:0x3d597789ea16054a084ac84ce87f50df9198f415@3?value=1e16&gasPrice=1000000000&gasLimit=100000',
'data': {
'amount': '0.01',
'asset': 'ETHro',
'address': '0x3D59…F415',
'gas_limit': '100000',
'gas_price': '1',
},
},
'payment_link': {
'url': 'ethereum:pay-0xc55cf4b03948d7ebc8b9e8bad92643703811d162@3/transfer?address=0x3d597789ea16054a084ac84ce87f50df9198f415&uint256=1e1',
'data': {
'amount': '10',
'asset': 'STT',
'address': '0x3D59…F415',
},
},
'validation_amount_too_presize': {
'url': 'ethereum:0xc55cf4b03948d7ebc8b9e8bad92643703811d162@3/transfer?address=0x101848D5C5bBca18E6b4431eEdF6B95E9ADF82FA&uint256=1e-19',
'data': {
'amount': '1e-19',
'asset': 'STT',
'address': '0x1018…82FA',
},
'send_transaction_validation_error': 'Amount is too precise',
},
'validation_amount_too_big': {
'url': 'ethereum:0x101848D5C5bBca18E6b4431eEdF6B95E9ADF82FA@3?value=1e25',
'data': {
'amount': '10000000',
'asset': 'ETHro',
'address': '0x1018…82FA',
},
'send_transaction_validation_error': 'Insufficient funds',
},
'validation_wrong_chain_id': {
'url': 'ethereum:0x101848D5C5bBca18E6b4431eEdF6B95E9ADF82FA?value=1e17',
'error': 'Network does not match',
'data': {
'amount': '0.1',
'asset': 'ETHro',
'address': '0x1018…82FA',
},
},
'validation_wrong_address': {
'url': 'ethereum:0x744d70fdbe2ba4cf95131626614a1763df805b9e@3/transfer?address=blablabla&uint256=1e10',
'error': 'Invalid address',
},
}
for key in url_data:
wallet_view.just_fyi('Checking %s case' % key)
wallet_view.scan_qr_button.click()
if wallet_view.allow_button.is_element_displayed():
wallet_view.allow_button.click()
wallet_view.enter_qr_edit_box.set_value(url_data[key]['url'])
wallet_view.ok_button.click()
if url_data[key].get('error'):
if not wallet_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'])
wallet_view.ok_button.click()
if url_data[key].get('data'):
if 'gas' in key:
actual_data = send_transaction_view.get_values_from_send_transaction_bottom_sheet(gas=True)
else:
actual_data = send_transaction_view.get_values_from_send_transaction_bottom_sheet()
difference_in_data = url_data[key]['data'].items() - actual_data.items()
if difference_in_data:
self.errors.append(
'In %s case returned value does not match expected in %s' % (key, repr(difference_in_data)))
if url_data[key].get('send_transaction_validation_error'):
error = url_data[key]['send_transaction_validation_error']
if not wallet_view.element_by_text_part(error).is_element_displayed():
self.errors.append(
'Expected error %s is not shown' % error)
send_transaction_view.cancel_button.click()
self.errors.verify_no_errors()

View File

@ -77,7 +77,7 @@ class NoButton(BaseButton):
class OkButton(BaseButton):
def __init__(self, driver):
super(OkButton, self).__init__(driver)
self.locator = self.Locator.xpath_selector("//*[@text='OK']")
self.locator = self.Locator.xpath_selector("//*[@text='OK'or @text='Ok']")
class ContinueButton(BaseButton):

View File

@ -101,6 +101,16 @@ class SelectAssetButton(BaseButton):
super(SelectAssetButton, self).__init__(driver)
self.locator = self.Locator.accessibility_id('choose-asset-button')
class AssetText(BaseText):
def __init__(self, driver):
super(AssetText, self).__init__(driver)
self.locator = self.Locator.xpath_selector('//*[@content-desc="choose-asset-button"]//android.widget.TextView')
class RecipientText(BaseText):
def __init__(self, driver):
super(RecipientText, self).__init__(driver)
self.locator = self.Locator.xpath_selector('//*[@content-desc="choose-recipient-button"]//android.widget.TextView')
class ErrorDialog(BaseView):
def __init__(self, driver):
@ -267,6 +277,8 @@ class SendTransactionView(BaseView):
self.got_it_button = GotItButton(self.driver)
self.select_asset_button = SelectAssetButton(self.driver)
self.asset_text = AssetText(self.driver)
self.recipient_text = RecipientText(self.driver)
self.error_dialog = ErrorDialog(self.driver)
@ -308,3 +320,16 @@ class SendTransactionView(BaseView):
def get_account_in_select_account_bottom_sheet_button(self, account_name):
return AccountNameInSelectAccountBottomSheet(self.driver, account_name)
def get_values_from_send_transaction_bottom_sheet(self, gas=False):
data = {
'amount': self.amount_edit_box.text,
'asset': self.asset_text.text,
'address': self.recipient_text.text
}
if gas:
self.sign_transaction_button.click_until_presence_of_element(self.sign_with_password)
self.network_fee_button.click_until_presence_of_element(self.gas_limit_input)
data['gas_limit'] = self.gas_limit_input.text
data['gas_price'] = self.gas_price_input.text
self.cancel_button.click()
return data

View File

@ -13,14 +13,12 @@ class SendRequestButton(BaseButton):
class ChooseRecipientButton(BaseButton):
def __init__(self, driver):
super(ChooseRecipientButton, self).__init__(driver)
self.locator = self.Locator.accessibility_id('choose-recipient-button')
class TransactionHistoryButton(BaseButton):
def __init__(self, driver):
super(TransactionHistoryButton, self).__init__(driver)
self.locator = self.Locator.text_selector("History")
@ -36,6 +34,16 @@ class ChooseFromContactsButton(BaseButton):
self.locator = self.Locator.text_selector("Choose From Contacts")
class ScanQRButton(BaseButton):
def __init__(self, driver):
super(ScanQRButton, self).__init__(driver)
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)
@ -103,7 +111,7 @@ class SetUpButton(BaseButton):
class SetCurrencyButton(BaseButton):
def __init__(self, driver):
super(SetCurrencyButton, self).__init__(driver)
self.locator = self.Locator.text_selector("Set default currency")
self.locator = self.Locator.text_selector("Set currency")
class SignInPhraseText(BaseText):
@ -409,6 +417,8 @@ class WalletView(BaseView):
self.account_color_button = AccountColorButton(self.driver)
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)