2018-05-16 07:22:02 +00:00
|
|
|
|
import time
|
2019-08-16 10:14:23 +00:00
|
|
|
|
|
|
|
|
|
from tests import common_password
|
|
|
|
|
from views.base_element import BaseButton, BaseText, BaseEditBox
|
2018-01-03 09:34:40 +00:00
|
|
|
|
from views.base_view import BaseView
|
2017-10-19 13:49:20 +00:00
|
|
|
|
|
|
|
|
|
|
2017-12-13 13:12:46 +00:00
|
|
|
|
class SendRequestButton(BaseButton):
|
|
|
|
|
|
|
|
|
|
def __init__(self, driver):
|
|
|
|
|
super(SendRequestButton, self).__init__(driver)
|
2018-03-15 20:01:08 +00:00
|
|
|
|
self.locator = self.Locator.accessibility_id('sent-request-button')
|
2017-12-13 13:12:46 +00:00
|
|
|
|
|
|
|
|
|
|
2017-10-19 13:49:20 +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')
|
2017-10-19 13:49:20 +00:00
|
|
|
|
|
|
|
|
|
|
2018-06-29 17:27:30 +00:00
|
|
|
|
class TransactionHistoryButton(BaseButton):
|
2017-10-19 13:49:20 +00:00
|
|
|
|
def __init__(self, driver):
|
2018-06-29 17:27:30 +00:00
|
|
|
|
super(TransactionHistoryButton, self).__init__(driver)
|
2019-11-07 13:38:14 +00:00
|
|
|
|
self.locator = self.Locator.text_selector("History")
|
2017-10-19 13:49:20 +00:00
|
|
|
|
|
2017-10-23 20:46:49 +00:00
|
|
|
|
def navigate(self):
|
2018-01-03 09:34:40 +00:00
|
|
|
|
from views.transactions_view import TransactionsView
|
|
|
|
|
return TransactionsView(self.driver)
|
2017-10-19 13:49:20 +00:00
|
|
|
|
|
|
|
|
|
|
2017-10-23 20:46:49 +00:00
|
|
|
|
class ChooseFromContactsButton(BaseButton):
|
2017-10-19 13:49:20 +00:00
|
|
|
|
def __init__(self, driver):
|
2017-10-23 20:46:49 +00:00
|
|
|
|
super(ChooseFromContactsButton, self).__init__(driver)
|
2019-11-07 13:38:14 +00:00
|
|
|
|
self.locator = self.Locator.text_selector("Choose From Contacts")
|
2017-10-19 13:49:20 +00:00
|
|
|
|
|
|
|
|
|
|
2020-04-15 14:25:18 +00:00
|
|
|
|
class ScanQRButton(BaseButton):
|
|
|
|
|
def __init__(self, driver):
|
|
|
|
|
super(ScanQRButton, self).__init__(driver)
|
|
|
|
|
self.locator = self.Locator.accessibility_id("accounts-qr-code")
|
|
|
|
|
|
2020-05-20 15:43:29 +00:00
|
|
|
|
|
2019-11-07 13:38:14 +00:00
|
|
|
|
class AssetText(BaseText):
|
|
|
|
|
def __init__(self, driver, asset):
|
|
|
|
|
super(AssetText, self).__init__(driver)
|
2020-05-19 10:40:39 +00:00
|
|
|
|
self.locator = self.Locator.xpath_selector("//android.view.ViewGroup[@content-desc=':%s-asset-value']"
|
|
|
|
|
"//android.widget.TextView[1]" % asset)
|
2017-10-19 13:49:20 +00:00
|
|
|
|
|
|
|
|
|
|
2020-05-20 15:43:29 +00:00
|
|
|
|
class AssetFullNameInAssets(BaseText):
|
|
|
|
|
def __init__(self, driver):
|
|
|
|
|
super(AssetFullNameInAssets, self).__init__(driver)
|
2020-07-08 14:28:54 +00:00
|
|
|
|
self.locator = self.Locator.xpath_selector('//*[@content-desc="checkbox"]/../../android.widget.TextView[1]')
|
2020-05-20 15:43:29 +00:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
class AssetSymbolInAssets(BaseText):
|
|
|
|
|
def __init__(self, driver):
|
|
|
|
|
super(AssetSymbolInAssets, self).__init__(driver)
|
2020-07-10 16:00:56 +00:00
|
|
|
|
self.locator = self.Locator.xpath_selector('//*[@content-desc="checkbox"]/../../android.widget.TextView[2]')
|
2020-05-20 15:43:29 +00:00
|
|
|
|
|
|
|
|
|
class CurrencyItemText(BaseText):
|
|
|
|
|
def __init__(self, driver):
|
|
|
|
|
super(CurrencyItemText, self).__init__(driver)
|
|
|
|
|
self.locator = self.Locator.xpath_selector('//*[@content-desc="currency-item"]//android.widget.TextView')
|
|
|
|
|
|
|
|
|
|
|
2017-10-23 20:46:49 +00:00
|
|
|
|
class UsdTotalValueText(BaseText):
|
2017-10-19 13:49:20 +00:00
|
|
|
|
def __init__(self, driver):
|
2017-10-23 20:46:49 +00:00
|
|
|
|
super(UsdTotalValueText, self).__init__(driver)
|
2018-08-01 00:16:33 +00:00
|
|
|
|
self.locator = self.Locator.accessibility_id('total-amount-value-text')
|
2017-10-19 13:49:20 +00:00
|
|
|
|
|
|
|
|
|
|
2018-02-09 15:16:07 +00:00
|
|
|
|
class SendTransactionRequestButton(BaseButton):
|
|
|
|
|
def __init__(self, driver):
|
|
|
|
|
super(SendTransactionRequestButton, self).__init__(driver)
|
2018-03-15 20:01:08 +00:00
|
|
|
|
self.locator = self.Locator.accessibility_id('sent-transaction-request-button')
|
2018-02-09 15:16:07 +00:00
|
|
|
|
|
2018-11-13 08:25:55 +00:00
|
|
|
|
def navigate(self):
|
|
|
|
|
from views.send_transaction_view import SendTransactionView
|
|
|
|
|
return SendTransactionView(self.driver)
|
|
|
|
|
|
2018-02-09 15:16:07 +00:00
|
|
|
|
|
|
|
|
|
class OptionsButton(BaseButton):
|
|
|
|
|
def __init__(self, driver):
|
|
|
|
|
super(OptionsButton, self).__init__(driver)
|
2018-03-15 20:01:08 +00:00
|
|
|
|
self.locator = self.Locator.accessibility_id('options-menu-button')
|
2018-02-09 15:16:07 +00:00
|
|
|
|
|
2019-10-25 14:33:56 +00:00
|
|
|
|
class AccountOptionsButton(BaseButton):
|
|
|
|
|
def __init__(self, driver, account_name):
|
|
|
|
|
super(AccountOptionsButton, self).__init__(driver)
|
2020-08-06 08:48:12 +00:00
|
|
|
|
self.locator = self.Locator.xpath_selector('(//*[@text="%s"]/../..//*[@content-desc="icon"])[2]' % account_name)
|
2019-10-25 14:33:56 +00:00
|
|
|
|
|
2018-02-09 15:16:07 +00:00
|
|
|
|
|
|
|
|
|
class ManageAssetsButton(BaseButton):
|
|
|
|
|
def __init__(self, driver):
|
|
|
|
|
super(ManageAssetsButton, self).__init__(driver)
|
2019-06-24 15:53:02 +00:00
|
|
|
|
self.locator = self.Locator.accessibility_id('wallet-manage-assets')
|
2018-02-09 15:16:07 +00:00
|
|
|
|
|
|
|
|
|
|
2020-10-07 16:07:42 +00:00
|
|
|
|
class ScanTokensButton(BaseButton):
|
|
|
|
|
def __init__(self, driver):
|
|
|
|
|
super(ScanTokensButton, self).__init__(driver)
|
|
|
|
|
self.locator = self.Locator.accessibility_id('wallet-scan-token')
|
|
|
|
|
|
|
|
|
|
|
2018-02-09 15:16:07 +00:00
|
|
|
|
class STTCheckBox(BaseButton):
|
|
|
|
|
def __init__(self, driver):
|
|
|
|
|
super(STTCheckBox, self).__init__(driver)
|
2019-06-24 15:53:02 +00:00
|
|
|
|
self.locator = self.Locator.xpath_selector("//*[@text='STT']"
|
|
|
|
|
"/../android.view.ViewGroup[@content-desc='checkbox']")
|
2018-02-09 15:16:07 +00:00
|
|
|
|
|
|
|
|
|
|
2018-05-02 16:01:17 +00:00
|
|
|
|
class QRCodeImage(BaseButton):
|
|
|
|
|
def __init__(self, driver):
|
|
|
|
|
super(QRCodeImage, self).__init__(driver)
|
|
|
|
|
self.locator = self.Locator.accessibility_id('qr-code-image')
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
class AddressText(BaseButton):
|
|
|
|
|
def __init__(self, driver):
|
|
|
|
|
super(AddressText, self).__init__(driver)
|
|
|
|
|
self.locator = self.Locator.accessibility_id('address-text')
|
|
|
|
|
|
|
|
|
|
|
2018-05-11 19:15:39 +00:00
|
|
|
|
class SetUpButton(BaseButton):
|
|
|
|
|
def __init__(self, driver):
|
|
|
|
|
super(SetUpButton, self).__init__(driver)
|
2019-03-14 19:51:54 +00:00
|
|
|
|
self.locator = self.Locator.text_selector("Let’s get set up")
|
2018-05-11 19:15:39 +00:00
|
|
|
|
|
2019-07-12 07:16:02 +00:00
|
|
|
|
|
2019-06-28 14:36:24 +00:00
|
|
|
|
class SetCurrencyButton(BaseButton):
|
|
|
|
|
def __init__(self, driver):
|
|
|
|
|
super(SetCurrencyButton, self).__init__(driver)
|
2020-04-15 14:25:18 +00:00
|
|
|
|
self.locator = self.Locator.text_selector("Set currency")
|
2019-06-28 14:36:24 +00:00
|
|
|
|
|
2018-05-11 19:15:39 +00:00
|
|
|
|
|
2018-05-16 19:59:36 +00:00
|
|
|
|
class SignInPhraseText(BaseText):
|
|
|
|
|
def __init__(self, driver):
|
|
|
|
|
super(SignInPhraseText, self).__init__(driver)
|
2019-07-12 07:16:02 +00:00
|
|
|
|
self.locator = self.Locator.xpath_selector('//*[@text="This is your signing phrase"]'
|
|
|
|
|
'//following-sibling::*[2]/android.widget.TextView')
|
2018-05-16 19:59:36 +00:00
|
|
|
|
|
2018-06-29 17:27:30 +00:00
|
|
|
|
@property
|
2019-07-29 00:35:36 +00:00
|
|
|
|
def string(self):
|
|
|
|
|
return self.text
|
2018-06-29 17:27:30 +00:00
|
|
|
|
|
|
|
|
|
@property
|
2019-07-29 00:35:36 +00:00
|
|
|
|
def list(self):
|
|
|
|
|
return self.string.split()
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
class RemindMeLaterButton(BaseButton):
|
|
|
|
|
def __init__(self, driver):
|
|
|
|
|
super(RemindMeLaterButton, self).__init__(driver)
|
2020-01-07 12:33:47 +00:00
|
|
|
|
self.locator = self.Locator.xpath_selector("//*[@text='Show me this again']")
|
2018-06-29 17:27:30 +00:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
class AssetTextElement(BaseText):
|
|
|
|
|
def __init__(self, driver, asset_name):
|
|
|
|
|
super(AssetTextElement, self).__init__(driver)
|
2020-05-19 10:40:39 +00:00
|
|
|
|
self.locator = self.Locator.text_part_selector(asset_name)
|
2018-06-29 17:27:30 +00:00
|
|
|
|
|
|
|
|
|
|
2018-11-09 12:36:21 +00:00
|
|
|
|
class CollectibleTextElement(BaseText):
|
|
|
|
|
def __init__(self, driver, collectible_name):
|
|
|
|
|
super().__init__(driver)
|
|
|
|
|
self.locator = self.Locator.accessibility_id('%s-collectible-value-text' % collectible_name.lower())
|
|
|
|
|
|
|
|
|
|
|
2018-06-29 17:27:30 +00:00
|
|
|
|
class AssetCheckBox(BaseButton):
|
|
|
|
|
def __init__(self, driver, asset_name):
|
|
|
|
|
super(AssetCheckBox, self).__init__(driver)
|
2018-07-19 09:57:45 +00:00
|
|
|
|
self.asset_name = asset_name
|
2019-02-11 12:39:07 +00:00
|
|
|
|
self.locator = self.Locator.xpath_selector("//*[@text='%s']" % self.asset_name)
|
2018-07-19 09:57:45 +00:00
|
|
|
|
|
|
|
|
|
def click(self):
|
2020-05-14 10:41:09 +00:00
|
|
|
|
self.scroll_to_element(12).click()
|
2018-08-15 12:51:52 +00:00
|
|
|
|
self.driver.info('Click %s asset checkbox' % self.asset_name)
|
2018-06-29 17:27:30 +00:00
|
|
|
|
|
2018-05-16 19:59:36 +00:00
|
|
|
|
|
2018-07-03 12:40:44 +00:00
|
|
|
|
class TotalAmountText(BaseText):
|
|
|
|
|
|
|
|
|
|
def __init__(self, driver):
|
|
|
|
|
super(TotalAmountText, self).__init__(driver)
|
|
|
|
|
self.locator = self.Locator.accessibility_id('total-amount-value-text')
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
class CurrencyText(BaseText):
|
|
|
|
|
|
|
|
|
|
def __init__(self, driver):
|
|
|
|
|
super(CurrencyText, self).__init__(driver)
|
|
|
|
|
self.locator = self.Locator.accessibility_id('total-amount-currency-text')
|
|
|
|
|
|
2019-06-28 14:36:24 +00:00
|
|
|
|
|
2019-07-12 07:16:02 +00:00
|
|
|
|
class CollectiblesButton(BaseButton):
|
2019-06-28 14:36:24 +00:00
|
|
|
|
def __init__(self, driver):
|
|
|
|
|
super(CollectiblesButton, self).__init__(driver)
|
|
|
|
|
self.locator = self.Locator.text_selector('Collectibles')
|
2018-07-03 12:40:44 +00:00
|
|
|
|
|
2019-07-12 07:16:02 +00:00
|
|
|
|
|
2020-10-23 13:52:58 +00:00
|
|
|
|
class NumberInCollectiblesButton(BaseButton):
|
|
|
|
|
def __init__(self, driver, name):
|
|
|
|
|
super(NumberInCollectiblesButton, self).__init__(driver)
|
|
|
|
|
self.locator = self.Locator.xpath_selector('//*[@text="%s"]//following-sibling::android.widget.TextView' % name)
|
2019-10-03 18:33:36 +00:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
class ViewInCryptoKittiesButton(BaseButton):
|
|
|
|
|
def __init__(self, driver):
|
|
|
|
|
super(ViewInCryptoKittiesButton, self).__init__(driver)
|
|
|
|
|
self.locator = self.Locator.accessibility_id('open-collectible-button')
|
|
|
|
|
|
|
|
|
|
def navigate(self):
|
|
|
|
|
from views.web_views.base_web_view import BaseWebView
|
|
|
|
|
return BaseWebView(self.driver)
|
|
|
|
|
|
|
|
|
|
def click(self):
|
2019-12-18 14:39:58 +00:00
|
|
|
|
self.wait_for_element(60).click()
|
2019-10-03 18:33:36 +00:00
|
|
|
|
self.driver.info('Tap on View in CryptoKitties')
|
|
|
|
|
return self.navigate()
|
|
|
|
|
|
|
|
|
|
|
2018-07-16 12:57:01 +00:00
|
|
|
|
class BackupRecoveryPhrase(BaseButton):
|
2018-07-06 11:10:48 +00:00
|
|
|
|
def __init__(self, driver):
|
2018-07-16 12:57:01 +00:00
|
|
|
|
super(BackupRecoveryPhrase, self).__init__(driver)
|
2020-01-07 12:33:47 +00:00
|
|
|
|
self.locator = self.Locator.text_selector('Back up your seed phrase')
|
2018-07-06 11:10:48 +00:00
|
|
|
|
|
|
|
|
|
def navigate(self):
|
|
|
|
|
from views.profile_view import ProfileView
|
|
|
|
|
return ProfileView(self.driver)
|
|
|
|
|
|
|
|
|
|
|
2019-06-24 15:53:02 +00:00
|
|
|
|
class BackupRecoveryPhraseWarningText(BaseButton):
|
|
|
|
|
def __init__(self, driver):
|
|
|
|
|
super(BackupRecoveryPhraseWarningText, self).__init__(driver)
|
|
|
|
|
self.locator = self.Locator.accessibility_id('back-up-your-seed-phrase-warning')
|
|
|
|
|
|
|
|
|
|
|
2019-07-03 14:29:01 +00:00
|
|
|
|
class MultiaccountMoreOptions(BaseButton):
|
2019-08-02 21:22:23 +00:00
|
|
|
|
def __init__(self, driver):
|
2019-07-03 14:29:01 +00:00
|
|
|
|
super(MultiaccountMoreOptions, self).__init__(driver)
|
2019-06-24 15:53:02 +00:00
|
|
|
|
self.locator = self.Locator.accessibility_id('accounts-more-options')
|
|
|
|
|
|
|
|
|
|
|
2019-08-16 10:14:23 +00:00
|
|
|
|
class AccountElementButton(BaseButton):
|
|
|
|
|
def __init__(self, driver, account_name):
|
|
|
|
|
super(AccountElementButton, self).__init__(driver)
|
|
|
|
|
self.locator = self.Locator.xpath_selector(
|
2020-08-18 09:47:00 +00:00
|
|
|
|
"//*[@content-desc='accountcard%s']" % account_name)
|
2019-08-16 10:14:23 +00:00
|
|
|
|
|
|
|
|
|
def color_matches(self, expected_color_image_name: str):
|
|
|
|
|
amount_text = BaseText(self.driver)
|
2020-11-06 11:23:12 +00:00
|
|
|
|
amount_text.locator = amount_text.Locator.xpath_selector(self.locator.value + "//*[@content-desc='account-total-value']")
|
2019-08-16 10:14:23 +00:00
|
|
|
|
return amount_text.is_element_image_equals_template(expected_color_image_name)
|
2019-06-24 15:53:02 +00:00
|
|
|
|
|
2020-04-03 14:45:45 +00:00
|
|
|
|
class StatusAccountTotalValueText(BaseText):
|
|
|
|
|
def __init__(self, driver):
|
|
|
|
|
super(StatusAccountTotalValueText, self).__init__(driver)
|
|
|
|
|
self.locator = self.Locator.accessibility_id('account-total-value')
|
|
|
|
|
|
|
|
|
|
|
2019-06-24 15:53:02 +00:00
|
|
|
|
|
|
|
|
|
class SendTransactionButton(BaseButton):
|
|
|
|
|
def __init__(self, driver):
|
|
|
|
|
super(SendTransactionButton, self).__init__(driver)
|
|
|
|
|
self.locator = self.Locator.xpath_selector("//*[@text='Send']")
|
|
|
|
|
|
|
|
|
|
def navigate(self):
|
|
|
|
|
from views.send_transaction_view import SendTransactionView
|
|
|
|
|
return SendTransactionView(self.driver)
|
|
|
|
|
|
2019-10-21 07:15:34 +00:00
|
|
|
|
def click(self):
|
|
|
|
|
self.find_element().click()
|
|
|
|
|
self.driver.info('Tap on %s' % self.name)
|
|
|
|
|
return self.navigate()
|
|
|
|
|
|
2019-06-24 15:53:02 +00:00
|
|
|
|
|
|
|
|
|
class ReceiveTransactionButton(BaseButton):
|
|
|
|
|
def __init__(self, driver):
|
|
|
|
|
super(ReceiveTransactionButton, self).__init__(driver)
|
|
|
|
|
self.locator = self.Locator.xpath_selector("//*[@text='Receive']")
|
|
|
|
|
|
|
|
|
|
def navigate(self):
|
|
|
|
|
from views.send_transaction_view import SendTransactionView
|
|
|
|
|
return SendTransactionView(self.driver)
|
|
|
|
|
|
|
|
|
|
|
2019-08-02 21:22:23 +00:00
|
|
|
|
class AddCustomTokenButton(BaseButton):
|
|
|
|
|
def __init__(self, driver):
|
|
|
|
|
super(AddCustomTokenButton, self).__init__(driver)
|
|
|
|
|
self.locator = self.Locator.xpath_selector("//*[@text='Add custom token']")
|
|
|
|
|
|
|
|
|
|
def navigate(self):
|
|
|
|
|
from views.add_custom_token_view import AddCustomTokenView
|
|
|
|
|
return AddCustomTokenView(self.driver)
|
|
|
|
|
|
|
|
|
|
|
2019-08-16 10:14:23 +00:00
|
|
|
|
class AddAccountButton(BaseButton):
|
|
|
|
|
def __init__(self, driver):
|
|
|
|
|
super(AddAccountButton, self).__init__(driver)
|
2020-08-18 09:47:00 +00:00
|
|
|
|
self.locator = self.Locator.accessibility_id('add-new-account')
|
2019-08-16 10:14:23 +00:00
|
|
|
|
|
|
|
|
|
|
2020-03-02 16:07:46 +00:00
|
|
|
|
class GenerateAnAccountButton(BaseButton):
|
2019-08-16 10:14:23 +00:00
|
|
|
|
def __init__(self, driver):
|
2020-03-02 16:07:46 +00:00
|
|
|
|
super(GenerateAnAccountButton, self).__init__(driver)
|
|
|
|
|
self.locator = self.Locator.accessibility_id('add-account-sheet-generate')
|
2019-08-16 10:14:23 +00:00
|
|
|
|
|
2019-12-20 17:35:36 +00:00
|
|
|
|
class AddAWatchOnlyAddressButton(BaseButton):
|
|
|
|
|
def __init__(self, driver):
|
|
|
|
|
super(AddAWatchOnlyAddressButton, self).__init__(driver)
|
2020-03-02 16:07:46 +00:00
|
|
|
|
self.locator = self.Locator.accessibility_id('add-account-sheet-watch')
|
|
|
|
|
|
|
|
|
|
class EnterASeedPhraseButton(BaseButton):
|
|
|
|
|
def __init__(self, driver):
|
|
|
|
|
super(EnterASeedPhraseButton, self).__init__(driver)
|
|
|
|
|
self.locator = self.Locator.accessibility_id('add-account-sheet-seed')
|
|
|
|
|
|
|
|
|
|
class EnterAPrivateKeyButton(BaseButton):
|
|
|
|
|
def __init__(self, driver):
|
|
|
|
|
super(EnterAPrivateKeyButton, self).__init__(driver)
|
|
|
|
|
self.locator = self.Locator.accessibility_id('add-account-sheet-private-key')
|
2019-12-20 17:35:36 +00:00
|
|
|
|
|
|
|
|
|
class EnterAddressInput(BaseEditBox):
|
|
|
|
|
def __init__(self, driver):
|
|
|
|
|
super(EnterAddressInput, self).__init__(driver)
|
2020-03-02 16:07:46 +00:00
|
|
|
|
self.locator = self.Locator.accessibility_id('add-account-enter-watch-address')
|
|
|
|
|
|
|
|
|
|
class EnterSeedPhraseInput(BaseEditBox):
|
|
|
|
|
def __init__(self, driver):
|
|
|
|
|
super(EnterSeedPhraseInput, self).__init__(driver)
|
|
|
|
|
self.locator = self.Locator.accessibility_id('add-account-enter-seed')
|
|
|
|
|
|
|
|
|
|
class EnterPrivateKeyInput(BaseEditBox):
|
|
|
|
|
def __init__(self, driver):
|
|
|
|
|
super(EnterPrivateKeyInput, self).__init__(driver)
|
|
|
|
|
self.locator = self.Locator.accessibility_id('add-account-enter-private-key')
|
2019-12-20 17:35:36 +00:00
|
|
|
|
|
|
|
|
|
class DeleteAccountButton(BaseButton):
|
|
|
|
|
def __init__(self, driver):
|
|
|
|
|
super(DeleteAccountButton, self).__init__(driver)
|
|
|
|
|
self.locator = self.Locator.text_selector('Delete account')
|
2019-08-16 10:14:23 +00:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
class EnterYourPasswordInput(BaseEditBox):
|
|
|
|
|
def __init__(self, driver):
|
|
|
|
|
super(EnterYourPasswordInput, self).__init__(driver)
|
2020-03-02 16:07:46 +00:00
|
|
|
|
self.locator = self.Locator.accessibility_id('add-account-enter-password')
|
2019-08-16 10:14:23 +00:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
class AccountNameInput(BaseEditBox):
|
|
|
|
|
def __init__(self, driver):
|
|
|
|
|
super(AccountNameInput, self).__init__(driver)
|
2020-03-04 09:11:25 +00:00
|
|
|
|
self.locator = self.Locator.accessibility_id('enter-account-name')
|
2019-08-16 10:14:23 +00:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
class AccountColorButton(BaseButton):
|
|
|
|
|
def __init__(self, driver):
|
|
|
|
|
super(AccountColorButton, self).__init__(driver)
|
|
|
|
|
self.locator = self.Locator.xpath_selector("//android.widget.TextView[@text='Account color']"
|
2019-10-25 14:33:56 +00:00
|
|
|
|
"/following-sibling::android.view.ViewGroup[1]")
|
2019-08-16 10:14:23 +00:00
|
|
|
|
|
|
|
|
|
def select_color_by_position(self, position: int):
|
|
|
|
|
self.click()
|
|
|
|
|
self.driver.find_element_by_xpath(
|
2020-05-19 10:40:39 +00:00
|
|
|
|
"((//android.widget.ScrollView)[last()]/*/*)[%s]" % str(position+1)).click()
|
2019-08-16 10:14:23 +00:00
|
|
|
|
|
2020-03-02 16:07:46 +00:00
|
|
|
|
# Add account on Generate An Account screen
|
|
|
|
|
class AddAccountGenerateAnAccountButton(BaseButton):
|
2019-08-16 10:14:23 +00:00
|
|
|
|
def __init__(self, driver):
|
2020-03-02 16:07:46 +00:00
|
|
|
|
super(AddAccountGenerateAnAccountButton, self).__init__(driver)
|
|
|
|
|
self.locator = self.Locator.accessibility_id('add-account-add-account-button')
|
2019-08-16 10:14:23 +00:00
|
|
|
|
|
2019-10-25 14:33:56 +00:00
|
|
|
|
class AccountSettingsButton(BaseButton):
|
|
|
|
|
def __init__(self, driver):
|
|
|
|
|
super(AccountSettingsButton, self).__init__(driver)
|
|
|
|
|
self.locator = self.Locator.text_selector('Account settings')
|
|
|
|
|
|
|
|
|
|
class ApplySettingsButton(BaseButton):
|
|
|
|
|
def __init__(self, driver):
|
|
|
|
|
super(ApplySettingsButton, self).__init__(driver)
|
|
|
|
|
self.locator = self.Locator.text_selector('Apply')
|
2019-08-16 10:14:23 +00:00
|
|
|
|
|
2018-01-03 09:34:40 +00:00
|
|
|
|
class WalletView(BaseView):
|
2017-10-19 13:49:20 +00:00
|
|
|
|
def __init__(self, driver):
|
2018-01-03 09:34:40 +00:00
|
|
|
|
super(WalletView, self).__init__(driver)
|
2017-10-19 13:49:20 +00:00
|
|
|
|
self.driver = driver
|
|
|
|
|
|
2018-06-29 17:27:30 +00:00
|
|
|
|
self.send_transaction_button = SendTransactionButton(self.driver)
|
|
|
|
|
self.transaction_history_button = TransactionHistoryButton(self.driver)
|
2017-10-23 20:46:49 +00:00
|
|
|
|
self.usd_total_value = UsdTotalValueText(self.driver)
|
2018-02-09 15:16:07 +00:00
|
|
|
|
|
|
|
|
|
self.send_transaction_request = SendTransactionRequestButton(self.driver)
|
2018-06-29 17:27:30 +00:00
|
|
|
|
self.receive_transaction_button = ReceiveTransactionButton(self.driver)
|
2018-01-03 09:34:40 +00:00
|
|
|
|
|
2017-12-13 13:12:46 +00:00
|
|
|
|
self.send_request_button = SendRequestButton(self.driver)
|
2018-02-09 15:16:07 +00:00
|
|
|
|
self.options_button = OptionsButton(self.driver)
|
|
|
|
|
self.manage_assets_button = ManageAssetsButton(self.driver)
|
2020-10-07 16:07:42 +00:00
|
|
|
|
self.scan_tokens_button = ScanTokensButton(self.driver)
|
2018-02-09 15:16:07 +00:00
|
|
|
|
self.stt_check_box = STTCheckBox(self.driver)
|
2020-05-20 15:43:29 +00:00
|
|
|
|
self.all_assets_full_names = AssetFullNameInAssets(self.driver)
|
|
|
|
|
self.all_assets_symbols = AssetSymbolInAssets(self.driver)
|
|
|
|
|
self.currency_item_text = CurrencyItemText(self.driver)
|
|
|
|
|
|
2017-10-23 20:46:49 +00:00
|
|
|
|
|
2018-05-02 16:01:17 +00:00
|
|
|
|
self.qr_code_image = QRCodeImage(self.driver)
|
|
|
|
|
self.address_text = AddressText(self.driver)
|
|
|
|
|
|
2018-05-11 19:15:39 +00:00
|
|
|
|
self.set_up_button = SetUpButton(self.driver)
|
2018-05-16 19:59:36 +00:00
|
|
|
|
self.sign_in_phrase = SignInPhraseText(self.driver)
|
2019-07-29 00:35:36 +00:00
|
|
|
|
self.remind_me_later_button = RemindMeLaterButton(self.driver)
|
2018-05-11 19:15:39 +00:00
|
|
|
|
|
2018-07-03 12:40:44 +00:00
|
|
|
|
self.total_amount_text = TotalAmountText(self.driver)
|
|
|
|
|
self.currency_text = CurrencyText(self.driver)
|
2018-07-16 12:57:01 +00:00
|
|
|
|
self.backup_recovery_phrase = BackupRecoveryPhrase(self.driver)
|
2019-06-24 15:53:02 +00:00
|
|
|
|
self.backup_recovery_phrase_warning_text = BackupRecoveryPhraseWarningText(self.driver)
|
|
|
|
|
|
2019-08-02 21:22:23 +00:00
|
|
|
|
self.add_custom_token_button = AddCustomTokenButton(self.driver)
|
|
|
|
|
|
2019-06-24 15:53:02 +00:00
|
|
|
|
# elements for multiaccount
|
2019-07-03 14:29:01 +00:00
|
|
|
|
self.multiaccount_more_options = MultiaccountMoreOptions(self.driver)
|
2020-11-11 15:37:27 +00:00
|
|
|
|
self.accounts_status_account = AccountElementButton(self.driver, account_name=self.status_account_name)
|
2019-06-28 14:36:24 +00:00
|
|
|
|
self.collectibles_button = CollectiblesButton(self.driver)
|
2020-10-23 13:52:58 +00:00
|
|
|
|
self.cryptokitties_in_collectibles_number = NumberInCollectiblesButton(self.driver, 'CryptoKitties')
|
2019-10-03 18:33:36 +00:00
|
|
|
|
self.view_in_cryptokitties_button = ViewInCryptoKittiesButton(self.driver)
|
2019-06-28 14:36:24 +00:00
|
|
|
|
self.set_currency_button = SetCurrencyButton(self.driver)
|
2019-08-16 10:14:23 +00:00
|
|
|
|
self.add_account_button = AddAccountButton(self.driver)
|
2020-03-02 16:07:46 +00:00
|
|
|
|
self.generate_an_account_button = GenerateAnAccountButton(self.driver)
|
2019-12-20 17:35:36 +00:00
|
|
|
|
self.add_watch_only_address_button = AddAWatchOnlyAddressButton(self.driver)
|
2020-03-02 16:07:46 +00:00
|
|
|
|
self.enter_a_seed_phrase_button = EnterASeedPhraseButton(self.driver)
|
|
|
|
|
self.enter_a_private_key_button = EnterAPrivateKeyButton(self.driver)
|
2019-12-20 17:35:36 +00:00
|
|
|
|
self.enter_address_input = EnterAddressInput(self.driver)
|
2020-03-02 16:07:46 +00:00
|
|
|
|
self.enter_seed_phrase_input = EnterSeedPhraseInput(self.driver)
|
|
|
|
|
self.enter_a_private_key_input = EnterPrivateKeyInput(self.driver)
|
2019-12-20 17:35:36 +00:00
|
|
|
|
self.delete_account_button = DeleteAccountButton(self.driver)
|
2019-08-16 10:14:23 +00:00
|
|
|
|
self.enter_your_password_input = EnterYourPasswordInput(self.driver)
|
|
|
|
|
self.account_name_input = AccountNameInput(self.driver)
|
|
|
|
|
self.account_color_button = AccountColorButton(self.driver)
|
2020-03-02 16:07:46 +00:00
|
|
|
|
self.add_account_generate_account_button = AddAccountGenerateAnAccountButton(self.driver)
|
2020-04-03 14:45:45 +00:00
|
|
|
|
self.status_account_total_usd_value = StatusAccountTotalValueText(self.driver)
|
2020-04-15 14:25:18 +00:00
|
|
|
|
self.scan_qr_button = ScanQRButton(self.driver)
|
2018-07-03 12:40:44 +00:00
|
|
|
|
|
2019-10-25 14:33:56 +00:00
|
|
|
|
# individual account settings
|
|
|
|
|
self.account_settings_button = AccountSettingsButton(self.driver)
|
|
|
|
|
self.apply_settings_button = ApplySettingsButton(self.driver)
|
|
|
|
|
|
2017-10-23 20:46:49 +00:00
|
|
|
|
def get_usd_total_value(self):
|
2018-05-29 14:06:32 +00:00
|
|
|
|
import re
|
2018-08-16 16:47:13 +00:00
|
|
|
|
return float(re.sub('[~,]', '', self.usd_total_value.text))
|
2017-10-23 20:46:49 +00:00
|
|
|
|
|
2020-11-11 15:37:27 +00:00
|
|
|
|
def get_account_options_by_name(self, account_name=''):
|
|
|
|
|
account_name = self.status_account_name if not account_name else account_name
|
2019-12-20 17:35:36 +00:00
|
|
|
|
return AccountOptionsButton(self.driver, account_name)
|
2018-07-20 08:27:33 +00:00
|
|
|
|
|
2019-11-07 13:38:14 +00:00
|
|
|
|
def get_asset_amount_by_name(self, asset: str):
|
|
|
|
|
asset_value = AssetText(self.driver, asset)
|
|
|
|
|
asset_value.scroll_to_element()
|
2020-10-07 16:07:42 +00:00
|
|
|
|
try:
|
|
|
|
|
return float(asset_value.text.split()[0])
|
|
|
|
|
except ValueError:
|
|
|
|
|
return 0.0
|
2017-10-23 20:46:49 +00:00
|
|
|
|
|
2017-12-27 18:03:57 +00:00
|
|
|
|
def verify_currency_balance(self, expected_rate: int, errors: list):
|
2017-10-23 20:46:49 +00:00
|
|
|
|
usd = self.get_usd_total_value()
|
2020-07-14 16:32:47 +00:00
|
|
|
|
eth = self.get_asset_amount_by_name('ETH')
|
2017-12-27 18:03:57 +00:00
|
|
|
|
expected_usd = round(eth * expected_rate, 2)
|
2017-12-27 18:03:57 +00:00
|
|
|
|
percentage_diff = abs((usd - expected_usd) / ((usd + expected_usd) / 2)) * 100
|
|
|
|
|
if percentage_diff > 2:
|
|
|
|
|
errors.append('Difference between current (%s) and expected (%s) USD balance > 2%%!!' % (usd, expected_usd))
|
2018-01-14 17:43:36 +00:00
|
|
|
|
else:
|
2018-08-15 12:51:52 +00:00
|
|
|
|
self.driver.info('Current USD balance %s is ok' % usd)
|
2018-05-11 19:15:39 +00:00
|
|
|
|
|
2020-07-14 16:32:47 +00:00
|
|
|
|
def wait_balance_is_equal_expected_amount(self, asset ='ETH', expected_balance=0.1, wait_time=300):
|
2018-05-16 07:22:02 +00:00
|
|
|
|
counter = 0
|
|
|
|
|
while True:
|
|
|
|
|
if counter >= wait_time:
|
2019-10-29 16:02:07 +00:00
|
|
|
|
self.driver.fail('Balance is not changed during %s seconds!' % wait_time)
|
2019-11-07 13:38:14 +00:00
|
|
|
|
elif self.get_asset_amount_by_name(asset) != expected_balance:
|
2018-05-16 07:22:02 +00:00
|
|
|
|
counter += 10
|
|
|
|
|
time.sleep(10)
|
2018-06-08 10:02:54 +00:00
|
|
|
|
self.swipe_down()
|
2020-10-07 16:07:42 +00:00
|
|
|
|
self.driver.info('Waiting %s seconds for %s balance update to be equal to %s' % (counter,asset, expected_balance))
|
2018-05-16 07:22:02 +00:00
|
|
|
|
else:
|
2020-10-07 16:07:42 +00:00
|
|
|
|
self.driver.info('Balance for %s is equal to %s' % (asset, expected_balance))
|
2018-05-16 07:22:02 +00:00
|
|
|
|
return
|
|
|
|
|
|
2020-12-09 16:37:47 +00:00
|
|
|
|
def wait_balance_is_changed(self, asset ='ETH', initial_balance=0, wait_time=400, scan_tokens=False):
|
2019-11-07 13:38:14 +00:00
|
|
|
|
counter = 0
|
|
|
|
|
while True:
|
|
|
|
|
if counter >= wait_time:
|
|
|
|
|
self.driver.fail('Balance is not changed during %s seconds!' % wait_time)
|
|
|
|
|
elif self.asset_by_name(asset).is_element_present() and self.get_asset_amount_by_name(asset) == initial_balance:
|
2020-12-09 16:37:47 +00:00
|
|
|
|
if not self.transaction_history_button.is_element_displayed():
|
|
|
|
|
self.wallet_account_by_name(self.status_account_name).click()
|
|
|
|
|
self.swipe_down()
|
2019-11-07 13:38:14 +00:00
|
|
|
|
counter += 10
|
|
|
|
|
time.sleep(10)
|
2020-12-09 16:37:47 +00:00
|
|
|
|
[self.wallet_button.click() for _ in range(2)]
|
2019-11-07 13:38:14 +00:00
|
|
|
|
self.driver.info('Waiting %s seconds for %s to update' % (counter,asset))
|
|
|
|
|
elif not self.asset_by_name(asset).is_element_present(10):
|
|
|
|
|
counter += 10
|
|
|
|
|
time.sleep(10)
|
2020-10-22 09:41:29 +00:00
|
|
|
|
if scan_tokens:
|
|
|
|
|
self.scan_tokens()
|
2019-11-07 13:38:14 +00:00
|
|
|
|
self.swipe_down()
|
|
|
|
|
self.driver.info('Waiting %s seconds for %s to display asset' % (counter, asset))
|
|
|
|
|
else:
|
|
|
|
|
self.driver.info('Balance is updated!')
|
2020-04-10 10:25:46 +00:00
|
|
|
|
return self
|
2019-11-07 13:38:14 +00:00
|
|
|
|
|
2018-05-16 19:59:36 +00:00
|
|
|
|
def get_sign_in_phrase(self):
|
|
|
|
|
return ' '.join([element.text for element in self.sign_in_phrase.find_elements()])
|
|
|
|
|
|
2018-05-11 19:15:39 +00:00
|
|
|
|
def set_up_wallet(self):
|
2018-06-29 17:27:30 +00:00
|
|
|
|
phrase = self.sign_in_phrase.string
|
2019-07-12 07:16:02 +00:00
|
|
|
|
self.ok_got_it_button.click()
|
2018-05-16 19:59:36 +00:00
|
|
|
|
return phrase
|
2018-06-29 17:27:30 +00:00
|
|
|
|
|
2020-11-11 15:37:27 +00:00
|
|
|
|
def get_wallet_address(self, account_name=''):
|
|
|
|
|
account_name = self.status_account_name if not account_name else account_name
|
2019-09-26 09:11:46 +00:00
|
|
|
|
self.wallet_account_by_name(account_name).click()
|
2020-09-11 14:26:46 +00:00
|
|
|
|
self.receive_transaction_button.click_until_presence_of_element(self.qr_code_image)
|
2018-06-29 17:27:30 +00:00
|
|
|
|
address = self.address_text.text
|
2020-05-01 10:33:52 +00:00
|
|
|
|
self.close_share_popup()
|
2018-06-29 17:27:30 +00:00
|
|
|
|
return address
|
|
|
|
|
|
2019-09-26 09:11:46 +00:00
|
|
|
|
def wallet_account_by_name(self, account_name):
|
|
|
|
|
return AccountElementButton(self.driver, account_name)
|
|
|
|
|
|
2018-06-29 17:27:30 +00:00
|
|
|
|
def asset_by_name(self, asset_name):
|
|
|
|
|
return AssetTextElement(self.driver, asset_name)
|
|
|
|
|
|
|
|
|
|
def asset_checkbox_by_name(self, asset_name):
|
|
|
|
|
return AssetCheckBox(self.driver, asset_name)
|
2018-11-13 08:25:55 +00:00
|
|
|
|
|
2019-10-25 14:33:56 +00:00
|
|
|
|
def account_options_by_name(self, account_name):
|
|
|
|
|
return AccountOptionsButton(self.driver, account_name)
|
|
|
|
|
|
2019-05-27 16:45:20 +00:00
|
|
|
|
def select_asset(self, *args):
|
2019-07-03 14:29:01 +00:00
|
|
|
|
self.multiaccount_more_options.click()
|
2019-05-27 16:45:20 +00:00
|
|
|
|
self.manage_assets_button.click()
|
|
|
|
|
for asset in args:
|
|
|
|
|
self.asset_checkbox_by_name(asset).click()
|
|
|
|
|
self.cross_icon.click()
|
|
|
|
|
|
2020-10-07 16:07:42 +00:00
|
|
|
|
def scan_tokens(self, *args):
|
|
|
|
|
self.multiaccount_more_options.click()
|
|
|
|
|
self.scan_tokens_button.click()
|
|
|
|
|
counter = 0
|
|
|
|
|
if args:
|
|
|
|
|
for asset in args:
|
|
|
|
|
while True:
|
|
|
|
|
if counter >= 20:
|
|
|
|
|
self.driver.fail('Balance of %s is not changed during 20 seconds!' % asset)
|
|
|
|
|
elif self.get_asset_amount_by_name(asset) == 0.0:
|
|
|
|
|
self.multiaccount_more_options.click()
|
|
|
|
|
self.scan_tokens_button.click()
|
|
|
|
|
self.driver.info('Trying to scan for tokens one more time and waiting %s seconds for %s '
|
|
|
|
|
'to update' % (counter, asset))
|
|
|
|
|
time.sleep(5)
|
|
|
|
|
counter += 5
|
|
|
|
|
else:
|
|
|
|
|
self.driver.info('Balance of %s is updated!' % asset)
|
|
|
|
|
return self
|
|
|
|
|
|
2018-11-13 08:25:55 +00:00
|
|
|
|
def send_transaction(self, **kwargs):
|
|
|
|
|
send_transaction_view = self.send_transaction_button.click()
|
|
|
|
|
send_transaction_view.select_asset_button.click()
|
2020-04-07 14:57:31 +00:00
|
|
|
|
asset_name = kwargs.get('asset_name', 'ETH').upper()
|
2018-11-13 08:25:55 +00:00
|
|
|
|
asset_button = send_transaction_view.asset_by_name(asset_name)
|
2020-04-07 14:57:31 +00:00
|
|
|
|
send_transaction_view.select_asset_button.click_until_presence_of_element(send_transaction_view.eth_asset_in_select_asset_bottom_sheet_button)
|
2018-11-13 08:25:55 +00:00
|
|
|
|
asset_button.click()
|
|
|
|
|
send_transaction_view.amount_edit_box.click()
|
|
|
|
|
|
2018-11-26 14:06:34 +00:00
|
|
|
|
transaction_amount = str(kwargs.get('amount', send_transaction_view.get_unique_amount()))
|
2018-11-13 08:25:55 +00:00
|
|
|
|
|
|
|
|
|
send_transaction_view.amount_edit_box.set_value(transaction_amount)
|
2020-10-28 19:39:02 +00:00
|
|
|
|
if kwargs.get('account_name'):
|
|
|
|
|
send_transaction_view.chose_recipient_button.click()
|
|
|
|
|
send_transaction_view.accounts_button.click()
|
|
|
|
|
send_transaction_view.element_by_text(kwargs.get('account_name')).click()
|
|
|
|
|
else:
|
|
|
|
|
send_transaction_view.set_recipient_address(kwargs.get('recipient'))
|
2018-11-26 14:06:34 +00:00
|
|
|
|
if kwargs.get('sign_transaction', True):
|
2020-11-26 17:33:43 +00:00
|
|
|
|
send_transaction_view.sign_transaction_button.click_until_presence_of_element(send_transaction_view.network_fee_button)
|
2020-09-17 13:14:55 +00:00
|
|
|
|
send_transaction_view.sign_transaction(keycard=kwargs.get('keycard', False),
|
|
|
|
|
default_gas_price=kwargs.get('default_gas_price', False),
|
|
|
|
|
sender_password=kwargs.get('sender_password', common_password))
|
2020-10-28 19:39:02 +00:00
|
|
|
|
return send_transaction_view
|
2018-11-13 08:25:55 +00:00
|
|
|
|
|
|
|
|
|
def receive_transaction(self, **kwargs):
|
|
|
|
|
self.receive_transaction_button.click()
|
|
|
|
|
send_transaction_view = self.send_transaction_request.click()
|
|
|
|
|
send_transaction_view.select_asset_button.click()
|
2020-07-14 16:32:47 +00:00
|
|
|
|
asset_name = kwargs.get('asset_name', 'ETH').upper()
|
2018-11-13 08:25:55 +00:00
|
|
|
|
asset_button = send_transaction_view.asset_by_name(asset_name)
|
|
|
|
|
send_transaction_view.select_asset_button.click_until_presence_of_element(asset_button)
|
|
|
|
|
asset_button.click()
|
|
|
|
|
send_transaction_view.amount_edit_box.click()
|
|
|
|
|
|
|
|
|
|
transaction_amount = str(kwargs.get('amount')) if kwargs.get('amount') else \
|
|
|
|
|
send_transaction_view.get_unique_amount()
|
|
|
|
|
|
|
|
|
|
send_transaction_view.amount_edit_box.set_value(transaction_amount)
|
|
|
|
|
send_transaction_view.confirm()
|
|
|
|
|
send_transaction_view.chose_recipient_button.click()
|
|
|
|
|
|
|
|
|
|
recipient = kwargs.get('recipient')
|
|
|
|
|
send_transaction_view.recent_recipients_button.click()
|
|
|
|
|
recent_recipient = send_transaction_view.element_by_text(recipient)
|
|
|
|
|
send_transaction_view.recent_recipients_button.click_until_presence_of_element(recent_recipient)
|
|
|
|
|
recent_recipient.click()
|
|
|
|
|
self.send_request_button.click()
|
2018-11-09 12:36:21 +00:00
|
|
|
|
|
|
|
|
|
def collectible_amount_by_name(self, name):
|
|
|
|
|
elm = CollectibleTextElement(self.driver, name)
|
2018-11-29 09:41:53 +00:00
|
|
|
|
elm.scroll_to_element()
|
2018-11-09 12:36:21 +00:00
|
|
|
|
return elm.text
|
2019-06-28 14:36:24 +00:00
|
|
|
|
|
|
|
|
|
def set_currency(self, desired_currency='EUR'):
|
|
|
|
|
"""
|
|
|
|
|
:param desired_currency: defines a currency designator which is expressed by ISO 4217 code
|
|
|
|
|
"""
|
2019-08-26 17:09:30 +00:00
|
|
|
|
self.multiaccount_more_options.click_until_presence_of_element(self.set_currency_button)
|
2019-06-28 14:36:24 +00:00
|
|
|
|
self.set_currency_button.click()
|
|
|
|
|
desired_currency = self.element_by_text_part(desired_currency)
|
|
|
|
|
desired_currency.scroll_to_element()
|
|
|
|
|
desired_currency.click()
|
2019-08-16 10:14:23 +00:00
|
|
|
|
|
|
|
|
|
def get_account_by_name(self, account_name: str):
|
|
|
|
|
return AccountElementButton(self.driver, account_name)
|
|
|
|
|
|
2020-05-14 10:41:09 +00:00
|
|
|
|
def add_account(self, account_name: str, password: str = common_password, keycard=False):
|
2019-08-16 10:14:23 +00:00
|
|
|
|
self.add_account_button.click()
|
2020-03-02 16:07:46 +00:00
|
|
|
|
self.generate_an_account_button.click()
|
2019-08-16 10:14:23 +00:00
|
|
|
|
self.account_name_input.send_keys(account_name)
|
2020-05-14 10:41:09 +00:00
|
|
|
|
if keycard:
|
|
|
|
|
from views.keycard_view import KeycardView
|
|
|
|
|
keycard_view = KeycardView(self.driver)
|
2020-08-19 15:04:21 +00:00
|
|
|
|
self.add_account_generate_account_button.click()
|
2020-05-14 10:41:09 +00:00
|
|
|
|
keycard_view.enter_default_pin()
|
|
|
|
|
else:
|
|
|
|
|
self.enter_your_password_input.send_keys(password)
|
|
|
|
|
self.add_account_generate_account_button.click()
|