Fix for transaction confirmation and asset button

Signed-off-by: yevh-berdnyk <ie.berdnyk@gmail.com>
This commit is contained in:
yevh-berdnyk 2018-08-30 19:57:18 +03:00
parent 1fff9d7c19
commit 6679374573
No known key found for this signature in database
GPG Key ID: E9B425FDFC4DEA9C
4 changed files with 19 additions and 15 deletions

View File

@ -239,6 +239,21 @@ class CrossIcon(BaseButton):
self.locator = self.Locator.xpath_selector('(//android.view.ViewGroup[@content-desc="icon"])[1]') self.locator = self.Locator.xpath_selector('(//android.view.ViewGroup[@content-desc="icon"])[1]')
class AssetButton(BaseButton):
def __init__(self, driver, asset_name):
super(AssetButton, self).__init__(driver)
self.asset_name = asset_name
self.locator = self.Locator.text_part_selector(self.asset_name)
@property
def name(self):
return self.asset_name + self.__class__.__name__
def click(self):
self.wait_for_element().click()
self.driver.info('Tap on %s' % self.name)
class BaseView(object): class BaseView(object):
def __init__(self, driver): def __init__(self, driver):
self.driver = driver self.driver = driver
@ -500,3 +515,6 @@ class BaseView(object):
for key, value in kwargs.items(): for key, value in kwargs.items():
if re.findall('\W%s$|\W%s\W' % (value, value), logcat): if re.findall('\W%s$|\W%s\W' % (value, value), logcat):
pytest.fail('%s in logcat!!!' % key.capitalize(), pytrace=False) pytest.fail('%s in logcat!!!' % key.capitalize(), pytrace=False)
def asset_by_name(self, asset_name):
return AssetButton(self.driver, asset_name)

View File

@ -388,8 +388,3 @@ class ChatView(BaseView):
today_height = today_text_element.size['height'] today_height = today_text_element.size['height']
if message_location < today_location + today_height: if message_location < today_location + today_height:
errors.append("Message '%s' is not under 'Today' text" % text) errors.append("Message '%s' is not under 'Today' text" % text)
def asset_by_name(self, asset_name):
element = BaseButton(self.driver)
element.locator = element.Locator.text_selector(asset_name)
return element

View File

@ -89,12 +89,6 @@ class SelectAssetButton(BaseButton):
self.locator = self.Locator.accessibility_id('choose-asset-button') self.locator = self.Locator.accessibility_id('choose-asset-button')
class AssetButton(BaseButton):
def __init__(self, driver, asset_name):
super(AssetButton, self).__init__(driver)
self.locator = self.Locator.text_part_selector(asset_name)
class ErrorDialog(BaseView): class ErrorDialog(BaseView):
def __init__(self, driver): def __init__(self, driver):
super(ErrorDialog, self).__init__(driver) super(ErrorDialog, self).__init__(driver)
@ -180,6 +174,3 @@ class SendTransactionView(BaseView):
self.sign_transaction_button.click_until_presence_of_element(self.progress_bar) self.sign_transaction_button.click_until_presence_of_element(self.progress_bar)
self.progress_bar.wait_for_invisibility_of_element(60) self.progress_bar.wait_for_invisibility_of_element(60)
self.got_it_button.click() self.got_it_button.click()
def asset_by_name(self, asset_name):
return AssetButton(self.driver, asset_name)