Fixing wallet send tx tests

Signed-off-by: Serhy <sergii@status.im>
This commit is contained in:
Serhy 2019-11-29 19:32:47 +02:00
parent 34b356866b
commit 13a619502c
No known key found for this signature in database
GPG Key ID: 5D7C4B9E2B6F500B
7 changed files with 28 additions and 27 deletions

View File

@ -67,6 +67,7 @@
(cond-> {:title-prefix (wallet.utils/format-amount amount decimals)
:title (wallet.utils/display-symbol token)
:title-color-override colors/gray
:accessibility-label (str (:symbol token) "-asset-value")
:subtitle (str (if value value 0) " " currency)
:icon (if icon
[list/item-image icon]

View File

@ -57,14 +57,17 @@
(for [item [{:title (i18n/label :t/accounts)
:icon :main-icons/profile
:theme :action
:accessibility-label :chose-recipient-accounts-button
:on-press show-accounts-list}
{:title (i18n/label :t/scan-qr)
:icon :main-icons/qr
:theme :action
:accessibility-label :chose-recipient-scan-qr
:on-press request-camera-permissions}
{:title (i18n/label :t/recipient-code)
:icon :main-icons/address
:theme :action
:accessibility-label :choose-recipient-recipient-code
:on-press #(re-frame/dispatch [:wallet.send/navigate-to-recipient-code])}]]
^{:key item}
[list-item/list-item item])])

View File

@ -71,6 +71,7 @@
{:title (utils/get-shortened-checksum-address
(if (string? contact) contact (:address contact)))
:subtitle (when-not contact (i18n/label :t/wallet-choose-recipient))
:accessibility-label :choose-recipient-button
:on-press #(do
(re-frame/dispatch [:dismiss-keyboard])
(re-frame/dispatch [:bottom-sheet/show-sheet
@ -107,9 +108,10 @@
[list-item/list-item {:type :section-header :title :t/to}]
[render-contact to from-chat?]
[toolbar/toolbar
{:center {:label :t/wallet-send
:disabled? (not sign-enabled?)
:on-press #(re-frame/dispatch [:wallet.ui/sign-transaction-button-clicked tx])}}]]))
{:center {:label :t/wallet-send
:accessibility-label :send-transaction-bottom-sheet
:disabled? (not sign-enabled?)
:on-press #(re-frame/dispatch [:wallet.ui/sign-transaction-button-clicked tx])}}]]))
(defview prepare-transaction []
(letsubs [tx [:wallet/prepare-transaction]]

View File

@ -4,7 +4,7 @@ import string
from tests import marks, camera_access_error_text, common_password
from tests.base_test_case import SingleDeviceTestCase
from tests.users import wallet_users, transaction_senders, basic_user, ens_user, ens_user_other_domain
from tests.users import wallet_users, transaction_senders, basic_user, ens_user
from views.sign_in_view import SignInView
@ -326,16 +326,18 @@ class TestWalletManagement(SingleDeviceTestCase):
send_transaction.enter_recipient_address_button.click()
send_transaction.enter_recipient_address_input.set_value('%s.stateofus.eth' % ens_user['ens'])
send_transaction.done_button.click()
if send_transaction.enter_recipient_address_text.text != ens_user['address']:
formatted_ens_user_address = send_transaction.get_formatted_recipient_address(ens_user['address'])
if send_transaction.enter_recipient_address_text.text != formatted_ens_user_address:
self.errors.append('ENS address on stateofus.eth is not resolved as recipient')
wallet.just_fyi('checking that ".eth" name will be resolved as recipient')
send_transaction.chose_recipient_button.click()
send_transaction.enter_recipient_address_button.click()
send_transaction.enter_recipient_address_input.set_value(ens_user_other_domain['ens'])
send_transaction.enter_recipient_address_input.set_value(ens_user['ens_another_domain'])
send_transaction.done_button.click()
if send_transaction.enter_recipient_address_text.text != ens_user_other_domain['address']:
if send_transaction.enter_recipient_address_text.text != formatted_ens_user_address:
self.errors.append('ENS address on another domain is not resolved as recipient')
self.errors.verify_no_errors()

View File

@ -352,7 +352,7 @@ class TestTransactionWalletSingleDevice(SingleDeviceTestCase):
error_text = send_transaction.element_by_text('Insufficient funds')
if not error_text.is_element_displayed():
self.errors.append(
"'Insufficient funds' error is now shown when sending %s ETH from wallet with balance %s" % (
"'Insufficient funds' error is not shown when sending %s ETH from wallet with balance %s" % (
round(eth_value + 1), eth_value))
send_transaction.select_asset_button.click()
send_transaction.asset_by_name('STT').scroll_to_element()
@ -360,7 +360,7 @@ class TestTransactionWalletSingleDevice(SingleDeviceTestCase):
send_transaction.amount_edit_box.set_value(round(stt_value + 1))
if not error_text.is_element_displayed():
self.errors.append(
"'Insufficient funds' error is now shown when sending %s STT from wallet with balance %s" % (
"'Insufficient funds' error is not shown when sending %s STT from wallet with balance %s" % (
round(stt_value + 1), stt_value))
self.errors.verify_no_errors()
@ -396,17 +396,6 @@ class TestTransactionWalletSingleDevice(SingleDeviceTestCase):
send_transaction.element_by_text('intrinsic gas too low', 'text').wait_for_visibility_of_element(80)
send_transaction.ok_button.click()
send_transaction.sign_transaction_button.click()
send_transaction.network_fee_button.click()
send_transaction.gas_limit_input.clear()
gas_limit = '1005000'
send_transaction.gas_limit_input.set_value(gas_limit)
send_transaction.gas_price_input.clear()
gas_price = str(round(float(send_transaction.gas_price_input.text)) + 10)
send_transaction.gas_price_input.send_keys(gas_price)
send_transaction.update_fee_button.click()
send_transaction.sign_transaction()
self.network_api.find_transaction_by_unique_amount(sender['address'], amount)
@marks.testrail_id(5314)
@marks.critical

View File

@ -266,7 +266,7 @@ class AssetButton(BaseButton):
def __init__(self, driver, asset_name):
super(AssetButton, self).__init__(driver)
self.asset_name = asset_name
self.locator = self.Locator.text_selector(self.asset_name)
self.locator = self.Locator.xpath_selector('(//*[@content-desc=":' + self.asset_name + '-asset-value"])[2]')
@property
def name(self):

View File

@ -19,7 +19,7 @@ class CancelButton(BaseButton):
class SignTransactionButton(BaseButton):
def __init__(self, driver):
super(SignTransactionButton, self).__init__(driver)
self.locator = self.Locator.accessibility_id('sign-transaction-button')
self.locator = self.Locator.accessibility_id('send-transaction-bottom-sheet')
class AmountEditBox(BaseEditBox, BaseButton):
@ -63,30 +63,31 @@ class ChooseRecipientButton(BaseButton):
class AccountsButton(BaseButton):
def __init__(self, driver):
super(AccountsButton, self).__init__(driver)
self.locator = self.Locator.text_selector('Accounts')
self.locator = self.Locator.accessibility_id('chose-recipient-accounts-button')
class EnterRecipientAddressButton(BaseButton):
def __init__(self, driver):
super(EnterRecipientAddressButton, self).__init__(driver)
self.locator = self.Locator.xpath_selector("//*[@text='Enter recipient address']")
self.locator = self.Locator.accessibility_id('choose-recipient-recipient-code')
class ScanQRCodeButton(BaseButton):
def __init__(self, driver):
super(ScanQRCodeButton, self).__init__(driver)
self.locator = self.Locator.text_selector('Scan QR code')
self.locator = self.Locator.accessibility_id('chose-recipient-scan-qr')
class EnterRecipientAddressInput(BaseEditBox):
def __init__(self, driver):
super(EnterRecipientAddressInput, self).__init__(driver)
self.locator = self.Locator.xpath_selector("//*[@text='Enter recipient address']")
self.locator = self.Locator.accessibility_id("recipient-address-input")
class EnterRecipientAddressInputText(BaseText):
def __init__(self, driver):
super(EnterRecipientAddressInputText, self).__init__(driver)
self.locator = self.Locator.accessibility_id("recipient-address-text")
self.locator = self.Locator.xpath_selector("//*[@content-desc='choose-recipient-button']/android.widget.TextView")
class RecentRecipientsButton(BaseButton):
@ -259,3 +260,6 @@ class SendTransactionView(BaseView):
def get_transaction_fee_total(self):
return self.transaction_fee_total_value.text.split()[0]
def get_formatted_recipient_address(self, address):
return address[:6] + '' + address[-4:]