2023-09-07 04:13:38 +00:00
|
|
|
import allure
|
|
|
|
|
2023-10-06 08:33:42 +00:00
|
|
|
from gui.elements.button import Button
|
|
|
|
from gui.elements.object import QObject
|
2023-10-09 17:04:29 +00:00
|
|
|
from gui.elements.text_edit import TextEdit
|
2024-02-13 09:04:24 +00:00
|
|
|
from gui.objects_map import names
|
2023-09-07 04:13:38 +00:00
|
|
|
|
|
|
|
|
|
|
|
class AuthenticatePopup(QObject):
|
|
|
|
|
|
|
|
def __init__(self):
|
2024-02-13 09:04:24 +00:00
|
|
|
super(AuthenticatePopup, self).__init__(names.contextMenu_PopupItem)
|
|
|
|
self._password_text_edit = TextEdit(names.sharedPopup_Password_Input)
|
|
|
|
self._primary_button = Button(names.sharedPopup_Primary_Button)
|
2023-09-07 04:13:38 +00:00
|
|
|
|
|
|
|
@allure.step('Authenticate action with password')
|
|
|
|
def authenticate(self, password: str, attempt: int = 2):
|
|
|
|
self._password_text_edit.text = password
|
|
|
|
self._primary_button.click()
|
|
|
|
try:
|
|
|
|
self._primary_button.wait_until_hidden()
|
|
|
|
except AssertionError as err:
|
|
|
|
if attempt:
|
|
|
|
self.authenticate(password, attempt - 1)
|
|
|
|
else:
|
|
|
|
raise err
|
2023-11-03 15:04:23 +00:00
|
|
|
|
|
|
|
@allure.step('Check if authenticate button is present')
|
|
|
|
def is_authenticate_button_visible(self):
|
|
|
|
return self._primary_button.is_visible
|
|
|
|
|