chore: Revert getattr (#304)
Co-authored-by: vlado@status.im <Vladimir Druzhinin>
This commit is contained in:
parent
a1f405164e
commit
96190f3593
|
@ -22,10 +22,6 @@ class QObject:
|
||||||
self.real_name = getattr(objects_map, name)
|
self.real_name = getattr(objects_map, name)
|
||||||
self._image = Image(self.real_name)
|
self._image = Image(self.real_name)
|
||||||
|
|
||||||
def __getattr__(self, attr: str):
|
|
||||||
value = getattr(self.object, attr)
|
|
||||||
return value
|
|
||||||
|
|
||||||
def __str__(self):
|
def __str__(self):
|
||||||
return f'{type(self).__qualname__}({self.symbolic_name})'
|
return f'{type(self).__qualname__}({self.symbolic_name})'
|
||||||
|
|
||||||
|
@ -75,17 +71,17 @@ class QObject:
|
||||||
@property
|
@property
|
||||||
@allure.step('Get enabled {0}')
|
@allure.step('Get enabled {0}')
|
||||||
def is_enabled(self) -> bool:
|
def is_enabled(self) -> bool:
|
||||||
return getattr(self, 'enabled')
|
return getattr(self.object, 'enabled')
|
||||||
|
|
||||||
@property
|
@property
|
||||||
@allure.step('Get selected {0}')
|
@allure.step('Get selected {0}')
|
||||||
def is_selected(self) -> bool:
|
def is_selected(self) -> bool:
|
||||||
return getattr(self, 'selected')
|
return getattr(self.object, 'selected')
|
||||||
|
|
||||||
@property
|
@property
|
||||||
@allure.step('Get checked {0}')
|
@allure.step('Get checked {0}')
|
||||||
def is_checked(self) -> bool:
|
def is_checked(self) -> bool:
|
||||||
return getattr(self, 'checked')
|
return getattr(self.object, 'checked')
|
||||||
|
|
||||||
@property
|
@property
|
||||||
@allure.step('Get visible {0}')
|
@allure.step('Get visible {0}')
|
||||||
|
|
|
@ -20,22 +20,22 @@ class Window(QObject):
|
||||||
@allure.step("Maximize {0}")
|
@allure.step("Maximize {0}")
|
||||||
def maximize(self):
|
def maximize(self):
|
||||||
assert driver.toplevel_window.maximize(self.real_name), 'Maximize failed'
|
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}")
|
@allure.step("Minimize {0}")
|
||||||
def minimize(self):
|
def minimize(self):
|
||||||
assert driver.toplevel_window.minimize(self.real_name), 'Minimize failed'
|
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}")
|
@allure.step("Set focus on {0}")
|
||||||
def set_focus(self):
|
def set_focus(self):
|
||||||
assert driver.toplevel_window.set_focus(self.real_name), 'Set focus failed'
|
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")
|
@allure.step("Move {0} on top")
|
||||||
def on_top_level(self):
|
def on_top_level(self):
|
||||||
assert driver.toplevel_window.on_top_level(self.real_name), 'Set on top failed'
|
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}")
|
@allure.step("Close {0}")
|
||||||
def close(self):
|
def close(self):
|
||||||
|
@ -54,5 +54,5 @@ class Window(QObject):
|
||||||
|
|
||||||
def wait_until_appears(self, timeout_msec: int = configs.timeouts.UI_LOAD_TIMEOUT_MSEC):
|
def wait_until_appears(self, timeout_msec: int = configs.timeouts.UI_LOAD_TIMEOUT_MSEC):
|
||||||
super().wait_until_appears(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
|
return self
|
||||||
|
|
|
@ -119,32 +119,32 @@ class AccountDetailsView(WalletSettingsView):
|
||||||
|
|
||||||
@allure.step('Get account balance value')
|
@allure.step('Get account balance value')
|
||||||
def get_account_balance_value(self):
|
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
|
return balance
|
||||||
|
|
||||||
@allure.step("Get account address value")
|
@allure.step("Get account address value")
|
||||||
def get_account_address_value(self):
|
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]
|
address = raw_value.split(">")[-1]
|
||||||
return address
|
return address
|
||||||
|
|
||||||
@allure.step('Get account color value')
|
@allure.step('Get account color value')
|
||||||
def get_account_color_value(self):
|
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
|
return color_name
|
||||||
|
|
||||||
@allure.step('Get account emoji id')
|
@allure.step('Get account emoji id')
|
||||||
def get_account_emoji_id(self):
|
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
|
return emoji_id
|
||||||
|
|
||||||
@allure.step('Get account origin value')
|
@allure.step('Get account origin value')
|
||||||
def get_account_origin_value(self):
|
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')
|
@allure.step('Get account derivation path value')
|
||||||
def get_account_derivation_path_value(self):
|
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')
|
@allure.step('Get derivation path visibility')
|
||||||
def is_derivation_path_visible(self):
|
def is_derivation_path_visible(self):
|
||||||
|
@ -152,7 +152,7 @@ class AccountDetailsView(WalletSettingsView):
|
||||||
|
|
||||||
@allure.step('Get account storage value')
|
@allure.step('Get account storage value')
|
||||||
def get_account_storage_value(self):
|
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]
|
storage = raw_value.split(">")[-1]
|
||||||
return storage
|
return storage
|
||||||
|
|
||||||
|
@ -184,7 +184,7 @@ class NetworkWalletSettings(WalletSettingsView):
|
||||||
def get_network_item_attribute_by_id_and_attr_name(self, attribute_name, network_id):
|
def get_network_item_attribute_by_id_and_attr_name(self, attribute_name, network_id):
|
||||||
self._wallet_network_item_template.real_name['objectName'] = RegularExpression(
|
self._wallet_network_item_template.real_name['objectName'] = RegularExpression(
|
||||||
f'walletNetworkDelegate_.*_{network_id}')
|
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')
|
@allure.step('Open network to check the details')
|
||||||
def click_network_item_to_open_edit_view(self, network_id):
|
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')
|
@allure.step('Get the text for consent when changing RPC urls')
|
||||||
def get_acknowledgement_checkbox_text(self, attr):
|
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
|
return text
|
||||||
|
|
||||||
@allure.step('Get error message for Main RPC URL input')
|
@allure.step('Get error message for Main RPC URL input')
|
||||||
|
|
Loading…
Reference in New Issue