2023-09-11 18:24:13 +00:00
|
|
|
import allure
|
|
|
|
|
|
|
|
import configs
|
|
|
|
from gui.components.base_popup import BasePopup
|
2023-10-06 08:33:42 +00:00
|
|
|
from gui.elements.button import Button
|
|
|
|
from gui.elements.object import QObject
|
|
|
|
from gui.elements.text_edit import TextEdit
|
2024-02-13 09:04:24 +00:00
|
|
|
from gui.objects_map import names
|
2023-09-11 18:24:13 +00:00
|
|
|
|
|
|
|
|
|
|
|
class AuthenticatePopup(BasePopup):
|
|
|
|
|
|
|
|
def __init__(self):
|
|
|
|
super().__init__()
|
2024-05-30 12:07:43 +00:00
|
|
|
self._authenticate_popup_content = QObject(names.keycardSharedPopupContent_KeycardPopupContent)
|
2024-07-19 06:43:44 +00:00
|
|
|
self._password_text_edit = TextEdit(names.password_PlaceholderText)
|
2024-02-13 09:04:24 +00:00
|
|
|
self._authenticate_button = Button(names.authenticate_StatusButton)
|
2024-05-30 12:07:43 +00:00
|
|
|
self._primary_button = Button(names.sharedPopup_Primary_Button)
|
2024-02-13 09:04:24 +00:00
|
|
|
self._close_button = Button(names.headerCloseButton_StatusFlatRoundButton)
|
2023-09-11 18:24:13 +00:00
|
|
|
|
|
|
|
@allure.step('Wait until appears {0}')
|
|
|
|
def wait_until_appears(self, timeout_msec: int = configs.timeouts.UI_LOAD_TIMEOUT_MSEC):
|
2024-05-30 12:07:43 +00:00
|
|
|
self._authenticate_popup_content.wait_until_appears(timeout_msec)
|
2023-09-11 18:24:13 +00:00
|
|
|
return self
|
|
|
|
|
|
|
|
@allure.step('Authenticate actions with password {0}')
|
|
|
|
def authenticate(self, password: str):
|
2024-03-26 06:39:37 +00:00
|
|
|
self._password_text_edit.type_text(password)
|
2024-06-26 09:53:52 +00:00
|
|
|
# TODO https://github.com/status-im/status-desktop/issues/15345
|
2024-07-19 06:43:44 +00:00
|
|
|
self._primary_button.click(timeout=10)
|
2024-05-03 09:36:51 +00:00
|
|
|
self._authenticate_button.wait_until_hidden(10000)
|
2023-11-27 10:44:30 +00:00
|
|
|
|
2024-05-30 12:07:43 +00:00
|
|
|
@allure.step('Check if authenticate button is present')
|
|
|
|
def is_authenticate_button_visible(self):
|
|
|
|
return self._primary_button.is_visible
|
|
|
|
|
2023-11-27 10:44:30 +00:00
|
|
|
@allure.step('Close authenticate popup by close button')
|
|
|
|
def close_authenticate_popup(self):
|
|
|
|
self._close_button.click()
|
2024-05-30 12:07:43 +00:00
|
|
|
|