2023-12-11 07:20:57 +00:00
|
|
|
import time
|
|
|
|
|
2023-08-29 14:43:00 +00:00
|
|
|
import allure
|
|
|
|
|
2023-09-22 08:44:29 +00:00
|
|
|
from gui.components.back_up_your_seed_phrase_popup import BackUpYourSeedPhrasePopUp
|
2023-10-06 08:33:42 +00:00
|
|
|
from gui.elements.object import QObject
|
2023-10-30 08:59:01 +00:00
|
|
|
from gui.elements.scroll import Scroll
|
2024-02-13 09:04:24 +00:00
|
|
|
from gui.objects_map import names
|
2023-10-13 15:55:44 +00:00
|
|
|
from gui.screens.settings_communities import CommunitiesSettingsView
|
2023-12-11 07:20:57 +00:00
|
|
|
from gui.screens.settings_ens_usernames import ENSSettingsView
|
2023-11-02 13:51:38 +00:00
|
|
|
from gui.screens.settings_keycard import KeycardSettingsView
|
2023-10-13 15:55:44 +00:00
|
|
|
from gui.screens.settings_messaging import MessagingSettingsView
|
|
|
|
from gui.screens.settings_profile import ProfileSettingsView
|
|
|
|
from gui.screens.settings_syncing import SyncingSettingsView
|
|
|
|
from gui.screens.settings_wallet import WalletSettingsView
|
2024-02-10 10:02:47 +00:00
|
|
|
from gui.screens.settings_password import ChangePasswordView
|
2023-12-01 04:32:44 +00:00
|
|
|
from gui.components.settings.sign_out_popup import SignOutPopup
|
2023-08-29 14:43:00 +00:00
|
|
|
|
|
|
|
|
2023-09-11 18:24:13 +00:00
|
|
|
class LeftPanel(QObject):
|
2023-08-29 14:43:00 +00:00
|
|
|
|
|
|
|
def __init__(self):
|
2024-02-13 09:04:24 +00:00
|
|
|
super().__init__(names.mainWindow_LeftTabView)
|
|
|
|
self._settings_section_template = QObject(names.scrollView_MenuItem_StatusNavigationListItem)
|
|
|
|
self._scroll = Scroll(names.scrollView_Flickable)
|
|
|
|
self._settings_section_back_up_seed_option = QObject(names.settingsBackUpSeedPhraseOption)
|
2024-03-05 08:18:42 +00:00
|
|
|
self._settings_section_wallet_option = QObject(names.settingsWalletOption)
|
2023-08-29 14:43:00 +00:00
|
|
|
|
2023-10-02 09:21:12 +00:00
|
|
|
def _open_settings(self, object_name: str):
|
|
|
|
self._settings_section_template.real_name['objectName'] = object_name
|
2023-10-30 08:59:01 +00:00
|
|
|
if not self._settings_section_template.is_visible:
|
|
|
|
self._scroll.vertical_down_to(self._settings_section_template)
|
2023-08-29 14:43:00 +00:00
|
|
|
self._settings_section_template.click()
|
|
|
|
|
2023-10-09 17:01:13 +00:00
|
|
|
@allure.step('Check back up seed option menu item presence')
|
|
|
|
def check_back_up_seed_option_present(self):
|
2024-02-10 09:12:23 +00:00
|
|
|
return self._settings_section_back_up_seed_option.exists
|
2023-10-09 17:01:13 +00:00
|
|
|
|
2023-09-11 18:24:13 +00:00
|
|
|
@allure.step('Open messaging settings')
|
|
|
|
def open_messaging_settings(self) -> 'MessagingSettingsView':
|
2024-02-10 09:47:57 +00:00
|
|
|
self._open_settings('4-AppMenuItem')
|
2023-09-11 18:24:13 +00:00
|
|
|
return MessagingSettingsView()
|
|
|
|
|
2023-08-29 14:43:00 +00:00
|
|
|
@allure.step('Open communities settings')
|
2023-12-12 14:05:33 +00:00
|
|
|
def open_communities_settings(self, attempts: int = 2) -> 'CommunitiesSettingsView':
|
2024-02-10 09:47:57 +00:00
|
|
|
self._open_settings('13-AppMenuItem')
|
2023-12-12 14:05:33 +00:00
|
|
|
try:
|
|
|
|
return CommunitiesSettingsView()
|
|
|
|
except Exception as ex:
|
|
|
|
if attempts:
|
|
|
|
self.open_communities_settings(attempts-1)
|
|
|
|
else:
|
|
|
|
raise ex
|
2023-08-29 14:43:00 +00:00
|
|
|
|
2023-09-15 04:17:07 +00:00
|
|
|
@allure.step('Open wallet settings')
|
2024-03-05 13:07:11 +00:00
|
|
|
def open_wallet_settings(self) -> 'WalletSettingsView':
|
|
|
|
self._open_settings('5-AppMenuItem')
|
2024-03-05 08:18:42 +00:00
|
|
|
return WalletSettingsView()
|
2023-09-15 04:17:07 +00:00
|
|
|
|
2023-09-20 11:35:56 +00:00
|
|
|
@allure.step('Open profile settings')
|
2024-03-05 13:07:11 +00:00
|
|
|
def open_profile_settings(self) -> 'ProfileSettingsView':
|
2023-10-02 09:21:12 +00:00
|
|
|
self._open_settings('0-MainMenuItem')
|
2023-09-20 11:35:56 +00:00
|
|
|
return ProfileSettingsView()
|
|
|
|
|
2024-02-10 10:02:47 +00:00
|
|
|
@allure.step('Open password settings')
|
2024-03-05 13:07:11 +00:00
|
|
|
def open_password_settings(self) -> 'ChangePasswordView':
|
2024-02-10 10:02:47 +00:00
|
|
|
self._open_settings('1-MainMenuItem')
|
|
|
|
return ChangePasswordView()
|
|
|
|
|
2023-09-22 08:44:29 +00:00
|
|
|
@allure.step('Choose back up seed phrase in settings')
|
2024-03-05 13:07:11 +00:00
|
|
|
def open_back_up_seed_phrase(self) -> 'BackUpYourSeedPhrasePopUp':
|
2024-02-10 09:12:23 +00:00
|
|
|
self._open_settings('18-MainMenuItem')
|
2023-09-22 08:44:29 +00:00
|
|
|
return BackUpYourSeedPhrasePopUp()
|
|
|
|
|
2023-09-28 06:45:49 +00:00
|
|
|
@allure.step('Open syncing settings')
|
2024-03-05 13:07:11 +00:00
|
|
|
def open_syncing_settings(self, attempts: int = 2) -> 'SyncingSettingsView':
|
2024-02-10 09:43:55 +00:00
|
|
|
self._open_settings('9-MainMenuItem')
|
2023-11-02 16:07:12 +00:00
|
|
|
try:
|
|
|
|
return SyncingSettingsView().wait_until_appears()
|
2023-12-08 09:19:17 +00:00
|
|
|
except (AssertionError, LookupError) as ec:
|
2023-11-02 16:07:12 +00:00
|
|
|
if attempts:
|
|
|
|
return self.open_syncing_settings(attempts - 1)
|
|
|
|
else:
|
2023-12-08 09:19:17 +00:00
|
|
|
raise ec
|
2023-09-28 06:45:49 +00:00
|
|
|
|
2023-10-30 08:59:01 +00:00
|
|
|
@allure.step('Choose sign out and quit in settings')
|
2024-03-05 13:07:11 +00:00
|
|
|
def open_sign_out_and_quit(self) -> 'SignOutPopup':
|
2024-02-10 09:35:44 +00:00
|
|
|
self._open_settings('17-ExtraMenuItem')
|
2023-12-01 04:32:44 +00:00
|
|
|
return SignOutPopup()
|
2023-10-30 08:59:01 +00:00
|
|
|
|
2023-11-02 13:51:38 +00:00
|
|
|
@allure.step('Open keycard settings')
|
2024-03-05 13:07:11 +00:00
|
|
|
def open_keycard_settings(self) -> 'KeycardSettingsView':
|
2024-02-10 09:47:57 +00:00
|
|
|
self._open_settings('14-MainMenuItem')
|
2023-11-02 13:51:38 +00:00
|
|
|
return KeycardSettingsView()
|
|
|
|
|
2023-12-11 07:20:57 +00:00
|
|
|
@allure.step('Open ENS usernames settings')
|
2024-03-05 13:07:11 +00:00
|
|
|
def open_ens_usernames_settings(self) -> 'ENSSettingsView':
|
2023-12-11 07:20:57 +00:00
|
|
|
time.sleep(1)
|
2024-02-10 09:47:57 +00:00
|
|
|
self._open_settings('3-MainMenuItem')
|
2023-12-11 07:20:57 +00:00
|
|
|
return ENSSettingsView()
|
|
|
|
|
2023-08-29 14:43:00 +00:00
|
|
|
|
2023-09-11 18:24:13 +00:00
|
|
|
class SettingsScreen(QObject):
|
|
|
|
|
|
|
|
def __init__(self):
|
2024-02-13 09:04:24 +00:00
|
|
|
super().__init__(names.mainWindow_ProfileLayout)
|
2023-09-11 18:24:13 +00:00
|
|
|
self.left_panel = LeftPanel()
|