2018-07-13 10:56:36 +00:00
|
|
|
from views.base_element import BaseText
|
|
|
|
from views.base_element import BaseButton, BaseEditBox
|
2018-04-23 18:42:12 +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)
|
|
|
|
self.locator = self.Locator.accessibility_id('cancel-button')
|
|
|
|
|
|
|
|
|
2018-01-03 09:34:40 +00:00
|
|
|
class SignTransactionButton(BaseButton):
|
|
|
|
def __init__(self, driver):
|
|
|
|
super(SignTransactionButton, self).__init__(driver)
|
2018-03-15 20:01:08 +00:00
|
|
|
self.locator = self.Locator.accessibility_id('sign-transaction-button')
|
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
|
|
|
|
|
|
|
|
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
|
|
|
|
|
|
|
|
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)
|
2018-03-01 13:22:01 +00:00
|
|
|
self.locator = self.Locator.xpath_selector("//*[@text='Enter recipient address']")
|
2018-02-07 13:18:55 +00:00
|
|
|
|
|
|
|
|
|
|
|
class EnterRecipientAddressInput(BaseEditBox):
|
|
|
|
def __init__(self, driver):
|
|
|
|
super(EnterRecipientAddressInput, self).__init__(driver)
|
|
|
|
self.locator = self.Locator.xpath_selector("//*[@text='Enter recipient address']")
|
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
|
|
|
|
|
|
|
|
2018-07-13 10:56:36 +00:00
|
|
|
class AssetButton(BaseButton):
|
|
|
|
def __init__(self, driver, asset_name):
|
|
|
|
super(AssetButton, self).__init__(driver)
|
|
|
|
self.locator = self.Locator.text_part_selector(asset_name)
|
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)
|
|
|
|
|
|
|
|
|
2018-06-28 18:46:51 +00:00
|
|
|
class AdvancedButton(BaseButton):
|
|
|
|
def __init__(self, driver):
|
|
|
|
super(AdvancedButton, self).__init__(driver)
|
|
|
|
self.locator = self.Locator.accessibility_id('advanced-button')
|
|
|
|
|
|
|
|
|
|
|
|
class TransactionFeeButton(BaseButton):
|
|
|
|
def __init__(self, driver):
|
|
|
|
super(TransactionFeeButton, self).__init__(driver)
|
|
|
|
self.locator = self.Locator.accessibility_id('transaction-fee-button')
|
|
|
|
|
|
|
|
|
|
|
|
class GasLimitInput(BaseEditBox):
|
|
|
|
def __init__(self, driver):
|
|
|
|
super(GasLimitInput, self).__init__(driver)
|
|
|
|
self.locator = self.Locator.accessibility_id('gas-limit-input')
|
|
|
|
|
|
|
|
|
|
|
|
class GasPriceInput(BaseEditBox):
|
|
|
|
def __init__(self, driver):
|
|
|
|
super(GasPriceInput, self).__init__(driver)
|
|
|
|
self.locator = self.Locator.accessibility_id('gas-price-input')
|
|
|
|
|
|
|
|
|
|
|
|
class TotalFeeInput(BaseEditBox):
|
|
|
|
def __init__(self, driver):
|
|
|
|
super(TotalFeeInput, self).__init__(driver)
|
|
|
|
self.locator = self.Locator.xpath_selector("//*[@content-desc='total-fee-input']/android.widget.TextView")
|
|
|
|
|
|
|
|
|
2018-06-29 17:27:30 +00:00
|
|
|
class ShareButton(BaseButton):
|
|
|
|
|
|
|
|
def __init__(self, driver):
|
|
|
|
super(ShareButton, self).__init__(driver)
|
|
|
|
self.locator = self.Locator.accessibility_id('share-button')
|
|
|
|
|
|
|
|
|
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)
|
2018-02-19 11:51:53 +00:00
|
|
|
self.enter_recipient_address_button = EnterRecipientAddressButton(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)
|
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)
|
2018-06-28 18:46:51 +00:00
|
|
|
|
|
|
|
self.advanced_button = AdvancedButton(self.driver)
|
|
|
|
self.transaction_fee_button = TransactionFeeButton(self.driver)
|
|
|
|
self.gas_limit_input = GasLimitInput(self.driver)
|
|
|
|
self.gas_price_input = GasPriceInput(self.driver)
|
|
|
|
self.total_fee_input = TotalFeeInput(self.driver)
|
|
|
|
|
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)
|
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)
|
|
|
|
|
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-02-09 15:16:07 +00:00
|
|
|
def sign_transaction(self, sender_password):
|
|
|
|
self.sign_transaction_button.click_until_presence_of_element(self.enter_password_input)
|
|
|
|
self.enter_password_input.send_keys(sender_password)
|
|
|
|
self.sign_transaction_button.click_until_presence_of_element(self.got_it_button)
|
|
|
|
self.got_it_button.click()
|
2018-07-13 10:56:36 +00:00
|
|
|
|
|
|
|
def asset_by_name(self, asset_name):
|
|
|
|
return AssetButton(self.driver, asset_name)
|