status-desktop/test/e2e/gui/screens/settings_advanced.py

49 lines
2.3 KiB
Python
Raw Normal View History

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
from gui.objects_map import settings_names
2024-05-02 15:04:06 +00:00
class AdvancedSettingsView(QObject):
def __init__(self):
super().__init__(settings_names.mainWindow_AdvancedView)
2024-07-10 05:00:53 +00:00
self._scroll = Scroll(settings_names.settingsContentBase_ScrollView)
2024-05-02 15:04:06 +00:00
self._manage_community_on_testnet_button = Button(
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):
2024-07-10 05:00:53 +00:00
self._scroll.vertical_scroll_down(self._manage_community_on_testnet_button)
2024-05-02 15:04:06 +00:00
self._manage_community_on_testnet_button.click()
@allure.step('Enable creation of communities')
def enable_creation_of_communities(self):
2024-07-10 05:00:53 +00:00
self._scroll.vertical_scroll_down(self._enable_creation_community_button)
2024-05-02 15:04:06 +00:00
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:
2024-07-10 05:00:53 +00:00
self._scroll.vertical_scroll_down(self._manage_community_on_testnet_button)
2024-07-02 07:24:03 +00:00
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:
2024-07-10 05:00:53 +00:00
self._scroll.vertical_scroll_down(self._manage_community_on_testnet_button)
2024-07-02 07:24:03 +00:00
if mode == 'light':
return self._light_mode_button.is_checked
elif mode == 'relay':
return self._relay_mode_button.is_checked