Skip to content
This repository was archived by the owner on Aug 13, 2024. It is now read-only.
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion gui/components/onboarding/before_started_popup.py
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ def is_visible(self) -> bool:
@allure.step('Allow all and get started')
def get_started(self):
self._acknowledge_checkbox.set(True)
self._terms_of_use_checkBox.set(True, x=10)
self._terms_of_use_checkBox.set(True)
assert self._terms_of_use_link.is_visible, f"Terms of use link is missing"
assert self._privacy_policy_link.is_visible, f"Privacy Policy link is missing"
self._get_started_button.click()
Expand Down
4 changes: 2 additions & 2 deletions gui/components/wallet/add_saved_address_popup.py
Original file line number Diff line number Diff line change
Expand Up @@ -73,11 +73,11 @@ def add_saved_address(self, name: str, address: str):
self._address_text_edit.type_text(address)
if address.startswith("0x"):
self.verify_network_selector_enabled()
self._add_networks_selector.click(1, 1)
self._add_networks_selector.click()
self.set_ethereum_mainnet_network(True)
self.set_optimism_mainnet_network(True)
self.set_arbitrum_mainnet_network(True)
self._save_add_address_button.click() # click it twice to close the network selector pop up
self._name_text_edit.click() # click the text field to close the network selector pop up
self.verify_ethereum_mainnet_network_tag_present()
self.verify_otimism_mainnet_network_tag_present()
self.verify_arbitrum_mainnet_network_tag_present(),
Expand Down
14 changes: 1 addition & 13 deletions gui/elements/button.py
Original file line number Diff line number Diff line change
Expand Up @@ -10,16 +10,4 @@


class Button(QObject):

@allure.step('Click {0}')
def click(
self,
x: typing.Union[int, driver.UiTypes.ScreenPoint] = None,
y: typing.Union[int, driver.UiTypes.ScreenPoint] = None,
button: driver.MouseButton = None
):
if None not in (x, y, button):
getattr(self.object, 'clicked')()
LOG.info('%s: clicked', self)
else:
super(Button, self).click(x, y, button)
pass
4 changes: 2 additions & 2 deletions gui/elements/check_box.py
Original file line number Diff line number Diff line change
Expand Up @@ -12,9 +12,9 @@
class CheckBox(QObject):

@allure.step("Set {0} value: {1}")
def set(self, value: bool, x: int = None, y: int = None):
def set(self, value: bool):
if self.is_checked is not value:
self.click(x, y)
self.click()
assert driver.waitFor(
lambda: self.is_checked is value, configs.timeouts.UI_LOAD_TIMEOUT_MSEC), 'Value not changed'
LOG.info('%s: value changed to "%s"', self, value)
36 changes: 11 additions & 25 deletions gui/elements/object.py
Original file line number Diff line number Diff line change
Expand Up @@ -96,36 +96,22 @@ def click(
):
driver.mouseClick(
self.object,
x or self.width // 2,
y or self.height // 2,
x or int(self.object.width * 0.1),
y or int(self.object.height * 0.1),
button or driver.Qt.LeftButton
)
LOG.info('%s: clicked', self)
LOG.info('%s: is clicked with Qt.LeftButton', self)

@allure.step('Native click {0}')
def native_click(
def native_mouse_click(
self,
x: typing.Union[int, driver.UiTypes.ScreenPoint] = None,
y: typing.Union[int, driver.UiTypes.ScreenPoint] = None,
button: driver.MouseButton = None
):
driver.nativeMouseClick(
x or self.bounds.x + self.width // 2,
y or self.bounds.y + self.height // 2,
button or driver.MouseButton.LeftButton
)
LOG.info(f'{self}: native clicked')

@allure.step('Native click {0}')
def native_click(
self,
x: typing.Union[int, driver.UiTypes.ScreenPoint] = None,
y: typing.Union[int, driver.UiTypes.ScreenPoint] = None,
button: driver.MouseButton = None
):
driver.nativeMouseClick(
x or self.bounds.x + self.width // 2,
y or self.bounds.y + self.height // 2,
x or int(self.bounds.x + self.width // 2),
y or int(self.bounds.y + self.height // 2),
button or driver.MouseButton.LeftButton
)
LOG.info(f'{self}: native clicked')
Expand All @@ -145,18 +131,18 @@ def _hover():
assert driver.waitFor(lambda: _hover(), timeout_msec)
return self

@allure.step('Open context menu')
def open_context_menu(
@allure.step('Right click on {0}')
def right_click(
self,
x: typing.Union[int, driver.UiTypes.ScreenPoint] = None,
y: typing.Union[int, driver.UiTypes.ScreenPoint] = None,
):
self.click(
x or self.width // 2,
y or self.height // 2,
x or int(self.width // 2),
y or int(self.height // 2),
driver.Qt.RightButton
)
LOG.info('%s: clicked via Right Mouse Button', self)
LOG.info('%s: right clicked with Qt.RightButton', self)

@allure.step('Wait until appears {0}')
def wait_until_appears(self, timeout_msec: int = configs.timeouts.UI_LOAD_TIMEOUT_MSEC):
Expand Down
2 changes: 1 addition & 1 deletion gui/main_window.py
Original file line number Diff line number Diff line change
Expand Up @@ -127,7 +127,7 @@ def get_community_logo(self, name: str) -> Image:
@allure.step('Open context menu for community')
def open_community_context_menu(self, name: str) -> ContextMenu:
driver.objectMap.realName(self._get_community(name))['name'] = name
self._get_community(name).open_context_menu()
self._get_community(name).right_click()
return ContextMenu().wait_until_appears()

@allure.step('Invite people in community')
Expand Down
6 changes: 3 additions & 3 deletions gui/screens/community.py
Original file line number Diff line number Diff line change
Expand Up @@ -301,12 +301,12 @@ def select_channel(self, name: str):

@allure.step('Open general channel context menu')
def open_general_channel_context_menu(self):
self._general_channel_item.open_context_menu()
self._general_channel_item.right_click()
return ContextMenu()

@allure.step('Open category context menu')
def open_category_context_menu(self):
self._category_list_item.open_context_menu()
self._category_list_item.right_click()

@allure.step('Open create category popup')
def open_create_category_popup(self, attempts: int = 2) -> NewCategoryPopup:
Expand Down Expand Up @@ -385,7 +385,7 @@ def get_channel_or_category_index(self, name: str) -> int:

@allure.step('Right click on left panel')
def right_click_on_panel(self):
super(LeftPanel, self).open_context_menu()
super(LeftPanel, self).right_click()


class Chat(QObject):
Expand Down
2 changes: 1 addition & 1 deletion gui/screens/messages.py
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,7 @@ def start_chat(self):
@allure.step('Open context menu group chat')
def _open_context_menu_for_chat(self, chat_name: str) -> ContextMenu:
self._contact_item.real_name['objectName'] = chat_name
self._contact_item.open_context_menu()
self._contact_item.right_click()
return ContextMenu().wait_until_appears()

@allure.step('Open leave popup')
Expand Down
10 changes: 5 additions & 5 deletions gui/screens/wallet.py
Original file line number Diff line number Diff line change
Expand Up @@ -83,14 +83,14 @@ def select_account(self, account_name: str) -> 'WalletAccountView':
@allure.step('Open context menu from left wallet panel')
@close_exists(BasePopup())
def _open_context_menu(self) -> ContextMenu:
super(LeftPanel, self).open_context_menu()
super(LeftPanel, self).right_click()
return ContextMenu().wait_until_appears()

@allure.step('Open context menu for account')
@close_exists(BasePopup())
def _open_context_menu_for_account(self, account_name: str) -> ContextMenu:
self._wallet_account_item.real_name['title'] = account_name
self._wallet_account_item.wait_until_appears().open_context_menu()
self._wallet_account_item.wait_until_appears().right_click()
return ContextMenu().wait_until_appears()

@allure.step("Select Hide/Include in total balance from context menu for account")
Expand Down Expand Up @@ -175,17 +175,17 @@ def open_add_saved_address_popup(self, attempt=2) -> 'AddressPopup':

@allure.step('Open edit address popup for saved address')
def open_edit_address_popup(self, name: str) -> 'EditSavedAddressPopup':
self.open_context_menu(name).select_edit_saved_address()
self.right_click(name).select_edit_saved_address()
return EditSavedAddressPopup()

@allure.step('Delete saved address from the list')
def delete_saved_address(self, address_name):
self.open_context_menu(address_name).select_delete_saved_address()
self.right_click(address_name).select_delete_saved_address()
assert ConfirmationPopup().get_confirmation_text().startswith('Are you sure you want to remove')
ConfirmationPopup().confirm()

@allure.step('Open context menu in saved address')
def open_context_menu(self, name) -> ContextMenu:
def right_click(self, name) -> ContextMenu:
self._open_menu_button.real_name['objectName'] = 'savedAddressView_Delegate_menuButton' + '_' + name
self._address_list_item.real_name['objectName'] = 'savedAddressView_Delegate' + '_' + name
self._address_list_item.hover()
Expand Down