chore: Revert getattr (#304)

Co-authored-by: vlado@status.im <Vladimir Druzhinin>
This commit is contained in:
Vladimir Druzhinin 2023-11-15 09:42:17 +01:00 committed by GitHub
parent ecd9067551
commit 78733d8d9d
3 changed files with 17 additions and 21 deletions

View File

@ -22,10 +22,6 @@ class QObject:
self.real_name = getattr(objects_map, name)
self._image = Image(self.real_name)
def __getattr__(self, attr: str):
value = getattr(self.object, attr)
return value
def __str__(self):
return f'{type(self).__qualname__}({self.symbolic_name})'
@ -75,17 +71,17 @@ class QObject:
@property
@allure.step('Get enabled {0}')
def is_enabled(self) -> bool:
return getattr(self, 'enabled')
return getattr(self.object, 'enabled')
@property
@allure.step('Get selected {0}')
def is_selected(self) -> bool:
return getattr(self, 'selected')
return getattr(self.object, 'selected')
@property
@allure.step('Get checked {0}')
def is_checked(self) -> bool:
return getattr(self, 'checked')
return getattr(self.object, 'checked')
@property
@allure.step('Get visible {0}')

View File

@ -20,22 +20,22 @@ class Window(QObject):
@allure.step("Maximize {0}")
def maximize(self):
assert driver.toplevel_window.maximize(self.real_name), 'Maximize failed'
_logger.info(f'Window {getattr(self, "title", "")} is maximized')
_logger.info(f'Window {getattr(self.object, "title", "")} is maximized')
@allure.step("Minimize {0}")
def minimize(self):
assert driver.toplevel_window.minimize(self.real_name), 'Minimize failed'
_logger.info(f'Window {getattr(self, "title", "")} is minimized')
_logger.info(f'Window {getattr(self.object, "title", "")} is minimized')
@allure.step("Set focus on {0}")
def set_focus(self):
assert driver.toplevel_window.set_focus(self.real_name), 'Set focus failed'
_logger.info(f'Window {getattr(self, "title", "")} in focus')
_logger.info(f'Window {getattr(self.object, "title", "")} in focus')
@allure.step("Move {0} on top")
def on_top_level(self):
assert driver.toplevel_window.on_top_level(self.real_name), 'Set on top failed'
_logger.info(f'Window {getattr(self, "title", "")} moved on top')
_logger.info(f'Window {getattr(self.object, "title", "")} moved on top')
@allure.step("Close {0}")
def close(self):
@ -54,5 +54,5 @@ class Window(QObject):
def wait_until_appears(self, timeout_msec: int = configs.timeouts.UI_LOAD_TIMEOUT_MSEC):
super().wait_until_appears(timeout_msec)
_logger.info(f'Window {getattr(self, "title", "")} appears')
_logger.info(f'Window {getattr(self.object, "title", "")} appears')
return self

View File

@ -119,32 +119,32 @@ class AccountDetailsView(WalletSettingsView):
@allure.step('Get account balance value')
def get_account_balance_value(self):
balance = str(getattr(self._wallet_account_balance, 'subTitle'))[:-4]
balance = str(getattr(self._wallet_account_balance.object, 'subTitle'))[:-4]
return balance
@allure.step("Get account address value")
def get_account_address_value(self):
raw_value = str(getattr(self._wallet_account_address, 'subTitle'))
raw_value = str(getattr(self._wallet_account_address.object, 'subTitle'))
address = raw_value.split(">")[-1]
return address
@allure.step('Get account color value')
def get_account_color_value(self):
color_name = str(getattr(self._wallet_account_title, 'color')['name'])
color_name = str(getattr(self._wallet_account_title.object, 'color')['name'])
return color_name
@allure.step('Get account emoji id')
def get_account_emoji_id(self):
emoji_id = str(getattr(self._wallet_account_emoji, 'emojiId'))
emoji_id = str(getattr(self._wallet_account_emoji.object, 'emojiId'))
return emoji_id
@allure.step('Get account origin value')
def get_account_origin_value(self):
return str(getattr(self._wallet_account_origin, 'subTitle'))
return str(getattr(self._wallet_account_origin.object, 'subTitle'))
@allure.step('Get account derivation path value')
def get_account_derivation_path_value(self):
return str(getattr(self._wallet_account_derivation_path, 'subTitle'))
return str(getattr(self._wallet_account_derivation_path.object, 'subTitle'))
@allure.step('Get derivation path visibility')
def is_derivation_path_visible(self):
@ -152,7 +152,7 @@ class AccountDetailsView(WalletSettingsView):
@allure.step('Get account storage value')
def get_account_storage_value(self):
raw_value = str(getattr(self._wallet_account_stored, 'subTitle'))
raw_value = str(getattr(self._wallet_account_stored.object, 'subTitle'))
storage = raw_value.split(">")[-1]
return storage
@ -184,7 +184,7 @@ class NetworkWalletSettings(WalletSettingsView):
def get_network_item_attribute_by_id_and_attr_name(self, attribute_name, network_id):
self._wallet_network_item_template.real_name['objectName'] = RegularExpression(
f'walletNetworkDelegate_.*_{network_id}')
return getattr(self._wallet_network_item_template, attribute_name)
return getattr(self._wallet_network_item_template.object, attribute_name)
@allure.step('Open network to check the details')
def click_network_item_to_open_edit_view(self, network_id):
@ -358,7 +358,7 @@ class EditNetworkSettings(WalletSettingsView):
@allure.step('Get the text for consent when changing RPC urls')
def get_acknowledgement_checkbox_text(self, attr):
text = str(getattr(self._network_acknowledgment_checkbox, attr))
text = str(getattr(self._network_acknowledgment_checkbox.object, attr))
return text
@allure.step('Get error message for Main RPC URL input')