from pages.base_page import BasePage from Locators.configuration_page import ConfigurationPageLocators from data.assertions import Assertions from playwright.sync_api import Page import json class ConfigurationPage(BasePage): def __init__(self, page: Page) -> None: super().__init__(page) self.assertion = Assertions(page) def should_be_configuration_navigation_panel(self): self.assertion.check_presence(ConfigurationPageLocators.CONFIG_NAVIGATION_PANEL, \ "Configuration navigation panel is not present on the Configuration page") def should_be_maintenance_navigation_panel(self): self.assertion.check_presence(ConfigurationPageLocators.MAINTENANCE_NAVIGATION_PANEL, \ "Maintenance navigation panel is not present on the Configuration page") def click_configuration_navigation_panel_item(self, item_name): button_locator = None if item_name == "users": button_locator = ConfigurationPageLocators.CONFIG_NAVIGATION_PANEL_USER_BUTTON elif item_name == "notification": button_locator = ConfigurationPageLocators.CONFIG_NAVIGATION_PANEL_NOTIFICATION_BUTTON elif item_name == "maintenance": button_locator = ConfigurationPageLocators.CONFIG_NAVIGATION_PANEL_MAINTENANCE_BUTTON elif item_name == "ztp": button_locator = ConfigurationPageLocators.CONFIG_NAVIGATION_PANEL_ZTP_BUTTON else: assert False, "Unsupported configuration navigation panel item" self.click(button_locator) def click_maintenance_navigation_panel_item(self, item_name): button_locator = None if item_name == "session": button_locator = ConfigurationPageLocators.MAINTENANCE_NAVIGATION_PANEL_SESSION_BUTTON elif item_name == "service_status": button_locator = ConfigurationPageLocators.MAINTENANCE_NAVIGATION_PANEL_SERVICE_STATUS_BUTTON elif item_name == "licensing": button_locator = ConfigurationPageLocators.MAINTENANCE_NAVIGATION_PANEL_LICENSING_BUTTON else: assert False, "Unsupported configuration navigation panel item" self.click(button_locator)