2023-09-28 06:45:49 +00:00
|
|
|
import allure
|
|
|
|
import pyperclip
|
|
|
|
|
|
|
|
from gui.components.base_popup import BasePopup
|
2023-10-06 08:33:42 +00:00
|
|
|
from gui.elements.button import Button
|
2023-11-27 10:44:30 +00:00
|
|
|
from gui.elements.object import QObject
|
2023-10-06 08:33:42 +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-28 06:45:49 +00:00
|
|
|
|
|
|
|
|
|
|
|
class SyncNewDevicePopup(BasePopup):
|
|
|
|
|
|
|
|
def __init__(self):
|
|
|
|
super().__init__()
|
2024-02-13 09:04:24 +00:00
|
|
|
self._copy_button = Button(names.copy_SyncCodeStatusButton)
|
|
|
|
self._done_button = Button(names.done_SyncCodeStatusButton)
|
|
|
|
self._sync_code_field = TextEdit(names.syncCodeInput_StatusPasswordInput)
|
|
|
|
self._close_button = Button(names.close_StatusButton)
|
|
|
|
self._error_message = QObject(names.errorView_SyncingErrorMessage)
|
2023-11-27 10:44:30 +00:00
|
|
|
|
|
|
|
@property
|
|
|
|
@allure.step('Get primary error message')
|
|
|
|
def primary_error_message(self) -> str:
|
|
|
|
return str(self._error_message.object.primaryText)
|
|
|
|
|
|
|
|
@property
|
|
|
|
@allure.step('Get secondary error message')
|
|
|
|
def secondary_error_message(self) -> str:
|
|
|
|
return str(self._error_message.object.secondaryText)
|
2023-09-28 06:45:49 +00:00
|
|
|
|
|
|
|
@property
|
|
|
|
@allure.step('Get syncing code')
|
|
|
|
def syncing_code(self):
|
|
|
|
self._copy_button.click()
|
|
|
|
return pyperclip.paste()
|
|
|
|
|
|
|
|
@allure.step('Click done')
|
|
|
|
def done(self):
|
|
|
|
self._done_button.click()
|
2024-10-10 10:26:23 +00:00
|
|
|
self.wait_until_hidden()
|
2023-11-27 10:44:30 +00:00
|
|
|
|
|
|
|
@allure.step('Click close')
|
|
|
|
def close(self):
|
|
|
|
self._close_button.click()
|
|
|
|
self.wait_until_hidden()
|