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.text_edit import TextEdit
|
|
|
|
from gui.elements.object import QObject
|
2023-09-07 04:13:38 +00:00
|
|
|
|
|
|
|
|
|
|
|
class AuthenticatePopup(QObject):
|
|
|
|
|
|
|
|
def __init__(self):
|
|
|
|
super(AuthenticatePopup, self).__init__('contextMenu_PopupItem')
|
|
|
|
self._password_text_edit = TextEdit('sharedPopup_Password_Input')
|
|
|
|
self._primary_button = Button('sharedPopup_Primary_Button')
|
|
|
|
|
|
|
|
@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
|