2023-10-13 15:55:44 +00:00
|
|
|
import allure
|
|
|
|
|
|
|
|
from constants.syncing import SyncingSettings
|
2024-05-30 12:07:43 +00:00
|
|
|
from gui.components.authenticate_popup import AuthenticatePopup
|
2023-10-13 15:55:44 +00:00
|
|
|
from gui.components.settings.sync_new_device_popup import SyncNewDevicePopup
|
|
|
|
from gui.elements.button import Button
|
|
|
|
from gui.elements.object import QObject
|
|
|
|
from gui.elements.text_label import TextLabel
|
2024-07-09 10:05:39 +00:00
|
|
|
from gui.objects_map import settings_names, settings_names
|
2023-10-13 15:55:44 +00:00
|
|
|
|
|
|
|
|
|
|
|
class SyncingSettingsView(QObject):
|
|
|
|
|
|
|
|
def __init__(self):
|
2024-07-09 10:05:39 +00:00
|
|
|
super().__init__(settings_names.mainWindow_SyncingView)
|
|
|
|
self._setup_syncing_button = Button(settings_names.settings_Setup_Syncing_StatusButton)
|
|
|
|
self._backup_data_button = Button(settings_names.settings_Backup_Data_StatusButton)
|
|
|
|
self._sync_new_device_instructions_header = TextLabel(settings_names.settings_Sync_New_Device_Header)
|
|
|
|
self._sync_new_device_instructions_subtitle = TextLabel(settings_names.settings_Sync_New_Device_SubTitle)
|
2023-10-13 15:55:44 +00:00
|
|
|
|
|
|
|
@allure.step('Checking instructions elements: back up button presence')
|
|
|
|
def is_backup_button_present(self):
|
|
|
|
assert self._backup_data_button.is_visible, f"Backup button is not visible"
|
|
|
|
|
|
|
|
@allure.step('Checking instructions elements: header presence')
|
|
|
|
def is_instructions_header_present(self):
|
|
|
|
assert (self._sync_new_device_instructions_header.text
|
|
|
|
== SyncingSettings.SYNC_A_NEW_DEVICE_INSTRUCTIONS_HEADER.value), f"Sync a new device title is incorrect"
|
|
|
|
|
|
|
|
@allure.step('Checking instructions elements: subtitle presence')
|
|
|
|
def is_instructions_subtitle_present(self):
|
|
|
|
assert (self._sync_new_device_instructions_subtitle.text
|
|
|
|
== SyncingSettings.SYNC_A_NEW_DEVICE_INSTRUCTIONS_SUBTITLE.value), f"Sync a new device subtitle is incorrect"
|
|
|
|
|
|
|
|
@allure.step('Setup syncing')
|
|
|
|
def set_up_syncing(self, password: str):
|
2023-11-27 10:44:30 +00:00
|
|
|
self.click_setup_syncing()
|
2023-10-13 15:55:44 +00:00
|
|
|
AuthenticatePopup().wait_until_appears().authenticate(password)
|
|
|
|
return SyncNewDevicePopup().wait_until_appears()
|
2023-11-27 10:44:30 +00:00
|
|
|
|
|
|
|
@allure.step('Click setup syncing')
|
|
|
|
def click_setup_syncing(self):
|
|
|
|
self._setup_syncing_button.click()
|
|
|
|
return AuthenticatePopup().wait_until_appears()
|