2018-09-17 08:50:01 +00:00
|
|
|
from tests import common_password
|
2018-10-07 15:12:21 +00:00
|
|
|
from views.base_element import BaseText, BaseElement
|
2018-07-13 10:56:36 +00:00
|
|
|
from views.base_element import BaseButton, BaseEditBox
|
2019-08-02 21:22:23 +00:00
|
|
|
from views.base_view import BaseView, OkButton
|
2018-01-03 09:34:40 +00:00
|
|
|
|
|
|
|
|
|
|
|
class FirstRecipient(BaseButton):
|
|
|
|
def __init__(self, driver):
|
|
|
|
super(FirstRecipient, self).__init__(driver)
|
2018-03-15 20:01:08 +00:00
|
|
|
self.locator = self.Locator.accessibility_id('chat-icon')
|
2018-01-03 09:34:40 +00:00
|
|
|
|
|
|
|
|
2018-05-16 19:59:36 +00:00
|
|
|
class CancelButton(BaseButton):
|
|
|
|
def __init__(self, driver):
|
|
|
|
super(CancelButton, self).__init__(driver)
|
2020-07-29 15:54:45 +00:00
|
|
|
self.locator = self.Locator.text_selector("Cancel")
|
2018-05-16 19:59:36 +00:00
|
|
|
|
|
|
|
|
2018-01-03 09:34:40 +00:00
|
|
|
class SignTransactionButton(BaseButton):
|
|
|
|
def __init__(self, driver):
|
|
|
|
super(SignTransactionButton, self).__init__(driver)
|
2019-11-29 17:32:47 +00:00
|
|
|
self.locator = self.Locator.accessibility_id('send-transaction-bottom-sheet')
|
2018-01-03 09:34:40 +00:00
|
|
|
|
|
|
|
|
|
|
|
class AmountEditBox(BaseEditBox, BaseButton):
|
|
|
|
|
|
|
|
def __init__(self, driver):
|
|
|
|
super(AmountEditBox, self).__init__(driver)
|
2018-03-15 20:01:08 +00:00
|
|
|
self.locator = self.Locator.accessibility_id('amount-input')
|
2018-01-03 09:34:40 +00:00
|
|
|
|
2020-09-17 13:14:55 +00:00
|
|
|
def set_value(self, value):
|
|
|
|
BaseEditBox.set_value(self, value)
|
|
|
|
self.driver.press_keycode(66)
|
|
|
|
|
2020-07-29 15:54:45 +00:00
|
|
|
class SetMaxButton(BaseButton):
|
|
|
|
|
|
|
|
def __init__(self, driver):
|
|
|
|
super(SetMaxButton, self).__init__(driver)
|
|
|
|
self.locator = self.Locator.text_selector('Set max')
|
|
|
|
|
2018-01-03 09:34:40 +00:00
|
|
|
|
2018-05-16 19:59:36 +00:00
|
|
|
class SignInPhraseText(BaseText):
|
|
|
|
def __init__(self, driver):
|
|
|
|
super(SignInPhraseText, self).__init__(driver)
|
|
|
|
self.locator = self.Locator.accessibility_id('signing-phrase-text')
|
|
|
|
|
|
|
|
|
2018-01-03 09:34:40 +00:00
|
|
|
class PasswordInput(BaseEditBox):
|
|
|
|
def __init__(self, driver):
|
|
|
|
super(PasswordInput, self).__init__(driver)
|
|
|
|
self.locator = self.Locator.xpath_selector("//*[@text='Password']")
|
|
|
|
|
|
|
|
|
|
|
|
class EnterPasswordInput(BaseEditBox):
|
|
|
|
def __init__(self, driver):
|
|
|
|
super(EnterPasswordInput, self).__init__(driver)
|
2018-03-15 20:01:08 +00:00
|
|
|
self.locator = self.Locator.accessibility_id('enter-password-input')
|
2018-01-03 09:34:40 +00:00
|
|
|
|
|
|
|
|
|
|
|
class GotItButton(BaseButton):
|
|
|
|
def __init__(self, driver):
|
|
|
|
super(GotItButton, self).__init__(driver)
|
2018-03-15 20:01:08 +00:00
|
|
|
self.locator = self.Locator.accessibility_id('got-it-button')
|
2018-01-03 09:34:40 +00:00
|
|
|
|
|
|
|
|
|
|
|
class ChooseRecipientButton(BaseButton):
|
|
|
|
|
|
|
|
def __init__(self, driver):
|
|
|
|
super(ChooseRecipientButton, self).__init__(driver)
|
2018-03-15 20:01:08 +00:00
|
|
|
self.locator = self.Locator.accessibility_id('choose-recipient-button')
|
2018-01-03 09:34:40 +00:00
|
|
|
|
|
|
|
|
2019-08-16 10:14:23 +00:00
|
|
|
class AccountsButton(BaseButton):
|
|
|
|
def __init__(self, driver):
|
|
|
|
super(AccountsButton, self).__init__(driver)
|
2020-09-17 13:14:55 +00:00
|
|
|
self.locator = self.Locator.text_selector('My accounts')
|
2019-08-16 10:14:23 +00:00
|
|
|
|
|
|
|
|
2018-02-19 11:51:53 +00:00
|
|
|
class EnterRecipientAddressButton(BaseButton):
|
2018-01-03 09:34:40 +00:00
|
|
|
def __init__(self, driver):
|
2018-02-19 11:51:53 +00:00
|
|
|
super(EnterRecipientAddressButton, self).__init__(driver)
|
2019-11-29 17:32:47 +00:00
|
|
|
self.locator = self.Locator.accessibility_id('choose-recipient-recipient-code')
|
2018-02-07 13:18:55 +00:00
|
|
|
|
|
|
|
|
2018-07-20 08:27:33 +00:00
|
|
|
class ScanQRCodeButton(BaseButton):
|
|
|
|
def __init__(self, driver):
|
|
|
|
super(ScanQRCodeButton, self).__init__(driver)
|
2020-09-17 13:14:55 +00:00
|
|
|
self.locator = self.Locator.accessibility_id('scan-contact-code-button')
|
2018-07-20 08:27:33 +00:00
|
|
|
|
|
|
|
|
2018-02-07 13:18:55 +00:00
|
|
|
class EnterRecipientAddressInput(BaseEditBox):
|
|
|
|
def __init__(self, driver):
|
|
|
|
super(EnterRecipientAddressInput, self).__init__(driver)
|
2019-11-29 17:32:47 +00:00
|
|
|
self.locator = self.Locator.accessibility_id("recipient-address-input")
|
|
|
|
|
2018-01-03 09:34:40 +00:00
|
|
|
|
2019-10-16 11:59:21 +00:00
|
|
|
class EnterRecipientAddressInputText(BaseText):
|
|
|
|
def __init__(self, driver):
|
|
|
|
super(EnterRecipientAddressInputText, self).__init__(driver)
|
2020-05-19 10:40:39 +00:00
|
|
|
self.locator = self.Locator.xpath_selector("//*[@content-desc='choose-recipient-button']//android.widget.TextView")
|
2019-10-16 11:59:21 +00:00
|
|
|
|
2018-01-03 09:34:40 +00:00
|
|
|
|
2018-02-09 15:16:07 +00:00
|
|
|
class RecentRecipientsButton(BaseButton):
|
|
|
|
def __init__(self, driver):
|
|
|
|
super(RecentRecipientsButton, self).__init__(driver)
|
2018-05-17 16:02:25 +00:00
|
|
|
self.locator = self.Locator.xpath_selector("//*[@text='Contacts']")
|
2018-02-09 15:16:07 +00:00
|
|
|
|
|
|
|
|
|
|
|
class SelectAssetButton(BaseButton):
|
|
|
|
def __init__(self, driver):
|
|
|
|
super(SelectAssetButton, self).__init__(driver)
|
2018-03-15 20:01:08 +00:00
|
|
|
self.locator = self.Locator.accessibility_id('choose-asset-button')
|
2018-02-09 15:16:07 +00:00
|
|
|
|
2020-04-15 14:25:18 +00:00
|
|
|
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')
|
|
|
|
|
2018-02-09 15:16:07 +00:00
|
|
|
|
2018-04-23 18:42:12 +00:00
|
|
|
class ErrorDialog(BaseView):
|
|
|
|
def __init__(self, driver):
|
|
|
|
super(ErrorDialog, self).__init__(driver)
|
|
|
|
self.ok_button = OkButton(driver)
|
|
|
|
|
|
|
|
def wait_for_error_message(self, error_message, wait_time=30):
|
|
|
|
element = self.element_by_text_part(error_message)
|
|
|
|
return element.wait_for_element(wait_time)
|
|
|
|
|
|
|
|
|
2019-06-24 15:53:02 +00:00
|
|
|
class NetworkFeeButton(BaseButton):
|
2018-06-28 18:46:51 +00:00
|
|
|
def __init__(self, driver):
|
2019-06-24 15:53:02 +00:00
|
|
|
super(NetworkFeeButton, self).__init__(driver)
|
2020-06-24 13:25:53 +00:00
|
|
|
self.locator = self.Locator.accessibility_id('custom-gas-fee')
|
2018-06-28 18:46:51 +00:00
|
|
|
|
|
|
|
|
|
|
|
class TransactionFeeButton(BaseButton):
|
|
|
|
def __init__(self, driver):
|
|
|
|
super(TransactionFeeButton, self).__init__(driver)
|
|
|
|
self.locator = self.Locator.accessibility_id('transaction-fee-button')
|
|
|
|
|
|
|
|
|
2019-06-24 15:53:02 +00:00
|
|
|
class TransactionFeeTotalValue(BaseText):
|
2019-02-15 16:14:42 +00:00
|
|
|
def __init__(self, driver):
|
|
|
|
super(TransactionFeeTotalValue, self).__init__(driver)
|
2020-04-07 14:57:31 +00:00
|
|
|
self.locator = self.Locator.xpath_selector("//*[@text='Total Fee']//following::android.widget.TextView[1]")
|
2019-02-15 16:14:42 +00:00
|
|
|
|
|
|
|
|
2018-06-28 18:46:51 +00:00
|
|
|
class GasLimitInput(BaseEditBox):
|
|
|
|
def __init__(self, driver):
|
|
|
|
super(GasLimitInput, self).__init__(driver)
|
2019-06-24 15:53:02 +00:00
|
|
|
self.locator = self.Locator.xpath_selector("(//*[@text='Gas limit']/..//android.widget.EditText)[1]")
|
2018-06-28 18:46:51 +00:00
|
|
|
|
|
|
|
|
|
|
|
class GasPriceInput(BaseEditBox):
|
|
|
|
def __init__(self, driver):
|
|
|
|
super(GasPriceInput, self).__init__(driver)
|
2019-06-24 15:53:02 +00:00
|
|
|
self.locator = self.Locator.xpath_selector("(//*[@text='Gas limit']/..//android.widget.EditText)[2]")
|
2018-06-28 18:46:51 +00:00
|
|
|
|
2019-07-18 15:44:06 +00:00
|
|
|
@property
|
|
|
|
def text(self):
|
|
|
|
return self.find_element().text
|
|
|
|
|
2018-06-28 18:46:51 +00:00
|
|
|
|
2019-06-24 15:53:02 +00:00
|
|
|
class TotalFeeInput(BaseText):
|
2018-06-28 18:46:51 +00:00
|
|
|
def __init__(self, driver):
|
|
|
|
super(TotalFeeInput, self).__init__(driver)
|
2019-06-24 15:53:02 +00:00
|
|
|
self.locator = self.Locator.xpath_selector("//*[@text='Total Fee']/following-sibling::android.widget.TextView")
|
|
|
|
|
2020-04-02 10:30:20 +00:00
|
|
|
class ETHroAssetButtonInSelectAssetBottomSheet(BaseButton):
|
|
|
|
def __init__(self, driver):
|
|
|
|
super(ETHroAssetButtonInSelectAssetBottomSheet, self).__init__(driver)
|
2020-09-17 13:14:55 +00:00
|
|
|
self.locator = self.Locator.accessibility_id(':ETH-asset-value')
|
2020-04-02 10:30:20 +00:00
|
|
|
|
2019-06-24 15:53:02 +00:00
|
|
|
|
|
|
|
class UpdateFeeButton(BaseButton):
|
|
|
|
def __init__(self, driver):
|
|
|
|
super(UpdateFeeButton, self).__init__(driver)
|
|
|
|
self.locator = self.Locator.xpath_selector("//*[@text='Update']")
|
2018-06-28 18:46:51 +00:00
|
|
|
|
2019-10-21 07:15:06 +00:00
|
|
|
def click(self):
|
|
|
|
for _ in range(3):
|
|
|
|
self.driver.info('Tap on %s' % self.name)
|
|
|
|
self.find_element().click()
|
|
|
|
self.driver.info('Wait for no %s' % self.name)
|
2019-10-23 17:17:54 +00:00
|
|
|
if not self.is_element_displayed():
|
2019-10-21 07:15:06 +00:00
|
|
|
return self.navigate()
|
|
|
|
|
2018-06-28 18:46:51 +00:00
|
|
|
|
2020-06-24 13:25:53 +00:00
|
|
|
class ValidationErrorOnSendTransaction(BaseButton):
|
|
|
|
def __init__(self, driver, field):
|
|
|
|
super(ValidationErrorOnSendTransaction, self).__init__(driver)
|
|
|
|
self.locator = self.Locator.xpath_selector("//*[@text='%s']/../*[@content-desc='icon']" % field)
|
|
|
|
|
2020-10-06 14:48:08 +00:00
|
|
|
|
2020-06-24 13:25:53 +00:00
|
|
|
class ValidationIconOnSendTransaction(BaseButton):
|
|
|
|
def __init__(self, driver):
|
|
|
|
super(ValidationIconOnSendTransaction, self).__init__(driver)
|
2020-07-29 15:54:45 +00:00
|
|
|
self.locator = self.Locator.xpath_selector('//*[@content-desc="custom-gas-fee"]/../android.view.ViewGroup//*[@content-desc="icon"]')
|
2020-06-24 13:25:53 +00:00
|
|
|
|
|
|
|
|
2018-06-29 17:27:30 +00:00
|
|
|
class ShareButton(BaseButton):
|
|
|
|
def __init__(self, driver):
|
|
|
|
super(ShareButton, self).__init__(driver)
|
2019-07-12 07:16:02 +00:00
|
|
|
self.locator = self.Locator.accessibility_id('share-address-button')
|
2018-06-29 17:27:30 +00:00
|
|
|
|
2020-10-06 14:48:08 +00:00
|
|
|
class RecipientAddToFavoritesButton(BaseButton):
|
|
|
|
def __init__(self, driver):
|
|
|
|
super(RecipientAddToFavoritesButton, self).__init__(driver)
|
|
|
|
self.locator = self.Locator.accessibility_id('participant-add-to-favs')
|
|
|
|
|
|
|
|
class RecipientDoneButton(BaseButton):
|
|
|
|
def __init__(self, driver):
|
|
|
|
super(RecipientDoneButton, self).__init__(driver)
|
|
|
|
self.locator = self.Locator.accessibility_id('participant-done')
|
|
|
|
|
|
|
|
|
|
|
|
class NewFavoriteNameInput(BaseEditBox):
|
|
|
|
def __init__(self, driver):
|
|
|
|
super(NewFavoriteNameInput, self).__init__(driver)
|
|
|
|
self.locator = self.Locator.accessibility_id('fav-name')
|
|
|
|
|
|
|
|
|
|
|
|
class NewFavoriteAddFavorite(BaseButton):
|
|
|
|
def __init__(self, driver):
|
|
|
|
super(NewFavoriteAddFavorite, self).__init__(driver)
|
|
|
|
self.locator = self.Locator.accessibility_id('add-fav')
|
2018-06-29 17:27:30 +00:00
|
|
|
|
2018-10-07 15:12:21 +00:00
|
|
|
class OnboardingMessage(BaseElement):
|
|
|
|
def __init__(self, driver):
|
|
|
|
super().__init__(driver)
|
2019-07-12 07:16:02 +00:00
|
|
|
self.locator = self.Locator.text_selector('This is your signing phrase')
|
2018-10-07 15:12:21 +00:00
|
|
|
|
|
|
|
|
2018-11-26 14:06:34 +00:00
|
|
|
class NotEnoughEthForGas(BaseText):
|
|
|
|
def __init__(self, driver):
|
|
|
|
super().__init__(driver)
|
|
|
|
self.locator = self.Locator.text_selector('Not enough ETH for gas')
|
|
|
|
|
|
|
|
|
|
|
|
class ValidationWarnings(object):
|
|
|
|
def __init__(self, driver):
|
|
|
|
self.not_enough_eth_for_gas = NotEnoughEthForGas(driver)
|
|
|
|
|
|
|
|
|
2019-06-12 08:38:02 +00:00
|
|
|
class SignWithPasswordButton(BaseButton):
|
|
|
|
def __init__(self, driver):
|
|
|
|
super(SignWithPasswordButton, self).__init__(driver)
|
2020-05-14 10:41:09 +00:00
|
|
|
self.locator = self.Locator.text_selector('Sign with password')
|
2019-06-12 08:38:02 +00:00
|
|
|
|
|
|
|
|
|
|
|
class SignButton(BaseButton):
|
|
|
|
def __init__(self, driver):
|
|
|
|
super(SignButton, self).__init__(driver)
|
|
|
|
self.locator = self.Locator.xpath_selector('//*[@text="Sign"]')
|
|
|
|
|
2020-05-14 10:41:09 +00:00
|
|
|
|
|
|
|
class SignWithKeycardButton(BaseButton):
|
|
|
|
def __init__(self, driver):
|
|
|
|
super(SignWithKeycardButton, self).__init__(driver)
|
|
|
|
self.locator = self.Locator.text_part_selector('Sign with')
|
|
|
|
|
|
|
|
def navigate(self):
|
|
|
|
from views.keycard_view import KeycardView
|
|
|
|
return KeycardView(self.driver)
|
|
|
|
|
|
|
|
def click(self):
|
|
|
|
from views.keycard_view import TwoPinKeyboardButton
|
|
|
|
self.click_until_presence_of_element(TwoPinKeyboardButton(self.driver))
|
|
|
|
return self.navigate()
|
|
|
|
|
|
|
|
class SigningPhraseText(BaseText):
|
|
|
|
def __init__(self, driver):
|
|
|
|
super(SigningPhraseText, self).__init__(driver)
|
|
|
|
self.locator = self.Locator.text_part_selector('Signing phrase')
|
|
|
|
|
|
|
|
|
2020-03-24 15:45:15 +00:00
|
|
|
# Elements for commands in 1-1 chat
|
|
|
|
class UserNameInSendTransactionBottomSheet(BaseButton):
|
|
|
|
def __init__(self, driver, username_part):
|
|
|
|
super(UserNameInSendTransactionBottomSheet, self).__init__(driver)
|
|
|
|
self.username = username_part
|
|
|
|
self.locator = self.Locator.xpath_selector(
|
|
|
|
"//*[@content-desc='amount-input']/..//*[starts-with(@text,'%s')]" % self.username)
|
|
|
|
|
|
|
|
class AccountNameInSelectAccountBottomSheet(BaseButton):
|
|
|
|
def __init__(self, driver, account_part):
|
|
|
|
super(AccountNameInSelectAccountBottomSheet, self).__init__(driver)
|
|
|
|
self.username = account_part
|
|
|
|
self.locator = self.Locator.xpath_selector(
|
|
|
|
"//*[@text='Select account']/..//*[starts-with(@text,'%s')]" % self.username)
|
|
|
|
|
|
|
|
|
2020-05-14 10:41:09 +00:00
|
|
|
class SelectButton(BaseButton):
|
2020-03-24 15:45:15 +00:00
|
|
|
def __init__(self, driver):
|
|
|
|
super(SelectButton, self).__init__(driver)
|
|
|
|
self.locator = self.Locator.accessibility_id('select-account-bottom-sheet')
|
2019-06-12 08:38:02 +00:00
|
|
|
|
2020-04-02 10:30:20 +00:00
|
|
|
class RequestTransactionButtonBottomSheet(BaseButton):
|
|
|
|
def __init__(self, driver):
|
|
|
|
super(RequestTransactionButtonBottomSheet, self).__init__(driver)
|
|
|
|
self.locator = self.Locator.accessibility_id('request-transaction-bottom-sheet')
|
|
|
|
|
2018-01-03 09:34:40 +00:00
|
|
|
class SendTransactionView(BaseView):
|
|
|
|
def __init__(self, driver):
|
|
|
|
super(SendTransactionView, self).__init__(driver)
|
|
|
|
|
|
|
|
self.chose_recipient_button = ChooseRecipientButton(self.driver)
|
2019-08-16 10:14:23 +00:00
|
|
|
self.accounts_button = AccountsButton(self.driver)
|
2018-02-19 11:51:53 +00:00
|
|
|
self.enter_recipient_address_button = EnterRecipientAddressButton(self.driver)
|
2018-07-20 08:27:33 +00:00
|
|
|
self.scan_qr_code_button = ScanQRCodeButton(self.driver)
|
2018-02-07 13:18:55 +00:00
|
|
|
self.enter_recipient_address_input = EnterRecipientAddressInput(self.driver)
|
2018-01-03 09:34:40 +00:00
|
|
|
self.first_recipient_button = FirstRecipient(self.driver)
|
2019-10-16 11:59:21 +00:00
|
|
|
self.enter_recipient_address_text = EnterRecipientAddressInputText(self.driver)
|
2018-02-09 15:16:07 +00:00
|
|
|
self.recent_recipients_button = RecentRecipientsButton(self.driver)
|
2018-01-03 09:34:40 +00:00
|
|
|
self.amount_edit_box = AmountEditBox(self.driver)
|
2020-07-29 15:54:45 +00:00
|
|
|
self.set_max_button = SetMaxButton(self.driver)
|
2020-06-24 13:25:53 +00:00
|
|
|
self.validation_error_element = ValidationIconOnSendTransaction(self.driver)
|
2018-06-28 18:46:51 +00:00
|
|
|
|
2019-06-24 15:53:02 +00:00
|
|
|
self.network_fee_button = NetworkFeeButton(self.driver)
|
2018-06-28 18:46:51 +00:00
|
|
|
self.transaction_fee_button = TransactionFeeButton(self.driver)
|
2019-02-15 16:14:42 +00:00
|
|
|
self.transaction_fee_total_value = TransactionFeeTotalValue(self.driver)
|
2018-06-28 18:46:51 +00:00
|
|
|
self.gas_limit_input = GasLimitInput(self.driver)
|
|
|
|
self.gas_price_input = GasPriceInput(self.driver)
|
|
|
|
self.total_fee_input = TotalFeeInput(self.driver)
|
2019-06-24 15:53:02 +00:00
|
|
|
self.update_fee_button = UpdateFeeButton(self.driver)
|
2018-06-28 18:46:51 +00:00
|
|
|
|
2018-05-16 19:59:36 +00:00
|
|
|
self.cancel_button = CancelButton(self.driver)
|
2018-01-03 09:34:40 +00:00
|
|
|
self.sign_transaction_button = SignTransactionButton(self.driver)
|
2020-05-14 10:41:09 +00:00
|
|
|
self.sign_with_keycard_button = SignWithKeycardButton(self.driver)
|
2019-06-12 08:38:02 +00:00
|
|
|
self.sign_with_password = SignWithPasswordButton(self.driver)
|
|
|
|
self.sign_button = SignButton(self.driver)
|
2018-05-16 19:59:36 +00:00
|
|
|
self.sign_in_phrase_text = SignInPhraseText(self.driver)
|
2018-01-03 09:34:40 +00:00
|
|
|
self.password_input = PasswordInput(self.driver)
|
|
|
|
self.enter_password_input = EnterPasswordInput(self.driver)
|
|
|
|
self.got_it_button = GotItButton(self.driver)
|
2018-01-26 11:07:09 +00:00
|
|
|
|
2018-02-09 15:16:07 +00:00
|
|
|
self.select_asset_button = SelectAssetButton(self.driver)
|
2020-04-15 14:25:18 +00:00
|
|
|
self.asset_text = AssetText(self.driver)
|
|
|
|
self.recipient_text = RecipientText(self.driver)
|
2018-02-09 15:16:07 +00:00
|
|
|
|
2018-04-23 18:42:12 +00:00
|
|
|
self.error_dialog = ErrorDialog(self.driver)
|
|
|
|
|
2018-06-29 17:27:30 +00:00
|
|
|
self.share_button = ShareButton(self.driver)
|
|
|
|
|
2018-10-07 15:12:21 +00:00
|
|
|
self.onboarding_message = OnboardingMessage(self.driver)
|
2018-11-26 14:06:34 +00:00
|
|
|
self.validation_warnings = ValidationWarnings(self.driver)
|
2020-04-02 10:30:20 +00:00
|
|
|
self.eth_asset_in_select_asset_bottom_sheet_button = ETHroAssetButtonInSelectAssetBottomSheet(self.driver)
|
2018-10-07 15:12:21 +00:00
|
|
|
|
2020-03-24 15:45:15 +00:00
|
|
|
# Elements for commands in 1-1 chat
|
|
|
|
self.select_button = SelectButton(self.driver)
|
2020-04-02 10:30:20 +00:00
|
|
|
self.request_transaction_button = RequestTransactionButtonBottomSheet(self.driver)
|
2020-03-24 15:45:15 +00:00
|
|
|
|
2020-10-06 14:48:08 +00:00
|
|
|
# Elements on set recipient screen
|
|
|
|
self.recipient_add_to_favorites = RecipientAddToFavoritesButton(self.driver)
|
|
|
|
self.recipient_done = RecipientDoneButton(self.driver)
|
|
|
|
self.new_favorite_name_input = NewFavoriteNameInput(self.driver)
|
|
|
|
self.new_favorite_add_favorite = NewFavoriteAddFavorite(self.driver)
|
|
|
|
|
2018-11-07 13:09:23 +00:00
|
|
|
def complete_onboarding(self):
|
|
|
|
if self.onboarding_message.is_element_displayed():
|
|
|
|
from views.wallet_view import WalletView
|
|
|
|
wallet_view = WalletView(self.driver)
|
2019-07-15 15:53:56 +00:00
|
|
|
wallet_view.ok_got_it_button.click()
|
2018-11-07 13:09:23 +00:00
|
|
|
|
2020-09-17 13:14:55 +00:00
|
|
|
def set_recipient_address(self, address):
|
|
|
|
self.chose_recipient_button.click()
|
|
|
|
self.enter_recipient_address_input.set_value(address)
|
|
|
|
self.enter_recipient_address_input.click()
|
|
|
|
self.done_button.click()
|
|
|
|
|
2020-05-15 11:51:05 +00:00
|
|
|
def sign_transaction(self, sender_password: str = common_password, keycard=False, default_gas_price=True):
|
|
|
|
if not default_gas_price:
|
|
|
|
self.network_fee_button.click()
|
|
|
|
default_gas_price = self.gas_price_input.text
|
|
|
|
self.gas_price_input.clear()
|
2020-09-09 15:06:07 +00:00
|
|
|
self.gas_price_input.set_value(str(int(float(default_gas_price))+30))
|
2020-05-15 11:51:05 +00:00
|
|
|
self.update_fee_button.click()
|
2020-05-14 10:41:09 +00:00
|
|
|
if keycard:
|
|
|
|
keycard_view = self.sign_with_keycard_button.click()
|
|
|
|
keycard_view.enter_default_pin()
|
|
|
|
else:
|
|
|
|
self.sign_with_password.click_until_presence_of_element(self.enter_password_input)
|
|
|
|
self.enter_password_input.send_keys(sender_password)
|
|
|
|
self.sign_button.click_until_absense_of_element(self.sign_button)
|
2019-12-20 17:35:36 +00:00
|
|
|
self.ok_button.wait_for_element(120)
|
2019-06-12 08:38:02 +00:00
|
|
|
self.ok_button.click()
|
2019-02-15 16:14:42 +00:00
|
|
|
|
|
|
|
def get_transaction_fee_total(self):
|
2020-04-07 14:57:31 +00:00
|
|
|
self.network_fee_button.click_until_presence_of_element(self.gas_limit_input)
|
|
|
|
fee_value = self.transaction_fee_total_value.text.split()[0]
|
|
|
|
self.update_fee_button.click()
|
|
|
|
return fee_value
|
2019-02-15 16:14:42 +00:00
|
|
|
|
2019-11-29 17:32:47 +00:00
|
|
|
def get_formatted_recipient_address(self, address):
|
|
|
|
return address[:6] + '…' + address[-4:]
|
|
|
|
|
2020-03-24 15:45:15 +00:00
|
|
|
def get_username_in_transaction_bottom_sheet_button(self, username_part):
|
|
|
|
return UserNameInSendTransactionBottomSheet(self.driver, username_part)
|
|
|
|
|
|
|
|
def get_account_in_select_account_bottom_sheet_button(self, account_name):
|
|
|
|
return AccountNameInSelectAccountBottomSheet(self.driver, account_name)
|
|
|
|
|
2020-06-24 13:25:53 +00:00
|
|
|
def get_validation_icon(self, field='Network fee'):
|
|
|
|
return ValidationErrorOnSendTransaction(self.driver, field)
|
|
|
|
|
2020-04-15 14:25:18 +00:00
|
|
|
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
|
2020-10-06 14:48:08 +00:00
|
|
|
|
|
|
|
def add_to_favorites(self, name):
|
|
|
|
self.recipient_add_to_favorites.click()
|
|
|
|
self.new_favorite_name_input.set_value(name)
|
|
|
|
self.new_favorite_add_favorite.click()
|