2024-05-02 15:04:06 +00:00
|
|
|
import allure
|
|
|
|
|
2024-07-02 07:24:03 +00:00
|
|
|
from gui.components.settings.confirm_switch_waku_mode_popup import SwitchWakuModePopup
|
2024-05-02 15:04:06 +00:00
|
|
|
from gui.elements.button import Button
|
|
|
|
from gui.elements.object import QObject
|
|
|
|
from gui.elements.scroll import Scroll
|
2024-07-09 10:05:39 +00:00
|
|
|
from gui.objects_map import settings_names
|
2024-05-02 15:04:06 +00:00
|
|
|
|
|
|
|
|
|
|
|
class AdvancedSettingsView(QObject):
|
|
|
|
|
|
|
|
def __init__(self):
|
2024-07-09 10:05:39 +00:00
|
|
|
super().__init__(settings_names.mainWindow_AdvancedView)
|
|
|
|
self._scroll = Scroll(settings_names.settingsContentBaseScrollView_Flickable)
|
2024-05-02 15:04:06 +00:00
|
|
|
self._manage_community_on_testnet_button = Button(
|
2024-07-09 10:05:39 +00:00
|
|
|
settings_names.manageCommunitiesOnTestnetButton_StatusSettingsLineButton)
|
|
|
|
self._enable_creation_community_button = Button(settings_names.enableCreateCommunityButton_StatusSettingsLineButton)
|
|
|
|
self._light_mode_button = Button(settings_names.settingsContentBaseScrollViewLightWakuModeBloomSelectorButton)
|
|
|
|
self._relay_mode_button = Button(settings_names.settingsContentBaseScrollViewRelayWakuModeBloomSelectorButton)
|
2024-05-02 15:04:06 +00:00
|
|
|
|
|
|
|
@allure.step('Switch manage community on testnet option')
|
|
|
|
def switch_manage_on_community(self):
|
|
|
|
self._scroll.vertical_down_to(self._manage_community_on_testnet_button)
|
|
|
|
self._manage_community_on_testnet_button.click()
|
|
|
|
|
|
|
|
@allure.step('Enable creation of communities')
|
|
|
|
def enable_creation_of_communities(self):
|
|
|
|
self._scroll.vertical_down_to(self._enable_creation_community_button)
|
|
|
|
self._enable_creation_community_button.click()
|
2024-07-02 07:24:03 +00:00
|
|
|
|
|
|
|
@allure.step('Switch waku mode')
|
|
|
|
def switch_waku_mode(self, mode):
|
|
|
|
if not self._manage_community_on_testnet_button.is_visible:
|
|
|
|
self._scroll.vertical_down_to(self._manage_community_on_testnet_button)
|
|
|
|
if mode == 'light':
|
|
|
|
self._light_mode_button.click()
|
|
|
|
elif mode == 'relay':
|
|
|
|
self._relay_mode_button.click()
|
|
|
|
return SwitchWakuModePopup().wait_until_appears()
|
|
|
|
|
|
|
|
@allure.step('Verify waku mode enabled states')
|
|
|
|
def is_waku_mode_enabled(self, mode):
|
|
|
|
if not self._manage_community_on_testnet_button.is_visible:
|
|
|
|
self._scroll.vertical_down_to(self._manage_community_on_testnet_button)
|
|
|
|
if mode == 'light':
|
|
|
|
return self._light_mode_button.is_checked
|
|
|
|
elif mode == 'relay':
|
|
|
|
return self._relay_mode_button.is_checked
|