49 lines
1.7 KiB
Python
49 lines
1.7 KiB
Python
from selenium.webdriver.common.by import By
|
|
from page_objects.base_page import BasePage
|
|
|
|
class SettingsPanelPage(BasePage):
|
|
"""
|
|
Page object for the Settings Panel page.
|
|
"""
|
|
|
|
|
|
# Locators
|
|
_SETTING_TAB_TITLE = (By.XPATH, '//*[contains(@id,"content-settings")]//h3')
|
|
NOTIFICATIONS_SWITCH = (By.ID, "notifications")
|
|
THEME_SELECTOR = (By.ID, "theme")
|
|
|
|
def get_page_header(self):
|
|
"""
|
|
Gets the header text of the page.
|
|
Assumes the header is an h1 element.
|
|
"""
|
|
return self.get_text((By.TAG_NAME, "h1"))
|
|
|
|
def verify_title_is_settings(self):
|
|
return self.get_text(self._SETTING_TAB_TITLE)
|
|
def toggle_notifications(self):
|
|
"""
|
|
Clicks the notifications switch to toggle it.
|
|
"""
|
|
self.click(self.NOTIFICATIONS_SWITCH)
|
|
|
|
def is_notifications_enabled(self) -> bool:
|
|
"""
|
|
Checks if the notifications switch is in the 'on' or 'selected' state.
|
|
Note: This might need adjustment based on the actual HTML implementation (e.g., aria-checked).
|
|
"""
|
|
return self.is_element_selected(self.NOTIFICATIONS_SWITCH)
|
|
|
|
def select_theme(self, theme_name: str):
|
|
"""
|
|
Selects a theme from the dropdown.
|
|
|
|
:param theme_name: The visible text of the theme to select (e.g., "Dark").
|
|
"""
|
|
# This is a placeholder. The actual implementation depends on the select/dropdown component.
|
|
# If it's a standard <select>, this would involve the Select class from Selenium.
|
|
# from selenium.webdriver.support.ui import Select
|
|
# select = Select(self.find_element(self.THEME_SELECTOR))
|
|
# select.select_by_visible_text(theme_name)
|
|
pass
|